Skip to content
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

Emit metadata instead of link #75

Closed
ojeda opened this issue Jan 21, 2021 · 0 comments · Fixed by #76
Closed

Emit metadata instead of link #75

ojeda opened this issue Jan 21, 2021 · 0 comments · Fixed by #76
Labels
• kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options...

Comments

@ojeda
Copy link
Member

ojeda commented Jan 21, 2021

We couldn't do it right away in #52 because rustc required a fix (rust-lang/rust#81117, rust-lang/rust#81118).

The fix is now in (rust-lang/rust@f9275e1) and available since the 2021-01-21 nightly, so now we can go ahead and make the change.

@ojeda ojeda added • kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options... upstream - optional labels Jan 21, 2021
ojeda added a commit that referenced this issue Jan 21, 2021
It allows us to save a bit of space, ignore the duplicate object files,
and the archiving steps; e.g.:

      643544 libcompiler_builtins.rlib
    64171752 libcore.rlib

vs.

      530004 libcompiler_builtins.rmeta
    63679866 libcore.rmeta

We couldn't do it right away in [1] because `rustc` required a fix [2,3].
The fix is now in [4] and available since the 2021-01-21 nightly, so now
we can go ahead and make the change.

Fixes #75.

[1] #52
[2] rust-lang/rust#81117
[3] rust-lang/rust#81118
[4] rust-lang/rust@f9275e1

Suggested-by: bjorn3
Signed-off-by: Miguel Ojeda <[email protected]>
ojeda added a commit that referenced this issue Jan 21, 2021
It allows us to save a bit of space, ignore the duplicate object files,
and the archiving steps; e.g.:

      643544 libcompiler_builtins.rlib
    64171752 libcore.rlib

vs.

      530004 libcompiler_builtins.rmeta
    63679866 libcore.rmeta

We couldn't do it right away in [1] because `rustc` required a fix [2,3].
The fix is now in [4] and available since the 2021-01-21 nightly, so now
we can go ahead and make the change.

Fixes #75.

[1] #52
[2] rust-lang/rust#81117
[3] rust-lang/rust#81118
[4] rust-lang/rust@f9275e1

Suggested-by: bjorn3
Signed-off-by: Miguel Ojeda <[email protected]>
@ojeda ojeda closed this as completed in #76 Jan 21, 2021
ojeda pushed a commit that referenced this issue Nov 24, 2021
…fails

Check for a valid hv_vp_index array prior to derefencing hv_vp_index when
setting Hyper-V's TSC change callback.  If Hyper-V setup failed in
hyperv_init(), the kernel will still report that it's running under
Hyper-V, but will have silently disabled nearly all functionality.

  BUG: kernel NULL pointer dereference, address: 0000000000000010
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP
  CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc2+ #75
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:set_hv_tscchange_cb+0x15/0xa0
  Code: <8b> 04 82 8b 15 12 17 85 01 48 c1 e0 20 48 0d ee 00 01 00 f6 c6 08
  ...
  Call Trace:
   kvm_arch_init+0x17c/0x280
   kvm_init+0x31/0x330
   vmx_init+0xba/0x13a
   do_one_initcall+0x41/0x1c0
   kernel_init_freeable+0x1f2/0x23b
   kernel_init+0x16/0x120
   ret_from_fork+0x22/0x30

Fixes: 9328626 ("x86/hyperv: Reenlightenment notifications support")
Cc: [email protected]
Cc: Vitaly Kuznetsov <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
Reviewed-by: Vitaly Kuznetsov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Wei Liu <[email protected]>
ojeda pushed a commit that referenced this issue Sep 12, 2023
With latest clang18, I hit test_progs failures for the following test:

  #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
  #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
  #13      bpf_cookie:FAIL
  #75      fentry_fexit:FAIL
  #76/1    fentry_test/fentry:FAIL
  #76      fentry_test:FAIL
  #80/1    fexit_test/fexit:FAIL
  #80      fexit_test:FAIL
  #110/1   kprobe_multi_test/skel_api:FAIL
  #110/2   kprobe_multi_test/link_api_addrs:FAIL
  #110/3   kprobe_multi_test/link_api_syms:FAIL
  #110/4   kprobe_multi_test/attach_api_pattern:FAIL
  #110/5   kprobe_multi_test/attach_api_addrs:FAIL
  #110/6   kprobe_multi_test/attach_api_syms:FAIL
  #110     kprobe_multi_test:FAIL

