Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1234321pxp; Thu, 10 Mar 2022 01:11:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm4dbsae2ilLb1YhcJF51bpWyDjfPQm58kZbarAJXStN/1sBIYVgmqgter6toNBBLbepEL X-Received: by 2002:aa7:d390:0:b0:416:16ad:2483 with SMTP id x16-20020aa7d390000000b0041616ad2483mr3402371edq.122.1646903474006; Thu, 10 Mar 2022 01:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646903473; cv=none; d=google.com; s=arc-20160816; b=JRXVWzQoo8VJGiiN9JYPvz3M4CjfXsAr3ljaUVLBcwvmWgqqWQfAjTYAqX2Uhkc0R/ wmU0EM6rJATdrncYvQLsE8jG9Ge11zyPYhK8Twl4xBXu947E+ywd5V1iN9pt8uqmS+sS HKvV9dXNDk83EtdRMpERfocJaAuN1bxcPZ8j5gApiwddqCuY231qmIyPKpdOl75Nz0D/ eik5Tsyl+nyh/p8PjlKBZ3QDbSM+FlmaUFJnDWjE4weZqh44POOIn/LcHF3//VgsqI6B JFKUG6Ui7SVDH5qrEb+EFxtNk9Zvjr3aSBMSIFoAnR4gGFhf1s3dYi0K0xdhk7OUQRsc RDBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4umDXsTj1CldyJcysNP+Nnq3pVu2iPQxmtjAZsmbWQc=; b=a55jeARH2w4mIloIfKY5BrGFsTD5DYlTcBaoqYhNr2opD0mN+npb+R0J0cQZMPoaP1 ECepHvEucjMFSMIn8Ojwk4UVEIKRwP8vbkoC9g6rgEi6tpvgoOwXPq+9cVcne/OJf+Wr E62EGBgzXM/xGrG0DjwLfitZskw0B5T+LRzoXQ4D+9AdoGQE0YWOLqKxEkk0LkB0lYXK 31UIAu+ueKgDJorYPlpoenlYyNMdrhvxJoHdGnYt8ia1dRKdxExbCl1RuikknqkU1Ng+ rNEv9paLKHyLTvUL8mgeScSbAdxLn8/Xo9tC0YFHQc2Ch5GPseIS2gl+2aqLF2hSi0ye 6mvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fonhPV0E; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs12-20020a170906d1cc00b006b3c5400071si2633124ejb.802.2022.03.10.01.10.49; Thu, 10 Mar 2022 01:11:13 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=fonhPV0E; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237196AbiCIWHh (ORCPT + 99 others); Wed, 9 Mar 2022 17:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236636AbiCIWHf (ORCPT ); Wed, 9 Mar 2022 17:07:35 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D90011EF36 for ; Wed, 9 Mar 2022 14:06:36 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id n15so3185193plh.2 for ; Wed, 09 Mar 2022 14:06:36 -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=4umDXsTj1CldyJcysNP+Nnq3pVu2iPQxmtjAZsmbWQc=; b=fonhPV0Eq1KKbf2UvQA+KGAibGPw26KwBtm0dM70xCxj6ATohjtHnwM9d6UdiJ4pES TtwRiVhwuqVmD1pMJN1AjZmG+ufDLj8RIalRJKwWBNl6MUbtTzyxogX/ltfosrYrsK1W ukbHTdoheSpC4mi3+swuWKJMWUMvllUxyoHhA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4umDXsTj1CldyJcysNP+Nnq3pVu2iPQxmtjAZsmbWQc=; b=N+7A8zY++23bqquJ9iiS33rmLRyRsJ7k+UsE91wGWqleYuVHs1TDsDuCcqRMI1cZqq 2Mee29vxEXtCa9Fc5mgCXhi4MjBMf2IZkBbRFjrZJuokXwPp5xnndisTDcce64vANltN /xwrW9pX44Xvajr5F4Sd0qnH4t7YHa0KFpNcgbnritn2kJtKBb+syulmbUptdLwQ5irK OniwRiCMciqu2C6QRQ/ex4r9nHdO72dFp1GFVw2+S/gbZ6y4dyjgCbb14YxJpfuhLR0t l8frVX/hGEwFuoEFRRK6knv4gtZKvcawRnZdxQZd4zkltDfHCOMVlmV2SZZ2i5Rl90Qf lALQ== X-Gm-Message-State: AOAM531RZJMbQr0zlipbR08f6vjbUO8gdiur/zJzYeOjZwtvZQK0krOr iTWu3T4VJGYXmoAO5UVXQzocYA== X-Received: by 2002:a17:902:7404:b0:151:c3f9:e43a with SMTP id g4-20020a170902740400b00151c3f9e43amr1839188pll.12.1646863595999; Wed, 09 Mar 2022 14:06:35 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u8-20020a056a00098800b004f702473553sm4134935pfg.6.2022.03.09.14.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 14:06:35 -0800 (PST) Date: Wed, 9 Mar 2022 14:06:35 -0800 From: Kees Cook To: Nathan Chancellor Cc: Thomas Bogendoerfer , Marc Zyngier , Guenter Roeck , Yanteng Si , linux-mips@vger.kernel.org, Nick Desaulniers , Mark Rutland , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] MIPS: Only use current_stack_pointer on GCC Message-ID: <202203091406.E94510FD@keescook> References: <20220309204537.390428-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Wed, Mar 09, 2022 at 01:51:13PM -0700, Nathan Chancellor wrote: > Nit: I think the subject needs to be updated (I assume this was written > before Nick's fix?). > > On Wed, Mar 09, 2022 at 12:45:37PM -0800, Kees Cook wrote: > > Unfortunately, Clang did not have support for "sp" as a global register > > definition, and was crashing after the addition of current_stack_pointer. > > This has been fixed in Clang 15, but earlier Clang versions need to > > avoid this code, so add a versioned test and revert back to the > > open-coded asm instances. Fixes Clang build error: > > > > fatal error: error in backend: Invalid register name global variable > > > > Fixes: 200ed341b864 ("mips: Implement "current_stack_pointer"") > > Reported-by: Nathan Chancellor > > Cc: Thomas Bogendoerfer > > Cc: Marc Zyngier > > Cc: Guenter Roeck > > Cc: Yanteng Si > > Cc: linux-mips@vger.kernel.org > > Signed-off-by: Kees Cook > > Thanks for sending this! > > Reviewed-by: Nathan Chancellor > > > --- > > arch/mips/Kconfig | 2 +- > > arch/mips/include/asm/thread_info.h | 2 ++ > > arch/mips/kernel/irq.c | 3 ++- > > arch/mips/lib/uncached.c | 4 +++- > > 4 files changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig > > index 3f58b45fc953..15769013f46e 100644 > > --- a/arch/mips/Kconfig > > +++ b/arch/mips/Kconfig > > @@ -4,7 +4,7 @@ config MIPS > > default y > > select ARCH_32BIT_OFF_T if !64BIT > > select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT > > - select ARCH_HAS_CURRENT_STACK_POINTER > > + select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 150000 > > Nit: This can be 140000, as release/14.x has received the fix: > > https://github.com/llvm/llvm-project/commit/0826716786cd4a8c7cbcb8c01e4d9fac46b7a17a Oh! Excellent. Thanks; I missed that it made the branch. I'll send a v2. -- Kees Cook