Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
301 commits
Select commit Hold shift + click to select a range
1d18154
include/linux/filter.h: fix %lu warning msg and add condition prog->n…
chinrw Mar 25, 2024
13806d4
spinlock_cleanup_benchmark: Add BPF spinlock cleanup benchmark
MinhPhan8803 Mar 25, 2024
6dacff7
spinlock_cleanup_benchmark_user.c: update open object file
MinhPhan8803 Mar 26, 2024
23aa195
spinlock_cleanup_benchmark: rename to tracex9
MinhPhan8803 Mar 26, 2024
675ce23
tracex9_user.c: update bpf object file
MinhPhan8803 Mar 26, 2024
03df370
Added tail call program to calculate factorial
orangeng Apr 2, 2024
048fec0
samples/bpf: update recursion benchmark
jinghao-jia Apr 6, 2024
2ffd239
tracex9_user.c: use xdp instead of kprobe
chinrw Apr 7, 2024
d56c5a8
include/linux/filter.h: ignore benchmark timer for BPF dispatcher fun…
chinrw Apr 7, 2024
ec8d729
gitignore: ignore recursive sample binary
chinrw Apr 7, 2024
99eeef9
samples/bpf: fix warnings in recursive
jinghao-jia Apr 7, 2024
0aa3a5e
s/iu/rex/g
jinghao-jia Jun 12, 2024
4314ae1
bpf/syscall: fix incorrect fmt argument type
jinghao-jia Jun 25, 2024
dacc6f8
Fix build errors after rebase
jinghao-jia Aug 8, 2024
9b99f64
libbpf: export section_defs
jinghao-jia Aug 9, 2024
ad9a2ba
samples/bpf: temporarily skip tracex9
jinghao-jia Aug 16, 2024
5f28faf
samples/bpf: fix the use of de[recated libbpf API in tracex9
jinghao-jia Aug 18, 2024
50f6466
bpf,rex: remove bpf_trace_printk_rex
jinghao-jia Aug 20, 2024
ecfbc71
x86/rex_unwind: use unreachable() instead of BUG() to annotate noreturn
jinghao-jia Aug 20, 2024
6a84162
x86/rex_unwind: enlarge rex stack to 32k
jinghao-jia Aug 20, 2024
dfddc29
x86/rex_unwind: fix comments and annotations
jinghao-jia Aug 20, 2024
19cc908
rex/termination: Code for IPI based termination
rjsu26 Mar 29, 2024
1e56c0f
rex-termination: Read per-cpu termination flag before changing execut…
rjsu26 Apr 9, 2024
0c877ed
rex/termination: fix lib/bpf compile fail issue
chinrw Aug 30, 2024
4924523
rex/termination: add termination option in `bpftool`
chinrw Sep 1, 2024
2f069ad
rex/termination: remove the prog detach code in bpf_die()
chinrw Sep 1, 2024
5577cae
bpf: make bpf_termination_flag an unsigned char
jinghao-jia Sep 1, 2024
fe1c648
bpf: remove unused printk in __bpf_prog_run
jinghao-jia Sep 1, 2024
bad4e98
rex: fix cfi check failure
jinghao-jia Sep 2, 2024
906dfa3
rex: move termination code to its own file
jinghao-jia Sep 2, 2024
03d9c5b
rex: set up watchdog timer for termination
jinghao-jia Sep 2, 2024
bc3c408
rex: merge init function invocations
jinghao-jia Sep 2, 2024
6709269
rex: add basic support for watchdog-based termination
jinghao-jia Sep 3, 2024
8385a98
rex: fix null-ptr-deref and triggering condition
jinghao-jia Sep 4, 2024
153bce2
smp,ipi: do not warn on rex termination
jinghao-jia Sep 4, 2024
c17c17e
rex: fix inconsistent attributes in rex_landingpad
jinghao-jia Sep 5, 2024
4f4f381
rex: add per_cpu rex_cur_prog if bpf_stats_enabled_key
chinrw Sep 5, 2024
bdd0da8
rex: force loader process to dump core upon panic
jinghao-jia Sep 10, 2024
86f46ae
rex/kprobe: add function after barrier to disable OPTPROBES
chinrw Sep 13, 2024
26d1efa
rex: setup two hrtimers on different cpu during system boot
chinrw Sep 15, 2024
a6ed014
rex/termination: use per-CPU timer instead of IPI
jinghao-jia Sep 17, 2024
db5c8b2
rex: fix generic_smp_call_function_interrupt in xen function interrupt
chinrw Sep 19, 2024
1690531
rex: fix ERROR: modpost: "rex_curr_prog" [lib/test_bpf.ko] undefined!
chinrw Sep 19, 2024
e1c9bf4
rex/termination: disable print in timer handler
jinghao-jia Sep 19, 2024
1abfa62
samples/bpf: recursive: remove newline to match rex output
jinghao-jia Sep 21, 2024
d2cdc22
samples/tracex9: update xdp to native mode for spinlock_benchmark
chinrw Sep 24, 2024
28d82c7
samples/kprobes: support both int3-based and optimized kprobes in kpr…
jinghao-jia Sep 25, 2024
0b855cf
samples/bpf: add more verbose error message in recursive
jinghao-jia Sep 25, 2024
b38e6e0
samples/bpf: tracex9_user: remove unused variables
jinghao-jia Sep 25, 2024
6767103
samples/bpf: add map_tests for array, hash and static_u64
chinrw Sep 26, 2024
54b2c5e
samples/bpf: modify default key and map max_entries
chinrw Sep 26, 2024
e26f104
rex/landingpad: reset the rex_termination_state set in rex panic handler
chinrw Sep 27, 2024
beceefe
rex: set rex_curr_prog in rex_dispatcher_func
jinghao-jia Sep 27, 2024
b59ed7c
bpf: remove unused bpf prog debug printk
chinrw Sep 30, 2024
4287358
rex: fix the memory leak when "fp->active" failed
chinrw Oct 2, 2024
1c028b3
samples/bpf: remove the unused `ret` variable
chinrw Oct 2, 2024
37a0c8f
rex: free the `saved_state` when __bpf_prog_free() is called
chinrw Oct 2, 2024
af9e0fa
x86/rex: fix OOB access on rex stack area
jinghao-jia Oct 8, 2024
49377be
rex: avoid modifying non-rex contexts
jinghao-jia Oct 8, 2024
4fef654
x86/rex: save frame pointer directly on stack
jinghao-jia Oct 11, 2024
0601c94
samples/bpf: recursive: simplify program to match rex side
jinghao-jia Oct 12, 2024
710a7ad
rex: properly set prog->kprobe_override
jinghao-jia Dec 3, 2024
acecb62
samples/bpf: remove accidentally added build artifacts
jinghao-jia Jan 24, 2025
e842033
x86/rex: code cleanup
jinghao-jia Jan 24, 2025
c77303a
x86/dumpstack: support stack dump from rex programs
jinghao-jia Jan 24, 2025
0af2c52
x86/dumpstack: print rex stack name in stack dump
jinghao-jia Jan 24, 2025
943c0fa
x86/rex: save old stack pointer on top of rex stack
jinghao-jia Jan 25, 2025
fc815c6
rex: correctly allocate rex programs to kallsyms
jinghao-jia Jan 25, 2025
a6ad80e
x86/rex: split rsp modification to a separate function
jinghao-jia Jan 27, 2025
06d9d48
objtool: add rex landingpad functions to the noreturn set
jinghao-jia Jan 27, 2025
3f5d36d
rex: simplify handling of dyn_sym
jinghao-jia Jan 28, 2025
64b31cf
rex: add rust symbols to kallsyms
jinghao-jia Jan 28, 2025
fc6d51b
rex: correctly initialize bpf_ksym entries for rex symbols
jinghao-jia Jan 29, 2025
875cbf4
x86/rex: update outdated panic message
jinghao-jia Feb 6, 2025
960f42d
x86/rex: support retpoline in dispatcher
jinghao-jia Feb 6, 2025
7db2042
x86/rex: move __rex_landingpad to rex_64.S
jinghao-jia Feb 6, 2025
9aaf9a7
x86/rex: improve comments for asm functions
jinghao-jia Feb 7, 2025
41ae38f
x86/rex: replace WARN with ratelimited pr_err
jinghao-jia Feb 7, 2025
43dcf2f
x86/rex: replace inline asm with C function call to rex_landingpad_asm()
jinghao-jia Feb 7, 2025
e480f64
objtool: add rex_landingpad_asm() to noreturns list
jinghao-jia Feb 7, 2025
216aed8
perf: remove unused a.out obj
chinrw Feb 7, 2025
f8fd4f2
rex: cleanup rex_load_prog{,_base}
jinghao-jia Feb 18, 2025
c736140
rex: directly compute final value of relocations
jinghao-jia Feb 19, 2025
6543b82
kbuild: add simple meson support
jinghao-jia Feb 26, 2025
5244768
kbuild/meson: s/build_dir/kbuild_dir/g
jinghao-jia Feb 26, 2025
cc90426
kbuild/meson: fix build file format
jinghao-jia Feb 27, 2025
e5ced5a
kbuild/meson: use nproc instead of '32'
chinrw Mar 6, 2025
edc1297
kbuild/meson: explicitly capture and check nproc
jinghao-jia Mar 6, 2025
ffb8efe
kbuild/meson: enable build_always_stable to ensure vmlinux is up-to-date
chinrw Mar 25, 2025
1802500
rex: remove unnecessary zeroing of rex program segments
jinghao-jia Mar 30, 2025
765d3cd
rex: introduce rex_log_buf per-cpu buffer for formatting and printing
jinghao-jia Apr 5, 2025
72b7a53
x86/rex: print rex panic message from per-cpu log buffer
jinghao-jia Apr 5, 2025
63fb4f1
rex: do not count total memory size and page counts incermentally
jinghao-jia Apr 6, 2025
cd6db28
samples/kprobes: add missing MODULE_DESCRIPTION() to kprobe_target
jinghao-jia Jun 15, 2025
e7f41e6
kbuild/meson: do not clean meson.build during
jinghao-jia Jul 27, 2025
a9d3c21
Sanity testig done
Apr 9, 2026
8382a19
Sanity testing done
Apr 9, 2026
51970aa
Add support for sched_ext_ops_cfs
jampflah Apr 9, 2026
e9ba1a8
print statements on KCFI errors - reaching scx_enable
Apr 9, 2026
64fbf3c
Merging origin/sched_ext_ops_cfg.
jampflah Apr 14, 2026
08e7e17
Fix merge duplication error.
jampflah Apr 14, 2026
dcc047e
BPF_PROG_LOAD_DJW
djwillia Aug 23, 2021
05eabd9
not-working code
djwillia Nov 29, 2021
7a4ba7c
update to 5.15
djwillia Dec 3, 2021
fc1b415
alloc executable mem for prog
djwillia Dec 13, 2021
5c40f5a
take out printk
djwillia Dec 21, 2021
8bb338e
fix bpf_trace_printk by always enable trace event
jinghao-jia Jan 9, 2022
ff91542
ELF Loader in kernel
Sayeed42 Feb 4, 2022
fec9c6d
ELF loader woring for example program
jinghao-jia Feb 5, 2022
369a07e
free program memory
jinghao-jia Feb 7, 2022
40826b6
Page permission solved
Sayeed42 Feb 14, 2022
818a760
refactor page permission code
jinghao-jia Feb 14, 2022
1537c65
might have fixed the page fault (permission error)
jinghao-jia Feb 21, 2022
455e44b
fix problem with empty section
jinghao-jia Mar 11, 2022
f50a051
Fixed memory conflict for distributed apps
Sayeed42 Apr 15, 2022
e396ed5
Rewritten to resolve conflicts
Sayeed42 Apr 22, 2022
30b8e77
map support
jinghao-jia Apr 15, 2022
afdc3cf
load the ELF as "inner-unikernel base"
jinghao-jia Apr 27, 2022
e6a2ebf
implement subprog-loading functions to support multiple programs in t…
jinghao-jia Apr 29, 2022
7bdf07f
cleanup debug statements
jinghao-jia May 1, 2022
ebfcfbc
Patch GOT at load time
jinghao-jia Aug 30, 2022
26ea08e
Add specialized trace_printk for inner-unikernel
jinghao-jia Oct 4, 2022
69273fb
fixup .rela.dyn data
jinghao-jia Nov 10, 2022
4238aa1
remove generated files
jinghao-jia Nov 21, 2022
a93a715
allow larger programs
jinghao-jia May 11, 2023
09956ec
kernel support for cleanup mechanism
jinghao-jia May 11, 2023
4b6e332
Add support for rust panic handling and stack unwinding
jinghao-jia Aug 16, 2023
883a4cb
Link inner-unikernel invocation with new dispatcher
jinghao-jia Aug 17, 2023
7e64948
Save callee-saved registers in new dispatcher
jinghao-jia Aug 28, 2023
56de34d
x86: iu_unwind_64.S: fix indentation
jinghao-jia Aug 29, 2023
339dc79
allocate vmapped per-cpu iu_stack
jinghao-jia Sep 2, 2023
cf43ba0
switch stack for iu invocation
jinghao-jia Sep 2, 2023
c6d0cd3
x86: iu_unwind.c: add more verbose log and doc
jinghao-jia Sep 5, 2023
37932d3
x86: iu_unwind.c: add GREATer kernel message
chinrw Sep 5, 2023
7604d2c
bpf: filter.h: use iu_unwind as xdp prog dispatcher_func
chinrw Sep 6, 2023
5531f2b
handle potentially read-only map sections
jinghao-jia Sep 12, 2023
1ad3d38
bpf: syscall.c: fix compile warning for printk %lx -> %llx
chinrw Sep 12, 2023
7320ef4
bpf_prog_load_iu_base: refactor iu_parse_map and iu_parse_relas out
jinghao-jia Oct 24, 2023
2f6a70e
bpf_prog_load_iu_base: fixup relocs for dynamic symbols
jinghao-jia Oct 24, 2023
bf61891
uapi/bpf: remove got-related fields in bpf_attr
jinghao-jia Oct 24, 2023
5888de9
x86: iu_unwind_64.S: export symbol of iu_dispatcher_func to network
chinrw Oct 30, 2023
55a4097
x86/iu_unwind: prototype iu_dispatcher_func
jinghao-jia Oct 30, 2023
c9834e1
x86/iu_unwind: refactor iu panic path
jinghao-jia Nov 7, 2023
32bed46
bpf,iu: Fix refcnt leak on base program
jinghao-jia Nov 14, 2023
4cd42ba
bpf,iu: fix NULL-ptr-deref on error path
jinghao-jia Apr 5, 2024
0ad09e8
samples/kprobe: add kprobe target module
jinghao-jia Mar 24, 2024
8736f42
samples/kprobes/kprobe_target: prevent call from being optimized away
jinghao-jia Mar 24, 2024
bd28094
samples/kprobes: allow passing arguments from userspace to kprobes
jinghao-jia Apr 6, 2024
1f6965b
include/linux/filter.h: Add timing for dispatcher function in bpf_pro…
MinhPhan8803 Mar 21, 2024
a89b8f9
include/linux/filter.h: update log string
MinhPhan8803 Mar 21, 2024
0b49771
include/linux/filter.h: use nanoseconds for time
jinghao-jia Mar 24, 2024
bbba1e2
samples/bpf: add equivalent eBPF program for startup overhead
jinghao-jia Mar 24, 2024
c0bfe76
include/linux/filter.h: fix %lu warning msg and add condition prog->n…
chinrw Mar 25, 2024
7dc0cfd
spinlock_cleanup_benchmark: Add BPF spinlock cleanup benchmark
MinhPhan8803 Mar 25, 2024
0c31252
spinlock_cleanup_benchmark_user.c: update open object file
MinhPhan8803 Mar 26, 2024
d7a0b5f
spinlock_cleanup_benchmark: rename to tracex9
MinhPhan8803 Mar 26, 2024
e21fff9
tracex9_user.c: update bpf object file
MinhPhan8803 Mar 26, 2024
27e52a0
Added tail call program to calculate factorial
orangeng Apr 2, 2024
1ac7af0
samples/bpf: update recursion benchmark
jinghao-jia Apr 6, 2024
a017d7c
tracex9_user.c: use xdp instead of kprobe
chinrw Apr 7, 2024
6185cf0
include/linux/filter.h: ignore benchmark timer for BPF dispatcher fun…
chinrw Apr 7, 2024
df00646
gitignore: ignore recursive sample binary
chinrw Apr 7, 2024
181f9d2
samples/bpf: fix warnings in recursive
jinghao-jia Apr 7, 2024
6137368
s/iu/rex/g
jinghao-jia Jun 12, 2024
8dead1f
bpf/syscall: fix incorrect fmt argument type
jinghao-jia Jun 25, 2024
2ea90b4
Fix build errors after rebase
jinghao-jia Aug 8, 2024
aa026c0
libbpf: export section_defs
jinghao-jia Aug 9, 2024
c5bf106
samples/bpf: temporarily skip tracex9
jinghao-jia Aug 16, 2024
b115778
samples/bpf: fix the use of de[recated libbpf API in tracex9
jinghao-jia Aug 18, 2024
dfed930
bpf,rex: remove bpf_trace_printk_rex
jinghao-jia Aug 20, 2024
ae145aa
x86/rex_unwind: use unreachable() instead of BUG() to annotate noreturn
jinghao-jia Aug 20, 2024
ace8d6e
x86/rex_unwind: enlarge rex stack to 32k
jinghao-jia Aug 20, 2024
34726ad
x86/rex_unwind: fix comments and annotations
jinghao-jia Aug 20, 2024
428bae4
rex/termination: Code for IPI based termination
rjsu26 Mar 29, 2024
adf4f9b
rex-termination: Read per-cpu termination flag before changing execut…
rjsu26 Apr 9, 2024
d3f96c7
rex/termination: fix lib/bpf compile fail issue
chinrw Aug 30, 2024
d95eb5e
rex/termination: add termination option in `bpftool`
chinrw Sep 1, 2024
bdf45f3
rex/termination: remove the prog detach code in bpf_die()
chinrw Sep 1, 2024
90480cb
bpf: make bpf_termination_flag an unsigned char
jinghao-jia Sep 1, 2024
4ce739f
bpf: remove unused printk in __bpf_prog_run
jinghao-jia Sep 1, 2024
4f15a56
rex: fix cfi check failure
jinghao-jia Sep 2, 2024
2ff6a9c
rex: move termination code to its own file
jinghao-jia Sep 2, 2024
b653f07
rex: set up watchdog timer for termination
jinghao-jia Sep 2, 2024
cf7c25f
rex: merge init function invocations
jinghao-jia Sep 2, 2024
0c07ca0
rex: add basic support for watchdog-based termination
jinghao-jia Sep 3, 2024
a52fc1b
rex: fix null-ptr-deref and triggering condition
jinghao-jia Sep 4, 2024
58f3418
smp,ipi: do not warn on rex termination
jinghao-jia Sep 4, 2024
a25328f
rex: fix inconsistent attributes in rex_landingpad
jinghao-jia Sep 5, 2024
b7a3790
rex: add per_cpu rex_cur_prog if bpf_stats_enabled_key
chinrw Sep 5, 2024
97af42a
rex: force loader process to dump core upon panic
jinghao-jia Sep 10, 2024
25a6586
rex/kprobe: add function after barrier to disable OPTPROBES
chinrw Sep 13, 2024
4868e73
rex: setup two hrtimers on different cpu during system boot
chinrw Sep 15, 2024
61997d3
rex/termination: use per-CPU timer instead of IPI
jinghao-jia Sep 17, 2024
323f161
rex: fix generic_smp_call_function_interrupt in xen function interrupt
chinrw Sep 19, 2024
0e7ae42
rex: fix ERROR: modpost: "rex_curr_prog" [lib/test_bpf.ko] undefined!
chinrw Sep 19, 2024
34c7621
rex/termination: disable print in timer handler
jinghao-jia Sep 19, 2024
a957a9e
samples/bpf: recursive: remove newline to match rex output
jinghao-jia Sep 21, 2024
92bcee8
samples/tracex9: update xdp to native mode for spinlock_benchmark
chinrw Sep 24, 2024
cfb2a9c
samples/kprobes: support both int3-based and optimized kprobes in kpr…
jinghao-jia Sep 25, 2024
12479d8
samples/bpf: add more verbose error message in recursive
jinghao-jia Sep 25, 2024
fe073b0
samples/bpf: tracex9_user: remove unused variables
jinghao-jia Sep 25, 2024
6a5e544
samples/bpf: add map_tests for array, hash and static_u64
chinrw Sep 26, 2024
be99aed
samples/bpf: modify default key and map max_entries
chinrw Sep 26, 2024
b03c4ac
rex/landingpad: reset the rex_termination_state set in rex panic handler
chinrw Sep 27, 2024
b37cae8
rex: set rex_curr_prog in rex_dispatcher_func
jinghao-jia Sep 27, 2024
887400f
bpf: remove unused bpf prog debug printk
chinrw Sep 30, 2024
8cfc4f7
rex: fix the memory leak when "fp->active" failed
chinrw Oct 2, 2024
528213c
samples/bpf: remove the unused `ret` variable
chinrw Oct 2, 2024
a02c524
rex: free the `saved_state` when __bpf_prog_free() is called
chinrw Oct 2, 2024
896919e
x86/rex: fix OOB access on rex stack area
jinghao-jia Oct 8, 2024
bac5baa
rex: avoid modifying non-rex contexts
jinghao-jia Oct 8, 2024
4c4dd55
x86/rex: save frame pointer directly on stack
jinghao-jia Oct 11, 2024
f60dee3
samples/bpf: recursive: simplify program to match rex side
jinghao-jia Oct 12, 2024
d3907c0
rex: properly set prog->kprobe_override
jinghao-jia Dec 3, 2024
2e65921
samples/bpf: remove accidentally added build artifacts
jinghao-jia Jan 24, 2025
711d9e9
x86/rex: code cleanup
jinghao-jia Jan 24, 2025
3612f78
x86/dumpstack: support stack dump from rex programs
jinghao-jia Jan 24, 2025
5d21eda
x86/dumpstack: print rex stack name in stack dump
jinghao-jia Jan 24, 2025
ee95713
x86/rex: save old stack pointer on top of rex stack
jinghao-jia Jan 25, 2025
6849395
rex: correctly allocate rex programs to kallsyms
jinghao-jia Jan 25, 2025
db04598
x86/rex: split rsp modification to a separate function
jinghao-jia Jan 27, 2025
0b64908
objtool: add rex landingpad functions to the noreturn set
jinghao-jia Jan 27, 2025
470b7c2
rex: simplify handling of dyn_sym
jinghao-jia Jan 28, 2025
fc52724
rex: add rust symbols to kallsyms
jinghao-jia Jan 28, 2025
d34835c
rex: correctly initialize bpf_ksym entries for rex symbols
jinghao-jia Jan 29, 2025
8249b58
x86/rex: update outdated panic message
jinghao-jia Feb 6, 2025
bd190e7
x86/rex: support retpoline in dispatcher
jinghao-jia Feb 6, 2025
5293cfe
x86/rex: move __rex_landingpad to rex_64.S
jinghao-jia Feb 6, 2025
15ebfd3
x86/rex: improve comments for asm functions
jinghao-jia Feb 7, 2025
8245abe
x86/rex: replace WARN with ratelimited pr_err
jinghao-jia Feb 7, 2025
1a961e9
x86/rex: replace inline asm with C function call to rex_landingpad_asm()
jinghao-jia Feb 7, 2025
0775943
objtool: add rex_landingpad_asm() to noreturns list
jinghao-jia Feb 7, 2025
2aa275c
perf: remove unused a.out obj
chinrw Feb 7, 2025
c0dc7dc
rex: cleanup rex_load_prog{,_base}
jinghao-jia Feb 18, 2025
0e39756
rex: directly compute final value of relocations
jinghao-jia Feb 19, 2025
e5ddbe3
kbuild: add simple meson support
jinghao-jia Feb 26, 2025
7cfdd25
kbuild/meson: s/build_dir/kbuild_dir/g
jinghao-jia Feb 26, 2025
eae4c12
kbuild/meson: fix build file format
jinghao-jia Feb 27, 2025
52410f5
kbuild/meson: use nproc instead of '32'
chinrw Mar 6, 2025
9d8d233
kbuild/meson: explicitly capture and check nproc
jinghao-jia Mar 6, 2025
099b352
kbuild/meson: enable build_always_stable to ensure vmlinux is up-to-date
chinrw Mar 25, 2025
4374589
rex: remove unnecessary zeroing of rex program segments
jinghao-jia Mar 30, 2025
64020af
rex: introduce rex_log_buf per-cpu buffer for formatting and printing
jinghao-jia Apr 5, 2025
7daad1b
x86/rex: print rex panic message from per-cpu log buffer
jinghao-jia Apr 5, 2025
40700e4
rex: do not count total memory size and page counts incermentally
jinghao-jia Apr 6, 2025
3c44e96
samples/kprobes: add missing MODULE_DESCRIPTION() to kprobe_target
jinghao-jia Jun 15, 2025
e406726
kbuild/meson: do not clean meson.build during
jinghao-jia Jul 27, 2025
4c9ae66
Plumbing Rex scheduler name through Rex sched_ext path
Apr 21, 2026
8d2cf1f
Fix leak on SCX_EXIT_ERROR_STALL (mode 1 scx simple soft stall).
jampflah Apr 26, 2026
90e2e16
Merge branch 'rex-linux' into nmi_branch_test
dg1197 May 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/x86/include/asm/asm-prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <asm/page.h>
#include <asm/checksum.h>
#include <asm/mce.h>
#include <asm/rex.h>

#include <asm-generic/asm-prototypes.h>

Expand Down
40 changes: 40 additions & 0 deletions arch/x86/include/asm/rex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_REX_UNWIND_H
#define _ASM_X86_REX_UNWIND_H

#include <linux/linkage.h>
#include <linux/percpu.h>

#ifndef __ASSEMBLY__

/*
* Total stack is 8 pages (32k) large. 4 pages are reserved for kernel helpers/
* Therefore, the actual usable stack is 4 pages.
*/
#define REX_STACK_ORDER 3
#define REX_STACK_SIZE (PAGE_SIZE << REX_STACK_ORDER)

struct bpf_prog;
struct bpf_insn;

DECLARE_PER_CPU(unsigned char, rex_termination_state);
DECLARE_PER_CPU(void *, rex_stack_ptr);

extern asmlinkage unsigned int rex_dispatcher_func(
const void *ctx,
const struct bpf_prog *prog,
unsigned int (*bpf_func)(const void *,
const struct bpf_insn *));

int arch_init_rex_stack(void);

static __always_inline bool arch_on_rex_stack(struct pt_regs *regs)
{
unsigned long sp = regs->sp;
u64 rex_tos = (u64)this_cpu_read_stable(rex_stack_ptr);
return sp >= (rex_tos + 8 - REX_STACK_SIZE) && sp < (rex_tos + 8);
}

#endif /* !__ASSEMBLY__ */

#endif /* _ASM_X86_REX_UNWIND_H */
1 change: 1 addition & 0 deletions arch/x86/include/asm/stacktrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum stack_type {
STACK_TYPE_IRQ,
STACK_TYPE_SOFTIRQ,
STACK_TYPE_ENTRY,
STACK_TYPE_REX,
STACK_TYPE_EXCEPTION,
STACK_TYPE_EXCEPTION_LAST = STACK_TYPE_EXCEPTION + N_EXCEPTION_STACKS-1,
};
Expand Down
42 changes: 42 additions & 0 deletions arch/x86/kernel/dumpstack_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/nmi.h>

#include <asm/cpu_entry_area.h>
#include <asm/rex.h>
#include <asm/stacktrace.h>

static const char * const exception_stack_names[] = {
Expand Down Expand Up @@ -50,6 +51,9 @@ const char *stack_type_name(enum stack_type type)
return "ENTRY_TRAMPOLINE";
}

if (type == STACK_TYPE_REX)
return "REX";

if (type >= STACK_TYPE_EXCEPTION && type <= STACK_TYPE_EXCEPTION_LAST)
return exception_stack_names[type - STACK_TYPE_EXCEPTION];

Expand Down Expand Up @@ -167,6 +171,41 @@ static __always_inline bool in_irq_stack(unsigned long *stack, struct stack_info
return true;
}

static __always_inline bool in_rex_stack(unsigned long *stack, struct stack_info *info)
{
unsigned long *end = (unsigned long *)this_cpu_read(rex_stack_ptr);
unsigned long *begin;

/*
* @end points directly to the top most stack entry to avoid a -8
* adjustment in the stack switch hotpath. Adjust it back before
* calculating @begin.
*/
end++;
begin = end - (IRQ_STACK_SIZE / sizeof(long));

/*
* Due to the switching logic RSP can never be == @end because the
* final operation is 'popq %rsp' which means after that RSP points
* to the original stack and not to @end.
*/
if (stack < begin || stack >= end)
return false;

info->type = STACK_TYPE_REX;
info->begin = begin;
info->end = end;

/*
* The next stack pointer is stored at the top of the irq stack
* before switching to the irq stack. Actual stack entries are all
* below that.
*/
info->next_sp = (unsigned long *)*(end - 1);

return true;
}

bool noinstr get_stack_info_noinstr(unsigned long *stack, struct task_struct *task,
struct stack_info *info)
{
Expand All @@ -185,6 +224,9 @@ bool noinstr get_stack_info_noinstr(unsigned long *stack, struct task_struct *ta
if (in_entry_stack(stack, info))
return true;

if (in_rex_stack(stack, info))
return true;

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_call_function)
apic_eoi();
trace_call_function_entry(CALL_FUNCTION_VECTOR);
inc_irq_stat(irq_call_count);
generic_smp_call_function_interrupt();
generic_smp_call_function_interrupt(regs);
trace_call_function_exit(CALL_FUNCTION_VECTOR);
}

Expand All @@ -268,7 +268,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_call_function_single)
apic_eoi();
trace_call_function_single_entry(CALL_FUNCTION_SINGLE_VECTOR);
inc_irq_stat(irq_call_count);
generic_smp_call_function_single_interrupt();
generic_smp_call_function_single_interrupt(regs);
trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR);
}

