Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5140543yba; Tue, 30 Apr 2019 09:46:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhsXnxLEdK16T93BZwRPpJ3XeCeRsNSVSaeHA21aa65LUZP19m1IOIUmC5CWYBcXSmkdiU X-Received: by 2002:a17:902:e793:: with SMTP id cp19mr65561823plb.65.1556642776444; Tue, 30 Apr 2019 09:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556642776; cv=none; d=google.com; s=arc-20160816; b=sNTsAduS2iOZ6tr3aXGWG5Ik+of+ZTnhtWDbuFUGoDtEatFh/a053e+AQyWkc4uU91 UQVyldhLebIb3lQU0/fKbZtD1NMZWwNisur9PcoueaJMBN+0gPsUxD1MBTOeGMep3iWi QZm8Wc/xtBMYt2hEvvptfdDO92W+E60a2d08UVV4wgXX5EtXqyp45IOMW4+TIkQauRsQ wq32rbY5gPKW7vuxHFZjiMjbVNbj1VRUEuHqNH/6qaLQedtJssWeIWleECbvMhLc+wi2 ZBiTeR/tVfNFjftD3nDH5r59eGFaIpHj4SgHK/u2dBskq4QnQddJB67nPhdW+p1MFuKG XCWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=J1qJxdnx9wSU4R8P+0fGV/kWZnabM/4xN4pzgyRbyRs=; b=o1aO8bg8FgJRUqKMH7nGaxvXyxyndwaPLOBPqh28cktne024GKxGCumPewBcJA77NC pLmbdFazs7sq2/8xTlXD099NbWUmDg08vHKJEkdN7JBAwjs7C6CQWh0+wYdJEUp9AqLY /MMLJt9SGdIUt7Zz9Ma20+WOeESnYDWlShlvYEjr2bjB4hSV3G8pd+yA11qLqO9BqdzE 0JSHNIoBs/xg9gkHzjpk73zvwrcaJJtHn6nyXGo2H9wcNxbDlYhFUClVTwlPwxk3u1oO sL6C3e4Cifa829j3Dw+mfIi6xk7MznKgYT3OVFRD8RU60hQnhnRDcgDBQX6ZT4ya/TuH n57w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0Cwgl455; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n85si21260442pfi.288.2019.04.30.09.45.59; Tue, 30 Apr 2019 09:46:16 -0700 (PDT) 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=@kernel.org header.s=default header.b=0Cwgl455; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726451AbfD3QoX (ORCPT + 99 others); Tue, 30 Apr 2019 12:44:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726115AbfD3QoX (ORCPT ); Tue, 30 Apr 2019 12:44:23 -0400 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F063C21841 for ; Tue, 30 Apr 2019 16:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556642662; bh=X+93M0oEsG72OeT0c4AH+IZFAW8t4zob5MBGfr+nR9E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=0Cwgl455POKYMyoluPcjKgBdy7MMFfOBK6PhZ3vnyEg4hzP6tOhml4qkU7KTNKmik 4VEYMrW936vYFJxKyXvtLznG+d7qY7wXLGmlS8zYEz+zTbTOHnlvichZVCogwT8K2S a0CWqzM+0emJWwLc4qdt1sFhXsGIjcES73x5topM= Received: by mail-wr1-f53.google.com with SMTP id r7so2078171wrr.13 for ; Tue, 30 Apr 2019 09:44:21 -0700 (PDT) X-Gm-Message-State: APjAAAVrP9Q7rMZvrZHs/ZTCmAqLvjL6KsmY4k68hCuHoHrr1CRN2Mae Id2e4oDF3twt4wJ8Xsab1y4bM6lfCxQIvxvLzcMQKw== X-Received: by 2002:a5d:424e:: with SMTP id s14mr22195947wrr.77.1556642660479; Tue, 30 Apr 2019 09:44:20 -0700 (PDT) MIME-Version: 1.0 References: <1556228754-12996-1-git-send-email-rppt@linux.ibm.com> <1556228754-12996-6-git-send-email-rppt@linux.ibm.com> <20190426074223.GY4038@hirez.programming.kicks-ass.net> <20190428054711.GD14896@rapoport-lnx> In-Reply-To: <20190428054711.GD14896@rapoport-lnx> From: Andy Lutomirski Date: Tue, 30 Apr 2019 09:44:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 5/7] x86/mm/fault: hook up SCI verification To: Mike Rapoport Cc: Peter Zijlstra , LKML , Alexandre Chartre , Andy Lutomirski , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , James Bottomley , Jonathan Adams , Kees Cook , Paul Turner , Thomas Gleixner , Linux-MM , LSM List , X86 ML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 27, 2019 at 10:47 PM Mike Rapoport wrote: > > On Fri, Apr 26, 2019 at 09:42:23AM +0200, Peter Zijlstra wrote: > > On Fri, Apr 26, 2019 at 12:45:52AM +0300, Mike Rapoport wrote: > > > If a system call runs in isolated context, it's accesses to kernel code and > > > data will be verified by SCI susbsytem. > > > > > > Signed-off-by: Mike Rapoport > > > --- > > > arch/x86/mm/fault.c | 28 ++++++++++++++++++++++++++++ > > > 1 file changed, 28 insertions(+) > > > > There's a distinct lack of touching do_double_fault(). It appears to me > > that you'll instantly trigger #DF when you #PF, because the #PF handler > > itself will not be able to run. > > The #PF handler is able to run. On interrupt/error entry the cr3 is > switched to the full kernel page tables, pretty much like PTI does for > user <-> kernel transitions. It's in the patch 3. > > PeterZ meant page_fault, not do_page_fault. In your patch, page_fault and some of error_entry run before that magic switchover happens. If they're not in the page tables, you double-fault. And don't even try to do SCI magic in the double-fault handler. As I understand it, the SDM and APM aren't kidding when they say that #DF is an abort, not a fault. There is a single case in the kernel where we recover from #DF, and it was vetted by microcode people.