From patchwork Sat Jan 29 02:37:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Kelley X-Patchwork-Id: 50562 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2EC3A382C404 for ; Sat, 29 Jan 2022 02:38:47 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.ziglang.org (mail.ziglang.org [108.61.23.47]) by sourceware.org (Postfix) with ESMTPS id F3A50385841D for ; Sat, 29 Jan 2022 02:37:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F3A50385841D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ziglang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ziglang.org From: Andrew Kelley DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ziglang.org; s=mail; t=1643423875; bh=UlN1EUIjLlANcevwBma3VxlmY9L84aU6G6pe9fZbJ/M=; h=From:To:Cc:Subject:Date; b=Ak3cn9wbJOmwjsKQrUgghQkcIIJEfuKIyrMS0b4niE47/p+18kQT8e6cGNjv16Qup +D/fBuQWszvzAC/7T/PAcsUox00LybJ9QN84roh2rb/9junMZ6KVp8g2L/Hu6wjSqJ SZC8X/eo1Lt+3jJ1WQqrfRbK/Qitowdo8MlAJcpg= To: libc-alpha@sourceware.org Subject: [PATCH] features: version-gate _DYNAMIC_STACK_SIZE_SOURCE Date: Fri, 28 Jan 2022 19:37:27 -0700 Message-Id: <20220129023727.1496360-1-andrew@ziglang.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , Cc: Andrew Kelley Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Without this patch, software compiled against glibc 2.34 headers but then executed on a system with an older glibc version will attempt to invoke `sysconf(_SC_SIGSTKSZ)` when MINSIGSTKSZ or SIGSTKSZ are used. On glibcs older than 2.34, this will return -1 (with an errno of EINVAL), effectively causing MINSIGSTKSZ and SIGSTKSZ to have the value of -1. This patch version-gates the _DYNAMIC_STACK_SIZE_SOURCE preprocessor definition so that this problem cannot occur. Downstream patch: https://github.com/ziglang/zig/commit/39083c31a550ed80f369f60d35791e98904b8096 --- include/features.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/features.h b/include/features.h index ab2b2caac4..77a8f8cc32 100644 --- a/include/features.h +++ b/include/features.h @@ -220,8 +220,10 @@ # define _DEFAULT_SOURCE 1 # undef _ATFILE_SOURCE # define _ATFILE_SOURCE 1 -# undef _DYNAMIC_STACK_SIZE_SOURCE -# define _DYNAMIC_STACK_SIZE_SOURCE 1 +# if __GNUC_PREREQ (2,34) +# undef _DYNAMIC_STACK_SIZE_SOURCE +# define _DYNAMIC_STACK_SIZE_SOURCE 1 +# endif #endif /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,