Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp329505imp; Thu, 21 Feb 2019 02:16:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IZAhtv2uDXTorOrMfzp/hg8vNOlIsOWMMYvrb+hNzXl6MfAZ56QgcyNHKyThoXfOarf9CCj X-Received: by 2002:aa7:8150:: with SMTP id d16mr16769588pfn.172.1550744181426; Thu, 21 Feb 2019 02:16:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550744181; cv=none; d=google.com; s=arc-20160816; b=jm4zP866gfTMa/rCPIDvzRJmuuRQIp5Hpde2brlP7LuWtp7FYqjGkxBUZv55kP5Y4k 8zU0c6mfA6Jt8LtI0dm0usabCrr7dZ27Vm+bfM1Q+6VeJGBsAc+f0UROp+qc86K10FUu GfYBSxe2Gj75UUGlQ43meHsB2CoYpNBX+udTe0DGbxIBIwryHzXJ/nTmiCrU49CtYpmk mltRX9wPrzDMR5+7/TfcAVyos1bLeAa9uh2+wtAr4oOnrMoLmf63uiJTkGgj1vmZBdiR 0CWCZQQg4jbbLeTV1Vtnd+iJ99cHdyjoP2/Qw06UsT/KVIYPvLNzQyIV4S+Tcf6KFgy4 XYJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:organization:from:cc :references:to:subject:dkim-signature; bh=of+UOoaufvXAOYEMPoQhjJN0bDeiXnBVjiQpxPz1tSI=; b=F7/Cqx2wefnxETa1O4gY6EcLwU1JWkcgqGq/5UruobnhwC3F2fe3g0ALXPIsrF1U1h HhcV9znXFydUXOVvVzqy4xmrA5dGadHcYrI8CTJ84ygQa/T3ke0yxLqZfXPwu5srR8Pl 08ElZmahPjBmBdd8K0nTkTJWp6o4pmixC/GHYeVErTZfF4WCOPtZOuJAYhRfxsKkwy/D RBHQjUv2HztWJSNkzJOJ4umH2yCLGcFoklsCAXt2GJgGjwiMnvevoqfzKDMRaJp3sZRM 9NvWkII1u634Qb900r7/ylvjQa5OZXPJtFmc1G4FUY8+iyZgIIQyJbUlkZR7jZQWUoXw fxog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=E0t53ipZ; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si13064649plk.85.2019.02.21.02.16.05; Thu, 21 Feb 2019 02:16:21 -0800 (PST) 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=@oracle.com header.s=corp-2018-07-02 header.b=E0t53ipZ; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbfBUKP0 (ORCPT + 99 others); Thu, 21 Feb 2019 05:15:26 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41708 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbfBUKP0 (ORCPT ); Thu, 21 Feb 2019 05:15:26 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1LADmo1147039; Thu, 21 Feb 2019 10:15:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=of+UOoaufvXAOYEMPoQhjJN0bDeiXnBVjiQpxPz1tSI=; b=E0t53ipZYC4p2XaH4RDQNe60ZrjpjMVHnMYAhebi+915vle7WKoSjvlZRZkVgNtPefRZ 7yQHp8Lj36bgyqcw7yimFy+iu2cOeYORZAJUHejfjVIx7G0PM3X+Z2Jo0SsXIIMOVrPQ AuKaACHvgqLrx79uX+5nbxPAqlFcYOFbORMXHjgt3ooIjtECQ7AJ6RhtcyCbNlaUMN8I 6Wapnv+01FeRpqR4iTVuauw7njcdwbglu/s6xaSs4zeP2HVqtuab/whlfZug4qem6eey RixZ1008Lnk86AKm8HZlXXHD5KN/t4Cfc6K+mRDrq0FOCP3/Iw+NJfqK8BgCkQh9UoHy Zw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qp81ef6ck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Feb 2019 10:15:01 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x1LAF0OL014963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Feb 2019 10:15:01 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1LAExPT005413; Thu, 21 Feb 2019 10:14:59 GMT Received: from [10.166.106.34] (/10.166.106.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Feb 2019 02:14:58 -0800 Subject: Re: [PATCH] x86/alternatives: check int3 breakpoint physical addresses To: Thomas Gleixner References: <1548428249-8258-1-git-send-email-alexandre.chartre@oracle.com> <8995b3b4-b805-c8c7-95a8-a39ab000f289@oracle.com> <771b5877-4cb6-203b-fd95-ed63f9736373@oracle.com> Cc: LKML , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Josh Poimboeuf , x86@kernel.org, Peter Zijlstra From: Alexandre Chartre Organization: Oracle Corporation Message-ID: <8a5996a0-9f0c-3bcd-c2fb-8a554fa4c765@oracle.com> Date: Thu, 21 Feb 2019 11:14:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <771b5877-4cb6-203b-fd95-ed63f9736373@oracle.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9173 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902210076 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/11/2019 10:57 AM, Alexandre Chartre wrote: > > On 02/11/2019 10:15 AM, Thomas Gleixner wrote: >> On Mon, 11 Feb 2019, Alexandre Chartre wrote: >>> On 02/10/2019 10:23 PM, Thomas Gleixner wrote: >>>> On Fri, 25 Jan 2019, Alexandre Chartre wrote: >>>>> Note that this issue has been observed and reproduced with a custom kernel >>>>> with some code mapped to different virtual addresses and using jump labels >>>>> As jump labels use text_poke_bp(), crashes were sometimes observed when >>>>> updating jump labels. >>>> >>>> Rightfully so. text_poke_bp() pokes at the kernels text mapping which is >>>> very well defined and unique. Why would you map the same text to different >>>> virtual addresses and then use a randomly chosen one to poke at it? >>>> >>> >>> As an example, we used to have per-CPU SYSCALL entry trampoline [1] where the >>> entry_SYSCALL_64_trampoline function was mapped to a different virtual address >>> for each CPU. So, a syscall would execute entry_SYSCALL_64_trampoline() from a >>> different virtual address depending on the CPU being used. With that code, >>> adding a jump label in entry_SYSCALL_64_trampoline() causes the described >>> issue. >> >> Right, but we knew that and there was no reason to put a jump label into >> that. AFAICT we don't have anything like this in the kernel. > > In our particular case, we have introduced a jump label in JMP_NOSPEC (which > is used by entry_SYSCALL_64_trampoline()) to have the option to dynamically > enable/disable retpoline at runtime. So that's when we faced this issue. > >> That said, I'm not opposed to apply the patch as is, I just wanted to get a >> better understanding about the background. > > Sure. I am aware this is a corner case, and I was precisely looking for feedback > to check if it is worth fixing that issue. So I appreciate your reply, and I would > understand if the patch is rejected because that's a case that we are just not > expecting to happen. > Hi Thomas, Do you have any final thought about this patch? Should we drop it or apply it? As the patch is small and simple, I think it's worth applying it to prevent any such (future?) issue. Thanks, alex.