Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp58749ybf; Thu, 27 Feb 2020 16:02:28 -0800 (PST) X-Google-Smtp-Source: APXvYqw1+bYFmEOFzA3CC2DdrQ2aBmOVIWcQPsI/ugm4pN3mHYSCij4HlzsbgbuF9gVFuH5iQ0Es X-Received: by 2002:a9d:6753:: with SMTP id w19mr1045921otm.51.1582848147907; Thu, 27 Feb 2020 16:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582848147; cv=none; d=google.com; s=arc-20160816; b=nrtNLNeO17fMcI9s+jGOxJciTc00cTl4C/U0nxQxWkAZa9XBhSX5FXbqmzJ6cXyzPw FCLp/6srEBqpDnXq2zY3vGBadgHxW7+mgk5QQ+HvpndffC9JEgbuANLkTaUDzT4+G+qd m8CH0eJy8Sk1K9R6cbDyc08CImwM+FU0Oebuk298a8sglWpQKdckAiztm2S4SRLtx+ga hcS+tIPdsUosfUsaGMEpHHQdAf/UtZargq6FKfkFV95nY9qePMmO1xYlYw4bngo6QfVk DjODNh//h6+1vXbkjyoOybgazFjk/mET39jNJnk6PO62bEDyQm5V1cnGMyGKqeXABG2f jsUw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Oz6De1dIYEgjxhRabTRk4CB78qRzDNYlR7Nzf0r7zm8=; b=PGjuuEmhctQ8cUfN1/lWRh5wUly9M8588KkoEFgB5iNohuHbjnvL0x5j8cW8JdnwH0 hvSWhOzeOCU57uhkFVmZdm9hJLsoBrRyf0mdM9EJ57gdqjXyiWJ3xsfgfAomwCGp7WTu Nn//JXwUJ7hRQje2PTI+HXm06gM3SVzU9wixwSu7iGBKrBTtK+hfpo70f+NEhhaz8Ech yMr/3UK312U/4/6ZET0AsH+izGtWfy8Fw4Zs5fvbaj1XdDZ1TWrSQ6aEDIWtvwRkJDcT +2bXnrUbHuogEJrf/oVe+SaicJKZcU4F6U8RP4jNDJmVYJWv6eMF+ATVgkGNGq3jXnZF P5tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ej0qYQRk; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23si789964oic.127.2020.02.27.16.02.15; Thu, 27 Feb 2020 16:02:27 -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=@chromium.org header.s=google header.b=Ej0qYQRk; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730394AbgB1ABd (ORCPT + 99 others); Thu, 27 Feb 2020 19:01:33 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46017 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730328AbgB1ABa (ORCPT ); Thu, 27 Feb 2020 19:01:30 -0500 Received: by mail-pl1-f193.google.com with SMTP id b22so457379pls.12 for ; Thu, 27 Feb 2020 16:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oz6De1dIYEgjxhRabTRk4CB78qRzDNYlR7Nzf0r7zm8=; b=Ej0qYQRkax6vt9VbEqKCxSCRfVTpbF6R6yfkIQH8hH+HCk4aampkSCQAJSBx/l3Eul QYdGcYFrpkp7QbTQ9dqQZFDOh3Tk90FzGpRVXkXIXRjJeG0HLpM37JMU0ecBnf624Z4b p9gSB349m5UGPUQTt7tNnLStSo1C536+EubDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Oz6De1dIYEgjxhRabTRk4CB78qRzDNYlR7Nzf0r7zm8=; b=mmDkEWlwj2JqVTzSnt4fC2o30QOp3Gj9FSAzi2py2tnilQLHwZDG+vNDhYl4WYlJdh HuUSaYOcDUEIZX25V23/Y6hdmU9zwD61mHCBo5AP0mlgOm4/ztuB0GNvXXOn6pGCTxD4 kxyvyEgDr12igtSaJKD1Pnj1ER2jJJVvlx4Pmo0b0iJK4Z9OPYQtWgso+8h5UUYjmKIN eo+KKPyeB+Qrbi3hSyTNI2+HemroJFew1oYNzYLT6pdRkbGkVVCgIdj4pUMJEDRCf43N /M5r09oQZdgyAAZA3R5n2hRSDTT4uNR/xlhwX/nkoVI7XUucsJuk/Ft+4uG0DVVd6drz 0Bzw== X-Gm-Message-State: APjAAAUQM16sU9dWlX3u+bXvpJsKDlEyRGh7nDwMp4n4yXsP1DlyxOqF BvhKE9sOOUa6ucWkyoFlxRxu3A== X-Received: by 2002:a17:90a:868b:: with SMTP id p11mr1609353pjn.60.1582848088646; Thu, 27 Feb 2020 16:01:28 -0800 (PST) Received: from thgarnie.kir.corp.google.com ([2620:0:1008:1100:6e62:16fa:a60c:1d24]) by smtp.gmail.com with ESMTPSA id c18sm7314476pgw.17.2020.02.27.16.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 16:01:28 -0800 (PST) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: kristen@linux.intel.com, keescook@chromium.org, Thomas Garnier , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Miguel Ojeda , Rasmus Villemoes , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: [PATCH v11 11/11] x86/alternatives: Adapt assembly for PIE support Date: Thu, 27 Feb 2020 16:00:56 -0800 Message-Id: <20200228000105.165012-12-thgarnie@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200228000105.165012-1-thgarnie@chromium.org> References: <20200228000105.165012-1-thgarnie@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 13adca37c99a..43a148042656 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -243,7 +243,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, feature, output, input...) \ asm_inline volatile (ALTERNATIVE("call %P[old]", "call %P[new]", feature) \ - : 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. @@ -256,8 +256,8 @@ static inline int alternatives_text_reserved(void *start, void *end) asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\ "call %P[new2]", feature2) \ : 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.25.1.481.gfbce0eb801-goog