History

integer-wrap: Force full rebuild when .scl file changes

Since the integer wrapping sanitizer's behavior depends on its associated .scl file, we must force a full rebuild if the file changes. If not, instrumentation may differ between targets based on when they were built. Generate a new header file, integer-wrap.h, any time the Clang .scl file changes. Include the header file in compiler-version.h when its associated feature name, INTEGER_WRAP, is defined. This will be picked up by fixdep and force rebuilds where needed.

Kees Cook committed 1 year ago

Commit 11bb1671 parent 056000c3 files · +16 −0Browse files

Showing the changes to scripts (2 of 3 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.ubsan +1 −0
  2. scripts/basic/Makefile +5 −0
scripts/Makefile.ubsan+1−0
@@ -15,6 +15,7 @@ ubsan-cflags-$(CONFIG_UBSAN_TRAP) += $(call cc-option,-fsanitize-trap=undefined · 14 unmodified lines
1515 export CFLAGS_UBSAN := $(ubsan-cflags-y)
1616
1717 ubsan-integer-wrap-cflags-$(CONFIG_UBSAN_INTEGER_WRAP) += \
18+ -DINTEGER_WRAP \
1819 -fsanitize-undefined-ignore-overflow-pattern=all \
1920 -fsanitize=signed-integer-overflow \
2021 -fsanitize=unsigned-integer-overflow \
scripts/basic/Makefile+5−0
@@ -14,3 +14,8 @@ cmd_create_randstruct_seed = \ · 13 unmodified lines
1414 $(obj)/randstruct.seed: $(gen-randstruct-seed) FORCE
1515 $(call if_changed,create_randstruct_seed)
1616 always-$(CONFIG_RANDSTRUCT) += randstruct.seed
17+
18+# integer-wrap: if the .scl file changes, we need to do a full rebuild.
19+$(obj)/../../include/generated/integer-wrap.h: $(srctree)/scripts/integer-wrap-ignore.scl FORCE
20+ $(call if_changed,touch)
21+always-$(CONFIG_UBSAN_INTEGER_WRAP) += ../../include/generated/integer-wrap.h

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t