Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11293015rwd; Thu, 22 Jun 2023 11:12:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GcLheIneT5ICpwbYn92j7tU0hvcl1XAew1PZqfDaZjbRQHObGcfE5gnNvLAuPTk/IInYr X-Received: by 2002:a17:903:18e:b0:1b3:f8f4:5ff with SMTP id z14-20020a170903018e00b001b3f8f405ffmr7724771plg.69.1687457528420; Thu, 22 Jun 2023 11:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687457528; cv=none; d=google.com; s=arc-20160816; b=k4998V41y15NDBnMaegSZYkahoblUGLeAaujlZoKHI3bvd2dAArQA3bTyde5W4opCf e88qXFVjLsIsZNWPApZ9fgOyYhwRfmWvJ+nfgncoEQb/3B6rrabwO2HPP3w08X/lU5pV 8/m/4zqujEXSm3K4bWvkemidEvOHLiAOdh7y8tEMmL0atvrHQuWnSRq2yXds1cxon8TV ZazfkLnfUNwOV1SKu7qlW2Rb8jbwJukiqJO0HIfJeKuzLnis2Sn6ripLyPOTH33KSrTI 2vQykbP6WSMzMt+xcUcd5R65ytdfwjVeIVjSVs28xhnYK9asF+lOa+EU1U4ftv3wzQpV WKeg== 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:dkim-signature:date; bh=yBPDKVDKo7RgxuJh4mBkBN8dPDJGGJoVbT05wvGx1hY=; b=V4XkrCnD0Fw5GQO4BiJ9GApCu1M35gvNJVjSoQGhKVZTGlSdJsKvC1QtETU3Cxy43d 5r67i4sWC+MnzfoUqR2IRaGayhvKi/4bpPh6AUwETjFDI3wEBNvY6JntxRQvvK7c6qIT Ggq07tSA6/S7bxsPSM76oprXVjXs2ocBujkliKR+jd6rpQrmBuna7Sdq2A6K+4CnjLCD f70RpbqJydtXMRPSpiGT4HVCGdHV5CHpjYI5PpTY/D0TN+baL+vqi7YNMJ1V5k90JrOq BJL48HrnKUujXefCXmfB6UYgBG8TexUMd1+V1lqMZ9RNg+P0p/GoWwBcvH6AIcDx113p Uylw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=a0jIRN6u; 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 u10-20020a170902e80a00b001aafea6f85esi7579749plg.435.2023.06.22.11.11.56; Thu, 22 Jun 2023 11:12:08 -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=@t-8ch.de header.s=mail header.b=a0jIRN6u; 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 S231179AbjFVR5p (ORCPT + 99 others); Thu, 22 Jun 2023 13:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbjFVR5o (ORCPT ); Thu, 22 Jun 2023 13:57:44 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3261FE7; Thu, 22 Jun 2023 10:57:42 -0700 (PDT) Date: Thu, 22 Jun 2023 19:57:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1687456660; bh=Lh5/dT2/13B9EXy2EOf+33Uc0+KDF5N223sZ8gY2ghQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a0jIRN6uorF/F9EBzVqYUuTtrds07ROblRlgUxndZHn9hogyVPkXLdTvXTO2UkIEg 5NJ6D7H4aayk10KSXeDefsxm80Krs5ulztsuXcgyyX6455EaAatxYTI5PLJNKY5J2x EGDjVFq8DyAUrAUEtt9JtfNlCLmTtT9m6jZYNpmo= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Ammar Faizi Cc: Jens Axboe , Alviro Iskandar Setiawan , Guillem Jover , Jeff Moyer , Stefan Hajnoczi , Michael William Jonathan , Matthew Patrick , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List Subject: Re: [RFC PATCH liburing v1 3/3] src/Makefile: Allow using stack protector with libc Message-ID: <6734a933-6e61-45b1-969c-1767f1aad43b@t-8ch.de> References: <20230622172029.726710-1-ammarfaizi2@gnuweeb.org> <20230622172029.726710-4-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230622172029.726710-4-ammarfaizi2@gnuweeb.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 2023-06-23 00:20:29+0700, Ammar Faizi wrote: > Currently, the stack protector is forcefully disabled. Let's allow using > the stack protector feature only if libc is used. > > The stack protector will remain disabled by default if no custom CFLAGS > are provided. This ensures the default behavior doesn't change while > still offering the option to enable the stack protector. FYI There are patches in the pipeline that enable stackprotector support for nolibc [0]. They should land in 6.5. It only supports "global" mode and not per-thread-data. But as nolibc does not support threads anyways that should not matter. A compiler flag has to be passed though, but that can be automated [1]. So the -fno-stack-protector can probably be removed completely. [0] https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/include/nolibc/stackprotector.h?h=dev.2023.06.16a [1] https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/tree/tools/testing/selftests/nolibc/Makefile?h=dev.2023.06.16a#n81 > Cc: Stefan Hajnoczi > Cc: Guillem Jover > Co-authored-by: Alviro Iskandar Setiawan > Signed-off-by: Alviro Iskandar Setiawan > Signed-off-by: Ammar Faizi > --- > src/Makefile | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/src/Makefile b/src/Makefile > index 951c48fc6797be75..c4c28cbe87c7a8de 100644 > --- a/src/Makefile > +++ b/src/Makefile > @@ -10,9 +10,8 @@ CPPFLAGS ?= > override CPPFLAGS += -D_GNU_SOURCE \ > -Iinclude/ -include ../config-host.h \ > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 > -CFLAGS ?= -g -O3 -Wall -Wextra > +CFLAGS ?= -g -O3 -Wall -Wextra -fno-stack-protector > override CFLAGS += -Wno-unused-parameter \ > - -fno-stack-protector \ > -DLIBURING_INTERNAL \ > $(LIBURING_CFLAGS) > SO_CFLAGS=-fPIC $(CFLAGS) > @@ -46,8 +45,8 @@ liburing_srcs := setup.c queue.c register.c syscall.c version.c > > ifeq ($(CONFIG_NOLIBC),y) > liburing_srcs += nolibc.c > - override CFLAGS += -nostdlib -nodefaultlibs -ffreestanding -fno-builtin > - override CPPFLAGS += -nostdlib -nodefaultlibs -ffreestanding -fno-builtin > + override CFLAGS += -nostdlib -nodefaultlibs -ffreestanding -fno-builtin -fno-stack-protector > + override CPPFLAGS += -nostdlib -nodefaultlibs -ffreestanding -fno-builtin -fno-stack-protector > override LINK_FLAGS += -nostdlib -nodefaultlibs > endif > > -- > Ammar Faizi >