linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Michael Ellerman <mpe@ellerman.id.au>, Kees Cook <keescook@chromium.org>
Cc: shuah@kernel.org, luto@amacapital.net, wad@chromium.org,
	daniel@iogearbox.net, kafai@fb.com, yhs@fb.com, andriin@fb.com,
	gregkh@linuxfoundation.org, tglx@linutronix.de,
	khilman@baylibre.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
Date: Wed, 4 Mar 2020 17:29:16 -0700	[thread overview]
Message-ID: <da1b2591-bb19-9dc7-ed5f-cc2481c24f87@linuxfoundation.org> (raw)
In-Reply-To: <87eeu7r6qf.fsf@mpe.ellerman.id.au>

On 3/4/20 5:22 PM, Michael Ellerman wrote:
> Shuah Khan <skhan@linuxfoundation.org> writes:
>> On 3/4/20 3:42 PM, Kees Cook wrote:
>>> On Wed, Mar 04, 2020 at 03:13:33PM -0700, Shuah Khan wrote:
>>>> Fix seccomp relocatable builds. This is a simple fix to use the
>>>> right lib.mk variable TEST_GEN_PROGS for objects to leverage
>>>> lib.mk common framework for relocatable builds.
>>>>
>>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>>> ---
>>>>    tools/testing/selftests/seccomp/Makefile | 16 +++-------------
>>>>    1 file changed, 3 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
>>>> index 1760b3e39730..a8a9717fc1be 100644
>>>> --- a/tools/testing/selftests/seccomp/Makefile
>>>> +++ b/tools/testing/selftests/seccomp/Makefile
>>>> @@ -1,17 +1,7 @@
>>>>    # SPDX-License-Identifier: GPL-2.0
>>>> -all:
>>>> -
>>>> -include ../lib.mk
>>>> -
>>>> -.PHONY: all clean
>>>> -
>>>> -BINARIES := seccomp_bpf seccomp_benchmark
>>>>    CFLAGS += -Wl,-no-as-needed -Wall
>>>> +LDFLAGS += -lpthread
>>>>    
>>>> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
>>>
>>> How is the ../kselftest_harness.h dependency detected in the resulting
>>> build rules?
>>>
>>> Otherwise, looks good.
>>
>> Didn't see any problems. I will look into adding the dependency.
> 
> Before:
> 
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>      INSTALL /home/michael/build/adhoc/kselftest/usr/include
>    gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
>    gcc -Wl,-no-as-needed -Wall    seccomp_benchmark.c   -o seccomp_benchmark
>    
>    $ touch tools/testing/selftests/kselftest_harness.h
>    
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>      INSTALL /home/michael/build/adhoc/kselftest/usr/include
>    gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
>    $
> 
> Note that touching the header causes it to rebuild seccomp_bpf.
> 
> With this patch applied:
> 
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>    gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_bpf.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_bpf
>    gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_benchmark.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_benchmark
>    
>    $ touch tools/testing/selftests/kselftest_harness.h
>    
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>    make[1]: Nothing to be done for 'all'.
>    $
> 
> 

Thanks. I realized I overlooked header dependency case.

> So yeah it still needs:
> 
> seccomp_bpf: ../kselftest_harness.h
> 
> 
Yes v2 coming up. It also has to handle OUTPUT relocation.

thanks,
-- Shuah

  reply	other threads:[~2020-03-05  0:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
2020-03-11 22:58   ` Kevin Hilman
2020-03-11 23:31     ` Shuah Khan
2020-05-15  2:27       ` Randy Dunlap
2020-05-15 14:15         ` Shuah Khan
2020-03-04 22:13 ` [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
2020-03-04 22:42   ` Kees Cook
2020-03-04 23:15     ` Shuah Khan
2020-03-05  0:22       ` Michael Ellerman
2020-03-05  0:29         ` Shuah Khan [this message]
2020-03-04 22:13 ` [PATCH 3/4] selftests: android: ion: Fix ionmap_test compile error Shuah Khan
2020-03-04 22:13 ` [PATCH 4/4] selftests: android: Fix custom install from skipping test progs Shuah Khan
2020-03-04 23:09 ` [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da1b2591-bb19-9dc7-ed5f-cc2481c24f87@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=khilman@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wad@chromium.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).