bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/27412] Suspicious "setting incorrect section attributes for .no


From: slyfox at inbox dot ru
Subject: [Bug gas/27412] Suspicious "setting incorrect section attributes for .note.Linux" warnings on linux kernel
Date: Sat, 13 Feb 2021 15:01:35 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27412

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to H.J. Lu from comment #1)
> (In reply to Sergei Trofimovich from comment #0)
> > When building current linux-5.10 (or master) with gcc-11/binutins-2.36 gas
> > complains about incorrect (used) section flags. Minimal reproducer:
> > 
> > $ cat bug.c
> >     static const int _note_55 __attribute__((__used__))
> > __attribute__((section(".note.Linux"))) = 42;
> > 
> > $ gcc-11.0.0 -c bug.c -o bug-11.o -fno-ident
> >   /tmp/ccJ9p7TD.s: Assembler messages:
> >   /tmp/ccJ9p7TD.s:3: Warning: setting incorrect section attributes for
> > .note.Linux
> 
> This is an assembler bug.

Aha. I'll ignore the warning for now then.

> > Is it a real problem or a false positive warning? Currently
> > gcc-11/binutils-2.36 generates kernels that can't load some modules and
> > complain about a bunch of orphan sections. I wonder if this warhing is
> > related and somehow affects future linking.

> Please try:
> 
> https://github.com/hjl-tools/linux/commit/
> d97c4aeb041b756861bb16ee895e2616f4b4061a

Did not help. More details of what I see:

When I try to load mei-me.ko kernel crashes in jump_labels init as if there are
no certain sections (maybe data sections?):

    $ modprobe mei-me
    $ dmesg
BUG: unable to handle page fault for address: ffffffffc006eb90
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
PGD 12840b067 P4D 12840b067 PUD 12840d067 PMD 100323067 PTE 800000010178e161
Oops: 0003 [#1] PREEMPT SMP
CPU: 1 PID: 116 Comm: modprobe Not tainted 5.11.0-rc7-00091-g34add6d4b676 #209
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.org-2.fc31 04/01/2014
RIP: 0010:jump_label_add_module+0x1b4/0x280
Code: 00 48 8b 43 08 a8 02 0f 85 a7 00 00 00 48 83 e0 fc 48 c7 02 00 00 00 00
48 89 42 08 48 8b 43 08 83 e0 03 48 09 c2 48 83 ca 02 <48> 89 53 08 4d 89 6e 10
49 89 6e 08 48 8b 43 08 a8 02 74 6b 48 83
RSP: 0018:ffffb48e001b7d88 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffffffffc006eb88 RCX: 0000000000000000
RDX: ffffa43a802f53c2 RSI: ffffffffa41d2cc8 RDI: ffffffffa41d2cc8
RBP: ffffffffc004d1f0 R08: 0000000000000001 R09: 0000000000000012
R10: 0000000000001000 R11: ffffa43a816d9001 R12: ffffffffc004d5b0
R13: ffffffffc004ea00 R14: ffffa43a802f53a0 R15: ffffffffc004d1f8
FS:  00000000019f53c0(0000) GS:ffffa43abbc80000(0000) knl GS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffc006eb90 CR3: 00000001016fe003 CR4: 0000000000060ee0
Call Trace:
 jump_label_module_notify+0x53/0x90
 blocking_notifier_call_chain_robust+0x6c/0xd0
 load_module+0x58e/0x810
 __do_sys_init_module+0x115/0x160
 do_syscall_64+0x2d/0x70
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x55ce39
Code: 0c 00 b8 ca 00 00 00 0f 05 eb a5 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48
89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01
c3 48 c7 c1 e0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc3a5e37c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 000000000055ce39
RDX: 00000000006042ca RSI: 0000000000042078 RDI: 00007fb66fff7010
RBP: 00007fb66fff7010 R08: 0000000001a0b890 R09: 0000000000042078
R10: 0000000000000007 R11: 0000000000000246 R12: 00000000006042ca
R13: 0000000000000000 R14: 0000000001a08054 R15: 00007fb66ffd6ad0
Modules linked in: mei_me(+) mei
CR2: ffffffffc006eb90
---[ end trace d7a0c94b086625bf ]---

Seemingly related linker warnings are in form of:

...
x86_64-pc-linux-gnu-ld: warning: orphan section `.data.event_kfree_skb' from
`net/core/net-traces.o' being placed in section `.data.event_kfree_skb'
x86_64-pc-linux-gnu-ld: warning: orphan section `.data.event_bpf_test_finish'
from `net/bpf/test_run.o' being placed in section `.data.event_bpf_test_finish'
x86_64-pc-linux-gnu-ld: warning: orphan section `.data.event_fib6_table_lookup'
from `net/ipv6/route.o' being placed in section `.data.event_fib6_table_lookup'
...

These appeared after gcc-10 switch. gcc-10 seems to be very eager at placing
things to their own sections:

Minimal example:

$ cat net-traces.c
  struct s {
    void *print_fmt;
  };
  struct s print_fmt_napi_poll[1];
  __attribute__((__used__)) struct s event_napi_poll = {print_fmt_napi_poll};


Note the
    .section        .data.event_napi_poll,"awR"
vs
    .data
in:

$ gcc-11.0.0 -fno-PIE -S net-traces.c -fno-ident && cat net-traces.s
        .file   "net-traces.c"
        .text
        .globl  print_fmt_napi_poll
        .bss
        .align 8
        .type   print_fmt_napi_poll, @object
        .size   print_fmt_napi_poll, 8
print_fmt_napi_poll:
        .zero   8
        .globl  event_napi_poll
        .section        .data.event_napi_poll,"awR"
        .align 8
        .type   event_napi_poll, @object
        .size   event_napi_poll, 8
event_napi_poll:
        .quad   print_fmt_napi_poll
        .section        .note.GNU-stack,"",@progbits

$ gcc-10.2.0 -fno-PIE -S net-traces.c -fno-ident && cat net-traces.s
        .file   "net-traces.c"
        .text
        .globl  print_fmt_napi_poll
        .bss
        .align 8
        .type   print_fmt_napi_poll, @object
        .size   print_fmt_napi_poll, 8
print_fmt_napi_poll:
        .zero   8
        .globl  event_napi_poll
        .data
        .align 8
        .type   event_napi_poll, @object
        .size   event_napi_poll, 8
event_napi_poll:
        .quad   print_fmt_napi_poll
        .section        .note.GNU-stack,"",@progbits

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]