Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1780250rwo; Wed, 2 Aug 2023 22:24:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEgvgpUIP2+ObtTMVFMzwb34W5qFiKiHMOSFytUOIxbuqV1PRvBTmI8wJOEWLSXDKKuYYYS X-Received: by 2002:a05:6512:32ce:b0:4fb:748f:604e with SMTP id f14-20020a05651232ce00b004fb748f604emr6929225lfg.36.1691040241852; Wed, 02 Aug 2023 22:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691040241; cv=none; d=google.com; s=arc-20160816; b=a/xXFBM2sCqt+yMLwIaMiRAL5oEYpjT+0a+F5LKR6U4nqdFzXTPph+FEwO3JxGal1r BRUSWPSWWdHCDVLL0JdDpfRZkIOVCuRW8yDxv4BJ0cKl+J8RFrKhKG1QXafIW6I1TIVv zadQrZhuiYlC/KCV7NakZ10d3T1uJyoDfwwa1oueE9/it0h1h4g6L+KT/kPN2/fK862q FdQzhoj2JbQOIbUNoimM3bUiHmrA/c1CRMZw9DmVavLWoV+dtmfl4rKTYV3gX4gLeddj uzLey0ncdelNVYaXlGoKHmtXdyDeeOQk9RQIl51npnTxGkXju2l+kAEIoPsacKHIWSNx J3qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EGq0YwzF2YmFCISjdz8YQ2qe+NcyD3KeK9hpZW1a4dE=; fh=YkDM8JXgK93THE6km+5GPCPlMnvTq8ePSDXNvUztGgg=; b=cgEkznrHHTG7AjCyxSZ1FlEucTnbp7PaQsvsr1SjG2qIyC74K93AU55C9Ze0R/NZDE Xf1/2QTe5l0dR5I1WcnrjQm3jAxKuZe8oZtSqe7G+gUyuvSvRiftlQWKSyb4Ij131Itu Fl4EmB4MKLnFyjNeNMvtv+fRRL+4V1pIreA6Sd2W/VF8HmlsosqfOUjRQsCP9DtWfS7G bHayq7RbDusdgHvrjJYfvF1yd9umYQhdjnxtmkWyTPE0KKr9qOSIJX6e+Si8yec/OhUn 7bLHbAgAeb3JTWXFM+E8PUsAWJIUWunQZqZGZxj3KrUpbcceuNnaVp8XFOSIkon+/7bb whnw== ARC-Authentication-Results: i=1; mx.google.com; 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 p21-20020aa7d315000000b0052228ec4a89si10859399edq.65.2023.08.02.22.23.38; Wed, 02 Aug 2023 22:24:01 -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; 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 S231656AbjHCEhf (ORCPT + 99 others); Thu, 3 Aug 2023 00:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbjHCEhe (ORCPT ); Thu, 3 Aug 2023 00:37:34 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52D8310CA; Wed, 2 Aug 2023 21:37:32 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 3734bKpE024095; Thu, 3 Aug 2023 06:37:20 +0200 Date: Thu, 3 Aug 2023 06:37:20 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: thomas@t-8ch.de, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org Subject: Re: [PATCH v4 08/12] selftests/nolibc: add test support for ppc Message-ID: <20230803043720.GA24073@1wt.eu> References: <20230803020533.GA23704@1wt.eu> <20230803025855.6925-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230803025855.6925-1-falcon@tinylab.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Thu, Aug 03, 2023 at 10:58:55AM +0800, Zhangjin Wu wrote: > Yes, ppc series at first, will renew it today. let's delay the whole tinyconfig > series (include part1) in v6.7, we have no enough time to test them carefully > for v6.6. Thanks. > > > > > Further compared the preprocessed files, found the root cause is the new > > > > > compiler using 'no_stack_protector' instead of > > > > > '__optimize__("-fno-stack-protector")'. And the attribute 'no_stack_protector' > > > > > breaks our "omit-frame-pointer" like the failure with '-O0' we fixed before. > > > > > > > > > > I checked some of the other architectures, they didn't have the same issue, but > > > > > test shows the 'no_stack_protector' attribute does have such compability issue > > > > > here. > > > > > > > > > > I learned the commit message of tools/include/nolibc/compiler.h, seems > > > > > __optimize__("-fno-stack-protector") is enough for all of the nolibc supported > > > > > architectures? is it ok for us to simply give up 'no_stack_protector' > > > > > eventully? otherwise, we should manually disable 'no_stack_protector' for > > > > > ppc32: > > > > > > > > > > #define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector"))) > > > > > > > > > > > > > Hello, any suggestion here? ;-) > > > > > > Patience :-) > > > > > > no_stack_protector is the offically documented mechanism to disable > > > stack protector for a function. As it works for all other architectures > > > this seems like a compiler bug. > > > > Or a limitation. To be honest we're playing with compiler limits by > > adjusting their optimizations per function. But as long as we don't > > break what currently works, we can accept to have some limits in a first > > version (e.g. if ppc32 doesn't support -O0 for now it's not dramatic). > > Also, some other archs use optimize("Os", "omit-frame-pointer")), maybe > > that's needed there as well. > > > > Since it is really related, let's summarize yesterdays's further test here for > a reference: > > Yesterday's test result on randomly chosen x86_64 and riscv64 shows, > from at least gcc 12.3.0 (may differs from archs), even with > optimize("Os", "omit-frame-pointer")), whatever with or without > '-fno-stack-protector', -O0 forbids the per function's > "omit-frame-pointer" as the doc [1] describes (as we discussed before), > that means some imtermediate gcc versions deviate from their docs and > now, the latest gcc version come back to follow its doc [1] and become > even more strict and then breaks our optimize("Os", > "omit-frame-pointer") workaround eventually: > > Most optimizations are completely disabled at -O0 or if an -O level > is not set on the command line, even if individual optimization > flags are specified. Note that the quoted paragraph above is mostly independent. The point here is that optimize("-Os") seems to be ignored then -O0 is passed on the command line. But I'm not that much surprised, because as we said, changing optimizations on the fly is tricky given that some have effects beyond just a function. > So, it is ok for us to simply ignore -O0 currently, let's work on them > in v6.7. Yeah I'm fine with this. In the worst case those using -O0 can also avoid using stack-protector. > > > If we want to work around it I would prefer to have both attributes. > > > > Also if you remember we also used to have a work-around for the > > function's entry code consisting in renaming _start and having a _start > > pointer in the asm code itself. That can remain an option to experiment > > with later. > > Yes, the 'asm' style of _start may be a choice to prevent gcc touching > our startup code. That was the case. We had an earlier version where _start was a label inside the asm statement, resulting in some unused prologue and epilogue for the function around that code. It was a bit ugly and I think it had some shortcomings but we may go back to that later if it brings some value. Willy