For example, for #13/2, the error messages are:

  [...]
  kprobe_multi_test_run:FAIL:kprobe_test7_result unexpected kprobe_test7_result: actual 0 != expected 1
  [...]
  kprobe_multi_test_run:FAIL:kretprobe_test7_result unexpected kretprobe_test7_result: actual 0 != expected 1

clang17 does not have this issue.

Further investigation shows that kernel func bpf_fentry_test7(), used in
the above tests, is inlined by the compiler although it is marked as
noinline.

  int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
  {
        return (long)arg;
  }

It is known that for simple functions like the above (e.g. just returning
a constant or an input argument), the clang compiler may still do inlining
for a noinline function. Adding 'asm volatile ("")' in the beginning of the
bpf_fentry_test7() can prevent inlining.

Signed-off-by: Yonghong Song <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Tested-by: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
gurugio added a commit to gurugio/rust-for-linux that referenced this issue Oct 28, 2023
I guess completion is not initialized correctly.
The completion is initialized by Default trait.
What to do more?

/ # mknod /dev/rust_ldd06 c 10 124
/ # cat /dev/rust_ldd06
[   38.598297] rust_completion: open is invoked
[   38.598899] rust_completion: read is invoked
[   38.599419] rust_completion: read:dummy=1
[   38.599927] BUG: kernel NULL pointer dereference, address: 0000000000000000
[   38.600741] #PF: supervisor write access in kernel mode
[   38.601348] #PF: error_code(0x0002) - not-present page
[   38.601948] PGD 41ac067 P4D 41ac067 PUD 42a2067 PMD 0
[   38.602542] Oops: 0002 [#1] PREEMPT SMP NOPTI
[   38.602880] CPU: 0 PID: 123 Comm: cat Tainted: G            E      6.6.0-rc4+ Rust-for-Linux#75
[   38.602880] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[   38.602880] RIP: 0010:wait_for_common+0xb5/0x170
[   38.602880] Code: f6 81 19 0c 00 00 01 75 70 48 89 4d c0 48 8b 45 c8 4c 39 f8 75 17 48 8b 46 18 4c 89 7e 18 48 8b 7d b0 2
[   38.602880] RSP: 0018:ffffc9000059bd70 EFLAGS: 00010046
[   38.602880] RAX: 0000000000000000 RBX: ffff88800433d148 RCX: ffff88800438e000
[   38.602880] RDX: 0000000000000002 RSI: ffff88800433d148 RDI: ffff88800433d158
[   38.602880] RBP: ffffc9000059bdc8 R08: 0000000000000000 R09: 0000000000000000
[   38.602880] R10: ffffc9000059bca8 R11: 3fffffffffffffff R12: 00007ffe6e0671b8
[   38.602880] R13: 7fffffffffffffff R14: 0000000000000002 R15: ffffc9000059bd90
[   38.602880] FS:  00000000020243c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000
[   38.602880] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   38.602880] CR2: 0000000000000000 CR3: 00000000042e6000 CR4: 00000000000006f0
[   38.602880] Call Trace:
[   38.602880]  <TASK>
[   38.602880]  ? __die_body+0x6b/0xb0
[   38.602880]  ? __die+0x9b/0xb0
[   38.602880]  ? page_fault_oops+0x24c/0x370
[   38.602880]  ? prb_read_valid+0x19/0x20
[   38.602880]  ? printk_get_next_message+0x72/0x320
[   38.602880]  ? kernelmode_fixup_or_oops+0xd7/0x100
[   38.602880]  ? __bad_area_nosemaphore+0x69/0x290
[   38.602880]  ? bad_area_nosemaphore+0x16/0x20
[   38.602880]  ? do_user_addr_fault+0x55a/0x620
[   38.602880]  ? exc_page_fault+0x7c/0xf0
[   38.602880]  ? asm_exc_page_fault+0x27/0x30
[   38.602880]  ? wait_for_common+0xb5/0x170
[   38.602880]  wait_for_completion+0x1d/0x20
[   38.602880]  _RNvMs3_NtCshlmskAEPslc_6kernel4fileINtB5_16OperationsVtableINtNtB7_7miscdev12RegistrationNtCs2Jef7UYeN6f_1]
[   38.602880]  ? _RNvXs4_NtNtNtCsaTHfZRq6xTQ_4core3fmt3num3impxNtB9_7Display3fmt+0x30/0x30
[   38.602880]  vfs_read+0xb4/0x280
[   38.602880]  ? do_sendfile+0x1cd/0x470
[   38.602880]  ksys_read+0x5f/0xb0
[   38.602880]  __x64_sys_read+0x1b/0x20
[   38.602880]  do_syscall_64+0x35/0x50
[   38.602880]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[   38.602880] RIP: 0033:0x4ad272
[   38.602880] Code: 31 c0 e9 b1 fe ff ff 50 48 8d 3d c1 80 17 00 e8 54 8e 00 00 0f 1f 40 00 f3 0f 1e fa 64 8b 04 25 18 00 4
[   38.602880] RSP: 002b:00007ffe6e067158 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[   38.602880] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004ad272
[   38.602880] RDX: 0000000000001000 RSI: 00007ffe6e0671b8 RDI: 0000000000000003
[   38.602880] RBP: 00007ffe6e0671b8 R08: 0000000000000001 R09: 0000000000000000
[   38.602880] R10: 0000000001000000 R11: 0000000000000246 R12: 0000000000001000
[   38.602880] R13: 00000000020243a0 R14: 0000000000000000 R15: 0000000000000001
[   38.602880]  </TASK>
[   38.602880] Modules linked in: rust_ldd06(E)
[   38.602880] CR2: 0000000000000000
[   38.602880] ---[ end trace 0000000000000000 ]---
[   38.602880] RIP: 0010:wait_for_common+0xb5/0x170
[   38.602880] Code: f6 81 19 0c 00 00 01 75 70 48 89 4d c0 48 8b 45 c8 4c 39 f8 75 17 48 8b 46 18 4c 89 7e 18 48 8b 7d b0 2
[   38.602880] RSP: 0018:ffffc9000059bd70 EFLAGS: 00010046
[   38.602880] RAX: 0000000000000000 RBX: ffff88800433d148 RCX: ffff88800438e000
[   38.602880] RDX: 0000000000000002 RSI: ffff88800433d148 RDI: ffff88800433d158
[   38.602880] RBP: ffffc9000059bdc8 R08: 0000000000000000 R09: 0000000000000000
[   38.602880] R10: ffffc9000059bca8 R11: 3fffffffffffffff R12: 00007ffe6e0671b8
[   38.602880] R13: 7fffffffffffffff R14: 0000000000000002 R15: ffffc9000059bd90
[   38.602880] FS:  00000000020243c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000
[   38.602880] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   38.602880] CR2: 0000000000000000 CR3: 00000000042e6000 CR4: 00000000000006f0
[   38.602880] note: cat[123] exited with irqs disabled
[   38.652903] note: cat[123] exited with preempt_count 1
[   38.653512] rust_completion: release is invoked

