All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Jann Horn <jannh@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)
Date: Thu, 11 Jul 2019 18:20:49 -0500	[thread overview]
Message-ID: <20190711232049.dedqd665znnpfhrx@treble> (raw)
In-Reply-To: <CAG48ez3ipuPHLxbqqc50=Kn4QuoNczkd7VqEoLPVd3WWLk2s+Q@mail.gmail.com>

On Thu, Jul 11, 2019 at 11:04:35PM +0200, Jann Horn wrote:
> On Thu, Jul 11, 2019 at 11:00 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Thu, Jul 11, 2019 at 7:26 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > >
> > > On Thu, Jul 11, 2019 at 02:40:06PM +0200, Arnd Bergmann wrote:
> > > > During randconfig testing with clang-9, I came across an object file
> > > > that makes objtool segfault, see attachment. Let me know if you need
> > > > more information to
> > > > debug this.
> > > >
> > > > I also get a ton of objtool warnings building random configurations, but Nick
> > > > mentioned that there is still a bug related to asm-goto in the build I'm using
> > > > that may be the root cause. Once I have a fixed clang-9 build, I can have a look
> > > > at those as well.
> > >
> > > Seg fault fix:
> >
> > Thanks for the fix! testing it over night now, will let you know tomorrow
> > if problems remain.
> >
> > I wonder if this is also related to several warnings I get about switch
> > tables like:
> >
> > drivers/usb/misc/sisusbvga/sisusb.o: warning: objtool:
> > sisusb_write_mem_bulk()+0x588: can't find switch jump table
> >
> > drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_mem_input_v.o:
> > warning: objtool: dce_mem_input_v_program_pte_vm()+0x46e: can't find
> > switch jump table
> > drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_opp_csc_v.o:
> > warning: objtool: dce110_opp_v_set_csc_default()+0x714: can't find
> > switch jump table
> > drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.o: warning: objtool:
> > nv50_clk_read()+0x15c: can't find switch jump table
> > drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.o: warning:
> > objtool: x_tune_dvbt2_demod_setting()+0x992: can't find switch jump
> > table
> > drivers/media/tuners/mt2063.o: warning: objtool:
> > MT2063_SetReceiverMode()+0x24d: can't find switch jump table
> > drivers/mmc/host/tifm_sd.o: warning: objtool: tifm_sd_exec()+0x7e:
> > can't find switch jump table
> > drivers/mtd/nand/raw/fsl_ifc_nand.o: warning: objtool:
> > fsl_ifc_nand_probe()+0x4c7: can't find switch jump table
> > drivers/net/can/at91_can.o: warning: objtool: at91_irq()+0x347: can't
> > find switch jump table
> > drivers/net/phy/phylink.o: warning: objtool:
> > phylink_mac_config()+0x2b5: can't find switch jump table
> > drivers/regulator/max8973-regulator.o: warning: objtool:
> > max8973_probe()+0x736: can't find switch jump table
> > drivers/regulator/tps80031-regulator.o: warning: objtool:
> > tps80031_regulator_probe()+0x143: can't find switch jump table
> > drivers/tty/cyclades.o: warning: objtool: cy_set_line_char()+0x86c:
> > can't find switch jump table
> > drivers/tty/serial/jsm/jsm_cls.o: warning: objtool: cls_param()+0x10b:
> > can't find switch jump table
> > drivers/tty/serial/jsm/jsm_neo.o: warning: objtool: neo_param()+0x151:
> > can't find switch jump table
> > drivers/usb/core/hub.o: warning: objtool: hub_probe()+0x920: can't
> > find switch jump table
> > drivers/usb/misc/sisusbvga/sisusb.o: warning: objtool:
> > sisusb_write_mem_bulk()+0x4db: can't find switch jump table
> > kernel/rcu/tree.o: warning: objtool: rcu_note_context_switch()+0x6b8:
> > can't find switch jump table
> > lib/zstd/decompress.o: warning: objtool:
> > ZSTD_decodeLiteralsBlock()+0x5e: can't find switch jump table
> >
> > If you want to have a look, I can provide object files and/or reduced test
> > cases for this. My guess is that it is unrelated to the warnings that Nick
> > saw for asm-goto.
> 
> I was playing around with building the kernel with LLVM a few months
> ago and used this local patch, but didn't get around to submitting
> upstream because I couldn't reproduce the problem for some reason. I
> think the warnings you're getting sound like what I saw back then:
> https://gist.github.com/thejh/0434662728afb95d72455bf30ece5817
> 
> Quoting the commit message from that patch:
> 
> ====
> With clang from git master, code can be generated where a function contains
> two indirect jump instructions that use the same switch table. To deal with
> this case and similar ones properly, convert the switch table parsing to
> use two passes:
> ====
> 
> Does that sound like what you're seeing?

Thanks Jann, I like this approach.  Hopefully it also works with GCC.

The switch tables (and jump tables in general) have been a hot topic in
objtool lately.  I have several other patches pending which touch this
code.  I'll integrate your patch with the others and try to do some more
testing in GCC.

-- 
Josh

      parent reply	other threads:[~2019-07-11 23:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 12:40 objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o) Arnd Bergmann
2019-07-11 17:26 ` Josh Poimboeuf
2019-07-11 21:00   ` Arnd Bergmann
2019-07-11 21:04     ` Jann Horn
2019-07-11 21:29       ` Arnd Bergmann
2019-07-12  7:51         ` Arnd Bergmann
2019-07-12 13:57           ` Josh Poimboeuf
2019-07-12 14:19             ` Arnd Bergmann
2019-07-12 14:29               ` Josh Poimboeuf
2019-07-12 16:59                 ` Nick Desaulniers
2019-07-12 20:40                   ` Arnd Bergmann
2019-07-16 20:24                     ` Nick Desaulniers
2019-07-16 22:05                       ` Arnd Bergmann
2019-07-16 23:03                         ` Josh Poimboeuf
2019-07-18 22:36                           ` Nick Desaulniers
2019-07-18 23:20                             ` Josh Poimboeuf
2019-07-11 23:20       ` Josh Poimboeuf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711232049.dedqd665znnpfhrx@treble \
    --to=jpoimboe@redhat.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.