LKML Archive on
 help / color / Atom feed
From: Kees Cook <>
To: Shuah Khan <>
Subject: Re: [PATCH v2 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
Date: Thu, 5 Mar 2020 09:42:13 -0800
Message-ID: <202003050937.BA14B70DEB@keescook> (raw)
In-Reply-To: <>

On Thu, Mar 05, 2020 at 09:41:34AM -0700, Shuah Khan wrote:
> On 3/4/20 7:20 PM, Kees Cook wrote:
> > Instead of the TEST_CUSTOM_PROGS+all dance, you can just add an explicit
> > dependency, with the final seccomp/Makefile looking like this:
> > 
> > 
> > # SPDX-License-Identifier: GPL-2.0
> > CFLAGS += -Wl,-no-as-needed -Wall
> > LDFLAGS += -lpthread
> > 
> > TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
> > 
> TEST_CUSTOM_PROGS is for differentiating test programs that
> can't use generic rules. It is appropriate to use
> for seccomp_bpf

I don't follow? This suggested Makefile works for me (i.e. it can use
the generic rules since CFLAGS and LDFLAGS can be customized
first, and it just adds an additional dependency).

> > include ../
> > 
> > # Additional dependencies
> > $(OUTPUT)/seccomp_bpf: ../kselftest_harness.h

BTW, I see a lot of other targets that use kselftest_harness.h appear to
be missing this Makefile dependency, but that's a different problem. :)

> > (Though this fails in the same way as above when run from the top-level
> > directory.)
> > 
> I didn't see this because I have been the same directory I used
> for relocated cross-build kernel. :(
> Thanks for testing this. I know the problem here. all is a dependency
> for install step and $(OUTPUT) is referencing the objdir before it
> gets created. It is a Makefile/ problem to fix.
> I will do a separate patch for this. This will show up in any test
> that is using $(OUTPUT) to relocate objects mainly the ones that
> require custom build rule like seeccomp.

Okay, cool. It looked to me like it lost track of the top level source
directory (i.e. "make: entering $output" ... "can't find

Anyway, I look forward to the next version and I'll get it tested. :)
Thanks for fixing this! I really like having a top-level "make" command
that can extract a single selftest; that's very handy!

Kees Cook

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  0:36 Shuah Khan
2020-03-05  2:20 ` Kees Cook
2020-03-05 16:41   ` Shuah Khan
2020-03-05 17:42     ` Kees Cook [this message]
2020-03-10 23:11       ` 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:

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

  git send-email \
    --in-reply-to=202003050937.BA14B70DEB@keescook \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone