Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6018280ybc; Wed, 27 Nov 2019 13:30:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyiwaKlVl2QuZchCiDojZGooFzV+Hq8Yz+KXaLwpqmvYwiYoN2VqA8an7lavHbRNReVFRq/ X-Received: by 2002:a05:6402:184e:: with SMTP id v14mr34350353edy.138.1574890209931; Wed, 27 Nov 2019 13:30:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890209; cv=none; d=google.com; s=arc-20160816; b=WuCyFYLF23NYjeraksOgx63B26VbiuR2PYCdfk3fM2I/HW5Msa69H756F5O51wNMjK D3RY+Zybqm4bA80UIAsDnfViPJ8B4vMs9hRAcCW3KRIDZN2/gLQzjmMOyFVswt+63YEC 214yBWZUUM2Y1WKeeUilXbJbF9nTkCzEeKOZp/iUFnp9A6vmiZHlUKfrjU8S44skfdHf Ax1MY8VK1PV93AbWYZjNT8JbEyNEfdI+neZh1S3NsAND/3QKnpbUZcYPvZH/stnC/TEz WOvi2TChEJsIzW8H3AjFIH3tl0WZfonAXQqrFUULLy+SLq9BMmxsPL7sK0GZBzwx8MNN Pyiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=AU8WPHPcJwgxJBr+X5FwEaImchiySZo1ynMHnH/canY=; b=sSuS0WtkJ1SvA22StzXn9RZ8+JCYgaNxLnuEkhJfGkvmhGNcCtBnZstUQZaQdz0fJ+ w/SFRsRd/roiCph/Qnf4ieP34zixdexpw98f5MjGLbbokJ75sd5VYKe5guJ1AVm0yv5P B1/aZpc3suoKzGZPgpboCggB5ljfz+zFzp0K+C/lJKqEUTiE9sMemQtzn3ZIWr5T9nNg dFzI7rsPUZYkGsBu20uBCCdYL0NMAyQUOBX/EG24ZwsLAPr5xVUEP0y4YNCrjND9U1us 0+6cxnZnBA6LftBzxJ8/V58S20eKmjkNgv1DUdSuXyGQEAtvcX32xcA8cBT5zsiR4cXr DB+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hc4qLWQG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by4si11514644edb.87.2019.11.27.13.29.46; Wed, 27 Nov 2019 13:30:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=Hc4qLWQG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732643AbfK0VZc (ORCPT + 99 others); Wed, 27 Nov 2019 16:25:32 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35907 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729466AbfK0VBn (ORCPT ); Wed, 27 Nov 2019 16:01:43 -0500 Received: by mail-pg1-f196.google.com with SMTP id k13so11602643pgh.3 for ; Wed, 27 Nov 2019 13:01:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=AU8WPHPcJwgxJBr+X5FwEaImchiySZo1ynMHnH/canY=; b=Hc4qLWQGgzdCLdShOcG5ZNTa/yab3KUhfeglShq0i2R4fmTs3ScV3yul6Gnes0iN1k wa9/8P0PcpHA+ovA7kwe+triOy0bT0vqoIviQcLuBfQwHx7+WSJN+2bl52WimqB7cq2r EpTMoES7T2vTdNSV61kd7vvJhAAcvxbaqK0OaDg8N6FqPPagNAUWRgttd/mgWr+MltOZ BBpNi5GjVHuIdyh5ntVVxZuDlJQg5SL00KBW373A5jUJtx7iuuHjAB39sNGsVZJaUKDB AK8UljEf6RpABB1H2XUhG7KlBYdhDUY4wipLYJCe1C7thbSY2HSKnC+YrYTpZhLTq4XU PxHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=AU8WPHPcJwgxJBr+X5FwEaImchiySZo1ynMHnH/canY=; b=Vemw4S+LqwM5zJb0z7+i+Xlin1X1mNE7Y9VROs1NevydzLhQDEUKsMotpRVsQVDtp7 qHwZ0osGUASKEoABIpsdbp6Li/f0ivaUXC/N7NsmwRahMyl5C1CknOHU79gs+ZGwZ9Mr TaJGPeCs/Ftc/+VX6i0U9y4zwWNZnXbLbpXBxQ0m7N5XktKCh5JrxXAkPYOhz3SOCYqY 5jUA+HUIdGirgrEtqH28jjxJYynMJIPeC8gI6CzDHU8+LQfxLhy5p30llGskJlfIcmxx tCi/SKDBV2ozkzFYRTNV6EVV6j0prF4+gGcTeQS3W5Px5RuQn49kuZzETi6XK0Hk5AaQ Y1bw== X-Gm-Message-State: APjAAAVoBFC510fBo7WkzNYZWTo/RKfdDePuTPM7Ilc8DIa2XagEXCu5 P41ItiXoc0MnkqqqCT2zaCv5rg== X-Received: by 2002:aa7:9409:: with SMTP id x9mr49838829pfo.168.1574888502882; Wed, 27 Nov 2019 13:01:42 -0800 (PST) Received: from ?IPv6:2600:1010:b01a:c632:65aa:1159:6a8b:716d? ([2600:1010:b01a:c632:65aa:1159:6a8b:716d]) by smtp.gmail.com with ESMTPSA id s15sm7539145pjp.3.2019.11.27.13.01.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2019 13:01:41 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] lkdtm/bugs: Avoid ifdefs for DOUBLE_FAULT Date: Wed, 27 Nov 2019 13:01:40 -0800 Message-Id: References: <201911271118.FCC2D04F@keescook> Cc: Ingo Molnar , Andy Lutomirski , x86 , linux-kernel@vger.kernel.org In-Reply-To: <201911271118.FCC2D04F@keescook> To: Kees Cook X-Mailer: iPhone Mail (17A878) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 27, 2019, at 11:19 AM, Kees Cook wrote: >=20 > =EF=BB=BFLKDTM test visibility shouldn't change, so remove the ifdefs on > DOUBLE_FAULT and make sure test failure doesn't crash the system. >=20 > Link: https://lore.kernel.org/lkml/20191127184837.GA35982@gmail.com > Fixes: b09511c253e5 ("lkdtm: Add a DOUBLE_FAULT crash type on x86") > Signed-off-by: Kees Cook > --- > applies on top of tip/x86/urgent > --- > drivers/misc/lkdtm/bugs.c | 8 +++++--- > drivers/misc/lkdtm/core.c | 4 +--- > drivers/misc/lkdtm/lkdtm.h | 2 -- > 3 files changed, 6 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c > index a4fdad04809a..22f5293414cc 100644 > --- a/drivers/misc/lkdtm/bugs.c > +++ b/drivers/misc/lkdtm/bugs.c > @@ -342,9 +342,9 @@ void lkdtm_UNSET_SMEP(void) > #endif > } >=20 > -#ifdef CONFIG_X86_32 > void lkdtm_DOUBLE_FAULT(void) > { > +#ifdef CONFIG_X86_32 > /* > * Trigger #DF by setting the stack limit to zero. This clobbers > * a GDT TLS slot, which is okay because the current task will die > @@ -373,6 +373,8 @@ void lkdtm_DOUBLE_FAULT(void) > asm volatile ("movw %0, %%ss; addl $0, (%%esp)" :: > "r" ((unsigned short)(GDT_ENTRY_TLS_MIN << 3))); >=20 > - panic("tried to double fault but didn't die\n"); > -} > + pr_err("FAIL: tried to double fault but didn't die!\n"); > +#else > + pr_err("FAIL: this test is only available on 32-bit x86.\n"); > #endif > +} I=E2=80=99m not familiar with the userspace tooling, but this seems unfortun= ate. The first FAIL is =E2=80=9Cthe test case screwed up, and it=E2=80=99s a= bug.=E2=80=9D The second FAIL is =E2=80=9Cnot applicable to this system.=E2= =80=9D ISTM simply not exposing the test on systems that don=E2=80=99t support make= s sense. Can you clarify?=