From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6692FC43381 for ; Thu, 21 Feb 2019 10:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36571214AF for ; Thu, 21 Feb 2019 10:15:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="E0t53ipZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbfBUKP0 (ORCPT ); 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.