Skip to content

drivers/hwmon/pmbus/adm1275.o: warning: objtool: adm1275_probe()+0x744: unreachable instruction #621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ms178 opened this issue Jul 29, 2019 · 6 comments
Labels
[ARCH] x86_64 This bug impacts ARCH=x86_64 Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. [TOOL] objtool warning is produced by the kernel's objtool

Comments

@ms178
Copy link

ms178 commented Jul 29, 2019

With -O3, linux-next-next-20190726 and clang version 10.0.0 (366783), there is an objtool warning observed in:

drivers/hwmon/pmbus/adm1275.o: warning: objtool: adm1275_probe()+0x744: unreachable instruction

It should be reproducible while using the attached config plus Makefile and /arch/x86/Makefile settings.

buildlog_Westmere_2.txt

config_Westmere_2.txt

Makefile_Westmere_2.txt

arch_x86_Makefile.txt

Originally posted by @ms178 in #548 (comment)

@ms178 ms178 added [TOOL] objtool warning is produced by the kernel's objtool [ARCH] x86_64 This bug impacts ARCH=x86_64 labels Jul 29, 2019
@ms178
Copy link
Author

ms178 commented Jul 30, 2019

Testing with -O2, linux-next-next-20190730 and clang version 10.0.0 (366783) also confirmed this issue.

buildlog_o2.txt

It now errors out at the end with:

WARNING: "phys_base" [vmlinux] is the static EXPORT_SYMBOL
WARNING: "ahci_em_messages" [vmlinux] is the static EXPORT_SYMBOL_GPL
WARNING: "ftrace_set_clr_event" [vmlinux] is the static EXPORT_SYMBOL_GPL
WARNING: "empty_zero_page" [vmlinux] is the static EXPORT_SYMBOL
WARNING: "hypercall_page" [vmlinux] is the static EXPORT_SYMBOL_GPL
MODINFO modules.builtin.modinfo
ld: drivers/gpio/gpiolib-devres.o: in function devm_gpiod_get_from_of_node': (.text+0x172): undefined reference to gpiod_get_from_of_node'

Here is the config used:
config.txt

@nathanchance
Copy link
Member

Still reproducible with ToT LLVM and kernel with the provided .config.

nathanchance pushed a commit that referenced this issue Jul 18, 2020
rmnet can have only two bridge interface.
One of them is a link interface and another one is added by
the master operation.
rmnet interface shouldn't allow adding additional
bridge interfaces by mater operation.
But, there is no code to deny additional interfaces.
So, interface leak occurs.

Test commands:
    ip link add dummy0 type dummy
    ip link add dummy1 type dummy
    ip link add dummy2 type dummy
    ip link add rmnet0 link dummy0 type rmnet mux_id 1
    ip link set dummy1 master rmnet0
    ip link set dummy2 master rmnet0
    ip link del rmnet0

In the above test command, the dummy0 was attached to rmnet as VND mode.
Then, dummy1 was attached to rmnet0 as BRIDGE mode.
At this point, dummy0 mode is switched from VND to BRIDGE automatically.
Then, dummy2 is attached to rmnet as BRIDGE mode.
At this point, rmnet0 should deny this operation.
But, rmnet0 doesn't deny this.
So that below splat occurs when the rmnet0 interface is deleted.