Expand Down
3 changes: 3 additions & 0 deletions arch/x86/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ ifeq ($(CONFIG_X86_32),y)
else
obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o bpf_timed_may_goto.o
endif

obj-y += rex.o
obj-y += rex_$(BITS).o
105 changes: 105 additions & 0 deletions arch/x86/net/rex.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* X86-specific code for Rex support
*/
#define pr_fmt(fmt) "rex: " fmt

#include <linux/bpf.h>
#include <linux/compiler_types.h>
#include <linux/module.h>
#include <linux/objtool.h>
#include <linux/percpu.h>
#include <linux/printk.h>
#include <linux/vmalloc.h>

#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/rex.h>

/* Align to page size, since the stack trace is broken anyway */
struct rex_stack {
char stack[REX_STACK_SIZE];
} __aligned(PAGE_SIZE);

DEFINE_PER_CPU_PAGE_ALIGNED(struct rex_stack, rex_stack_backing_store)
__visible;
DEFINE_PER_CPU(void *, rex_stack_ptr);

DECLARE_PER_CPU(const struct bpf_prog *, rex_curr_prog);

/*
* Not supposed to be called by other kernel code, therefore keep prototype
* private
*/
void rex_landingpad(void) __noreturn;

static int map_rex_stack(unsigned int cpu)
{
char *stack = (char *)per_cpu_ptr(&rex_stack_backing_store, cpu);
struct page *pages[REX_STACK_SIZE / PAGE_SIZE];
void *va;
int i;

for (i = 0; i < REX_STACK_SIZE / PAGE_SIZE; i++) {
phys_addr_t pa = per_cpu_ptr_to_phys(stack + (i << PAGE_SHIFT));

pages[i] = pfn_to_page(pa >> PAGE_SHIFT);
}

va = vmap(pages, REX_STACK_SIZE / PAGE_SIZE, VM_MAP, PAGE_KERNEL);
if (!va)
return -ENOMEM;

/* Store actual TOS to avoid adjustment in the hotpath */
per_cpu(rex_stack_ptr, cpu) = va + REX_STACK_SIZE - 8;

pr_info("Initialize rex_stack on CPU %d at 0x%llx\n", cpu,
((u64)va) + REX_STACK_SIZE);

return 0;
}

