Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9333704ybi; Wed, 24 Jul 2019 02:17:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZONte/v2F5oal5P+cHevsHiJdFcFAvbnAkLhh7K9DToJTotZEWEhEDsUB0eYqSWS+s6Dh X-Received: by 2002:a17:90a:a116:: with SMTP id s22mr86096893pjp.47.1563959840203; Wed, 24 Jul 2019 02:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563959840; cv=none; d=google.com; s=arc-20160816; b=rD/HNZhPnwolBeEnwnI8tp0gRB9v/l7Q2M89PM+akbgp72PVqm9qOlnv0lKHf/uSw4 w7/QaTTPj/YwDJ99QUMho9ncJuC1lSXs4Aa+ga0p5+rp2rNV3dwlhHAtxHc3lcvzsHwx 0VIyPkScoGP3nduZJcXQbT0R8nWc7Pxwea04KeSSN6hlpl7qTaXJDMy7LYdgkKzjuPQS Wmt+f3Sbb96ieNR8sGUr83iZiLhc40RsmKsTdYEibKMsLwMdUB+dk41RMGWt2cfAVaUV wHWEtU0Ffy9P1cyG7xUzBOfvsuHVx1nWE2S/BgVYwbW89Qen/ibfeW8OljfP9ck4PeHC +pdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P++G4+Hz0arFZYzGJZ+QG+qM4QDwhDQLrMwzJGHEyZY=; b=qfguVjVmMESc5JkCHFVXeQaOTIL5BzzYC/iyq+HHBWw07hIu3byvX79bpka6o9DtOf IZxHMjtJq6v6dZtSsYh3HX0QCol62IotYoMrGQwkJ3Bd4PqLbnLw9egemZ/EV+ZssxbH ROo6O9IspEP/7sHirlXe2iXu4OraFCwu+GwIa7wb3tE+Bq9m0hZ7M/Gs5/LyxS9MudIz DXp2a3cmaR7kk37fSAzfpTPYBkWf9YtZxZNGsTIg70YP4aBz1z1boHelit0gh/2YTDT5 1u3k7Kxe/ooO6ztzyfNLuvmynojQCsUgs4Z8K5kFCh7/RADED/LItR04MQRg0PT30GEz GDJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=1KdCWzgW; 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 o12si13595431pgn.390.2019.07.24.02.17.05; Wed, 24 Jul 2019 02:17:20 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=1KdCWzgW; 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 S1726623AbfGXJOw (ORCPT + 99 others); Wed, 24 Jul 2019 05:14:52 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54470 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfGXJOv (ORCPT ); Wed, 24 Jul 2019 05:14:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=P++G4+Hz0arFZYzGJZ+QG+qM4QDwhDQLrMwzJGHEyZY=; b=1KdCWzgWulsi3IBfsv8jy595R UnfpIx6ZkNH9rlSBcB58f9EF+iJWUNNlBHNjhPicufGaKuSiY3OZ8qOsZc/gG16Te0vdGfgekq6bA 0B1uNi/kz54qv4lyCbT4mf86DPKjYL/4VmajslrhokpXeVSk5jhJg4WWzp1PP5hz9ve652vBzbH8d l2JNIK8PYNS18RRKGQyYvldlJIZ2KeGynlog5CyHfN0e0J7vRqMyWbkLf0Ia5N8TXe6UF24yho92Y wpjggEX0hse6nHFUzkTYW+VjfU+tAgJIEiH5IutTfaIe9PKtji61OgfqGyL67pcjqcaQmnO1oijkP +dfhO7VQQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hqDM9-0002Oq-I3; Wed, 24 Jul 2019 09:14:41 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DE02F2026E807; Wed, 24 Jul 2019 11:14:38 +0200 (CEST) Date: Wed, 24 Jul 2019 11:14:38 +0200 From: Peter Zijlstra To: Matt Mullins Cc: tglx@linutronix.de, luto@kernel.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/entry/32: pass cr2 to do_async_page_fault Message-ID: <20190724091438.GA31363@hirez.programming.kicks-ass.net> References: <20190724042058.24506-1-mmullins@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724042058.24506-1-mmullins@fb.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 23, 2019 at 09:20:58PM -0700, Matt Mullins wrote: > Commit a0d14b8909de ("x86/mm, tracing: Fix CR2 corruption") added the > address parameter to do_async_page_fault, but does not pass it from the > 32-bit entry point. To plumb it through, factor-out > common_exception_read_cr2 in the same fashion as common_exception, and > uses it from both page_fault and async_page_fault. > > For a 32-bit KVM guest, this fixes: > > [ 1.148669][ T1] Run /sbin/init as init process > [ 1.153328][ T1] Starting init: /sbin/init exists but couldn't execute it (error -14) > > Fixes: a0d14b8909de ("x86/mm, tracing: Fix CR2 corruption") > Signed-off-by: Matt Mullins Argh. Sorry for overlooking that one. Acked-by: Peter Zijlstra (Intel) There's some potential for sharing between common_exception and your common_exception_read_cr2, I'll see if I can do that without making a mess of it. Also; FB uses 32bit guests?!? > --- > arch/x86/entry/entry_32.S | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S > index 2bb986f305ac..4f86928246e7 100644 > --- a/arch/x86/entry/entry_32.S > +++ b/arch/x86/entry/entry_32.S > @@ -1443,8 +1443,12 @@ BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR, > > ENTRY(page_fault) > ASM_CLAC > - pushl $0; /* %gs's slot on the stack */ > + pushl $do_page_fault > + jmp common_exception_read_cr2 > +END(page_fault) > > +common_exception_read_cr2: > + /* the function address is in %gs's slot on the stack */ > SAVE_ALL switch_stacks=1 skip_gs=1 > > ENCODE_FRAME_POINTER > @@ -1452,6 +1456,7 @@ ENTRY(page_fault) > > /* fixup %gs */ > GS_TO_REG %ecx > + movl PT_GS(%esp), %edi > REG_TO_PTGS %ecx > SET_KERNEL_GS %ecx > > @@ -1463,9 +1468,9 @@ ENTRY(page_fault) > > TRACE_IRQS_OFF > movl %esp, %eax # pt_regs pointer > - call do_page_fault > + CALL_NOSPEC %edi > jmp ret_from_exception > -END(page_fault) > +END(common_exception_read_cr2) > > common_exception: > /* the function address is in %gs's slot on the stack */ > @@ -1595,7 +1600,7 @@ END(general_protection) > ENTRY(async_page_fault) > ASM_CLAC > pushl $do_async_page_fault > - jmp common_exception > + jmp common_exception_read_cr2 > END(async_page_fault) > #endif > > -- > 2.17.1 >