Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4476245imm; Mon, 15 Oct 2018 15:49:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Ywg4o1dvomS8BL2gL0UbST5rsdvNiN8/Naiu3dXRNCQxZbMxqBVkaXSZpm9IGOBXyfX0l X-Received: by 2002:a62:1112:: with SMTP id z18-v6mr19458418pfi.200.1539643754704; Mon, 15 Oct 2018 15:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539643754; cv=none; d=google.com; s=arc-20160816; b=ox0u9MeG/tZGX9K6RS8sSEDuTrTjAfEzdB2a1fDGxT1AcFv1DD8VCkZ4qfP2K4kFaB b59lcJHSU5de8e/KkGiajxY+bQlx12Oxe2KQT5mngdy0lg9tIFeXmoEUv2QFxexNwrLj RiQ+quJQ3hQjpe+2/RHohopUnIJl+9O4Y+k+auFxgFAknHVpUPEhpc2QAY6OmunJhXHd t6rxEd8AxVllH59NKruPuxTOdfXOOgeU5a/ArCOPBwgS2tJtqjj1ogFA+TqtoEh+v6hS 1RfMpKl/6Bf/LWf8741NA4DJcmtF9DaOpd1DOG4hOU7bn/oYETsWwNCGc5WuSvsD5S06 1OBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=Yq7cAHf8F7PW+t95dpp6GCWUFslhvWiPYFUB7IEr9FU=; b=YxTvGJv6NiVyUO6Z9GpM5WYMAYfeaQkX+aIe6a9mUBgDm6P7SU2vesO62uqvDYBOZh /VAn6BMy0cQyuYaML7r+Sue/szYvaA+TS2yl5OOzrt5IGP1iqQr+SzMtBfMJ1+yL32rY a3XtIb1IBn7M2czn0XeyjQZdH5DTV3igM2R3S4LiwnlbctulDON24aKqk58vlKeCNPPW tCGfIiBAqKy/wliOP6zwX4sy+lA01JwakrmFk6mYfMvAqipsU8z/ONY6SEcENsk5wvxP ceWr0d70xD8cNjwlB4m/ns1IzHpc15NebecKD+K+5KKfRGwPdxsj+BeDNoy5k7Y0RDfb XxMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=F9ba1EdO; 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 g12-v6si12427672pla.70.2018.10.15.15.48.59; Mon, 15 Oct 2018 15:49:14 -0700 (PDT) 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=F9ba1EdO; 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 S1727136AbeJPGdy (ORCPT + 99 others); Tue, 16 Oct 2018 02:33:54 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:35046 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726836AbeJPGdx (ORCPT ); Tue, 16 Oct 2018 02:33:53 -0400 Received: by mail-yb1-f196.google.com with SMTP id o63-v6so8156199yba.2 for ; Mon, 15 Oct 2018 15:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Yq7cAHf8F7PW+t95dpp6GCWUFslhvWiPYFUB7IEr9FU=; b=F9ba1EdOUKaafX9xrEqBARmbgLTf5BTazH9EUA2zqpIfgfemc+EGfElDFaacLlXV70 SA7qSzK0tJNB0lhVdaPyb67bG07z0qrCMfA8JY1yy0usQeNdR/5MAAilhLx9CDq/xc6w D6ks2MQH8YTAZYX27MjGeIYcrdDQWf7iSlB7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Yq7cAHf8F7PW+t95dpp6GCWUFslhvWiPYFUB7IEr9FU=; b=FfiXN4Fo6AGHK2HXn3o1vq1o/gMZ/EuqfOPCBsja0td1hWqAi4u1zMXOBgjTS6CeIk pVjpsMSDL6HQDncmOUx2WDTCtuYjgOfRumZ3xIANj2OdgainSmbEqG7fhDoce4zbPxhJ GcSIket8lHqJ/tFo0uKCYN9+Ws1zhzzGmZ7U6qRwYAKDQk9TmXXJnLTV1MoAljRqjjpB kEJk5xOaLmOaaTqRtDWoS1WlNbTR62U/HqVLbkWInwycpOJFna7SkfzQcqPdpwyqoe7/ nO9NBX8l08edC5Zgins48xC9JeoQcu46/DykNxwEOUAh4dkhT0LTYtdpMA1RnkE5JO8K RejQ== X-Gm-Message-State: ABuFfoiJvQ0kM2nXToAiWEN7qOSip+pCVBfAamFUHG6i//NjItyk3Edq DsXWjzyuWJdviDdBqMwMvcx9gE61ZhU= X-Received: by 2002:a25:ce83:: with SMTP id x125-v6mr10686326ybe.145.1539643595159; Mon, 15 Oct 2018 15:46:35 -0700 (PDT) Received: from mail-yw1-f49.google.com (mail-yw1-f49.google.com. [209.85.161.49]) by smtp.gmail.com with ESMTPSA id r5-v6sm4966713ywr.80.2018.10.15.15.46.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 15:46:34 -0700 (PDT) Received: by mail-yw1-f49.google.com with SMTP id j75-v6so8165167ywj.10 for ; Mon, 15 Oct 2018 15:46:34 -0700 (PDT) X-Received: by 2002:a81:2cc3:: with SMTP id s186-v6mr10806432yws.168.1539643133798; Mon, 15 Oct 2018 15:38:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:d116:0:0:0:0:0 with HTTP; Mon, 15 Oct 2018 15:38:53 -0700 (PDT) In-Reply-To: References: <20181005084754.20950-1-kristina.martsenko@arm.com> <20181005084754.20950-18-kristina.martsenko@arm.com> From: Kees Cook Date: Mon, 15 Oct 2018 15:38:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC 17/17] arm64: compile the kernel with ptrauth -msign-return-address To: Vladimir Murzin Cc: Kristina Martsenko , linux-arm-kernel , linux-arch , Jacob Bramley , Arnd Bergmann , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Adam Wallis , Will Deacon , kvmarm@lists.cs.columbia.edu, Ramana Radhakrishnan , Amit Kachhap , Dave P Martin , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 7:23 AM, Vladimir Murzin wrote: > Hi Kristina, > > On 05/10/18 09:47, Kristina Martsenko wrote: >> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile >> index 106039d25e2f..dbcd43ea99d8 100644 >> --- a/arch/arm64/Makefile >> +++ b/arch/arm64/Makefile >> @@ -56,6 +56,10 @@ KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) >> KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) >> KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) >> >> +ifeq ($(CONFIG_ARM64_PTR_AUTH),y) >> +KBUILD_CFLAGS += -msign-return-address=all >> +endif > > Should not it be done via cc-option so old toolchains keep working [1]? > > [1] > $ aarch64-linux-gnu-gcc --version > aarch64-linux-gnu-gcc (Linaro GCC 2014.11) 4.9.3 20141031 (prerelease) > Copyright (C) 2014 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > $ aarch64-linux-gnu-gcc -msign-return-address=all > aarch64-linux-gnu-gcc: error: unrecognized command line option '-msign-return-address=all' > ... I would like to see CONFIG_ARM64_PTR_AUTH testing for compiler support via Kconfig (as stack-protector does). This would allow developers to only see the option if it was available (i.e. no "downgrade" happens if the compiler is missing support). Using cc-option runs the risk of building a kernel with CONFIG_ARM64_PTR_AUTH set, but _not_ actually using ptr auth. -Kees -- Kees Cook Pixel Security