Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752414AbeAESqM (ORCPT + 1 other); Fri, 5 Jan 2018 13:46:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:45824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752163AbeAESqL (ORCPT ); Fri, 5 Jan 2018 13:46:11 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D31C721928 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org X-Google-Smtp-Source: ACJfBotClTFiajlVbiX/jOaYomaQBzrQWBknnSXOgjtbLvLo2zNluG/VSnWSaLIN4r6t95O1BA3hch9jiTCfYzHbnys= MIME-Version: 1.0 In-Reply-To: <20180105183048.ywi5cccs4ecggwy3@pd.tnic> References: <17c5ebeb2e00879b0af1a9c32bf37ecdd9b9b31b.1515130397.git.luto@kernel.org> <20180105134025.kzmnydmzrnfdokz7@pd.tnic> <20180105183048.ywi5cccs4ecggwy3@pd.tnic> From: Andy Lutomirski Date: Fri, 5 Jan 2018 10:45:49 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] selftests/x86: Add test_vsyscall To: Borislav Petkov Cc: Andy Lutomirski , X86 ML , LKML , Kees Cook , Peter Zijlstra , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, Jan 5, 2018 at 10:30 AM, Borislav Petkov wrote: > On Fri, Jan 05, 2018 at 10:01:23AM -0800, Andy Lutomirski wrote: >> Yes. There are very clever tools like 'pin' that instrument a binary >> by decoding all the instructions it executes and generating an >> instrumented copy. If that binary calls into the vDSO, the vDSO gets >> decoded and instrumented (which works fine). If the binary calls into >> the vsyscall page, it still needs to work. So the vsyscall page >> contains machine code that actually works (even if it's NX) to support >> these tools. The authors and users of the tools yelled loudly in an >> earlier version of the vsyscall emulation code that didn't support >> this use case. > > It rings a bell... > >> The root cause here is that 4.4 is KAISER, not KPTI. The >> kaiser_set_shadow_pgd() function is a steaming pile of shit, and this >> is a known bug in it. > > Tell me about it. > > We found out last night it breaks EFI too, see: > > https://lkml.kernel.org/r/alpine.LRH.2.00.1801051909160.27010@gjva.wvxbf.pm > > To put it mildly, this new PTI et al crap will bring us a lot of fun in > the coming year. I tell ya, a year from now we'll be dealing with the > fallout from this. > >> I have zero desire to hack up some stupid special case in there. For >> the modern KPTI kernels, I rewrote that function entirely to be much >> simpler and much more correct. >> >> It should be straightforward to kludge something up, though, but I'm >> not volunteering. > > Yeah, I think adding _PAGE_RW into the mix should fix it but I need to > give it a try first. > Not _PAGE_RW. Probably _PAGE_USER somewhere in the hierarchy.