int arch_init_rex_stack(void)
{
int i, ret = 0;
for_each_online_cpu(i) {
ret = map_rex_stack(i);
if (ret < 0) {
pr_err("Failed to initialize rex stack on CPU %d\n", i);
break;
}
}
return ret;
}

/* Do not declare rex_landingpad_asm() in header file since it should only be
* called from rex_landingpad()
*/
asmlinkage void __noreturn rex_landingpad_asm(void);

void __noreturn rex_landingpad(void)
{
struct task_struct *loader;
DEFINE_RATELIMIT_STATE(rex_rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);

/* Report error */
if (__ratelimit(&rex_rs)) {
pr_err("%s\n", this_cpu_ptr(rex_log_buf));
dump_stack();
}

loader = find_task_by_pid_ns(
this_cpu_read_stable(rex_curr_prog)->saved_state->loader_pid,
&init_pid_ns);

/* Reuse the seccomp signal for now */
if (loader)
force_sig_fault_to_task(SIGSYS, SYS_SECCOMP, NULL, loader);

/* Reset the rex_termination_state set in rex panic handler */
this_cpu_write(rex_termination_state, 0);

/* Handle the rest fixups */
rex_landingpad_asm();
}
84 changes: 84 additions & 0 deletions arch/x86/net/rex_64.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* X86 asm for Rex support
*/
#include <linux/export.h>
#include <linux/linkage.h>
#include <asm/errno.h>
#include <asm/nospec-branch.h>
#include <asm/percpu.h>

