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 [8.43.85.97]) (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 F1D381F66F for ; Tue, 3 Nov 2020 03:06:53 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8A12386F036; Tue, 3 Nov 2020 03:06:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8A12386F036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1604372812; bh=ELdzyed2+gHH75Co19SS2bpEkfeVK9f7jMYaaATYaqs=; 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=RFetLT/85AYtQ6l4TRKc7trDRalqnKYdppHp9O/UQsKaH1/8r/DmEHbOb5kHD/c6I rIwmAaurPrpk9Oxgui/wOkfHiySVZ2tSy/J+GygUynvtSxIPQx+5zXd3aAfDFENFPM 4mxUR0OOXSmvZMA7UGaPIfEwjPnzzwAUOlK7Fsbo= Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by sourceware.org (Postfix) with ESMTPS id 147033858001 for ; Tue, 3 Nov 2020 03:06:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 147033858001 Received: by mail-ot1-x341.google.com with SMTP id g19so5270993otp.13 for ; Mon, 02 Nov 2020 19:06:50 -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=ELdzyed2+gHH75Co19SS2bpEkfeVK9f7jMYaaATYaqs=; b=gy/oi3qhoQYzD76iF2ys/ENf3NO2y+7mGk1on1WH/93p0LdjOX0jvbgOxDBXH7Pvj9 j+FVSwGRcooU5bvnnblHmyUzFgDZ+BZA6+Q4z+a9XAlzgQgSwc9m2rgkcG8FNrrAwcrm md51gau+ZG3GqEKXmCVLockkDynOmjOdWQhmG2A90qYrTinoJipk3O2znxaNv0loyKMR DhCr8VdNnwAqHy9bwL4s/v3zknkgUFEzHPF8QFMo/jcHH533zmdB5m6JA8KBvHJnWvo4 VueRoMC+owKlbjO7jQ4tzm0ZoB+hmPwLfXGJVGqdpuZAIMQWeoM1lu4Lkx7YguM4UyRm OT5Q== X-Gm-Message-State: AOAM5305AiwiYnfqlgkhk3NpqhoZo1BYaPojHuzb2bdJpQFuOA+9jb3n kj0CVchZSpV6CvXRROJoqhdBlaess4B07Suwp2U= X-Google-Smtp-Source: ABdhPJzgcMdkOJqMMiey5U/tRYRvxL4kIL50F22Rqd1KPhsmnMffVZMYHwnmCCMTjbydsHdVCfQtp4i32EZN9l78ZFk= X-Received: by 2002:a9d:4703:: with SMTP id a3mr14604389otf.179.1604372809438; Mon, 02 Nov 2020 19:06:49 -0800 (PST) MIME-Version: 1.0 References: <20201010121935.3263605-1-hjl.tools@gmail.com> <20201014174659.GL32292@arm.com> <20201015115728.GA64160@gmail.com> <20201019150846.GP32292@arm.com> <20201020091912.GS32292@arm.com> In-Reply-To: Date: Mon, 2 Nov 2020 19:06:13 -0800 Message-ID: Subject: 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 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 -- H.J.