From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A1CE21F66F for ; Wed, 18 Nov 2020 14:14:17 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B760395C877; Wed, 18 Nov 2020 14:14:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B760395C877 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605708856; bh=OfgWpQogPODoUpemLHxCu0mME70J8uETgoo/VuoCFoE=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=W771diAr2BvkSa6x7KBGYDWtOrEMstqjsk6xOCaeYaiG1A61AY8fioSjANcoj0qeI HHCpffZXjoY+fvl/LUSONVZlKDu/gfyVHq8y9vyzO1H3xQOq10btAZmnfdsCmzZ+h/ M+6tw66XyW4JLtNzOOGBVlYMz+MVb+mSWT/bPumw= Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by sourceware.org (Postfix) with ESMTPS id 0A6E53854817 for ; Wed, 18 Nov 2020 14:14:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0A6E53854817 Received: by mail-oi1-x241.google.com with SMTP id o25so2323728oie.5 for ; Wed, 18 Nov 2020 06:14:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OfgWpQogPODoUpemLHxCu0mME70J8uETgoo/VuoCFoE=; b=qoC1XKGDC/UHIbw6uBwPsPI/S8WxdNH3+ayFqtpJYeMeMGibXLfMeExOsnqGtc4Mrj r0HqOjFvjjlnTm9MECWoR2rsSp/ifhJq7wjJbcp9+TwztT54qM6ddr4Pzt+STlt1A9pg UzNW/iw9R6DsjpRPUSEFCE+9g36RXBdoYe+Z+6Zcs4r9270tnalRWvaSjlgATls8h7Fg tuM6oyJ7J9HMIiPHVe21wC2kjqyGIdhsltdKxmsRrrwwlSE6M2cPIeP52jyCctQTRAAJ U7IuKtXT4InXhwfUzOPF+hFQTRCH9CWNd149/lrFRG70r7VWnaLLVI9w1ozK5EIf513m Ay0A== X-Gm-Message-State: AOAM5304juz8rSEF3vsG+Jp72O+UPP7CVGSk7r35e8w8Ya0EICQ8b5AD BkmP5TYL+/UZuAfel8/Y3v4SlH2o4UWNOb3KXK0= X-Google-Smtp-Source: ABdhPJxK1hw4NeHQGigp2hz2JtyBQKQvRdHw9+Qqjmzj1sbga0PfMR2TGqCt+TwUzLKMdQ/yACYt0SKuvTBhU7nhYAY= X-Received: by 2002:aca:c70b:: with SMTP id x11mr178979oif.58.1605708851400; Wed, 18 Nov 2020 06:14:11 -0800 (PST) MIME-Version: 1.0 References: <20201014174659.GL32292@arm.com> <20201015115728.GA64160@gmail.com> <20201019150846.GP32292@arm.com> <20201020091912.GS32292@arm.com> <20201104165018.GE6882@arm.com> In-Reply-To: Date: Wed, 18 Nov 2020 06:13:35 -0800 Message-ID: Subject: Re: PING: V7 [PATCH] sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] To: Dave Martin Content-Type: text/plain; charset="UTF-8" X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: GNU C Library , Joseph Myers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Wed, Nov 4, 2020 at 9:48 AM H.J. Lu wrote: > > On Wed, Nov 4, 2020 at 8:50 AM Dave Martin wrote: > > > > On Mon, Nov 02, 2020 at 07:06:13PM -0800, H.J. Lu via Libc-alpha wrote: > > > On Tue, Oct 20, 2020 at 11:19 AM H.J. Lu wrote: > > > > > > > > On Tue, Oct 20, 2020 at 7:59 AM H.J. Lu wrote: > > > > > > > > > > On Tue, Oct 20, 2020 at 2:19 AM Dave Martin wrote: > > > > > > > > > > > > On Mon, Oct 19, 2020 at 02:32:35PM -0700, H.J. Lu via Libc-alpha wrote: > > > > > > > On Mon, Oct 19, 2020 at 8:08 AM Dave Martin wrote: > > > > > > > > > > > > > > > > On Thu, Oct 15, 2020 at 04:57:28AM -0700, H.J. Lu via Libc-alpha wrote: > > > > > > > > > > > > [...] > > > > > > > > > > > > > > > > > diff --git a/sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h b/sysdeps/unix/sysv/linux/x86/dl-minsigstacksize.h > > > > > > > > > > > > [...] > > > > > > > > > > > > > > > > > +/* Emulate AT_MINSIGSTKSZ with XSAVE. */ > > > > > > > > > > > + > > > > > > > > > > > +static inline void > > > > > > > > > > > +dl_check_minsigstacksize (void) > > > > > > > > > > > +{ > > > > > > > > > > > + /* NB: Default to a constant MINSIGSTKSZ. */ > > > > > > > > > > > + _Static_assert (__builtin_constant_p (MINSIGSTKSZ), > > > > > > > > > > > + "MINSIGSTKSZ is constant"); > > > > > > > > > > > + /* Return if AT_MINSIGSTKSZ is provide by kernel. */ > > > > > > > > > > > + if (GLRO(dl_minsigstacksize) != MINSIGSTKSZ) > > > > > > > > > > > + return; > > > > > > > > > > > > > > > > > > > > Couldn't the kernel actually yield MINSIGSTKSZ or a smaller value, say, > > > > > > > > > > if running on hardware that doesn't have AVX-512? > > > > > > > > > > > > > > > > > > > It is OK for MINSIGSTKSZ > AT_MINSIGSTKSZ. For _SC_SIGSTKSZ_SOURCE, > > > > > > > > > dynamic MINSIGSTKSZ is defined as sysconf (_SC_SIGSTKSZ) which is > > > > > > > > > > > > > > > > > > MAX (SIGSTKSZ, MAX (MINSIGSTKSZ, sysconf (_SC_MINSIGSTKSZ)) * 4) > > > > > > > > > > > > > > > > > > and dynamic MINSIGSTKSZ is always > MINSIGSTKSZ. > > > > > > > > > > > > > > > > > > > We might want a separate flag to indicate whether we obtained a value > > > > > > > > > > from the auxv, rather relying on MINSIGSTKSZ having this magic meaning. > > > > > > > > > > > > > > > > > > AT_MINSIGSTKSZ is the only way for GLRO(dl_minsigstacksize) != MINSIGSTKSZ. > > > > > > > > > > > > > > > > Yes, but reading AT_MINSIGSTKSZ doesn't guarantee that > > > > > > > > GLRO(dl_minsigstkszsize) != MINSIGSTKSZ, no? > > > > > > > > > > > > > > > > What if the value reported for AT_MINSIGSTKSZ is actually the same as > > > > > > > > MINSIGSTKSZ? This could be the case on some arches in future even if > > > > > > > > it's never true today. But the code here assumes that AT_MINSIGSTKSZ > > > > > > > > wasn't available in this case, and reverts to a fallback guess. > > > > > > > > > > > > > > Since the fallback tracks what the kernel does, if AT_MINSIGSTKSZ > > > > > > > is 2KB, the fallback will be 2KB or slightly larger. > > > > > > > > > > > > Well, I guess that should be safe. It still feels a bit like it works > > > > > > by accident, but I may be being too paranoid. > > > > > > > > > > Let me work on that. > > > > > > > > > > > > > Here is the updated patch to initialize GLRO(dl_minsigstacksize) > > > > to 0 on x86. > > > > > > > > > > PING: > > > > > > https://sourceware.org/pipermail/libc-alpha/2020-October/118843.html > > > > Because the signal context doesn't actually fit in mcontext_t any more > > (or, recursively, in ucontext_t), it would make sense to amend some of > > the ucontext-related functions at the same time, and force people > > towards this updated interface when building with _SC_SIGSTKSZ_SOURCE. > > That may be useful. > > > I'm aiming to get a draft proposal onto the list next week, if people > > can wait for that before deciding whether the two sets of changes should > > be coupled... > > > > Thanks. If there are no more comments, I will check in it together with https://sourceware.org/pipermail/libc-alpha/2020-October/118707.html on Friday, Nov 20. Thanks. -- H.J.