.code64
.section .text, "ax"

/*
* Dispatcher func for Rex
*
* %rdi: ctx argument of the Rex program
* %rsi: pointer to the Rex program struct
* %rdx: fucntion pointer to the entry of the Rex program
*/
SYM_FUNC_START(rex_dispatcher_func)
/* save the callee-saved registers and the frame pointer*/
pushq %rbp
pushq %rbx
pushq %r12
pushq %r13
pushq %r14
pushq %r15

/* switch stack and save old rsp*/
movq PER_CPU_VAR(rex_stack_ptr), %rbp
movq %rsp, (%rbp)
movq %rbp, %rsp

/* record start time */
movq jiffies(%rip), %r11
movq %r11, PER_CPU_VAR(rex_prog_start_time)

/* let the timer know we are in */
movq %rsi, PER_CPU_VAR(rex_curr_prog)

/* invoke bpf func */
CALL_NOSPEC rdx

/*
* Exit path: rex_landingpad also redirects the control flow here
*
* %rax: program return value or default return value in case of a panic
* %rsp: top entry of the Rex stack
*/
SYM_INNER_LABEL(rex_exit, SYM_L_GLOBAL)
/* let the timer know we are out */
movq $0, PER_CPU_VAR(rex_curr_prog)

/* pop old stack pointer into rsp */
popq %rsp

/* restore the callee-saved registers and the frame pointer */
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbx
popq %rbp

/* return */
RET
SYM_FUNC_END(rex_dispatcher_func)
EXPORT_SYMBOL(rex_dispatcher_func)

/*
* Low-level fixups for Rust panics
*/
SYM_FUNC_START(rex_landingpad_asm)
/* set an return value of 0 */
movq $0, %rax

/* reset stack */
movq PER_CPU_VAR(rex_stack_ptr), %rsp

/* jump to exit path */
jmp rex_exit
SYM_FUNC_END(rex_landingpad_asm)
STACK_FRAME_NON_STANDARD(rex_landingpad_asm);
4 changes: 2 additions & 2 deletions arch/x86/xen/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ void xen_send_IPI_allbutself(int vector)

static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id)
{
generic_smp_call_function_interrupt();
generic_smp_call_function_interrupt(dev_id);
inc_irq_stat(irq_call_count);

return IRQ_HANDLED;
}

static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
{
generic_smp_call_function_single_interrupt();
generic_smp_call_function_single_interrupt(dev_id);
inc_irq_stat(irq_call_count);

return IRQ_HANDLED;
Expand Down
Loading