Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9077794ybi; Tue, 23 Jul 2019 21:22:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPutTCuDSBX3NQeszY90Mmqyk7SPzjx2aRRn2oAucxLacq9hBYPphhwr/jtSsLtDsZlOY+ X-Received: by 2002:a63:3112:: with SMTP id x18mr79482130pgx.385.1563942176949; Tue, 23 Jul 2019 21:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563942176; cv=none; d=google.com; s=arc-20160816; b=i3CohfYn5SMShivLd3E4+PhSoP4mKdCJtovcz3Gi6eUYqlu9Bz6LsXLbCTYrgwNB1X jyKpVdgCkKYNXWsJBrwoPXtps8rMjjWGl6HjhCHkUVCC3WAEQRzijd0kR74ufSH1/9JG YNaSqcYKnBBWKElCiE79m+rE+KLWg9RvJdQrfh5mU3QPLGSJximiVnRY5eqZWQq1uNET NuNGuZlLeMCj+L58BnawZ77xAwIiAdk9qGxngU8MmbJuRXMmGT6yocWsInVvWR0MsKMn e//2c//vEmj2Ke9ailImrYgcosV5j/8OdqMy8K9HKFkmvdVorsxyxNTzSH8DPE5VwLfF SfAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Wk97K/FpChliCnAWp8qRZILMqltAYsa7445Kk2ubOFc=; b=0aVjq9HGpymIgYlOqhl6wp2WI8COUOI576aK/j1FIfXhSWgihcx15cg9Dgmy9r9kQa wS2CQobwPf2dwnfHnYBT8t8wdBQOctxByUyT3VogcVf3Av9PnUL5yXpSy0riTwfV+WOx 9veuZKKhlEKqvOKrMcPk8LHKwRmE2LI9CGhuFrraA0nScz6P5jP4KaL7NRDcewB3UhJ0 rFZdK6EjIf6elT9ekSIPFQgmdXHqo2HhMLkOjnguTULbGlMicPHGQFIrAhUIuiPAn0lU KCTNDvvRcP/ptoSaZhi3rr2G9Am+rRNs2kkgN+J3Gn7mpAWJ8/BlKo9mufUPmoQV/MsU xRQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Qp5hsXLH; 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=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si7377537pgl.318.2019.07.23.21.22.41; Tue, 23 Jul 2019 21:22:56 -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=@fb.com header.s=facebook header.b=Qp5hsXLH; 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=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726000AbfGXEVh (ORCPT + 99 others); Wed, 24 Jul 2019 00:21:37 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:46678 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbfGXEVh (ORCPT ); Wed, 24 Jul 2019 00:21:37 -0400 Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6O4IdnS005481; Tue, 23 Jul 2019 21:21:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=Wk97K/FpChliCnAWp8qRZILMqltAYsa7445Kk2ubOFc=; b=Qp5hsXLHFO/7Gcsdvw0Aylf/mR/ycl7N028073VKfsUN4vgdj+acnXLV2TRGzwcgTSip mTbYccW78UeHQ1x8PgUHZwwjg7V+h2hFFXTZYCYWRqf960+rIFjf0EfN1P/V3/Rm3s62 +aIJ+FOW9VuPuq0cV13s8wLtG/AWlgOGHGI= Received: from mail.thefacebook.com (mailout.thefacebook.com [199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2tx621ja2h-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 23 Jul 2019 21:21:12 -0700 Received: from mmullins-1.thefacebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::128) with Microsoft SMTP Server id 15.1.1713.5; Tue, 23 Jul 2019 21:21:10 -0700 From: Matt Mullins To: , , CC: Matt Mullins , Ingo Molnar , "Borislav Petkov" , "H. Peter Anvin" , , Subject: [PATCH] x86/entry/32: pass cr2 to do_async_page_fault Date: Tue, 23 Jul 2019 21:20:58 -0700 Message-ID: <20190724042058.24506-1-mmullins@fb.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c081:10::13] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-24_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1907240047 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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