Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6086591imm; Wed, 27 Jun 2018 01:52:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIZbjXDhYbMdEk1ju+ts0L6ZddOaMqfrveghVWQBeq8TRcpG12rI2zUP84z0r9KroLs0hvv X-Received: by 2002:a17:902:7e08:: with SMTP id b8-v6mr5226366plm.230.1530089557773; Wed, 27 Jun 2018 01:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530089557; cv=none; d=google.com; s=arc-20160816; b=sp02GaUG6rCK8UoW39WfDmnWdi6P499MsWK/ULD1KmX0ZXEapA3oR8NmrKNCii4vG0 3gNouY1+u4YZ8NI8KnsT4p0rQfsNY6cF54eHALiWTxE0wPkphB1PoG2pTa3Qk7hRerFh zieBhajQxZT35x/kT4IDID+l2AaJiiwcOscDtaBCXeFJPu/1cb3m6uXS+IM2AZAWMpsW aE5nRUUKsBEMb0QuSLZdMoQ9efxem9CalqalGyRhlzf4qVFN7QJUfD2zwVeN+MfCUMI8 Vj+OwKyMTOe8YliRJBYCpn0fVcDrN4FPSqwA4lQZG555DXLpqIyLPVIAV7zPzXc6SDq2 Rv7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=JedqM9/y1sfiQl+R0OegUQXf9DlVhJGVDmGzYH8ay54=; b=e37Ph0frzhxGKyDVZVYm5Qmm6q1nut7Ak+ya7XXM5rngtMIVIRk4LE5JXEIfEH5tRu t4RKQtiQL+3JZUAGuR/hiJ9BnaSh/66t/8c4CoeE+ZXoenZNhZOnsL0PvIutQtz1xrIz LjbehM1YXRf/oLl54o72Qx7WixUZVhJ1ATV8RytsRvtsS4MxD6umhOYIiEwSilwQcw7i edLiOnHnidihQBgeWLh49I+ghJR7HSIbUTp65HpqAfQ/x+rAvysHdjzYm6nXUQujTDBd kSC2fdE/8EXgPzI0/mASIC5HHTgfgGJpX3dVJSMjl7chVzjEWAfXEMMjaVqar/xrArVB 1aeQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24-v6si3576346pfk.276.2018.06.27.01.52.20; Wed, 27 Jun 2018 01:52:37 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933710AbeF0IvO (ORCPT + 99 others); Wed, 27 Jun 2018 04:51:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:9536 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933470AbeF0IvL (ORCPT ); Wed, 27 Jun 2018 04:51:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2018 01:51:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,278,1526367600"; d="scan'208";a="241028109" Received: from keunhyun-mobl1.amr.corp.intel.com (HELO [192.168.4.139]) ([10.255.29.56]) by fmsmga006.fm.intel.com with ESMTP; 27 Jun 2018 01:51:09 -0700 Subject: Re: [PATCH] x86/entry/64/compat: Fix "x86/entry/64/compat: Preserve r8-r11 in int $0x80" To: Andy Lutomirski , x86@kernel.org, LKML Cc: Borislav Petkov , stable@vger.kernel.org References: <6012b922485401bc42676e804171ded262fc2ef2.1530078306.git.luto@kernel.org> From: Li Zhijian Message-ID: <3554c7ba-d7d2-4255-cc10-4bfa45b4952d@intel.com> Date: Wed, 27 Jun 2018 16:51:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <6012b922485401bc42676e804171ded262fc2ef2.1530078306.git.luto@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/27/2018 1:45 PM, Andy Lutomirski wrote: > Commit 8bb2610bc496 ("x86/entry/64/compat: Preserve r8-r11 in int > $0x80") was busted. My original patch had a minor conflict with > some of the nospec changes. git apply is very clever and silently > accepted the patch by making the same changes to a different > function in the same file. There was obviously a huge offset, but > git apply for some reason doesn't feel any need to say so. > > Move the changes to the correct function. Now the > test_syscall_vdso_32 selftests passes. > > If anyone cares to observe the original problem, try applying the > patch at > https://lore.kernel.org/lkml/d4c4d9985fbe64f8c9e19291886453914b48caee.1523975710.git.luto@kernel.org/raw > to the kernel at 316d097c4cd4e7f2ef50c40cff2db266593c4ec4. git am and > git apply accept the patch without any complaints at all. patch -p1 > at least prints out a message about the huge offset. > > Reported-by: zhijianx.li@intel.com > Fixes: 8bb2610bc496 ("x86/entry/64/compat: Preserve r8-r11 in int $0x80") > Cc: stable@vger.kernel.org > Signed-off-by: Andy Lutomirski Tested-by: Li Zhijian > --- > arch/x86/entry/entry_64_compat.S | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S > index 9de7f1e1dede..7d0df78db727 100644 > --- a/arch/x86/entry/entry_64_compat.S > +++ b/arch/x86/entry/entry_64_compat.S > @@ -84,13 +84,13 @@ ENTRY(entry_SYSENTER_compat) > pushq %rdx /* pt_regs->dx */ > pushq %rcx /* pt_regs->cx */ > pushq $-ENOSYS /* pt_regs->ax */ > - pushq %r8 /* pt_regs->r8 */ > + pushq $0 /* pt_regs->r8 = 0 */ > xorl %r8d, %r8d /* nospec r8 */ > - pushq %r9 /* pt_regs->r9 */ > + pushq $0 /* pt_regs->r9 = 0 */ > xorl %r9d, %r9d /* nospec r9 */ > - pushq %r10 /* pt_regs->r10 */ > + pushq $0 /* pt_regs->r10 = 0 */ > xorl %r10d, %r10d /* nospec r10 */ > - pushq %r11 /* pt_regs->r11 */ > + pushq $0 /* pt_regs->r11 = 0 */ > xorl %r11d, %r11d /* nospec r11 */ > pushq %rbx /* pt_regs->rbx */ > xorl %ebx, %ebx /* nospec rbx */ > @@ -374,13 +374,13 @@ ENTRY(entry_INT80_compat) > pushq %rcx /* pt_regs->cx */ > xorl %ecx, %ecx /* nospec cx */ > pushq $-ENOSYS /* pt_regs->ax */ > - pushq $0 /* pt_regs->r8 = 0 */ > + pushq %r8 /* pt_regs->r8 */ > xorl %r8d, %r8d /* nospec r8 */ > - pushq $0 /* pt_regs->r9 = 0 */ > + pushq %r9 /* pt_regs->r9 */ > xorl %r9d, %r9d /* nospec r9 */ > - pushq $0 /* pt_regs->r10 = 0 */ > + pushq %r10 /* pt_regs->r10*/ > xorl %r10d, %r10d /* nospec r10 */ > - pushq $0 /* pt_regs->r11 = 0 */ > + pushq %r11 /* pt_regs->r11 */ > xorl %r11d, %r11d /* nospec r11 */ > pushq %rbx /* pt_regs->rbx */ > xorl %ebx, %ebx /* nospec rbx */