Signed-off-by: Gioh Kim <[email protected]>
gurugio added a commit to gurugio/rust-for-linux that referenced this issue Oct 31, 2023
I guess completion is not initialized correctly.
The completion is initialized by Default trait.
What to do more?

/ # mknod /dev/rust_ldd06 c 10 124
/ # cat /dev/rust_ldd06
[   38.598297] rust_completion: open is invoked
[   38.598899] rust_completion: read is invoked
[   38.599419] rust_completion: read:dummy=1
[   38.599927] BUG: kernel NULL pointer dereference, address: 0000000000000000
[   38.600741] #PF: supervisor write access in kernel mode
[   38.601348] #PF: error_code(0x0002) - not-present page
[   38.601948] PGD 41ac067 P4D 41ac067 PUD 42a2067 PMD 0
[   38.602542] Oops: 0002 [#1] PREEMPT SMP NOPTI
[   38.602880] CPU: 0 PID: 123 Comm: cat Tainted: G            E      6.6.0-rc4+ Rust-for-Linux#75
[   38.602880] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[   38.602880] RIP: 0010:wait_for_common+0xb5/0x170
[   38.602880] Code: f6 81 19 0c 00 00 01 75 70 48 89 4d c0 48 8b 45 c8 4c 39 f8 75 17 48 8b 46 18 4c 89 7e 18 48 8b 7d b0 2
[   38.602880] RSP: 0018:ffffc9000059bd70 EFLAGS: 00010046
[   38.602880] RAX: 0000000000000000 RBX: ffff88800433d148 RCX: ffff88800438e000
[   38.602880] RDX: 0000000000000002 RSI: ffff88800433d148 RDI: ffff88800433d158
[   38.602880] RBP: ffffc9000059bdc8 R08: 0000000000000000 R09: 0000000000000000
[   38.602880] R10: ffffc9000059bca8 R11: 3fffffffffffffff R12: 00007ffe6e0671b8
[   38.602880] R13: 7fffffffffffffff R14: 0000000000000002 R15: ffffc9000059bd90
[   38.602880] FS:  00000000020243c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000
[   38.602880] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   38.602880] CR2: 0000000000000000 CR3: 00000000042e6000 CR4: 00000000000006f0
[   38.602880] Call Trace:
[   38.602880]  <TASK>
[   38.602880]  ? __die_body+0x6b/0xb0
[   38.602880]  ? __die+0x9b/0xb0
[   38.602880]  ? page_fault_oops+0x24c/0x370
[   38.602880]  ? prb_read_valid+0x19/0x20
[   38.602880]  ? printk_get_next_message+0x72/0x320
[   38.602880]  ? kernelmode_fixup_or_oops+0xd7/0x100
[   38.602880]  ? __bad_area_nosemaphore+0x69/0x290
[   38.602880]  ? bad_area_nosemaphore+0x16/0x20
[   38.602880]  ? do_user_addr_fault+0x55a/0x620
[   38.602880]  ? exc_page_fault+0x7c/0xf0
[   38.602880]  ? asm_exc_page_fault+0x27/0x30
[   38.602880]  ? wait_for_common+0xb5/0x170
[   38.602880]  wait_for_completion+0x1d/0x20
[   38.602880]  _RNvMs3_NtCshlmskAEPslc_6kernel4fileINtB5_16OperationsVtableINtNtB7_7miscdev12RegistrationNtCs2Jef7UYeN6f_1]
[   38.602880]  ? _RNvXs4_NtNtNtCsaTHfZRq6xTQ_4core3fmt3num3impxNtB9_7Display3fmt+0x30/0x30
[   38.602880]  vfs_read+0xb4/0x280
[   38.602880]  ? do_sendfile+0x1cd/0x470
[   38.602880]  ksys_read+0x5f/0xb0
[   38.602880]  __x64_sys_read+0x1b/0x20
[   38.602880]  do_syscall_64+0x35/0x50
[   38.602880]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[   38.602880] RIP: 0033:0x4ad272
[   38.602880] Code: 31 c0 e9 b1 fe ff ff 50 48 8d 3d c1 80 17 00 e8 54 8e 00 00 0f 1f 40 00 f3 0f 1e fa 64 8b 04 25 18 00 4
[   38.602880] RSP: 002b:00007ffe6e067158 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[   38.602880] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004ad272
[   38.602880] RDX: 0000000000001000 RSI: 00007ffe6e0671b8 RDI: 0000000000000003
[   38.602880] RBP: 00007ffe6e0671b8 R08: 0000000000000001 R09: 0000000000000000
[   38.602880] R10: 0000000001000000 R11: 0000000000000246 R12: 0000000000001000
[   38.602880] R13: 00000000020243a0 R14: 0000000000000000 R15: 0000000000000001
[   38.602880]  </TASK>
[   38.602880] Modules linked in: rust_ldd06(E)
[   38.602880] CR2: 0000000000000000
[   38.602880] ---[ end trace 0000000000000000 ]---
[   38.602880] RIP: 0010:wait_for_common+0xb5/0x170
[   38.602880] Code: f6 81 19 0c 00 00 01 75 70 48 89 4d c0 48 8b 45 c8 4c 39 f8 75 17 48 8b 46 18 4c 89 7e 18 48 8b 7d b0 2
[   38.602880] RSP: 0018:ffffc9000059bd70 EFLAGS: 00010046
[   38.602880] RAX: 0000000000000000 RBX: ffff88800433d148 RCX: ffff88800438e000
[   38.602880] RDX: 0000000000000002 RSI: ffff88800433d148 RDI: ffff88800433d158
[   38.602880] RBP: ffffc9000059bdc8 R08: 0000000000000000 R09: 0000000000000000
[   38.602880] R10: ffffc9000059bca8 R11: 3fffffffffffffff R12: 00007ffe6e0671b8
[   38.602880] R13: 7fffffffffffffff R14: 0000000000000002 R15: ffffc9000059bd90
[   38.602880] FS:  00000000020243c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000
[   38.602880] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   38.602880] CR2: 0000000000000000 CR3: 00000000042e6000 CR4: 00000000000006f0
[   38.602880] note: cat[123] exited with irqs disabled
[   38.652903] note: cat[123] exited with preempt_count 1
[   38.653512] rust_completion: release is invoked

Signed-off-by: Gioh Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• kbuild Related to building the kernel, `make`, `Kbuild`, `Kconfig` options...
Development

Successfully merging a pull request may close this issue.

1 participant