[RFC PATCH bpf-next v5 4/8] selftests/bpf: generate the signing key and certificate once
Mykola Lysenko <[email protected]> Tue, 4 Aug 2026 10:01:52 -0700
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
$(VERIFICATION_CERT) and $(PRIVATE_KEY) come from a single genkey invocation, but a rule with two normal targets runs its recipe once per stale target - under -j both runs execute concurrently and the openssl invocations race on the same output files. Rewrite it as a pattern rule: pattern rules with multiple targets are implicitly grouped even before make 4.3 introduced grouped (&:) targets - the same workaround the test_kmods rule already uses. Signed-off-by: Mykola Lysenko <[email protected]> --- tools/testing/selftests/bpf/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 565862247..774286a55 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -800,7 +800,11 @@ VERIFY_SIG_HDR := verification_cert.h VERIFICATION_CERT := $(BUILD_DIR)/signing_key.der PRIVATE_KEY := $(BUILD_DIR)/signing_key.pem -$(VERIFICATION_CERT) $(PRIVATE_KEY): $(VERIFY_SIG_SETUP) +# One genkey run produces both files. A plain two-target rule is not +# grouped - under -j make would run genkey twice concurrently and the +# openssl invocations race; the pattern form is implicitly grouped even +# with make < 4.3. +$(BUILD_DIR)/%.pem $(BUILD_DIR)/%.der: $(VERIFY_SIG_SETUP) $(Q)mkdir -p $(BUILD_DIR) $(Q)$(VERIFY_SIG_SETUP) genkey $(BUILD_DIR) -- 2.43.0