Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4589361iob; Sun, 8 May 2022 18:24:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFVRzdE202DNPK4SU3ap/R5JZs3vV+/n0fYbKM5UmgHAe8nQbeejGYkVF7Q4jamSWZN6/j X-Received: by 2002:a63:1406:0:b0:3c1:d946:4dae with SMTP id u6-20020a631406000000b003c1d9464daemr11298309pgl.362.1652059487644; Sun, 08 May 2022 18:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652059487; cv=none; d=google.com; s=arc-20160816; b=IzRjag8eAW4Fr2JLfaFk59iKp0MWxdGU6SZ356HvKtArXCmxN6rLGXPq0bCqPuFYVg t8YnCS0FJLyGajiLzpIVaAkbNVBB1t4Fmvuk6AbpFVNyXPwNE8RiShfYDvpFntGaQXnB YayRJfdrn0TeFZIbD2aJfpdZrPmjRNa60p1xqYudzaDBycXLBJmWQH4cex4Btj/RObPa Ndjvzjn1T5fwkLygK1HgOGM0VZHyoSse+XFC/8TQRxkbcowloRIQ46uxeGmsJqAnkGFc 3W12LRDBCnvcktFBUT6a6abEXCyhhMqfgwfW1IkuU4mrPsYEe7eeemw+iN7HByxGDs/L MieQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cfjBpPSTKD0mxIJlaH4E/HbfRgCKLgkoD1yBnSwV+wo=; b=uYA5aAJbNpmPAv6bA5CC39Sc2w76oRHGsqT2acqtMucaTTaMWEWhycbTnOudh7mz6J KnrPBQy9uJt1NynghAEgiWEZteho/LfiLqQbltiuS/1NbUprYSLv6ic1Wn0RLPzRfxjc BKH7lc7lLcxJ8/4zpkohhspPAmZBaTBOP4EW3G8drVRPIlR7HxiTGQdKF9jm4aYALvPj 7XGpyQzXBMffxi391C8cQKtkZ79n/4OhNkszKS5+WW6cRDGIKy+ICGcuqYuOkUEW4yDD NarVes37sHxVh41xQo3fv6PKGLRbbtph/CpC31Xw3T0r4f7gdHt3VJ8OFLnvmcyomkQk R9Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=Os1dbOKV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l18-20020a170903121200b001567b004ecdsi11015898plh.551.2022.05.08.18.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 18:24:47 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=Os1dbOKV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C892C13E36; Sun, 8 May 2022 18:24:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443470AbiEFQKx (ORCPT + 99 others); Fri, 6 May 2022 12:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443436AbiEFQKs (ORCPT ); Fri, 6 May 2022 12:10:48 -0400 Received: from smtp-bc0d.mail.infomaniak.ch (smtp-bc0d.mail.infomaniak.ch [45.157.188.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D885517F8 for ; Fri, 6 May 2022 09:07:00 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4KvwS34MJqzMqwSp; Fri, 6 May 2022 18:06:59 +0200 (CEST) Received: from localhost (unknown [23.97.221.149]) by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4KvwS32l31zlhMBg; Fri, 6 May 2022 18:06:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1651853219; bh=vG2/gV61tHlvAQI7l0YN0fWRhamXraC0NU13ogkNew8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Os1dbOKVHJH6OgKRepFmxVJILBwJPunGoO4Sy2WNKH97mrfPsTIEzcFH0Mjwxim/b ksMkkR91Slkhru/HYTxEEQsa4Jjkfq4yjv1XJf+malOmArZ5xsgrEzb7hzs5Ytbyzy wQ+jzsaT8LzH9u2AffxJbHLUdk/e4veUFpIHyEB8= From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: James Morris , "Serge E . Hallyn" Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Jann Horn , Kees Cook , Konstantin Meskhidze , Nathan Chancellor , Nick Desaulniers , Paul Moore , Shuah Khan , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v2 03/10] selftests/landlock: Extend tests for minimal valid attribute size Date: Fri, 6 May 2022 18:08:13 +0200 Message-Id: <20220506160820.524344-4-mic@digikod.net> In-Reply-To: <20220506160820.524344-1-mic@digikod.net> References: <20220506160820.524344-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This might be useful when the struct landlock_ruleset_attr will get more fields. Cc: Shuah Khan Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220506160820.524344-4-mic@digikod.net --- Changes since v1: * Format with clang-format and rebase. --- tools/testing/selftests/landlock/base_test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/landlock/base_test.c b/tools/testing/selftests/landlock/base_test.c index 3faeae4233a4..be9b937256ac 100644 --- a/tools/testing/selftests/landlock/base_test.c +++ b/tools/testing/selftests/landlock/base_test.c @@ -35,6 +35,8 @@ TEST(inconsistent_attr) ASSERT_EQ(EINVAL, errno); ASSERT_EQ(-1, landlock_create_ruleset(ruleset_attr, 1, 0)); ASSERT_EQ(EINVAL, errno); + ASSERT_EQ(-1, landlock_create_ruleset(ruleset_attr, 7, 0)); + ASSERT_EQ(EINVAL, errno); ASSERT_EQ(-1, landlock_create_ruleset(NULL, 1, 0)); /* The size if less than sizeof(struct landlock_attr_enforce). */ @@ -47,6 +49,9 @@ TEST(inconsistent_attr) ASSERT_EQ(-1, landlock_create_ruleset(ruleset_attr, page_size + 1, 0)); ASSERT_EQ(E2BIG, errno); + /* Checks minimal valid attribute size. */ + ASSERT_EQ(-1, landlock_create_ruleset(ruleset_attr, 8, 0)); + ASSERT_EQ(ENOMSG, errno); ASSERT_EQ(-1, landlock_create_ruleset( ruleset_attr, sizeof(struct landlock_ruleset_attr), 0)); -- 2.35.1