From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F292C3DA66 for ; Wed, 23 Aug 2023 17:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236387AbjHWR1d (ORCPT ); Wed, 23 Aug 2023 13:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjHWR1c (ORCPT ); Wed, 23 Aug 2023 13:27:32 -0400 Received: from smtp-8fad.mail.infomaniak.ch (smtp-8fad.mail.infomaniak.ch [83.166.143.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9813BE67 for ; Wed, 23 Aug 2023 10:27:28 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4RWCp6446kzMq6M1; Wed, 23 Aug 2023 17:27:26 +0000 (UTC) Received: from unknown by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4RWCp50WRKz3X; Wed, 23 Aug 2023 19:27:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1692811646; bh=dkvxW7AWHKnBaIGfgaNdqXPMIYBWr7XnIRLwQ1vra2M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F3dcaOmF1IAkSAzWsBED07OLpGDNIQx8JRLoQ//DbumeZykZBaQH6WOeUI/Ijkx+1 N8G/6UwbaO3yIR20QHuP8g3KKlIQYaE4zotoom3acxxie+5psNEPDlj/v8Dz9s+1gW nb/sgdGFTKsZLq3bgQg6KuflO/oV7kQAtucarqvA= Date: Wed, 23 Aug 2023 19:27:23 +0200 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Casey Schaufler Cc: paul@paul-moore.com, linux-security-module@vger.kernel.org, jmorris@namei.org, serge@hallyn.com, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v13 11/11] LSM: selftests for Linux Security Module syscalls Message-ID: <20230823.aequ5ahg0Aeb@digikod.net> References: <20230802174435.11928-1-casey@schaufler-ca.com> <20230802174435.11928-12-casey@schaufler-ca.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230802174435.11928-12-casey@schaufler-ca.com> X-Infomaniak-Routing: alpha Precedence: bulk List-ID: On Wed, Aug 02, 2023 at 10:44:34AM -0700, Casey Schaufler wrote: > Add selftests for the three system calls supporting the LSM > infrastructure. This set of tests is limited by the differences > in access policy enforced by the existing security modules. > > Signed-off-by: Casey Schaufler > --- > MAINTAINERS | 1 + > tools/testing/selftests/Makefile | 1 + > tools/testing/selftests/lsm/Makefile | 19 ++ > tools/testing/selftests/lsm/common.c | 81 ++++++ > tools/testing/selftests/lsm/common.h | 33 +++ > tools/testing/selftests/lsm/config | 3 + > .../selftests/lsm/lsm_get_self_attr_test.c | 240 ++++++++++++++++++ > .../selftests/lsm/lsm_list_modules_test.c | 140 ++++++++++ > .../selftests/lsm/lsm_set_self_attr_test.c | 74 ++++++ > 9 files changed, 592 insertions(+) > create mode 100644 tools/testing/selftests/lsm/Makefile > create mode 100644 tools/testing/selftests/lsm/common.c > create mode 100644 tools/testing/selftests/lsm/common.h > create mode 100644 tools/testing/selftests/lsm/config > create mode 100644 tools/testing/selftests/lsm/lsm_get_self_attr_test.c > create mode 100644 tools/testing/selftests/lsm/lsm_list_modules_test.c > create mode 100644 tools/testing/selftests/lsm/lsm_set_self_attr_test.c > diff --git a/tools/testing/selftests/lsm/Makefile b/tools/testing/selftests/lsm/Makefile > new file mode 100644 > index 000000000000..bae6c1e3bba4 > --- /dev/null > +++ b/tools/testing/selftests/lsm/Makefile > @@ -0,0 +1,19 @@ > +# SPDX-License-Identifier: GPL-2.0 > +# > +# First run: make -C ../../../.. headers_install > + > +CFLAGS += -Wall -O2 $(KHDR_INCLUDES) > +LOCAL_HDRS += common.h > + > +TEST_GEN_PROGS := lsm_get_self_attr_test lsm_list_modules_test \ > + lsm_set_self_attr_test You could use the wildcard approach to avoid explicitly listing output files here, but it's not a big deal. > + > +include ../lib.mk > + > +$(TEST_GEN_PROGS): > + > +$(OUTPUT)/lsm_get_self_attr_test: lsm_get_self_attr_test.c common.c > +$(OUTPUT)/lsm_set_self_attr_test: lsm_set_self_attr_test.c common.c > +$(OUTPUT)/lsm_list_modules_test: lsm_list_modules_test.c common.c It would be nice to add /*_test to a .gitignore file > + > +EXTRA_CLEAN = $(OUTPUT)/common.o Anyway, this Makefile works with all kind of test builds (cf. commit a52540522c9541bfa3e499d2edba7bc0ca73a4ca). I'll send another review for this file soon.