Skip to content

powerpc: net: bpf_jit_comp: Fix misuse of fallthrough - #119

Closed
kernel-patches-bot wants to merge 2 commits into
bpf-nextfrom
series/204533=>bpf-next
Closed

kernel-patches-bot wants to merge 2 commits into
bpf-nextfrom
series/204533=>bpf-next

Conversation

@kernel-patches-bot

Copy link
Copy Markdown

Pull request for series with
subject: powerpc: net: bpf_jit_comp: Fix misuse of fallthrough
version: 1
url: https://patchwork.ozlabs.org/project/netdev/list/?series=204533

@kernel-patches-bot

Copy link
Copy Markdown
Author

Master branch: ba5f4cf
series: https://patchwork.ozlabs.org/project/netdev/list/?series=204533
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.ozlabs.org/project/netdev/list/?series=204533, error message:
Cmd('git') failed due to: exit code(128)
cmdline: git am -3
stderr: 'fatal: previous rebase directory .git/rebase-apply still exists but mbox given.'

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

kernel-patches-bot and others added 2 commits September 29, 2020 13:30
The user defined label following "fallthrough" is not considered by GCC
and causes build failure.

kernel-source/include/linux/compiler_attributes.h:208:41: error: attribute
'fallthrough' not preceding a case label or default label [-Werror]
 208   define fallthrough _attribute((fallthrough_))
                          ^~~~~~~~~~~~~

Signed-off-by: He Zhe <[email protected]>
@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot
kernel-patches-bot deleted the series/204533=>bpf-next branch September 30, 2020 16:13
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Jan 26, 2024
Like commit 1cf3bfc ("bpf: Support 64-bit pointers to kfuncs")
for s390x, add support for 64-bit pointers to kfuncs for LoongArch.
Since the infrastructure is already implemented in BPF core, the only
thing need to be done is to override bpf_jit_supports_far_kfunc_call().

Before this change, several test_verifier tests failed:

  # ./test_verifier | grep # | grep FAIL
  #119/p calls: invalid kfunc call: ptr_to_mem to struct with non-scalar FAIL
  #120/p calls: invalid kfunc call: ptr_to_mem to struct with nesting depth > 4 FAIL
  #121/p calls: invalid kfunc call: ptr_to_mem to struct with FAM FAIL
  #122/p calls: invalid kfunc call: reg->type != PTR_TO_CTX FAIL
  #123/p calls: invalid kfunc call: void * not allowed in func proto without mem size arg FAIL
  #124/p calls: trigger reg2btf_ids[reg->type] for reg->type > __BPF_REG_TYPE_MAX FAIL
  #125/p calls: invalid kfunc call: reg->off must be zero when passed to release kfunc FAIL
  #126/p calls: invalid kfunc call: don't match first member type when passed to release kfunc FAIL
  #127/p calls: invalid kfunc call: PTR_TO_BTF_ID with negative offset FAIL
  #128/p calls: invalid kfunc call: PTR_TO_BTF_ID with variable offset FAIL
  #129/p calls: invalid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  #130/p calls: valid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  #486/p map_kptr: ref: reference state created and released on xchg FAIL

This is because the kfuncs in the loaded module are far away from
__bpf_call_base:

  ffff800002009440 t bpf_kfunc_call_test_fail1    [bpf_testmod]
  9000000002e128d8 T __bpf_call_base

The offset relative to __bpf_call_base does NOT fit in s32, which breaks
the assumption in BPF core. Enable bpf_jit_supports_far_kfunc_call() lifts
this limit.

Note that to reproduce the above result, tools/testing/selftests/bpf/config
should be applied, and run the test with JIT enabled, unpriv BPF enabled.

With this change, the test_verifier tests now all passed:

  # ./test_verifier
  ...
  Summary: 777 PASSED, 0 SKIPPED, 0 FAILED

Tested-by: Tiezhu Yang <[email protected]>
Signed-off-by: Hengqi Chen <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Feb 26, 2026
In a similar fashion to the IPv4 output route tests, add equivalent IPv6
tests.

Output without "bpf: fib_lookup: Honor oif in IPv6 output route
lookups":

 # ./test_progs -a fib_lookup
 [...]
 Testing IPv6 output route, without source, via second device test_fib_lookup:PASS:bpf_prog_test_run_opts 0 nsec
 test_fib_lookup:PASS:fib_lookup_ret 0 nsec
 test_fib_lookup:FAIL:ifindex does not match unexpected ifindex does not match: actual 10010 != expected 10020
 [...]
 Testing IPv6 output route, with source, via second device set_lookup_params:PASS:inet_pton(IPV6_IFACE_ADDR) 0 nsec
 test_fib_lookup:PASS:bpf_prog_test_run_opts 0 nsec
 test_fib_lookup:PASS:fib_lookup_ret 0 nsec
 test_fib_lookup:FAIL:ifindex does not match unexpected ifindex does not match: actual 10010 != expected 10020
 [...]
 Testing IPv6 output route, oif mismatch set_lookup_params:PASS:inet_pton(IPV6_IFACE_ADDR) 0 nsec
 test_fib_lookup:PASS:bpf_prog_test_run_opts 0 nsec
 test_fib_lookup:FAIL:fib_lookup_ret unexpected fib_lookup_ret: actual 0 != expected 4
 [...]
 #119     fib_lookup:FAIL
 Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED

Output with "bpf: fib_lookup: Honor oif in IPv6 output route lookups":

 # ./test_progs -a fib_lookup
 #119     fib_lookup:OK
 Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

That is, without the specified patch, unlike IPv4, IPv6 would always
resolve the most specific route with the lowest metric, even if its
nexthop device does not match the specified oif.

Reviewed-by: Petr Machata <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Feb 26, 2026
Add tests that verify that bpf_fib_lookup() is able to resolve the
destination MAC for an IPv6 link-local address when specifying the
BPF_FIB_LOOKUP_OUTPUT flag.

Output without "bpf: fib_lookup: Allow output lookups for IPv6
link-local addresses":

 # ./test_progs -a fib_lookup
 [...]
 Testing IPv6 output route, link-local, via first device set_lookup_params:PASS:inet_pton(IPV6_IFACE_ADDR) 0 nsec
 test_fib_lookup:PASS:bpf_prog_test_run_opts 0 nsec
 test_fib_lookup:FAIL:fib_lookup_ret unexpected fib_lookup_ret: actual 4 != expected 0
 [...]
 Testing IPv6 output route, link-local, via second device set_lookup_params:PASS:inet_pton(IPV6_IFACE_ADDR) 0 nsec
 test_fib_lookup:PASS:bpf_prog_test_run_opts 0 nsec
 test_fib_lookup:FAIL:fib_lookup_ret unexpected fib_lookup_ret: actual 4 != expected 0
 [...]
 #119     fib_lookup:FAIL
 Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED

Output with "bpf: fib_lookup: Allow output lookups for IPv6 link-local
addresses":

 # ./test_progs -a fib_lookup
 #119     fib_lookup:OK
 Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

Reviewed-by: Petr Machata <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
iamkafai pushed a commit to iamkafai/bpf_next_ci that referenced this pull request May 18, 2026
Add check_dtroot() to validate dtroot_t integrity, focusing on preventing
index/pointer overflows from on-disk corruption.

Key checks:
 - freecnt bounded by [0, DTROOTMAXSLOT-1] (slot[0] reserved for header).
 - freelist validity: -1 when freecnt=0; 1~DTROOTMAXSLOT-1 when non-zero,
   with linked list checks (no duplicates, proper termination via next=-1).
 - stbl bounds: nextindex within stbl array size; entries within 0~8, no
   duplicates (excluding idx=0).

Invoked in copy_from_dinode() when loading directory inodes, catching
corruption early before directory operations trigger out-of-bounds access.

This fixes the following UBSAN warning.

[  101.832754][ T5960] ------------[ cut here ]------------
[  101.832762][ T5960] UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dtree.c:3713:8
[  101.832792][ T5960] index -1 is out of range for type 'struct dtslot[128]'
[  101.832807][ T5960] CPU: 2 UID: 0 PID: 5960 Comm: 5f7f0caf9979e9d Tainted: G            E       6.18.0-rc4-00250-g2603eb907f03 kernel-patches#119 PREEMPT_{RT,(full
[  101.832817][ T5960] Tainted: [E]=UNSIGNED_MODULE
[  101.832819][ T5960] Hardware name: QEMU Ubuntu 25.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[  101.832823][ T5960] Call Trace:
[  101.832833][ T5960]  <TASK>
[  101.832838][ T5960]  dump_stack_lvl+0x189/0x250
[  101.832909][ T5960]  ? __pfx_dump_stack_lvl+0x10/0x10
[  101.832925][ T5960]  ? __pfx__printk+0x10/0x10
[  101.832934][ T5960]  ? rt_mutex_slowunlock+0x493/0x8a0
[  101.832959][ T5960]  ubsan_epilogue+0xa/0x40
[  101.832966][ T5960]  __ubsan_handle_out_of_bounds+0xe9/0xf0
[  101.833007][ T5960]  dtInsertEntry+0x936/0x1430 [jfs]
[  101.833094][ T5960]  dtSplitPage+0x2c8b/0x3ed0 [jfs]
[  101.833177][ T5960]  ? __pfx_rt_mutex_slowunlock+0x10/0x10
[  101.833193][ T5960]  dtInsert+0x109b/0x6000 [jfs]
[  101.833283][ T5960]  ? rt_mutex_slowunlock+0x493/0x8a0
[  101.833296][ T5960]  ? __pfx_rt_mutex_slowunlock+0x10/0x10
[  101.833307][ T5960]  ? rt_spin_unlock+0x161/0x200
[  101.833315][ T5960]  ? __pfx_dtInsert+0x10/0x10 [jfs]
[  101.833391][ T5960]  ? txLock+0xaf9/0x1cb0 [jfs]
[  101.833477][ T5960]  ? dtInitRoot+0x22a/0x670 [jfs]
[  101.833556][ T5960]  jfs_mkdir+0x6ec/0xa70 [jfs]
[  101.833636][ T5960]  ? __pfx_jfs_mkdir+0x10/0x10 [jfs]
[  101.833721][ T5960]  ? generic_permission+0x2e5/0x690
[  101.833760][ T5960]  ? bpf_lsm_inode_mkdir+0x9/0x20
[  101.833776][ T5960]  vfs_mkdir+0x306/0x510
[  101.833786][ T5960]  do_mkdirat+0x247/0x590
[  101.833795][ T5960]  ? __pfx_do_mkdirat+0x10/0x10
[  101.833804][ T5960]  ? getname_flags+0x1e5/0x540
[  101.833815][ T5960]  __x64_sys_mkdir+0x6c/0x80
[  101.833823][ T5960]  do_syscall_64+0xfa/0xfa0
[  101.833832][ T5960]  ? lockdep_hardirqs_on+0x9c/0x150
[  101.833840][ T5960]  ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[  101.833847][ T5960]  ? exc_page_fault+0xab/0x100
[  101.833856][ T5960]  entry_SYSCALL_64_after_hwframe+0x77/0x7f

Signed-off-by: Yun Zhou <[email protected]>
Signed-off-by: Dave Kleikamp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant