From patchwork Tue Mar 13 15:24:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Palethorpe X-Patchwork-Id: 885174 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 400zDx5TjKz9s9l for ; Wed, 14 Mar 2018 02:25:05 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2A3583E773B for ; Tue, 13 Mar 2018 16:25:03 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 694B03E6B32 for ; Tue, 13 Mar 2018 16:25:01 +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-3.smtp.seeweb.it (Postfix) with ESMTPS id 5874C1A008B9 for ; Tue, 13 Mar 2018 16:25:00 +0100 (CET) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CA183AC92; Tue, 13 Mar 2018 15:24:59 +0000 (UTC) From: Richard Palethorpe To: ltp@lists.linux.it Date: Tue, 13 Mar 2018 16:24:48 +0100 Message-Id: <20180313152448.7480-2-rpalethorpe@suse.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313105541.GB14611@rei> References: <20180313105541.GB14611@rei> X-Virus-Scanned: clamav-milter 0.99.2 at in-3.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-3.smtp.seeweb.it Cc: Richard Palethorpe Subject: [LTP] [PATCH v2 2/2] 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 --- testcases/cve/cve-2015-3290.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c index 87c9c956c..631702e2e 100644 --- a/testcases/cve/cve-2015-3290.c +++ b/testcases/cve/cve-2015-3290.c @@ -215,8 +215,13 @@ 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))); + if (TEST_RETURN == -EINVAL) { + tst_brk(TCONF | TRERRNO, + "modify_ldt: 16-bit data segments are probably disabled"); + } else if (TEST_RETURN != 0) { + tst_brk(TBROK | TRERRNO, "modify_ldt"); + } } static void try_corrupt_stack(unsigned short orig_ss) @@ -474,6 +479,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 = {