mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
Enable context analysis for security/tomoyo.
This demonstrates a larger conversion to use Clang's context
analysis. The benefit is additional static checking of locking rules,
along with better documentation.
Tomoyo makes use of several synchronization primitives, yet its clear
design made it relatively straightforward to enable context analysis.
One notable finding was:
security/tomoyo/gc.c:664:20: error: reading variable 'write_buf' requires holding mutex '&tomoyo_io_buffer::io_sem'
664 | is_write = head->write_buf != NULL;
For which Tetsuo writes:
"Good catch. This should be data_race(), for tomoyo_write_control()
might concurrently update head->write_buf from non-NULL to non-NULL
with head->io_sem held."
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251219154418.3592607-35-elver@google.com
22 lines
819 B
Makefile
22 lines
819 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
CONTEXT_ANALYSIS := y
|
|
|
|
obj-y = audit.o common.o condition.o domain.o environ.o file.o gc.o group.o load_policy.o memory.o mount.o network.o realpath.o securityfs_if.o tomoyo.o util.o
|
|
|
|
targets += builtin-policy.h
|
|
|
|
quiet_cmd_policy = POLICY $@
|
|
cmd_policy = { \
|
|
$(foreach x, profile exception_policy domain_policy manager stat, \
|
|
printf 'static char tomoyo_builtin_$x[] __initdata =\n'; \
|
|
sed -e 's/\\/\\\\/g' -e 's/\"/\\"/g' -e 's/\(.*\)/\t"\1\\n"/' -- $(firstword $(filter %/$x.conf %/$x.conf.default, $^) /dev/null); \
|
|
printf '\t"";\n';) \
|
|
} > $@
|
|
|
|
$(obj)/builtin-policy.h: $(wildcard $(obj)/policy/*.conf $(src)/policy/*.conf.default) FORCE
|
|
$(call if_changed,policy)
|
|
|
|
ifndef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING
|
|
$(obj)/common.o: $(obj)/builtin-policy.h
|
|
endif
|