Skip to content

Commit

Permalink
env: Add option for CONFIG_UBSAN_BOUNDS in Arch and Fedora builds
Browse files Browse the repository at this point in the history
This can help catch obvious bugs.

Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Nov 15, 2023
1 parent e0f28b8 commit 9cef521
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fish/functions/cbl_bld_krnl_pkg.fish
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function cbl_bld_krnl_pkg -d "Build ClangBuiltLinux Arch Linux kernel package"

for arg in $argv
switch $arg
case --cfi --cfi-permissive -f --full -l --local --lto -m --menuconfig
case --cfi --cfi-permissive -f --full -l --local --lto -m --menuconfig -u --ubsan-bounds
set -a config_args $arg
case -p --permissive
set -a config_args --cfi-permissive
Expand Down
2 changes: 1 addition & 1 deletion fish/functions/cbl_bld_krnl_rpm.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function cbl_bld_krnl_rpm -d "Build a .rpm kernel package"
# Allow cross compiling
for arg in $argv
switch $arg
case --cfi --cfi-permissive --lto --no-werror
case --cfi --cfi-permissive --lto --no-werror -u --ubsan-bounds
set -a gen_config_args $arg
case -g --gcc
set gcc true
Expand Down
12 changes: 11 additions & 1 deletion fish/functions/cbl_gen_archconfig.fish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ function cbl_gen_archconfig -d "Generate a configuration file for Arch Linux"
-e LTO_CLANG_THIN
case -m --menuconfig
set menuconfig true
case -u --ubsan-bounds
set -a config_args \
-e UBSAN \
-e UBSAN_BOUNDS \
-d UBSAN_ALIGNMENT \
-d UBSAN_BOOL \
-d UBSAN_DIV_ZERO \
-d UBSAN_ENUM \
-d UBSAN_SHIFT \
-d UBSAN_UNREACHABLE
case linux-debug linux-mainline-'*' linux-next-'*'
set pkg $arg
end
Expand Down Expand Up @@ -71,7 +81,7 @@ function cbl_gen_archconfig -d "Generate a configuration file for Arch Linux"
# Step 5: Run through olddefconfig with Clang
kmake -C $src KCONFIG_CONFIG=$cfg LLVM=1 LLVM_IAS=1 olddefconfig

# Step 6: Enable ThinLTO or CFI
# Step 6: Enable ThinLTO, CFI, or UBSAN
if test -n "$config_args"
$src/scripts/config \
--file $cfg \
Expand Down
10 changes: 10 additions & 0 deletions fish/functions/cbl_gen_fedoraconfig.fish
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ function cbl_gen_fedoraconfig -d "Downloads and modifies Fedora's kernel configu
-e LTO_CLANG_THIN
case --no-werror
set no_werror true
case -u --ubsan-bounds
set -a scripts_config_args \
-e UBSAN \
-e UBSAN_BOUNDS \
-d UBSAN_ALIGNMENT \
-d UBSAN_BOOL \
-d UBSAN_DIV_ZERO \
-d UBSAN_ENUM \
-d UBSAN_SHIFT \
-d UBSAN_UNREACHABLE
end
end
if not set -q arch
Expand Down

0 comments on commit 9cef521

Please sign in to comment.