From patchwork Mon Jan 2 10:09:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720686 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls6w1wL2z23fV for ; Mon, 2 Jan 2023 21:09:59 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D291385843D for ; Mon, 2 Jan 2023 10:09:52 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 7C6DA3858D38 for ; Mon, 2 Jan 2023 10:09:42 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 8ED912014E; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C6rPJ-ZbqOjU; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 362D72014A; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00Belv-2Q; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 1/7] htl: Check error returned by __getrlimit Date: Mon, 2 Jan 2023 11:09:32 +0100 Message-Id: <20230102100938.2778311-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- htl/pt-create.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htl/pt-create.c b/htl/pt-create.c index 5d37edbbff..d3847b69ea 100644 --- a/htl/pt-create.c +++ b/htl/pt-create.c @@ -136,8 +136,8 @@ __pthread_create_internal (struct __pthread **thread, if (stacksize == 0) { struct rlimit rlim; - __getrlimit (RLIMIT_STACK, &rlim); - if (rlim.rlim_cur != RLIM_INFINITY) + err = __getrlimit (RLIMIT_STACK, &rlim); + if (err == 0 && rlim.rlim_cur != RLIM_INFINITY) stacksize = rlim.rlim_cur; if (stacksize == 0) stacksize = PTHREAD_STACK_DEFAULT; From patchwork Mon Jan 2 10:09:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls7f0bD1z23fS for ; Mon, 2 Jan 2023 21:10:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 00FFE38983B6 for ; Mon, 2 Jan 2023 10:10:28 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id D27823858433 for ; Mon, 2 Jan 2023 10:09:45 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id D839E20151; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vRYBjIYCoK8W; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 364FE2014C; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00Bely-2W; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 2/7] hurd _S_msg_add_auth: Initialize new arrays to 0 Date: Mon, 2 Jan 2023 11:09:33 +0100 Message-Id: <20230102100938.2778311-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" If make_list fails, they would be undefined, and freeup with free uninitialized pointers. --- hurd/hurdauth.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hurd/hurdauth.c b/hurd/hurdauth.c index 9086e9484c..25cc8ee88d 100644 --- a/hurd/hurdauth.c +++ b/hurd/hurdauth.c @@ -101,21 +101,24 @@ _S_msg_add_auth (mach_port_t me, __mutex_lock (&_hurd_id.lock); _hurd_check_ids (); -#define MAKE(genaux,uidgid) \ - make_list (&new ## genaux ## uidgid ## s, \ +#define MAKE(genaux,uidgid) ({ \ + new ## genaux ## uidgid ## s = 0; \ + nnew ## genaux ## uidgid ## s = 0; \ + make_list (&new ## genaux ## uidgid ## s, \ &nnew ## genaux ## uidgid ## s, \ _hurd_id.genaux.uidgid ## s, \ _hurd_id.genaux.n ## uidgid ## s, \ genaux ## uidgid ## s, \ - n ## genaux ## uidgid ## s) + n ## genaux ## uidgid ## s); \ +}) err = MAKE (gen, uid); if (!err) - MAKE (aux, uid); + err = MAKE (aux, uid); if (!err) - MAKE (gen, gid); + err = MAKE (gen, gid); if (!err) - MAKE (aux, gid); + err = MAKE (aux, gid); #undef MAKE __mutex_unlock (&_hurd_id.lock); From patchwork Mon Jan 2 10:09:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720687 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls6y5Fp1z23dV for ; Mon, 2 Jan 2023 21:10:02 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35B09385B501 for ; Mon, 2 Jan 2023 10:09:52 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 6DA143858D32 for ; Mon, 2 Jan 2023 10:09:42 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 5BC8120150; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MsQVSSzwYzEQ; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 51F7B2014E; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00Bem1-2e; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 3/7] hurd hurdstartup: Initialize remaining fields of hurd_startup_data Date: Mon, 2 Jan 2023 11:09:34 +0100 Message-Id: <20230102100938.2778311-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" In case we don't have a bootstrap port or __exec_startup_get_info failed, we should avoid leaking uninitialized fields of data. --- hurd/hurdstartup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hurd/hurdstartup.c b/hurd/hurdstartup.c index e9cd8a360b..d312766052 100644 --- a/hurd/hurdstartup.c +++ b/hurd/hurdstartup.c @@ -145,6 +145,11 @@ _hurd_startup (void **argptr, void (*main) (intptr_t *data)) data.portarraysize = 0; data.intarray = NULL; data.intarraysize = 0; + data.stack_base = 0; + data.stack_size = 0; + data.phdr = 0; + data.phdrsz = 0; + data.user_entry = 0; } else if ((void *) &envp[envc + 1] == argv[0]) { From patchwork Mon Jan 2 10:09:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls7N0QF5z23fV for ; Mon, 2 Jan 2023 21:10:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B1E903889E06 for ; Mon, 2 Jan 2023 10:10:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id DA0B43858C50 for ; Mon, 2 Jan 2023 10:09:42 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id C70582014D; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dK3wzDhtQDvk; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 05E2B20151; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00Bem7-2l; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 4/7] htl: Drop duplicate check in __pthread_stack_alloc Date: Mon, 2 Jan 2023 11:09:35 +0100 Message-Id: <20230102100938.2778311-5-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- sysdeps/mach/htl/pt-stack-alloc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sysdeps/mach/htl/pt-stack-alloc.c b/sysdeps/mach/htl/pt-stack-alloc.c index cb1807cd16..d8c88fc389 100644 --- a/sysdeps/mach/htl/pt-stack-alloc.c +++ b/sysdeps/mach/htl/pt-stack-alloc.c @@ -57,9 +57,6 @@ get_stack: return EAGAIN; } - if (base >= VM_MAX_ADDRESS) - return EAGAIN; - next_stack_base = base + stacksize; (*stackaddr) = (void *) base; From patchwork Mon Jan 2 10:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls7R2Mklz23fS for ; Mon, 2 Jan 2023 21:10:27 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 847833893657 for ; Mon, 2 Jan 2023 10:10:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id C6EE63858C53 for ; Mon, 2 Jan 2023 10:09:44 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 0E6F02014C; Mon, 2 Jan 2023 11:09:42 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I4esEny8WMtY; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 75F402014F; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00BemB-2r; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 5/7] hurd: Make dl-sysdep __sbrk check __vm_allocate call Date: Mon, 2 Jan 2023 11:09:36 +0100 Message-Id: <20230102100938.2778311-6-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The caller won't be able to progress, but better crash than use random addr. --- sysdeps/mach/hurd/dl-sysdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 2f022ee90c..84fe966efe 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -699,7 +699,8 @@ void *weak_function __sbrk (intptr_t increment) { vm_address_t addr; - __vm_allocate (__mach_task_self (), &addr, increment, 1); + if (__vm_allocate (__mach_task_self (), &addr, increment, 1)) + return NULL; return (void *) addr; } From patchwork Mon Jan 2 10:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720688 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls763GRDz23dw for ; Mon, 2 Jan 2023 21:10:10 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34866383569C for ; Mon, 2 Jan 2023 10:10:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id C93513858C60 for ; Mon, 2 Jan 2023 10:09:44 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 2057F2014F; Mon, 2 Jan 2023 11:09:42 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qeOuEK6wg8D2; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 0DF3220152; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00BemF-2x; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 6/7] hurd fcntl: Make LOCKED macro more robust Date: Mon, 2 Jan 2023 11:09:37 +0100 Message-Id: <20230102100938.2778311-7-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- sysdeps/mach/hurd/fcntl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c index ea35e9b977..48608493a1 100644 --- a/sysdeps/mach/hurd/fcntl.c +++ b/sysdeps/mach/hurd/fcntl.c @@ -109,7 +109,7 @@ __libc_fcntl (int fd, int cmd, ...) /* Set RESULT by evaluating EXPR with the descriptor locked. Check for an empty descriptor and return EBADF. */ -#define LOCKED(expr) \ +#define LOCKED(expr) do { \ HURD_CRITICAL_BEGIN; \ __spin_lock (&d->port.lock); \ if (d->port.port == MACH_PORT_NULL) \ @@ -117,7 +117,8 @@ __libc_fcntl (int fd, int cmd, ...) else \ result = (expr); \ __spin_unlock (&d->port.lock); \ - HURD_CRITICAL_END; + HURD_CRITICAL_END; \ +} while(0) case F_GETFD: /* Get descriptor flags. */ LOCKED (d->flags); From patchwork Mon Jan 2 10:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1720691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nls7M65hXz23fS for ; Mon, 2 Jan 2023 21:10:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A7BC3858423 for ; Mon, 2 Jan 2023 10:10:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id B5E273858C83 for ; Mon, 2 Jan 2023 10:09:42 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 4874320153; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JHinBtBLvG7G; Mon, 2 Jan 2023 11:09:41 +0100 (CET) Received: from begin (lfbn-bor-1-376-208.w109-215.abo.wanadoo.fr [109.215.91.208]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 97D0A20150; Mon, 2 Jan 2023 11:09:40 +0100 (CET) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1pCHlD-00BemI-32; Mon, 02 Jan 2023 11:09:39 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 7/7] hurd getcwd: Fix memory leak on error Date: Mon, 2 Jan 2023 11:09:38 +0100 Message-Id: <20230102100938.2778311-8-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> References: <20230102100938.2778311-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: 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: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" --- sysdeps/mach/hurd/getcwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index d11f744b2c..6ca364a418 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -274,6 +274,8 @@ __hurd_canonicalize_directory_name_internal (file_t thisdir, /* Set errno. */ (void) __hurd_fail (err); lose: + if (orig_size == 0) + free (file_name); cleanup (); return NULL; }