Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp306347rwl; Thu, 23 Mar 2023 16:45:26 -0700 (PDT) X-Google-Smtp-Source: AK7set8ThihuJfWGlqceawQCEngo+ORCPFxWw97Nf+qDpYTckXY87NxnQxEGXWe5WK3U5TH2RvCC X-Received: by 2002:a05:6a20:1326:b0:cd:91bc:a9af with SMTP id g38-20020a056a20132600b000cd91bca9afmr843120pzh.58.1679615126640; Thu, 23 Mar 2023 16:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679615126; cv=none; d=google.com; s=arc-20160816; b=uRR143i29Cq8n/WHdPoIgNFqxdv8SrLz+56cAnzKSnZxr/vEUVYEtjyFEZ7VEQuFdP qerFIrb4b9sUVCG+DNWUnlFJPnV5iH0UhO0UxtLDO2gyztGYttKXLoRdvNIxjC5fnLj5 zvV4mgHsQ9xm1J2lBvFNWCpT5I6yMvXOf1tWqk9Nq9osRuGamcr+Tt0gzRno1/ssGnF/ FEWxE9A8lKWeLx5kJtJxs2AiMoQxIAGjfD8vebyO+0U34mLZY1eVzXimUGa4Ck5FFP5G GAS4AYexf/qNyKD3CHwejI1njXQ3yKtzM2to5SDVaUP4oV1i7XqxNZJbbrxA5brO8MQB 1icg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=ObRT8egLcHTFkOQqAwmIK5FAVJ9gMRJ898Z3pgISMCo=; b=HKHjG28r8EiCKMEUpbsBSpbBGirk0zNH9ZpfmnRR7Mm+LagWlyHA80g/bZ0sHZNsRi orMT4f+wvmZWJYzPgfu7ky0r3tNL1vJ/Vp4jbOiuS57yCtNRDQ2j+TRLyKwzXhO4hwXM toGWLT0AQsrrIXlUvNzkG8ndbFXUEckxQi9JtysBD6HtP71FhlUa5TbkH4pY14rbBfTK jx/TvaLDf2RxIHWyORA55ZuCm74Hs1AviFMF60qYjXzlr+pF1sS50JFZmve+IudcY+2E MgrC7ec7uGXNCUzjVt5Ll3PYLwjIj/rC3xeZUDFW/BqQjaNjFXVWbrZnorBnPUbpe1SU Z1nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=ktXoOzQG; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u189-20020a6385c6000000b0050beb800603si19984379pgd.39.2023.03.23.16.45.14; Thu, 23 Mar 2023 16:45:26 -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=@weissschuh.net header.s=mail header.b=ktXoOzQG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230489AbjCWXo0 (ORCPT + 99 others); Thu, 23 Mar 2023 19:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbjCWXoY (ORCPT ); Thu, 23 Mar 2023 19:44:24 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0CF27EFE; Thu, 23 Mar 2023 16:44:19 -0700 (PDT) Date: Thu, 23 Mar 2023 23:44:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1679615057; bh=RI5ocGFEEsxcupBslhNsOWQFWljVe9IxGeY5B4BEkzY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ktXoOzQGOa2NPonXMcMgpQ8sh1OAkTFV/BQ3EYAxbxYkoLCqxLRGPbDIm7PD5GObt vypxz4uUAcs3wZSH6HgK6Kv9vuveU3zSiwpC1x4AORHfrqQPBkDUhcxTTSrK7d5+6Q gAFWEJrBYcBIiEMGHnCcwHQyrh1K5uevjGKuIAcA= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 8/8] tools/nolibc: x86_64: add stackprotector support Message-ID: References: <20230223-nolibc-stackprotector-v2-0-4c938e098d67@weissschuh.net> <20230223-nolibc-stackprotector-v2-8-4c938e098d67@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Hi Willy, On Thu, Mar 23, 2023 at 09:19:48PM +0100, Willy Tarreau wrote: > On Mon, Mar 20, 2023 at 03:41:08PM +0000, Thomas Weißschuh wrote: > > Enable the new stackprotector support for x86_64. > (...) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > index 8f069ebdd124..543555f4cbdc 100644 > > --- a/tools/testing/selftests/nolibc/Makefile > > +++ b/tools/testing/selftests/nolibc/Makefile > > @@ -80,6 +80,8 @@ CFLAGS_STACKPROTECTOR = -DNOLIBC_STACKPROTECTOR \ > > $(call cc-option,-mstack-protector-guard=global) \ > > $(call cc-option,-fstack-protector-all) > > CFLAGS_i386 = $(CFLAGS_STACKPROTECTOR) > > +CFLAGS_x86_64 = $(CFLAGS_STACKPROTECTOR) > > +CFLAGS_x86 = $(CFLAGS_STACKPROTECTOR) > > CFLAGS_s390 = -m64 > > CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables \ > > $(call cc-option,-fno-stack-protector) \ > > This change is making it almost impossible for me to pass external CFLAGS > without forcefully disabling the automatic detection of stackprot. I need > to do it for some archs (e.g. "-march=armv5t -mthumb") or even to change > optimization levels. > > I figured that the simplest way to recover that functionality for me > consists in using a dedicated variable to assign stack protector per > supported architecure and concatenating it to the per-arch CFLAGS like > this: > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index 543555f4cbdc..bbce57420465 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -79,13 +79,13 @@ endif > CFLAGS_STACKPROTECTOR = -DNOLIBC_STACKPROTECTOR \ > $(call cc-option,-mstack-protector-guard=global) \ > $(call cc-option,-fstack-protector-all) > -CFLAGS_i386 = $(CFLAGS_STACKPROTECTOR) > -CFLAGS_x86_64 = $(CFLAGS_STACKPROTECTOR) > -CFLAGS_x86 = $(CFLAGS_STACKPROTECTOR) > +CFLAGS_STKP_i386 = $(CFLAGS_STACKPROTECTOR) > +CFLAGS_STKP_x86_64 = $(CFLAGS_STACKPROTECTOR) > +CFLAGS_STKP_x86 = $(CFLAGS_STACKPROTECTOR) > CFLAGS_s390 = -m64 > CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables \ > $(call cc-option,-fno-stack-protector) \ > - $(CFLAGS_$(ARCH)) > + $(CFLAGS_STKP_$(ARCH)) $(CFLAGS_$(ARCH)) > LDFLAGS := -s > > help: > > And now with this it works again for me on all archs, with all of them > showing "SKIPPED" for the -fstackprotector line except i386/x86_64 which > show "OK". > > Are you OK with this approach ? And if so, do you want to respin it or > do you want me to retrofit it into your 3 patches that introduce this > change (it's easy enough so I really don't care) ? Looks good to me. If nothing else needs to be changed feel free to fix it up on your side. Thanks, Thomas