Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1859667rwr; Fri, 28 Apr 2023 02:53:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79AG147vgXabrKZkRrYkpaoMBZY0XHT4a65HH9pXg4aseywD0NjEHOLtWnty6zCi4MFy4w X-Received: by 2002:a05:6a00:23c8:b0:641:23df:e92a with SMTP id g8-20020a056a0023c800b0064123dfe92amr5264414pfc.12.1682675638886; Fri, 28 Apr 2023 02:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682675638; cv=none; d=google.com; s=arc-20160816; b=KSsmi4LS5chy75+sq57gRwiCT1Ev8wayVCbXPqKXYZS1J52bD0K57TRZndjxYHuHHx gCj1S2RbelLiCQ22k0TvSIpm3jJw5mCFFmCV2MNbjanfB18C54Akwfm4cAObTMC3KSdP tQcAxDBoLPh//OdHntWMkCsg0c5xrpb7wBZdXX5m0xooT8QiNAlfRafxUxFzYK54Bjx3 t7lGFtigQ5AyRMXzFzN46tjF1934S8qlQPZlfefIK7c5zQkmvlMPtWqNPUBB0pRQZItr RPRHbLq+nR53qDz48Y3wRaW3faaO2bCl+ZIMBh9Cb6uGm0k/g+cazAxXV+8/R1tvrr3F Fgaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kNzViBjhN5Ze8gUicJ75SGyKKI+ewsaHwplG0KEKdWo=; b=FcAczKCGmEK2ik+XZlcAiX2sedsEiGOl7/v6y+bwKHILVXNikRA7h/lcZQH5qXBDTS 7lcjIpNE7PKrA+H01XLC0NxuupFB/lMESnbYeQ2DxK5zo8PNfjZ2bP/uCf4RuRoC5RMu yme8PvE2Y/Y2i1uAtzzExSRZ6F5sR43J+w1C7ULRT4v5N+5z6MA6ZStS9ehOBiK74eEf DKcvj50/2sv4Df4FymYN205D8GZZtlDfy9RhQYJXu0JAa+gNe95S244LFyuw3g08ET7f 1wdaojDSTntjtuBzw8mD1kGlhyUaGvTUONAjeSY+sw+hgLxaKpFLVy5wFKYt4NezsuMp sYAw== 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 y64-20020a638a43000000b005184398f8e0si21941618pgd.57.2023.04.28.02.53.47; Fri, 28 Apr 2023 02:53:58 -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 S1345577AbjD1JxA (ORCPT + 99 others); Fri, 28 Apr 2023 05:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345815AbjD1Jwh (ORCPT ); Fri, 28 Apr 2023 05:52:37 -0400 Received: from out0-194.mail.aliyun.com (out0-194.mail.aliyun.com [140.205.0.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8293759F2 for ; Fri, 28 Apr 2023 02:52:16 -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=ay29a033018047207;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---.STFoGBM_1682675527; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STFoGBM_1682675527) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:52:08 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , "Peter Zijlstra" , "Willy Tarreau" Subject: [PATCH RFC 10/43] x86/alternatives: Adapt assembly for PIE support Date: Fri, 28 Apr 2023 17:50:50 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Thomas Garnier From: Thomas Garnier Change the assembly options to work with pointers instead of integers. The generated code is the same PIE just ensures input is a pointer. Signed-off-by: Thomas Garnier Signed-off-by: Hou Wenlong Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/include/asm/alternative.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index d7da28fada87..cbf7c93087c8 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -307,7 +307,7 @@ static inline int alternatives_text_reserved(void *start, void *end) /* Like alternative_io, but for replacing a direct call with another one. */ #define alternative_call(oldfunc, newfunc, ft_flags, output, input...) \ asm_inline volatile (ALTERNATIVE("call %P[old]", "call %P[new]", ft_flags) \ - : output : [old] "i" (oldfunc), [new] "i" (newfunc), ## input) + : output : [old] "X" (oldfunc), [new] "X" (newfunc), ## input) /* * Like alternative_call, but there are two features and respective functions. @@ -320,8 +320,8 @@ static inline int alternatives_text_reserved(void *start, void *end) asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", ft_flags1,\ "call %P[new2]", ft_flags2) \ : output, ASM_CALL_CONSTRAINT \ - : [old] "i" (oldfunc), [new1] "i" (newfunc1), \ - [new2] "i" (newfunc2), ## input) + : [old] "X" (oldfunc), [new1] "X" (newfunc1), \ + [new2] "X" (newfunc2), ## input) /* * use this macro(s) if you need more than one output parameter -- 2.31.1