Splat looks like:
[  186.684787][    C2] WARNING: CPU: 2 PID: 1009 at net/core/dev.c:8992 rollback_registered_many+0x986/0xcf0
[  186.684788][    C2] Modules linked in: rmnet dummy openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_x
[  186.684805][    C2] CPU: 2 PID: 1009 Comm: ip Not tainted 5.8.0-rc1+ #621
[  186.684807][    C2] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  186.684808][    C2] RIP: 0010:rollback_registered_many+0x986/0xcf0
[  186.684811][    C2] Code: 41 8b 4e cc 45 31 c0 31 d2 4c 89 ee 48 89 df e8 e0 47 ff ff 85 c0 0f 84 cd fc ff ff 5
[  186.684812][    C2] RSP: 0018:ffff8880cd9472e0 EFLAGS: 00010287
[  186.684815][    C2] RAX: ffff8880cc56da58 RBX: ffff8880ab21c000 RCX: ffffffff9329d323
[  186.684816][    C2] RDX: 1ffffffff2be6410 RSI: 0000000000000008 RDI: ffffffff95f32080
[  186.684818][    C2] RBP: dffffc0000000000 R08: fffffbfff2be6411 R09: fffffbfff2be6411
[  186.684819][    C2] R10: ffffffff95f32087 R11: 0000000000000001 R12: ffff8880cd947480
[  186.684820][    C2] R13: ffff8880ab21c0b8 R14: ffff8880cd947400 R15: ffff8880cdf10640
[  186.684822][    C2] FS:  00007f00843890c0(0000) GS:ffff8880d4e00000(0000) knlGS:0000000000000000
[  186.684823][    C2] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  186.684825][    C2] CR2: 000055b8ab1077b8 CR3: 00000000ab612006 CR4: 00000000000606e0
[  186.684826][    C2] Call Trace:
[  186.684827][    C2]  ? lockdep_hardirqs_on_prepare+0x379/0x540
[  186.684829][    C2]  ? netif_set_real_num_tx_queues+0x780/0x780
[  186.684830][    C2]  ? rmnet_unregister_real_device+0x56/0x90 [rmnet]
[  186.684831][    C2]  ? __kasan_slab_free+0x126/0x150
[  186.684832][    C2]  ? kfree+0xdc/0x320
[  186.684834][    C2]  ? rmnet_unregister_real_device+0x56/0x90 [rmnet]
[  186.684835][    C2]  unregister_netdevice_many.part.135+0x13/0x1b0
[  186.684836][    C2]  rtnl_delete_link+0xbc/0x100
[ ... ]
[  238.440071][ T1009] unregister_netdevice: waiting for rmnet0 to become free. Usage count = 1

Fixes: 037f9cd ("net: rmnet: use upper/lower device infrastructure")
Signed-off-by: Taehee Yoo <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
@nathanchance
Copy link
Member

creduce spits out:

a, d, e;
struct {
  short b
} c[];
f() {
  switch (a & (1 << 5 | 1)) {
  case 0:;
    break;
  case 1 << 5:
    e = 5;
    break;
  case 1:
  case 1 << 5 | 1:
    e = 7;
  }
  d = c[e].b;
}
$ ~/src/linux/out/x86_64/tools/objtool/objtool orc generate --module --no-fp adm1275.o
adm1275.o: warning: objtool: f()+0x2f: unreachable instruction

$ llvm-objdump -D --section=.text adm1275.o

adm1275.o:      file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <f>:
       0: e8 00 00 00 00                callq   0x5 <f+0x5>
       5: 8b 05 00 00 00 00             movl    (%rip), %eax  # b <f+0xb>
       b: 83 e0 21                      andl    $33, %eax
       e: ff 24 c5 00 00 00 00          jmpq    *(,%rax,8)
      15: c7 05 00 00 00 00 07 00 00 00 movl    $7, (%rip)  # 1f <f+0x1f>
      1f: b8 07 00 00 00                movl    $7, %eax
      24: eb 18                         jmp     0x3e <f+0x3e>
      26: 48 63 05 00 00 00 00          movslq  (%rip), %rax  # 2d <f+0x2d>
      2d: eb 0f                         jmp     0x3e <f+0x3e>
      2f: c7 05 00 00 00 00 05 00 00 00 movl    $5, (%rip)  # 39 <f+0x39>
      39: b8 05 00 00 00                movl    $5, %eax
      3e: 0f bf 84 00 00 00 00 00       movswl  (%rax,%rax), %eax
      46: 89 05 00 00 00 00             movl    %eax, (%rip)  # 4c <f+0x4c>
      4c: c3                            retq

cc @jpoimboe

@jpoimboe
Copy link

jpoimboe commented Jan 5, 2021

This one looks familiar -- the switch statement jump table has dead code entries which point to the nop past the end of the function. I think there was another issue open for this which was recently closed today because it's fixed in clang 11? (sorry I don't have the issue #).

@nathanchance
Copy link
Member

#611 was the issue. Odd since this was reproduced with ToT LLVM :/

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Apr 22, 2021

Still an issue, reported upstream: https://llvm.org/pr50080,

@nickdesaulniers nickdesaulniers added the Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. label Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] x86_64 This bug impacts ARCH=x86_64 Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. [TOOL] objtool warning is produced by the kernel's objtool
Projects
None yet
Development

No branches or pull requests

4 participants