Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3011556ybf; Mon, 2 Mar 2020 21:00:36 -0800 (PST) X-Google-Smtp-Source: ADFU+vuiydVnpsS5LZhXii38jSowzFaH14ejPTbZEcOrbUYxh4NGglA7q4zsPf5sl0LJ0PF1kXQH X-Received: by 2002:aca:f2c5:: with SMTP id q188mr1305557oih.113.1583211636390; Mon, 02 Mar 2020 21:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583211636; cv=none; d=google.com; s=arc-20160816; b=EgA5MDB1utguJhtQieMogbFQBaDwGd2KkB/9WI3ZZ5D/wqBJF4sbJRd+u9EpfjBVDc KsMkWZP1BjkKv0IWmUsH9YvNGtEZqqY/ldz7X85dQLZDjhiik7Wo7/2eyjbzJ2s44grU gxqKd6oUJ3qZoO3dYUCMnaiPG1rP7qMH2qQaThIdLj2bQ7vXAxbioP0casWi/lYvKgw5 fyDqak9YUeBHcQ4ifID/mh9a8EWO8iG2FxQpQcvGVAld2qRjpCGSvFMyQneoOEd+4WVp zUHcRzK/DFhkj4ufEJR6EucPnDqmRfxiq1XbXNaz+TSJCSJkZUFZdX8M3Tm0KiXSHH3U lgLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OSg+JSGp6hQhw1bce7F3mzW7bduFXt5gWaDypQm8zyQ=; b=loKGREsrD81PL9QHpgT9sKXXFL1xNoIyBmM/sv2Ug64X/8xezxKVodoZNxyo0/NdwW YrSHusgzTOEF5FBeDCXQFVmOBQ6JvovRto9hLftoKZ5GVWSeB2gAejaM1mJn9/EXb3uZ JofTtHof0v1da83mzUSBKnFKOI9bxNJubkoYG4tzLDbUlC4HpA4yBnm3j7Utqgq7yHa7 IH+rEq9I4s2zVX/jSq5rSdL0GQG01u8P5vYOPieFVsNwg7SFJQzKK5La6hfC5PYWpw7A mQZIAADh7QqDsH+SH+dDDXJUg5q5X3zbzTm6jlterx1L2YtCYwa7GavHkyDYngySjmjY MRng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nbtp2Tl3; 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 e19si7145236otl.145.2020.03.02.21.00.24; Mon, 02 Mar 2020 21:00:36 -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=nbtp2Tl3; 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 S1725775AbgCCFAC (ORCPT + 99 others); Tue, 3 Mar 2020 00:00:02 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38342 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbgCCFAC (ORCPT ); Tue, 3 Mar 2020 00:00:02 -0500 Received: by mail-pl1-f195.google.com with SMTP id p7so757684pli.5 for ; Mon, 02 Mar 2020 21:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OSg+JSGp6hQhw1bce7F3mzW7bduFXt5gWaDypQm8zyQ=; b=nbtp2Tl36OKExvWG4Z11h/mNp7CTtxBemLmJhMZ31czsu66C86WttOMdwcZrEfew9l stexFmDexS+B5uCgHu4F404ZjmjNs/DCYfxYCA74JgeyMxOOnWB5Wq+tRyLYJp3gcR1C 9in0FcBLeOIrELlzyfvQH3MvAXgrRU6VQDef8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OSg+JSGp6hQhw1bce7F3mzW7bduFXt5gWaDypQm8zyQ=; b=f355WdCdZmxyPb9SRuxAqU/eZzeVuP2u8lAo5hwO8TbnM13jYwVEXw5loEJ8zC5hgM p/b0LpbXT2xQbTOLtESVrYeISSU0Fju/4uR4ql3p8hCJ8BB+2qoJ0vOlz3VZAzgkOUPQ fWhoxxATmjzz1LDCGaiJXVoax90Kd6VsKgXm0z1WdWo/UsVtUqHhym3btRRoGGYzzdS4 Pv8BihN6vhjSkRM0FBDKCCRr0uJe0f8zTmbeHV6xW6I9Xe12FA829OwwQJEukIEQ2Si4 QdudnIbD2pwWKO3G8rSltz7Jg3fVDDRLPg8zymFFlTf3ZNM5rX9TXS23tpClH/wbH7zp SvYg== X-Gm-Message-State: ANhLgQ1WYA245gtUpfo5ln1D+WuQI9BCL3SktzZ2o6AE1p8WS50oytOx gZLKdxNTJTdTxVuERR5xNL8pkg== X-Received: by 2002:a17:90b:2290:: with SMTP id kx16mr2109790pjb.152.1583211601610; Mon, 02 Mar 2020 21:00:01 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g7sm532672pjl.17.2020.03.02.21.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 21:00:00 -0800 (PST) Date: Mon, 2 Mar 2020 20:59:59 -0800 From: Kees Cook To: Thomas Garnier Cc: kernel-hardening@lists.openwall.com, kristen@linux.intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Miguel Ojeda , Rasmus Villemoes , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 11/11] x86/alternatives: Adapt assembly for PIE support Message-ID: <202003022059.67FCB9CB75@keescook> References: <20200228000105.165012-1-thgarnie@chromium.org> <20200228000105.165012-12-thgarnie@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200228000105.165012-12-thgarnie@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 27, 2020 at 04:00:56PM -0800, Thomas Garnier wrote: > 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 Reviewed-by: Kees Cook -Kees > --- > 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 > -- Kees Cook