From nobody Mon Dec 15 12:03:19 2025 X-Original-To: bugs@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 4dVJc73Vdgz6L4Vp for ; Mon, 15 Dec 2025 12:03:19 +0000 (UTC) (envelope-from bugzilla-noreply@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 4dVJc72dzZz430B for ; Mon, 15 Dec 2025 12:03:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765800199; 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: in-reply-to:in-reply-to:references:references; bh=QsCDaiaWqusqb2wjbJ0wCi7dSlRlE945QrgjHixliSg=; b=jIGUxnJpYlHsFd7kgZL+WdigAJTmC/OYFVdNruBWIJitQ/bpRxb+HWJmRy3kDbj2niLsi4 kAzYpka5iN6+H3O7jESRSJxxugoE2T2TXSHX1+kBfm+A47I5lV/LmmsHet3pcYI/Mhngay HR+tisRi/5zvXKPpVqDEoDkuTbd19iPbSc862CLTr2FlJFOh9y7fYalCjlk+JiP9TWT4ie LDfAnP8e78wkUw4tThrLDk7qA76f2iAjWbYsQ08hyXXlhT0FBAIw/+1m4fcsfA2GQ276bU w5HZOMM4OCefuMiz8ssN+QU1K/5/0yav+V3XtcmqwzN2VnIcfnHZg8EHO5OhaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765800199; 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: in-reply-to:in-reply-to:references:references; bh=QsCDaiaWqusqb2wjbJ0wCi7dSlRlE945QrgjHixliSg=; b=aKW9aI7iplGkQgVYSy9jSApibNRWRfBqxYrr960YPQN9ChErSvaiXvX66bKvZ8bQf5nZSn lchHeVm3BdhWSr4Da+wnMI5GhYPh0HIppIA4bahmloo/w6wuR/G1Mc7DZxsk9h6tal9QCV roLMXha5aX9jqzjdOvS8mSHhu3vk3T/SkY1ylZoSylk94/v499u8Gi3cZ2ywcZAQ5yD8cL ouGR5+QileihtciH1miIRMY7BfRTCBqMDirTRdlpb2SmSTFdvzZdjt8He2BNLvSk9NsOJS cjK6mcBKurAYjaBV0k1/SdgQ2UgD2rjg9VVYVYoRgbawOtDEkt/CzxvmBs+0kw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765800199; a=rsa-sha256; cv=none; b=ca6wKuTea148ZUjNigoX++FYjJXImb6WHUEs40UQ6yapRP1Detv8unAQCSTBTxElErioZ4 Dt7WHx4ByJ49/ex9XBfmYzt0ANFjquRQrOoDS9WGnkEmAgKWrLS1xIvfXPk89t/Yq6Y9MH BQgTv2sHFJdZxlaD6zfEY0qsvMO+ftC1bOjat0gwKG/yfdc1UMZn7UEfOC7TDzcknAGjM8 nnd7HtiY/CXTLxa5IhZ9KhWv2F8FfgzvbR/tUiyoRtP+7t33vFzlb2ldhG1ML+ShNDSdno lfpH/tt4N//1a3N7TWPSyxH7TEIqko1OcMwbFO9lHyzh3HetX31gHqYijhnw+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4dVJc72Bv6z44J for ; Mon, 15 Dec 2025 12:03:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 5BFC3Jaa071040 for ; Mon, 15 Dec 2025 12:03:19 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 5BFC3JLZ071036 for bugs@FreeBSD.org; Mon, 15 Dec 2025 12:03:19 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 291677] FreeBSD 15.0 realloc does not set errno for large size values Date: Mon, 15 Dec 2025 12:03:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: brooks@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: brooks@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component cc assigned_to Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D291677 Brooks Davis changed: What |Removed |Added ---------------------------------------------------------------------------- Component|kern |bin CC| |brooks@FreeBSD.org Assignee|bugs@FreeBSD.org |brooks@FreeBSD.org --- Comment #1 from Brooks Davis --- Sigh. It looks like jemalloc refactored realloc() to use rallocx's interna= ls in the common case and didn't account for the need to set errno. The follo= wing untested patch likely fixes it (it might not be the best fix, but I think it does the job). Over all this doesn't give me great confidence in the correctness of this whole update. :( ``` diff --git a/contrib/jemalloc/src/jemalloc.c b/contrib/jemalloc/src/jemallo= c.c index e4b183d1a24d..30ad6bab44f0 100644 --- a/contrib/jemalloc/src/jemalloc.c +++ b/contrib/jemalloc/src/jemalloc.c @@ -3630,11 +3630,9 @@ je_realloc(void *ptr, size_t size) { if (likely(ptr !=3D NULL && size !=3D 0)) { void *ret =3D do_rallocx(ptr, size, 0, true); LOG("core.realloc.exit", "result: %p", ret); - return ret; } else if (ptr !=3D NULL && size =3D=3D 0) { void *ret =3D do_realloc_nonnull_zero(ptr); LOG("core.realloc.exit", "result: %p", ret); - return ret; } else { /* realloc(NULL, size) is equivalent to malloc(size). */ void *ret; @@ -3663,6 +3661,12 @@ je_realloc(void *ptr, size_t size) { LOG("core.realloc.exit", "result: %p", ret); return ret; } + + if (unlikely(ret =3D=3D NULL)) { + set_errno(ENOMEM); + } + + return ret; } JEMALLOC_ALWAYS_INLINE size_t ``` (Category reset to bin as this isn't a kernel issue) --=20 You are receiving this mail because: You are the assignee for the bug.=