From patchwork Sun Oct 4 13:09:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Topi Miettinen X-Patchwork-Id: 40660 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 EAA913840C2F; Sun, 4 Oct 2020 13:10:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAA913840C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601817004; bh=S44FPJOmyoRv8UxjVoUc+bDsiWQ3cIN/H/TxCf9Tn9w=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=K5kGzXMnug2yXuekoud92WjkcsXRWXUDE/3I8UoaN273Vj0CEJWCfHUymk0IIPbav YJIemK6t3ulhv0oRGi148iB8r7/0cvOi1rQrE4IYcUdi7dbXHJgaQOTp1IW1uUteJ0 nck4uEuqXt8V8FmS91kucbj3FizvjNtC1kV+kc/4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by sourceware.org (Postfix) with ESMTPS id 19158384A882 for ; Sun, 4 Oct 2020 13:10:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19158384A882 Received: by mail-lj1-x242.google.com with SMTP id v23so4919772ljd.1 for ; Sun, 04 Oct 2020 06:10:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S44FPJOmyoRv8UxjVoUc+bDsiWQ3cIN/H/TxCf9Tn9w=; b=CStxRqxR0ZOPjGSvDp2OXulCVOvYSQnuE0S1nBdcv3D4Y6aNFiRH1o5ZxtgFFrDfhV srqHupLXXnNYulMMWewEa5ts483yMFoiHbERgU//5Xyzjxm23fpFCtbzkVO64f9CjMad PYvAinWfSFEQHvAP2FnU5lhrQuBQVmk1yxfT9Ne9EDnthq/vQP82dKqY15AZPZVw38db pEIZzEyyIsQBIB8oNURE8vht34y9lEBahLPRvwt1VO2Bb56Xqk4OdiKBcqZrG47JjfDu vxSTsHH8pFpb2pbE/Eqt0NCx3YmymhcLOjiijCbxv01ZikmJ3/ABq9B6rmQj3wcpzURl Q32w== X-Gm-Message-State: AOAM531tsNl4Kxo/qdMQeccl0t1Xegm+KlzNq+lsDiLxD7UIM4Xqxe6s f2yUivtV7Z5Q5eKZa6pTWJVNX4sU33A= X-Google-Smtp-Source: ABdhPJxvds9oxrGG6XMX4iBKS8JmaK7T7MXrnwFENuruQgagDZkQ8D+t57mxA5e3lg/O9oxa9iWrQA== X-Received: by 2002:a2e:7604:: with SMTP id r4mr2768330ljc.161.1601816999644; Sun, 04 Oct 2020 06:09:59 -0700 (PDT) Received: from localhost.localdomain (88-114-211-119.elisa-laajakaista.fi. [88.114.211.119]) by smtp.gmail.com with ESMTPSA id i7sm2264454ljb.44.2020.10.04.06.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2020 06:09:59 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 3/3] dl-sysdep: disable remaining calls to sbrk() Date: Sun, 4 Oct 2020 16:09:38 +0300 Message-Id: <20201004130938.64575-4-toiwoton@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201004130938.64575-1-toiwoton@gmail.com> References: <20201004130938.64575-1-toiwoton@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-Patchwork-Original-From: Topi Miettinen via Libc-alpha From: Topi Miettinen Reply-To: Topi Miettinen Cc: Topi Miettinen Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Since sbrk() is not used for memory allocations, there's no need to initialize the break anymore. RFC: how to do this properly? Removing frob_brk() entirely causes build to break with strange link problems. Signed-off-by: Topi Miettinen --- elf/dl-sysdep.c | 2 ++ sysdeps/unix/sysv/linux/dl-sysdep.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c index 854570821c..200cea3ca7 100644 --- a/elf/dl-sysdep.c +++ b/elf/dl-sysdep.c @@ -234,6 +234,7 @@ _dl_sysdep_start (void **start_argptr, if (GLRO(dl_platform) != NULL) GLRO(dl_platformlen) = strlen (GLRO(dl_platform)); +#if 0 if (__sbrk (0) == _end) /* The dynamic linker was run as a program, and so the initial break starts just after our bss, at &_end. The malloc in dl-minimal.c @@ -242,6 +243,7 @@ _dl_sysdep_start (void **start_argptr, will see this new value and not clobber our data. */ __sbrk (GLRO(dl_pagesize) - ((_end - (char *) 0) & (GLRO(dl_pagesize) - 1))); +#endif /* If this is a SUID program we make sure that FDs 0, 1, and 2 are allocated. If necessary we are doing it ourself. If it is not diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 90c9b1db2d..d2f64b1137 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -33,7 +33,9 @@ static inline void frob_brk (void) { +#if 0 __brk (0); /* Initialize the break. */ +#endif } # include