From patchwork Tue Jul 17 08:35:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 944813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41VDB41vVtz9s0n for ; Tue, 17 Jul 2018 18:35:24 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1B9293E7447 for ; Tue, 17 Jul 2018 10:35:21 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id 77E2D3E7426 for ; Tue, 17 Jul 2018 10:35:20 +0200 (CEST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 21966201019 for ; Tue, 17 Jul 2018 10:35:18 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 24D2B77885; Tue, 17 Jul 2018 08:35:17 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94A7A111DD0A; Tue, 17 Jul 2018 08:35:16 +0000 (UTC) From: Jan Stancek To: ltp@lists.linux.it, naresh.kamboju@linaro.org Date: Tue, 17 Jul 2018 10:35:09 +0200 Message-Id: <3d0dd8e851d8db6bae222ca5946419b75df35ba5.1531816427.git.jstancek@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 17 Jul 2018 08:35:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 17 Jul 2018 08:35:17 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jstancek@redhat.com' RCPT:'' X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") fixes problem described in CVE-2018-13405. This commit is getting backported to older streams as well. This patch removes S_ISGID check for files created by non-group members in LTP tests creat08 and open10. Once 0fa3ecd87848 will be in non-rc kernel, we could add a new test for this CVE that would be limited to 4.18+ kernels. Signed-off-by: Jan Stancek Reviewed-by: Naresh Kamboju --- testcases/kernel/syscalls/creat/creat08.c | 13 ++++++------- testcases/kernel/syscalls/open/open10.c | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c index 50f2b39931b8..d22558ac3c53 100644 --- a/testcases/kernel/syscalls/creat/creat08.c +++ b/testcases/kernel/syscalls/creat/creat08.c @@ -361,13 +361,12 @@ int main(int ac, char **av) local_flag = FAILED; } - /* Verify modes */ - if (!(buf.st_mode & S_ISGID)) { - tst_resm(TFAIL, - "%s: Incorrect modes, setgid bit should be set", - setgid_B); - local_flag = FAILED; - } + /* + * Skip S_ISGID check + * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") + * clears S_ISGID for files created by non-group members + */ + close(fd); if (local_flag == PASSED) { diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c index 613f2288fbde..14feec9e127e 100644 --- a/testcases/kernel/syscalls/open/open10.c +++ b/testcases/kernel/syscalls/open/open10.c @@ -345,13 +345,11 @@ int main(int ac, char *av[]) local_flag = FAILED; } - /* Verify modes */ - if (!(buf.st_mode & S_ISGID)) { - tst_resm(TFAIL, - "%s: Incorrect modes, setgid bit not set", - setgid_B); - local_flag = FAILED; - } + /* + * Skip S_ISGID check + * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") + * clears S_ISGID for files created by non-group members + */ if (local_flag == PASSED) { tst_resm(TPASS, "Test passed in block2.");