From patchwork Tue Mar 13 10:29:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 885053 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=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 400rjl3LTnz9sTG for ; Tue, 13 Mar 2018 21:31:07 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 86B7C3E770A for ; Tue, 13 Mar 2018 11:31:04 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id DDBA33E6B32 for ; Tue, 13 Mar 2018 11:31:02 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 81FC21000348 for ; Tue, 13 Mar 2018 11:31:01 +0100 (CET) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BDD17ABB4; Tue, 13 Mar 2018 10:31:00 +0000 (UTC) From: Richard Palethorpe To: ltp@lists.linux.it Date: Tue, 13 Mar 2018 11:29:31 +0100 Message-Id: <20180313102931.27897-1-rpalethorpe@suse.com> X-Mailer: git-send-email 2.16.2 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: Richard Palethorpe Subject: [LTP] [PATCH] cve-2015-3290: Handle 16-bit segments being disabled 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" If modify_ldt fails with EINVAL then we can only assume the kernel has 16-bit data segments disabled. Signed-off-by: Richard Palethorpe --- It seems that on SUSE Enterprise 15 we have 16-bit segments disabled by default so the test can not run. testcases/cve/cve-2015-3290.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c index 87c9c956c..dbc2101a7 100644 --- a/testcases/cve/cve-2015-3290.c +++ b/testcases/cve/cve-2015-3290.c @@ -215,8 +215,14 @@ static void set_ldt(void) .useable = 0 }; - if (tst_syscall(__NR_modify_ldt, 1, &data_desc, sizeof(data_desc)) != 0) - tst_brk(TBROK | TERRNO, "modify_ldt"); + TEST(tst_syscall(__NR_modify_ldt, 1, &data_desc, sizeof(data_desc))); + TEST_ERRNO = -(int)TEST_RETURN; + if (TEST_RETURN == -EINVAL) { + tst_brk(TCONF | TTERRNO, + "modify_ldt: 16-bit data segments are probably disabled"); + } else if (TEST_RETURN != 0) { + tst_brk(TBROK | TTERRNO, "modify_ldt"); + } } static void try_corrupt_stack(unsigned short orig_ss) @@ -474,6 +480,8 @@ static void run(void) SAFE_WAITPID(pid, &status, 0); if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) tst_res(TFAIL, "corrupted NMI stack"); + else if (WIFEXITED(status) && WEXITSTATUS(status) != 0) + tst_res(WEXITSTATUS(status), "Propogate child status"); } static struct tst_test test = {