Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3971374imw; Thu, 7 Jul 2022 10:25:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tXuZiXfj/rxmGtEviDKE77DxWjjGY8EWwZ68ZRFAnhyv6U/nYh5hBNhDf67r6K/DMyBY/4 X-Received: by 2002:a17:907:608f:b0:726:c868:cf34 with SMTP id ht15-20020a170907608f00b00726c868cf34mr45905078ejc.606.1657214752856; Thu, 07 Jul 2022 10:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657214752; cv=none; d=google.com; s=arc-20160816; b=IP7eKd4if9CXOhQBIQoVzX/lg61m4rqxDTvdPwSx+1o7ZpuPJwNQJue5aIp/fqYoyY rkwpMhmQsdeaVeqxVdur1+GugjOpgiuUuSdkJnGYmTEtJtjKEdAsCKLEyt5bbWKviErV lGMcxnckIT4oooFHOC2s9zotjF98pQDNJ2+h1nId0m4IGCJ3kiZ1JBvD5vS918EhsxM9 1FDAQ2XVurKPNRz5nhjd1+82HdNFBzwpj5QEfqinA4CSevxWW57UnLwsMIPsyL7hpllB Vm8FxILd1z7XCGXVabymtgfaTpbPT8i5PKbeJqAj1fwmXeUym6ADYcNGUVbwlD4EOklq 3A4A== 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=0h8bos9EgQeVRXXnjjjaE1poGXQwPzwH8pouz7CtgM4=; b=egYv9FvEZgmJocZ/fnsy3ZCkDntfQDmTL+Syte2ZGJCgjQpswbDzzTdO6Gw/wPRabe FUdIG0Fc1HrFsdPsG95ypu9awDJeWh63BATsK8uC8KDMPnVOaMa8GYkxbixcmgewXhrx n9G6hmhuu0gwl2WZPcSkJTRRGKIRwcRGeu6xdWr22hlyxyBZ10U4o5SzoWSu/OJUazJ+ xXg5L0JZvAcqbN6Cvs4v1ftXNjBnkUKSgGfqNqibbbJOOXzn4ZiFfmDb2uaSx5HMcZN9 kqdWu3F/KSE0ALN+sX62nj5ob0LHm6fyYLdfUrVe1lpNd/XNbD+fSSU+Itr23hMHPrJF UYow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LLRdvuDr; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di11-20020a170906730b00b0072aebf9cc60si1144550ejc.619.2022.07.07.10.25.26; Thu, 07 Jul 2022 10:25:52 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=LLRdvuDr; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236116AbiGGRRK (ORCPT + 99 others); Thu, 7 Jul 2022 13:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236098AbiGGRRI (ORCPT ); Thu, 7 Jul 2022 13:17:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAD85A47C; Thu, 7 Jul 2022 10:17:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 980CD61147; Thu, 7 Jul 2022 17:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EE89C3411E; Thu, 7 Jul 2022 17:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657214227; bh=kr28mPaitT2hXZx987lyh9NyAySJXLUdOKVygYD27Oo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LLRdvuDrJUqZukDOtd4VwKGYbJakodGU28aqB7NORti+i68Ni0MSuktfoXMDjgm4A J4d2qxdecv4ucF3wTGKNSrJ4yBKitwVg9iD/dNHx78NZfAMBo5W3n7ddXm9Duuk9My GTRlzZKRiLLkthtHbxaKM5hCui7uLCnCte8HvDBa2VATdV/YhOKWAPzNLz1/RzUqyA uRYJ59NvG2JMQfiRWStd8yK11yWew8tQ18VvID5f1XRA51rHmKRteh6LSOJU4qGm2n n5fCtIAuDKncVzT2IfxwU5EgsEnMywxktn77JaGrp/VNhnVccJrTCRdKwJ+WN8HDeY +JRRxlu+LSqQw== Date: Thu, 7 Jul 2022 10:17:04 -0700 From: Nathan Chancellor To: Dave Hansen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nick Desaulniers , Tom Rix , Daniel Kolesa , linux-kernel@vger.kernel.org, patches@lists.linux.dev, llvm@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH] x86/Kconfig: Fix CONFIG_CC_HAS_SANE_STACKPROTECTOR when cross compiling with clang Message-ID: References: <20220617180845.2788442-1-nathan@kernel.org> <842b718f-8207-1565-3373-61098a4c2d33@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <842b718f-8207-1565-3373-61098a4c2d33@intel.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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, Jul 06, 2022 at 03:25:51PM -0700, Dave Hansen wrote: > On 6/17/22 11:08, Nathan Chancellor wrote: > > When clang is invoked without a '--target' flag, code is generated for > > the default target, which is usually the host (it is configurable via > > cmake). As a result, the has-stack-protector scripts will generate code > > for the default target but check for x86 specific segment registers, > > which cannot succeed if the default target is not x86. > > I guess the real root cause here is the direct use of '$(CC)' without > any other flags. Adding '$(CLANG_FLAGS)' seems like a pretty normal > fix, like in scripts/Kconfig.include. Right, also see the following commits for other areas where this was addressed. 58d746c119df ("efi/libstub: Add $(CLANG_FLAGS) to x86 flags") d5cbd80e302d ("x86/boot: Add $(CLANG_FLAGS) to compressed KBUILD_CFLAGS") 8abe7fc26ad8 ("x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS)") > I suspect there's another one of these here: > > arch/x86/um/vdso/Makefile: cmd_vdso = $(CC) -nostdlib -o $@ > > but I wouldn't be surprised if UML doesn't work with clang in the first > place. We have started testing UML with clang and it does work but I suspect there is little value to cross compiling a UML kernel, as it has to run in an x86 userland anyways, rather than through QEMU or other virtualization solutions. That is not something I plan to do anyways. If someone does and a fix similar to this one is needed, it can be done at that time. Thank you for picking up this change! Cheers, Nathan