From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by sourceware.org (Postfix) with ESMTPS id 788F43858403 for ; Mon, 25 Jul 2022 09:19:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 788F43858403 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 ams.source.kernel.org (Postfix) with ESMTPS id 92B67B80DE0 for ; Mon, 25 Jul 2022 09:19:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F97C36AE2 for ; Mon, 25 Jul 2022 09:19:09 +0000 (UTC) Received: by mail-vs1-f51.google.com with SMTP id 125so10081524vsx.7 for ; Mon, 25 Jul 2022 02:19:09 -0700 (PDT) X-Gm-Message-State: AJIora9qQ3LxsRZmb6fF6bANwUOMPXNnrnoehhAWk47NChQRyswDAmjW PWT9eHDuFS7qhSEQtSn1ekhGMB6ee5kJllhF+SA= X-Google-Smtp-Source: AGRyM1uMEm6el9y/wJ4BrBTuglLdMA2Rg/tpkMjSPCulAHMOvW9vNp6Jdv9CqnCsUuUiqcMBZup2+Kplbbhs+uOBoGg= X-Received: by 2002:a05:6102:dd4:b0:358:62b5:20a6 with SMTP id e20-20020a0561020dd400b0035862b520a6mr530332vst.84.1658740748476; Mon, 25 Jul 2022 02:19:08 -0700 (PDT) MIME-Version: 1.0 References: <20220725022227.16266-1-liuzhensong@loongson.cn> <4a264fe57282c1a191204775ffe033512240d2eb.camel@xry111.site> <32a2cb15-adf7-7f31-8682-f47728c83953@xen0n.name> In-Reply-To: <32a2cb15-adf7-7f31-8682-f47728c83953@xen0n.name> From: Huacai Chen Date: Mon, 25 Jul 2022 17:18:55 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] LoongArch: Set defaults to exec stack 0. To: WANG Xuerui Cc: Andreas Schwab , Xi Ruoyao , maskray@google.com, caiyinyu@loongson.cn, Xu Chenghua , liuzhensong , binutils@sourceware.org, chenglulu@loongson.cn Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 09:19:13 -0000 Hi, all, On Mon, Jul 25, 2022 at 5:17 PM WANG Xuerui wrote: > > On 2022/7/25 16:35, Andreas Schwab via Binutils wrote: > > On Jul 25 2022, Xi Ruoyao wrote: > > > >> The doc of elf_backend_default_execstack says: > >> > >> /* True if an object file lacking a .note.GNU-stack section > >> should be assumed to be requesting exec stack. At least one > >> other file in the link needs to have a .note.GNU-stack section > >> for a PT_GNU_STACK segment to be created. */ > >> > >> So I think it only controls the default behavior of bfd library and is > >> not related to the kernel? > > The kernel always controls the ultimate decision. > > > > It also means that if no input file has a GNU-stack note, no > > PT_GNU_STACK segment is created for the output, in which case the kernel > > default (which is PF_X for loongarch) applies. > > > > The value of DEFAULT_STACK_PERMS in glibc must also agree with the > > kernel. > > > Well, actually the kernel behavior seems to be overlooked during the > upstreaming process. No sane architecture in 2022 should have executable > stacks in the beginning. > > We'll fix this before Linux 5.19 is released, fortunately there's the > rc8 giving us the chance. Compatibility should not be a problem, as no > modern program should rely on the incorrect behavior, and the new-world > is still not widely adopted (read: <50 installations worldwide) so any > breakage can be chased down and fixed. > > Thanks very much for spotting this. Thank you very much, I will fix this in kernel side. Huacai >