Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp15189ima; Thu, 31 Jan 2019 11:36:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN4/HuV73Wb+hX3X/IUXVMdtKsZyVAxtOeyVjyOOkXDe+NIcH1Pt8tc3m8yPAKdM9dKb3vAm X-Received: by 2002:a63:f844:: with SMTP id v4mr32405874pgj.82.1548963371195; Thu, 31 Jan 2019 11:36:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548963371; cv=none; d=google.com; s=arc-20160816; b=sdWyNFueYJzElws+svUn9WReNF126ehHozO/8To0+RN2lRxWv2Gao8MoWdAdw2eKbc 2O9dDcyU2pbmBbI2Jh9LNHDkTCChpHScejzDVYwHgp4lzkf80x8umdqP+fNSrW47QISm FcN/obUQonB+o69hm4XOMET0fVdPZ24Ge4LC3wkCi9WeMVCr+hCv5OvJrQQrgu4s1ylF y06WKibyejy5xqlEq1L+E8hMlT18aL03e2D9jxnDGQOq9fVX7Vixf10wxgOqdSAltI8x Bgkp9nH+cx2OWgOacEB3owJ+5/eSKYsCTUP9lWQOZtXWh5wyMPFBxRnj3thmaOjcEU73 6ybw== 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=T/QIeKF6YLTG+0NkDsQbFayB5HHWNSAQl1KhPy/Dd4o=; b=INAsmWvIaOgLP5GtExVbVw78t5yRCQqzXbP0ouYQKgsgt5MW554CeusvQzsX1dDo9c m8u8GDtnMjQKVC5FSyGU3Cr9Fj9HodB0SibW3Y5jqHK/sZTmkYcg5OUnVqnWcC2rIvyS d2wDQ45NgwENDIncntmT+1yyT8ZWCzGFV5yMv4jcKSCldgZGOUeHuqQ+Gx2OGoOt2DLw 7x+n+3heqqrdDY/+Y0ad0ctLgDtRQXcnc/gd45M/sa6z5we6w1dHwX6MIOOpe7/o2MZQ ZvILK4RfUpEQgCP50eF6I/4aPrUNgWM6RdWsZ+aF7ZXm3wYgRPORR2EdWMWwhrM26Kb9 YfPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="c4suD/Ou"; 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 d15si5284287pgt.498.2019.01.31.11.35.56; Thu, 31 Jan 2019 11:36:11 -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="c4suD/Ou"; 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 S1729304AbfAaT2r (ORCPT + 99 others); Thu, 31 Jan 2019 14:28:47 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43655 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729262AbfAaT2e (ORCPT ); Thu, 31 Jan 2019 14:28:34 -0500 Received: by mail-pl1-f195.google.com with SMTP id gn14so1913196plb.10 for ; Thu, 31 Jan 2019 11:28:33 -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=T/QIeKF6YLTG+0NkDsQbFayB5HHWNSAQl1KhPy/Dd4o=; b=c4suD/OucmLKGFeVJSgSLQORzfP33u5kEC8q+QIx4/77Qg82IS0ordMJztWAgvHj4T qPgZPQwBLEQsoXqcSqh319tibA0R03mUz4NmtqjkelKZS7r5ufcY6Xvoz+9KjHz9esbg WDnYp1WC6qeEzD5YBY0nzd3Zsn4f0pOXQhyRs= 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=T/QIeKF6YLTG+0NkDsQbFayB5HHWNSAQl1KhPy/Dd4o=; b=CoZz3hYuzMXwu1yy1kqi0tegpikKL3PfrAYRTvGBO9SshnnsivUNXsft9spsK8V54R JuLKauqqrXW4aZPakxxnjiG6puXCSgUVaA/kB+IS0aA4FErK8EMf0vEryVRXO8U2+iAt 3t70N6/trB3RAjgbAhbuHVMoBR9Irwm/uIq3OxGhA0maMtmdcfPj9Z6CjntN8vKwVAIT m/iv6SCwtEf3sHYXjKKO3c+5c4AHYLTZr0XGi1MIQQRJr+qcsrYxYH4zMlR3VtU3kEOd dz8xLdmuMJ8dbzxVgoNTeyWB+PPLXdFb+wg6nH3IwZmhRgIHbvAcwHQFuY5zjgkugr8U DZAg== X-Gm-Message-State: AJcUukcq0S+rh68Im8PnvBAHEVdh/jSsk4fMQ1wZt6zfv8pQWOzjHyfy qaDxe5z6uQfflmSwnfHkB3kyDw== X-Received: by 2002:a17:902:bc44:: with SMTP id t4mr35754208plz.260.1548962913472; Thu, 31 Jan 2019 11:28:33 -0800 (PST) Received: from skynet.sea.corp.google.com ([2620:15c:17:4:29de:3bb1:1270:e679]) by smtp.gmail.com with ESMTPSA id s130sm11164399pgc.60.2019.01.31.11.28.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 11:28:32 -0800 (PST) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: kristen@linux.intel.com, Thomas Garnier , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, "Peter Zijlstra (Intel)" , Thomas Garnier , Alexey Dobriyan , Nadav Amit , linux-kernel@vger.kernel.org Subject: [PATCH v6 12/27] x86/alternatives: Adapt assembly for PIE support Date: Thu, 31 Jan 2019 11:24:19 -0800 Message-Id: <20190131192533.34130-13-thgarnie@chromium.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190131192533.34130-1-thgarnie@chromium.org> References: <20190131192533.34130-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. Position Independent Executable (PIE) support will allow to extend the KASLR randomization range below 0xffffffff80000000. 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 4c74073a19cc..f5d6fe1d294b 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -233,7 +233,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 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. @@ -246,8 +246,8 @@ static inline int alternatives_text_reserved(void *start, void *end) asm 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.20.1.495.gaa96b0ce6b-goog