Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14134143rwb; Sun, 27 Nov 2022 18:18:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PEiZOANMq/qCdY+ABjHUdrCTjp2Pp0QovxUt7uG54CjgJDOn15e81vqUZeqVCHtJnFK5K X-Received: by 2002:a17:903:40cb:b0:188:7dca:6f4a with SMTP id t11-20020a17090340cb00b001887dca6f4amr29659056pld.60.1669601929356; Sun, 27 Nov 2022 18:18:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669601929; cv=none; d=google.com; s=arc-20160816; b=ayqe6mIKxSvqCWQVQ6nX/6f8cofiLUqt1uD07xmmQB18oA1B8JyzAlVvt5zeXz6Txm F8l1ibTWV77Vh6Ce1E1QyaxTLd12Xa3L23jmtQhFvVEbBCDgFHFhX25B26yfbG3IDKQ2 NwQicasqWcKMqmcSrAS/BH17aVG6KHda69pPbrjOgXkc8ytjByz4YHaQ20M8Toe/aUxU lPdnCUBeYzW4XPaJfEUIuX2HspsTDK4QUMNXcyLUkEZEPS0JlitXM1uyYno67SRKzte4 g/755+hmn59Dg86vi8brIZWwJ0A5ZJq/R0/AWKHXk7AlSDtAbcST1ms67jSi+P40Xk1S siHA== 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 :message-id:date:subject:cc:to:from; bh=Hi/rug8EMdo6fGzOVO6x63AiJOZQ8cDsiHDGbnED+Xg=; b=KPUGc7sSmugpvNUV0/AMGxvPt0FlqxhGmMA8i6kn/Bz3aR+Mju8LQscPn1LaILYTxE nphahIBk0jlhvrkNMCsG5TO1WVYe6cJRBOOcnKk6s0xsBa/eLHgjYT1TC+A3WYEWEMUv mA3mYTDqf2b3J/v4JtPnv0+ixFX5BEr96QJyZThEuGuF4vfdBPtTnjXiiWzQKqWqoTQq f9SvsiObSahCG8eSP4/sCMzo21QCgH4TrGgXGTyJGPRj9fA8kCIOKS8jjp2NM/ljkQm6 zOR3+2bByGlwXnCttivDdTuRWp6sjDtBqDOfjdzksDOsd+yTmxaTEtP/Lk+ITFvEYcvY T+Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a056a000aca00b0055f8c0018b0si10170673pfl.288.2022.11.27.18.18.38; Sun, 27 Nov 2022 18:18:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbiK1CEV (ORCPT + 85 others); Sun, 27 Nov 2022 21:04:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbiK1CES (ORCPT ); Sun, 27 Nov 2022 21:04:18 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6FBAD2F9; Sun, 27 Nov 2022 18:04:17 -0800 (PST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NL7zv0ShszRpQL; Mon, 28 Nov 2022 10:03:39 +0800 (CST) Received: from kwepemm600001.china.huawei.com (7.193.23.3) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 28 Nov 2022 10:04:15 +0800 Received: from localhost.localdomain (10.90.53.65) by kwepemm600001.china.huawei.com (7.193.23.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 28 Nov 2022 10:04:15 +0800 From: limin To: , , , , CC: , , , , , , Subject: [PATCH -next] selftests/landlock: Fix selftest ptrace_test run fail Date: Mon, 28 Nov 2022 10:04:09 +0800 Message-ID: <20221128020409.1545717-1-limin100@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.65] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600001.china.huawei.com (7.193.23.3) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Tests PTRACE_ATTACH and PTRACE_MODE_READ on the parent, trace parent return -1 when child== 0 How to reproduce warning: $ make -C tools/testing/selftests TARGETS=landlock run_tests Signed-off-by: limin --- tools/testing/selftests/landlock/ptrace_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/landlock/ptrace_test.c b/tools/testing/selftests/landlock/ptrace_test.c index c28ef98ff3ac..88c4dc63eea0 100644 --- a/tools/testing/selftests/landlock/ptrace_test.c +++ b/tools/testing/selftests/landlock/ptrace_test.c @@ -267,12 +267,11 @@ TEST_F(hierarchy, trace) /* Tests PTRACE_ATTACH and PTRACE_MODE_READ on the parent. */ err_proc_read = test_ptrace_read(parent); ret = ptrace(PTRACE_ATTACH, parent, NULL, 0); + EXPECT_EQ(-1, ret); + EXPECT_EQ(EPERM, errno); if (variant->domain_child) { - EXPECT_EQ(-1, ret); - EXPECT_EQ(EPERM, errno); EXPECT_EQ(EACCES, err_proc_read); } else { - EXPECT_EQ(0, ret); EXPECT_EQ(0, err_proc_read); } if (ret == 0) { -- 2.33.0