From nobody Tue Sep 29 18:58:39 2026 X-Original-To: dev-commits-src-main@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 4hvSBR6SbPz6txyW for ; Tue, 29 Sep 2026 18:58:39 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvSBR5lfrz4KtZ for ; Tue, 29 Sep 2026 18:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790708319; 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=tacTkiDM/D69oR0gZqkhi/0/yJeuhC1th2FFdtRjejU=; b=mxzhOcXskiyZ3WzApp5FjwTQkQQurfQhMPs4RgG2cI1dzA9hp/D2StN6FY1MZFu7W6nHGo K9xtcIqtgyfmS2dgMyf7QC210Zmk0qw3nU+Iza8NiAjawCyzYCql/vb+NOir053zVzg89v Z2S9QQCUGijV7KZxfktBFwSJjH+H7IPTsrL5QicRlSRy8aonPVTM6qOau7GL1lt/jsyjo6 PIfHhdfCAPAcBtcH65kEEuV6sbdSohgVScf6KgmtfGFZ3/nvZVHiUtQz9hs6kaEMPI8+qd Cc4tudDknMCLuX6DeojfHy2gI8qkx70eE1dUh25FEwlG6SNjGf1hIuYUX7tCAg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790708319; b=hxIGcR6ngFoPEILyjfWihwwk6t9pu4MFXlurgkwKYBmBSOEYnW6tBq4DByaf1uo2TZ6bWQ skw8UMRxFf3DiIy6FilQjelJGrypPBCO5DxxY/2t8cp9LXjyLQXutCMo8AnLvSzMHuWa6i jHLTzZw+jiyHRYkpV10VS8DP7rk6M036pv4NqMqmvfwdiDCNSCI8Di/xHGMqG/jkeXShu9 PL7uCfLyphW6zuTiDiwCE+fcG9647r/Y2JUdtuyTbYDq/Nt16unKWZRdBEdWTRRJelZHYu 0tDLG3VMAkizTmpS0dbwaC14y+CR5OY4yJdydTmrr2mMWoFiR5Q3k1ESH7WSmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790708319; 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=tacTkiDM/D69oR0gZqkhi/0/yJeuhC1th2FFdtRjejU=; b=NtVov3QGxEkoj6Bf6Hu/6lzGEHceWc/Crrv4Xy2jiv65a0lcC6XBsLrMeZ+1i9Jo0q4avs P0/BJmCweNpdXlmsujqmqBELfFH0ENmWoKeQNMgNRxWwWQ1WpCt9xjKHRwsG8ia4m82oFy Wt45Fb6OX4KvlF4RyXzVG9Nx1IFf6FP8724sjh42R3081/QvLa0rVkPzfEngdjKhcC7/LG as/S/wrvQC+0+StUdWTUGxh86F70iFbDRAp81uyK8RJvLYpLHPujeyIFOluwKes6sM8yNs qMyzioAfppnw5uWPy5mqYnk2NZyITXIulwpCdMr0MmLq9ngiWSEphZV2IphbJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hvSBR4pYRz1PbW for ; Tue, 29 Sep 2026 18:58:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 427a1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 18:58:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f15642e24db7 - main - imgact_aout: Widen the overflow checks in exec_aout_imgact() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f15642e24db7d16c63ce484924d9075926dbf58a Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 18:58:39 +0000 Message-Id: <6abc0a5f.427a1.6337edb4@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f15642e24db7d16c63ce484924d9075926dbf58a commit f15642e24db7d16c63ce484924d9075926dbf58a Author: Mark Johnston AuthorDate: 2026-09-29 18:56:22 +0000 Commit: Mark Johnston CommitDate: 2026-09-29 18:56:22 +0000 imgact_aout: Widen the overflow checks in exec_aout_imgact() I suspect this overflow check isn't needed at all, at least today, since vm_map_insert() will detect wraparound when it creates segments (and even a check against UINT_MAX is too loose, since the max user address is AOUT32_USRSTACK == 0xbfc00000). But if we're going to keep this check, there doesn't seem to be any downside to applying it on all platforms, before exec_new_vmspace() tears down the current vmspace. Reported by: Muhammed Sariyildiz Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60027 --- sys/kern/imgact_aout.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 9978c74f0dee..86ee8f6913b9 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -236,17 +236,13 @@ exec_aout_imgact(struct image_params *imgp) */ if (/* entry point must lay with text region */ a_out->a_entry < virtual_offset || - a_out->a_entry >= virtual_offset + a_out->a_text || - + a_out->a_entry >= (uint64_t)virtual_offset + a_out->a_text || /* text and data size must each be page rounded */ - a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK - -#ifdef __amd64__ - || - /* overflows */ - virtual_offset + a_out->a_text + a_out->a_data + bss_size > UINT_MAX -#endif - ) + (a_out->a_text & PAGE_MASK) != 0 || + (a_out->a_data & PAGE_MASK) != 0 || + /* no overflows */ + (uint64_t)virtual_offset + a_out->a_text + a_out->a_data + + bss_size > UINT_MAX) return (-1); /* text + data can't exceed file size */