lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 406/879] selftests/bpf: Prevent skeleton generation race
    Date
    From: Andrii Nakryiko <andrii@kernel.org>

    [ Upstream commit 1e2666e029e5cc2b81dbd7c85af5bcc8c80524e0 ]

    Prevent "classic" and light skeleton generation rules from stomping on
    each other's toes due to the use of the same <obj>.linked{1,2,3}.o
    naming pattern. There is no coordination and synchronizataion between
    .skel.h and .lskel.h rules, so they can easily overwrite each other's
    intermediate object files, leading to errors like:

    /bin/sh: line 1: 170928 Bus error (core dumped)
    /data/users/andriin/linux/tools/testing/selftests/bpf/tools/sbin/bpftool gen skeleton
    /data/users/andriin/linux/tools/testing/selftests/bpf/test_ksyms_weak.linked3.o
    name test_ksyms_weak
    > /data/users/andriin/linux/tools/testing/selftests/bpf/test_ksyms_weak.skel.h
    make: *** [Makefile:507: /data/users/andriin/linux/tools/testing/selftests/bpf/test_ksyms_weak.skel.h] Error 135
    make: *** Deleting file '/data/users/andriin/linux/tools/testing/selftests/bpf/test_ksyms_weak.skel.h'

    Fix by using different suffix for light skeleton rule.

    Fixes: c48e51c8b07a ("bpf: selftests: Add selftests for module kfunc support")
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20220509004148.1801791-2-andrii@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    tools/testing/selftests/bpf/Makefile | 10 +++++-----
    1 file changed, 5 insertions(+), 5 deletions(-)

    diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
    index 3820608faf57..a15c47d2fa73 100644
    --- a/tools/testing/selftests/bpf/Makefile
    +++ b/tools/testing/selftests/bpf/Makefile
    @@ -415,11 +415,11 @@ $(TRUNNER_BPF_SKELS): %.skel.h: %.o $(BPFTOOL) | $(TRUNNER_OUTPUT)

    $(TRUNNER_BPF_LSKELS): %.lskel.h: %.o $(BPFTOOL) | $(TRUNNER_OUTPUT)
    $$(call msg,GEN-SKEL,$(TRUNNER_BINARY),$$@)
    - $(Q)$$(BPFTOOL) gen object $$(<:.o=.linked1.o) $$<
    - $(Q)$$(BPFTOOL) gen object $$(<:.o=.linked2.o) $$(<:.o=.linked1.o)
    - $(Q)$$(BPFTOOL) gen object $$(<:.o=.linked3.o) $$(<:.o=.linked2.o)
    - $(Q)diff $$(<:.o=.linked2.o) $$(<:.o=.linked3.o)
    - $(Q)$$(BPFTOOL) gen skeleton -L $$(<:.o=.linked3.o) name $$(notdir $$(<:.o=_lskel)) > $$@
    + $(Q)$$(BPFTOOL) gen object $$(<:.o=.llinked1.o) $$<
    + $(Q)$$(BPFTOOL) gen object $$(<:.o=.llinked2.o) $$(<:.o=.llinked1.o)
    + $(Q)$$(BPFTOOL) gen object $$(<:.o=.llinked3.o) $$(<:.o=.llinked2.o)
    + $(Q)diff $$(<:.o=.llinked2.o) $$(<:.o=.llinked3.o)
    + $(Q)$$(BPFTOOL) gen skeleton -L $$(<:.o=.llinked3.o) name $$(notdir $$(<:.o=_lskel)) > $$@

    $(TRUNNER_BPF_SKELS_LINKED): $(TRUNNER_BPF_OBJS) $(BPFTOOL) | $(TRUNNER_OUTPUT)
    $$(call msg,LINK-BPF,$(TRUNNER_BINARY),$$(@:.skel.h=.o))
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-08 02:18    [W:3.544 / U:0.676 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site