Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6965079rwb; Wed, 18 Jan 2023 11:35:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXsAjjkZ5E8avtASguCh5YmUrPKZlhbZG73kdWywgfVHfBLD6Csjrh+vsE7iebEMXIJzzTnP X-Received: by 2002:a17:902:9a97:b0:193:2a8c:28cb with SMTP id w23-20020a1709029a9700b001932a8c28cbmr8400003plp.21.1674070533839; Wed, 18 Jan 2023 11:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674070533; cv=none; d=google.com; s=arc-20160816; b=oY12DpCAsMgG9B6sk62cqIC0U/IXnOkJQbKDEe8ugDaLE4V7kYwH7emhFiX3LLv2KM IiLHmDu9NqvsVS9ofGo15MejQxJkWNh/kSwmbXiq/Kjpsu01MI0ZUf7KClmbV+SrhFHq tsDwkyAwYn27eomMxKAPxs6kcp1UPnahUP5gAYjZnuc7szSlr73YDqBTgK7WSETIH3dy NuzdHi54wRaIJY8P5q4AWO7vxy2D4yAMfvV86G9hppGwNrjzVau53WK4WqZVsxeXdo2+ 8VQ/1/Zclh4mp4MqeRKS6tPTEuMDbhjkhueDfrYDBusFCE6cXW8XVlu2l4IvtFro1wZF Jx3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=CyUR5YUMm8ysaAa5DWj670ggKcKYPCTZKk4awAgiO1I=; b=y1zy5CxA/PpfQL4kdjsNJGLuDLfIu3cJCSAqFyluVx5muGkvSpSQqr7xvHVVbCO2I6 7BQX0k5L28QadHpRivX9yHi9ake6x2/KNryXKL5D2Jnu+hWTipuVGkV1kzNQlxvgJikW LEedSux913dCwvFZy1odwdLrKGy+2IKSoQRrGosxHrsYERlf0AF/77X9ceOEfiBPA+1I qhQ9TPxqI0xt1TgtfhpqJprG7BnkgpViekRR8i774+b8RfSHqiVyjaEWXUOSLTPel7+G ZIOuCAENnubC1PNi0RnKIxYwP3//OxeFZ0qB4H6O2g3I4v4wpHjyuq9c1tigCKMySXx/ QXWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jEiGMsYr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a170902d4c100b0018c91adc929si40818632plg.400.2023.01.18.11.35.28; Wed, 18 Jan 2023 11:35:33 -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=@gmail.com header.s=20210112 header.b=jEiGMsYr; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbjART21 (ORCPT + 47 others); Wed, 18 Jan 2023 14:28:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbjART2Y (ORCPT ); Wed, 18 Jan 2023 14:28:24 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C63254113; Wed, 18 Jan 2023 11:28:23 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so23142wms.2; Wed, 18 Jan 2023 11:28:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=CyUR5YUMm8ysaAa5DWj670ggKcKYPCTZKk4awAgiO1I=; b=jEiGMsYrAxCjCLHs6mkQRY+H0loWMOrPpIXi1xkSgx//vqy9s+DozWfgjSS4YBRZBs MtHd3ILPtW2L3CSBBpV7fwzVyyasFhif6BaagMScsM10cwqj34DAnecbPHQ3g3qaZylV BOK+XkMpujyyYY1flwZ5ef1MvNyiKhVcAHfBwO61evwXCkrreDof6lpvLAtEm5wlmCD2 CNnu0Nykkr2AbmJlXwgPf1lWdkjNVz+izsra+0L3KHH9il/gIgUrRF8z9t4JCDyT0pHA 5PC+tL/QI5wOYSz42qniVZWNiLATcIzp+3DxOAKnG46f0ANvCW3rwKhcSDBi34NCO1iJ xodg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CyUR5YUMm8ysaAa5DWj670ggKcKYPCTZKk4awAgiO1I=; b=l89NevF1q/ea5uPvhrB2jJPaJY+n2Vf66OMiwDv+a3HAMoU6ehqIza115H7YrVzxeM gxbOrIeP03nBnDOMnzY8GeDzvDsoovc5Av19PXNPprtp2jG/HG2z1+MLgJ/8DRmVZZkk iJwxVxiVQoZ/GuZ2QL252M7ctMFrSxjWsSIuTaRZjGmYbUFjaifjyFWr2FjpwSxlHZ1+ VQEN59vswQfbifDkuHhnRX5m4yladz6+SOxjHh0A7n1HOayeF2f/O1vNKKqYCYq0W2W1 9np8thfVAVdLC9BIrZJ8ObITgWjhpNDLnQYnP8E9Cp6FvgbnsmU1SPCR+WqhOiUSFwXS 40Qg== X-Gm-Message-State: AFqh2koGNIDzGJNSLhMAZeB8FBod8sXiISWoPrqydYRsr7KOec82yHdb J9Gk7Nn6N8qIwPFVCbcJT3k= X-Received: by 2002:a05:600c:5d1:b0:3d0:761b:f86 with SMTP id p17-20020a05600c05d100b003d0761b0f86mr7756738wmd.28.1674070102037; Wed, 18 Jan 2023 11:28:22 -0800 (PST) Received: from [192.168.1.113] (host-176-36-0-241.b024.la.net.ua. [176.36.0.241]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c0a0600b003d04e4ed873sm3398843wmp.22.2023.01.18.11.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 11:28:21 -0800 (PST) Message-ID: <701abf4bbf5b7957a24d2f164c643e1d9f586fad.camel@gmail.com> Subject: Re: [PATCH] tools: bpf: Disable stack protector From: Eduard Zingerman To: Peter Foley , Quentin Monnet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Date: Wed, 18 Jan 2023 21:28:19 +0200 In-Reply-To: <20230114-bpf-v1-1-f836695a8b62@pefoley.com> References: <20230114-bpf-v1-1-f836695a8b62@pefoley.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Sat, 2023-01-14 at 18:00 -0500, Peter Foley wrote: > Avoid build errors on distros that force the stack protector on by > default. > e.g. > CLANG /home/peter/linux/work/tools/bpf/bpftool/pid_iter.bpf.o > skeleton/pid_iter.bpf.c:53:5: error: A call to built-in function '__stack= _chk_fail' is not supported. > int iter(struct bpf_iter__task_file *ctx) > ^ > 1 error generated. >=20 > Signed-off-by: Peter Foley > --- > tools/bpf/bpftool/Makefile | 1 + > tools/bpf/runqslower/Makefile | 5 +++-- > 2 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index f610e184ce02a..36ac0002e386f 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -215,6 +215,7 @@ $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h= $(LIBBPF_BOOTSTRAP) > -I$(or $(OUTPUT),.) \ > -I$(srctree)/tools/include/uapi/ \ > -I$(LIBBPF_BOOTSTRAP_INCLUDE) \ > + -fno-stack-protector \ While working on clang patch to disable stack protector for BPF target I've noticed that there is an option to disable default configuration file altogether [1]: --no-default-config Should we consider it instead of -fno-stack-protector to shield ourselves from any potential distro-specific changes? [1] https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-cl= ang-no-default-config > -g -O2 -Wall -target bpf -c $< -o $@ > $(Q)$(LLVM_STRIP) -g $@ > =20 > diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefil= e > index 8b3d87b82b7a2..f7313cc966a04 100644 > --- a/tools/bpf/runqslower/Makefile > +++ b/tools/bpf/runqslower/Makefile > @@ -60,8 +60,9 @@ $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(BPFTOOL) > $(QUIET_GEN)$(BPFTOOL) gen skeleton $< > $@ > =20 > $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT) > - $(QUIET_GEN)$(CLANG) -g -O2 -target bpf $(INCLUDES) \ > - -c $(filter %.c,$^) -o $@ && \ > + $(QUIET_GEN)$(CLANG) -g -O2 -target bpf $(INCLUDES) \ > + -fno-stack-protector \ > + -c $(filter %.c,$^) -o $@ && \ > $(LLVM_STRIP) -g $@ > =20 > $(OUTPUT)/%.o: %.c | $(OUTPUT) >=20 > --- > base-commit: 97ec4d559d939743e8af83628be5af8da610d9dc > change-id: 20230114-bpf-918ae127b77a >=20 > Best regards,