From nobody Thu Aug 28 13:55:22 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cCNFl15g7z663vK; Thu, 28 Aug 2025 13:55:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cCNFk61t5z3vvp; Thu, 28 Aug 2025 13:55:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756389322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=48N0bKqk03tq95zbeviugH2M5UhHhI1n1VNcHHUQPpQ=; b=j9JmYpQY8PXnaOiEhMvvHHwx3RPZdo63wAUB5t3/by0hCjS5oHlAH9EOrTMXfzB1DPKgWM +alwmYB/2uHPZfZ0Z8yDDyrTDxxtFDM7jDX/UlXIa4geQrIKc1vvqSPBO6jTjQvECVZcbz mmMSK/XPujYwJO4JKcGVk0aA/pZkg/IPTG4k28I6knGX4c/0/uaGDuz0WEv8Q+8QhbB0LB SbI21Z1oCWAX0XQNrJc1lbxsltgOJxfqMbvLDBz8LM6KbYmgpynsOPTB2+E/76gXIe3IOD XwG0wzXfM9u3bO67x9YcXx+H4J4cvdp2ZkxlcQI9ZOqML/jyBUzHQ5Yy2pFFOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756389322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=48N0bKqk03tq95zbeviugH2M5UhHhI1n1VNcHHUQPpQ=; b=KDIi9NY6/UAocpg/vf44RSerHzKLdjAOd8te92a5jY0hK0D3BzhTn9be/VYhLqzVEm2Toz A+DIQ7O4ko6BUjHMhZIlIWRJKO8IRwtqVC0SgErIyGNWksxT7EVHgDMK8iywCbpUTOzgh8 d6CcwXrj3zNp9hxr5TrpVaXp6AQVjSxN3WUOncKd6DwpTk6Ji7DFQhOgFiCnZJOMF38M8N gxsg50fzcRwqjMa+ZDOZKChtd2WyhA0VH3EI3PpuYINuHjjduejAp09kzvOXe94M/ndQCm swVynYBHqheC42+bwa+q5jBW2XHr6qUYcsjs+Dmwptp1ZrDk9rCPVgXh9EQ2Lg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756389322; a=rsa-sha256; cv=none; b=ZHu5SXcFndiWkSHcJbT2ZpLKIPzuwW3a+L4ZoAq65KXITiTUTZn0OnSVL1pNujxql6H1vg 8E4Y/IQ7inR+3c+ggy9jqM8bVhLWkw8l8BVteurSe2IQjLv/FoyKe7YI09wG6s4a1o1ZK6 s20oIssUh2HOJJnFAyxFwwd6lpJJXKEShAaQhTiYnH7CuHICzThvvmWlveBQRheQr5FY5Y 3aQauSgDyMYeAZx6srSehA8aXNlDVo+OSwf26Inri7jDjwYOK9ay3PTrn4z/K/aIoGy6BW oc7ya+Wsv8V0imDhutCMKwuzFBpbfiubUWLH5YYvtAwXSiEbalZ8ZcccdK98Qw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cCNFk5QNVz1B7V; Thu, 28 Aug 2025 13:55:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57SDtMKn040580; Thu, 28 Aug 2025 13:55:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57SDtMPF040577; Thu, 28 Aug 2025 13:55:22 GMT (envelope-from git) Date: Thu, 28 Aug 2025 13:55:22 GMT Message-Id: <202508281355.57SDtMPF040577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Maxim Sobolev Subject: git: 05fe8c88e1ce - stable/14 - libc: lib_malloc_aligned(): add a missing NULL check List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sobomax X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 05fe8c88e1ce7904a14997a5e5e253d92fbe3e42 Auto-Submitted: auto-generated The branch stable/14 has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=05fe8c88e1ce7904a14997a5e5e253d92fbe3e42 commit 05fe8c88e1ce7904a14997a5e5e253d92fbe3e42 Author: Maxim Sobolev AuthorDate: 2024-12-08 19:08:43 +0000 Commit: Maxim Sobolev CommitDate: 2025-08-28 13:54:34 +0000 libc: lib_malloc_aligned(): add a missing NULL check For some reason return value of the __je_bootstrap_malloc() is not checked and then de-referenced few lines below, causing a SEGV if an early allocation fails. MFC after: 1 month (cherry picked from commit 1e99be5dcda222d47a77715e190a381a14f46ece) --- lib/libc/gen/tls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 3c1a5472c0e5..30b4fc583c98 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -113,6 +113,8 @@ libc_malloc_aligned(size_t size, size_t align) align = sizeof(void *); mem = __je_bootstrap_malloc(size + sizeof(void *) + align - 1); + if (mem == NULL) + return (NULL); res = (void *)roundup2((uintptr_t)mem + sizeof(void *), align); *(void **)((uintptr_t)res - sizeof(void *)) = mem; return (res);