Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1891974rwr; Sat, 6 May 2023 00:32:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67TUl/Oe8huUlNWMkQyW8wOTYMHVdM12LX2bQw2/c4XPMOIBk0NND6yPqSIidJRJ/MvXUx X-Received: by 2002:a05:6a00:ac2:b0:63d:2f13:200 with SMTP id c2-20020a056a000ac200b0063d2f130200mr6355149pfl.16.1683358341684; Sat, 06 May 2023 00:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683358341; cv=none; d=google.com; s=arc-20160816; b=ZtXkc+wh7iatCPDiQzTSUWo7l43Krfa/MK+pPu9XnQOVTNzlKjqmVSq1b+VIu60aKS LF/aauwOJgx0oNrAjJGGNC8kR4bjNOUplZkBPv4EaX7p5kiR0SEhFIDBmTb+NaAwEilf 52f42o3ac0ML/0m1Nq1kORVtCWcfShqUP+NhxE0fxoOKOhOP3uPYjNyMKg2kKewpQe5M QNdzIofPCgLjTrD2o1RtAwU50bhU8ajqLGxfKv1PDpGNqWQAU2Yt4Px78dBDHzk6k1ll ubS/hHZ47YLy3nMl8+XXiXRUabMGl50d2DoNPgLX/QCQsK2H53qrlVOOjWhBvorI8ar/ oycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sDLLPfiML2Yy4mOSK6S9YhVraez9cLUQoKoOzcYCM6A=; b=EZkut7ZXpuMEtlSNvw0d17hHYOrGgktSElFPvnRL0bjy19P0Sah9mfAwNUatP6pOOF IDSquIVyAzbGgs51yZLOb8hgtMJXUIzhRhh7Nq+jMZjXlxtzlmLAcN6+dOxJrx+6k/el hXQXCK2A3fvF0DfvvqX+xqdRTNYGpR8pVl9J2bfoygRvgnHaa0IL/Xm2ym4V2pSaey2R +8IuSVobjPpvvg28y5QfrMmBIoK8RR8ZRUfglcbUaQUiX5vKaLVtmtcK15MkFku+Yc+C aavO6y3Zz65Dy1vjwZK0FozZu50KhXwj2X6OSOx0QK8kayNH9nka+vIddf5KvrPpNE/a armg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f2-20020a625102000000b0063f17d152c6si3641655pfb.300.2023.05.06.00.32.05; Sat, 06 May 2023 00:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjEFHTT (ORCPT + 99 others); Sat, 6 May 2023 03:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjEFHTS (ORCPT ); Sat, 6 May 2023 03:19:18 -0400 Received: from out0-215.mail.aliyun.com (out0-215.mail.aliyun.com [140.205.0.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C490111577; Sat, 6 May 2023 00:19:12 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047208;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---.SZmu-5V_1683357546; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.SZmu-5V_1683357546) by smtp.aliyun-inc.com; Sat, 06 May 2023 15:19:06 +0800 Date: Sat, 06 May 2023 15:19:06 +0800 From: "Hou Wenlong" To: Peter Zijlstra Cc: , "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Nathan Chancellor" , "Nick Desaulniers" , "Tom Rix" , , Subject: Re: [PATCH RFC 00/43] x86/pie: Make kernel image's virtual address flexible Message-ID: <20230506071906.GA99736@k08j02272.eu95sqa> References: <20230428152206.GA1464060@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230428152206.GA1464060@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 28, 2023 at 11:22:06PM +0800, Peter Zijlstra wrote: > > For some raison I didn't get 0/n but did get all of the others. Please > keep your Cc list consistent. > Sorry, I'll pay attention next time. > On Fri, Apr 28, 2023 at 05:50:40PM +0800, Hou Wenlong wrote: > > > - It is not allowed to reference global variables in an alternative > > section since RIP-relative addressing is not fixed in > > apply_alternatives(). Fortunately, all disallowed relocations in the > > alternative section can be captured by objtool. I believe that this > > issue can also be fixed by using objtool. > > https://lkml.kernel.org/r/Y9py2a5Xw0xbB8ou@hirez.programming.kicks-ass.net Thank you for your patch. However, it's more complicated for call depth tracking case. Although, the per-cpu variable in the alternative section is relocated, but the content of the "skl_call_thunk_template" is copied into another place, so the offset is still incorrect. I'm not sure if this case is common or not. Since the destination is clear, I could do relocation here as well, but it would make the code more complicated. Thanks!