Transcript
  • 1/7/2015 LinuxKernelArchive:Re:Randompanicinload_balance()with3.16rc

    http://lkml.iu.edu//hypermail/linux/kernel/1407.3/00650.html 1/2

    Re:Randompanicinload_balance()with3.16rcFrom:LinusTorvaldsDate:ThuJul24201414:47:25EST

    Nextmessage:JeromeGlisse:"Re:[PATCHv200/25]AMDKFDkerneldriver"Previousmessage:IgorBezukh:"[PATCH]Staging:vt6655:removeredundantcommentsfrombssdb.h"Inreplyto:PeterZijlstra:"Re:Randompanicinload_balance()with3.16rc"Nextinthread:PeterZijlstra:"Re:Randompanicinload_balance()with3.16rc"Messagessortedby:[date][thread][subject][author]

    OnWed,Jul23,2014at6:43PM,MichelDnzerwrote:>>>>Michel,minddoing>>>>makekernel/sched/fair.s>>>>andsendingustheresultingfile?>>Hereitis,gzipped,hopethat'sokay.>>Notethatmytreeisnowbasedon3.16rc6.

    Ok,soI'mlookingatthecodegenerationandyourcompilerispureandutter*shit*.

    AddingJakubtothecc,becausegcc4.9.0seemstobeterminallybroken.

    Lookiehere,yourcompilerdoessomeabsolutelyinsanethingswiththespilling,includingspillinga*constant*.Forchrissake,thatcompilershouldn'thavebeenallowedtograduatefromkindergarten.We'retalking"sloththatwasdroppedontheheadasababy"levelretardationlevelshere:

    ...movq$load_balance_mask,136(%rbp)#,%sfpsubq$184,%rsp#,movq(%rdx),%rax#sd_22(D)>parent,sd_parentmovl%edi,144(%rbp)#this_cpu,%sfpmovl%ecx,140(%rbp)#idle,%sfpmovq%r8,200(%rbp)#continue_balancing,%sfpmovq%rax,184(%rbp)#sd_parent,%sfpmovq136(%rbp),%rax#%sfp,tcp_ptr__#APPadd%gs:this_cpu_off,%rax#this_cpu_off,tcp_ptr__#NO_APP...

    Notethecontentsof136(%rbp).Seriously.That'san_immediate_constant_thatthecompilerisspilling.

    Somebodyneedstoraisethatasagccbug.Becauseitdamnwellissomeseriouslycrazyshit.

    However,thatconstantspillingpartjustcountsas"toostupidtolive".Therealbugisthis:

    movq$load_balance_mask,136(%rbp)#,%sfpsubq$184,%rsp#,

    wheregcccreatesthestackframe*after*havingalreadyusedittosavethatconstant*deep*belowthestackframe.

    Thex8664ABIspecifiesa128byteredzoneunderthestackpointer,andthisisokbythatlimit.Itlookslikeit'sillegal(136>128),butthefactis,we'vehadfour"pushq"stoupdate%rspsinceloadingtheframepointer,soit'sjust*barely*legalwiththeredzoning.

    Butwebuildthekernelwithmnoredzone.Wedo*not*followthex8664ABIwrtredzoning,becausewe*cannot*:interruptswhileinkernelmode*will*usethestackwithoutaredzone.Sothat"mnoredzone"isnotsome"optionalguideline".It'sahardandharshrequirementforthekernel,andgcc4.9isabuggypieceofshitforignoringit.Andyourbughappensbecuaseyouhappentohitaninterrupt_just_inthatsingleinstructionwindow(orperhapshitsomeothersimilarcaseandcorruptedkerneldatastructuresearlier).

  • 1/7/2015 LinuxKernelArchive:Re:Randompanicinload_balance()with3.16rc

    http://lkml.iu.edu//hypermail/linux/kernel/1407.3/00650.html 2/2

    Now,Isuspectthatthisredzoningbugmightactuallyberelatedtothefactthatgccisstupidinspillingaconstant.Iwouldnotbesurprisedifthereissomelivenessanalysisgoingontodecide*when*toinsertthestackdecrement,andconstantsarebeingignoredbecauseclearlylivenessisn'tanissueforaconstantvalue.Sothetwobugs("stupidconstantspilling"and"invaliduseorredzonestack")gohandinhand.Butwhoknows.

    Anyway,thisisnotakernelbug.Thisisyourcompilercreatingcompletelybrokencode.Wemayneedtoaddawarningtomakesurenobodycompileswithgcc4.9.0,andtheDebianpeopleshouldprobablydowngratetheirshinynewcompiler.

    Jakub,anyideas?

    LinusTounsubscribefromthislist:sendtheline"unsubscribelinuxkernel"inthebodyofamessagetomajordomo@xxxxxxxxxxxxxxxMoremajordomoinfoathttp://vger.kernel.org/majordomoinfo.htmlPleasereadtheFAQathttp://www.tux.org/lkml/

    Nextmessage:JeromeGlisse:"Re:[PATCHv200/25]AMDKFDkerneldriver"Previousmessage:IgorBezukh:"[PATCH]Staging:vt6655:removeredundantcommentsfrombssdb.h"Inreplyto:PeterZijlstra:"Re:Randompanicinload_balance()with3.16rc"Nextinthread:PeterZijlstra:"Re:Randompanicinload_balance()with3.16rc"Messagessortedby:[date][thread][subject][author]


Top Related