lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat,  7 May 2022 22:11:45 +0900
From:   Vincent Mailhol <mailhol.vincent@...adoo.fr>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Rikard Falkeborn <rikard.falkeborn@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Will Deacon <will@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [RFC PATCH v2 2/2] kbuild: call check-atomics.sh only if prerequisites change

check-atomics.sh is executed unconditionally. Most developers will not
modify the files being checked by this script and thus do not need to
execute it again for each iterative make.

We first add an additional dependency to include/linux/atomic/* to
make sure that the script gets executed again if the headers are
modified. We then use the if_change macro instead of cmd. c.f. [1] and
create the dot file scripts/atomic/.check-atomics which is used for
the target timestamp. Finally, the dot file is added to the
CLEAN_FILES target.

[1] https://www.kernel.org/doc/html/latest/kbuild/makefiles.html#command-change-detection

Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
 Kbuild   | 7 ++++---
 Makefile | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Kbuild b/Kbuild
index fa441b98c9f6..c3cb76ebcbaf 100644
--- a/Kbuild
+++ b/Kbuild
@@ -50,10 +50,11 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
 #####
 # Check atomic headers are up-to-date
 
-always-y += old-atomics
+always-y += scripts/atomic/.check-atomics
 
 quiet_cmd_atomics = CALL    $<
       cmd_atomics = $(CONFIG_SHELL) $<
 
-old-atomics: scripts/atomic/check-atomics.sh FORCE
-	$(call cmd,atomics)
+scripts/atomic/.check-atomics: scripts/atomic/check-atomics.sh $(wildcard include/linux/atomic/*) FORCE
+	$(call if_changed,atomics)
+	@touch $@
diff --git a/Makefile b/Makefile
index 9a820c525b86..9e815c8bb0b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1483,7 +1483,8 @@ endif # CONFIG_MODULES
 # Directories & files removed with 'make clean'
 CLEAN_FILES += include/ksym vmlinux.symvers modules-only.symvers \
 	       modules.builtin modules.builtin.modinfo modules.nsdeps \
-	       compile_commands.json .thinlto-cache
+	       compile_commands.json .thinlto-cache \
+	       scripts/atomic/.check-atomics
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_FILES += include/config include/generated          \
-- 
2.35.1

Powered by blists - more mailing lists