mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Ilie Halip <ilie.halip@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: objtool warning "uses BP as a scratch register" with clang-9
Date: Wed, 28 Aug 2019 21:41:47 +0200	[thread overview]
Message-ID: <CAK8P3a0C6jvBqsO2KXOV-j3eQ07zvCjUWqaYdTKDfne72EWUDA@mail.gmail.com> (raw)
In-Reply-To: <20190828175713.s7jub3sf6l7vyfoj@treble>

On Wed, Aug 28, 2019 at 7:57 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Wed, Aug 28, 2019 at 05:29:39PM +0200, Arnd Bergmann wrote:
> > On Wed, Aug 28, 2019 at 4:51 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> exit.o: warning: objtool: abort()+0x3: unreachable instruction
> hugetlb.o: warning: objtool: hugetlb_vm_op_fault()+0x3: unreachable instruction
> idle.o: warning: objtool: switched_to_idle()+0x3: unreachable instruction
> madvise.o: warning: objtool: hugepage_madvise()+0x3: unreachable instruction
> privcmd.o: warning: objtool: privcmd_ioctl_mmap_batch()+0x5dd: unreachable instruction
> process.o: warning: objtool: play_dead()+0x3: unreachable instruction
> rmap.o: warning: objtool: anon_vma_clone()+0x1c2: unreachable instruction
> s5c73m3-core.o: warning: objtool: s5c73m3_probe()+0x262: unreachable instruction
> videobuf2-core.o: warning: objtool: vb2_core_dqbuf()+0xae6: unreachable instruction
> xfrm_output.o: warning: objtool: xfrm_outer_mode_output()+0x109: unreachable instruction
> - clang issue: trying to finish frame pointer setup after BUG() in unreachable code path
>
> pinctrl-ingenic.o: warning: objtool: ingenic_pinconf_set()+0x10d: sibling call from callable instruction with modified stack frame
> - bad clang bug: sibling call without first popping registers

I reduced the last one to https://godbolt.org/z/7lZZL3

enum { PIN_CONFIG_BIAS_DISABLE } pinconf_to_config_param(void);
void ingenic_pinconf_set() {
  switch (pinconf_to_config_param())
  case PIN_CONFIG_BIAS_DISABLE: {
    asm("%c0:\n\t.pushsection .discard.unreachable\n\t.long %c0b - "
        ".\n\t.popsection\n\t"
        :
        : "i"(6));
    __builtin_unreachable();
  }
}
void ingenic_pinconf_group_set() {}

$ clang-9  -Os -mretpoline-external-thunk -fno-omit-frame-pointer -c
pinctrl-ingenic.i
$ objtool check  --retpoline --uaccess pinctrl-ingenic.o
pinctrl-ingenic.o: warning: objtool: ingenic_pinconf_set()+0xb:
sibling call from callable instruction with modified stack frame

$objdump -d pinctrl-ingenic.o
0000000000000000 <ingenic_pinconf_set>:
   0: 55                    push   %rbp
   1: 48 89 e5              mov    %rsp,%rbp
   4: e8 00 00 00 00        callq  9 <ingenic_pinconf_set+0x9>
5: R_X86_64_PLT32 pinconf_to_config_param-0x4
   9: 85 c0                test   %eax,%eax
   b: 74 02                je     f <ingenic_pinconf_group_set>
   d: 5d                    pop    %rbp
   e: c3                    retq

000000000000000f <ingenic_pinconf_group_set>:
   f: c3                    retq

I suspect that's actually another variant of the others. It doesn't
seem to be an
actual sibling call, just branching into what happens to be the start of the
next function in an unreachable code path.

Using '-O2' instead of '-0s', I get

pinctrl-ingenic.o: warning: objtool: ingenic_pinconf_set() falls
through to next function ingenic_pinconf_group_set()

0000000000000000 <ingenic_pinconf_set>:
   0: 55                    push   %rbp
   1: 48 89 e5              mov    %rsp,%rbp
   4: e8 00 00 00 00        callq  9 <ingenic_pinconf_set+0x9>
5: R_X86_64_PLT32 pinconf_to_config_param-0x4
   9: 85 c0                test   %eax,%eax
   b: 74 02                je     f <ingenic_pinconf_set+0xf>
   d: 5d                    pop    %rbp
   e: c3                    retq
   f: 90                    nop

0000000000000010 <ingenic_pinconf_group_set>:
  10: c3                    retq

        Arnd

  reply	other threads:[~2019-08-28 19:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 12:30 Arnd Bergmann
2019-08-27 14:51 ` Josh Poimboeuf
2019-08-27 14:59   ` Ilie Halip
2019-08-27 19:00     ` Arnd Bergmann
2019-08-27 19:22       ` Josh Poimboeuf
2019-08-27 19:47         ` Arnd Bergmann
2019-08-27 21:21           ` Nick Desaulniers
2019-08-28  9:00             ` Arnd Bergmann
2019-08-28 14:06               ` Arnd Bergmann
2019-08-28 14:51               ` Josh Poimboeuf
2019-08-28 15:29                 ` Arnd Bergmann
2019-08-28 17:57                   ` Josh Poimboeuf
2019-08-28 19:41                     ` Arnd Bergmann [this message]
2019-08-28 15:13               ` Arnd Bergmann
2019-08-28 15:22                 ` Josh Poimboeuf
2019-08-28 15:28                   ` Arnd Bergmann
2019-08-28 15:40                     ` Arnd Bergmann
2019-08-29 23:24                       ` Josh Poimboeuf
2019-08-30 10:44                         ` Arnd Bergmann
2019-08-30 15:14                           ` Josh Poimboeuf
2019-08-30 15:58                             ` Arnd Bergmann
2019-08-30 16:12                               ` David Laight
2019-08-30 16:03                             ` Linus Torvalds
2019-08-29 17:34                     ` Josh Poimboeuf
2019-08-29 18:30                       ` Linus Torvalds
2019-08-29 20:21                         ` Arnd Bergmann
2019-08-29 22:26                           ` Linus Torvalds
2019-08-30 15:02                             ` Josh Poimboeuf
2019-08-30 15:39                               ` David Laight
2019-08-30 15:48                               ` Linus Torvalds
2019-08-30 15:55                                 ` David Laight
2019-08-30 16:01                                   ` Linus Torvalds
2019-08-30 16:42                                     ` David Laight
2019-08-30 16:49                                 ` Josh Poimboeuf
2019-09-02  9:02                                   ` David Laight
2019-09-04 11:53                         ` Geert Uytterhoeven
2019-08-28 22:13         ` Nick Desaulniers
2019-08-29  0:28           ` Josh Poimboeuf

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=CAK8P3a0C6jvBqsO2KXOV-j3eQ07zvCjUWqaYdTKDfne72EWUDA@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=ilie.halip@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®