From nobody Wed Jan 03 16:50:47 2024 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 4T4whR4qN7z56FrH; Wed, 3 Jan 2024 16:50:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T4whR4DKnz4lNW; Wed, 3 Jan 2024 16:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704300647; 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=NBDm3N+0t0M3IQre2Md+uSEONKr81w7I+UKHUvFjsaQ=; b=HAuIJ0hg/azF0yDqBdhNksG/0xXtdGQqJV4563yjPZbIiRIE7X7xcrnZAON6616xxrcHhe 5WbK095qFBIyAlCXSOHtI+yoACuzpFfnSUV4ZR9qMvCNuAGP445dl66fCXExVPUOx52N93 LcYzp/C9ZJUdkDuWR3aE3ezgFAm8Kazg6E4Xx697kVEjB4hUX/Cu8QDBffIqnquVS9Ti5C 0r9lnjcucstPOjetZ/y6dRbZ4frlLMdQWvs583u9zw900Vpg3V+/GDrf1iA1Jf03ON1bHi z1dqX/6O7P2gKjw/+IGs+t1JqUAESjm+0uayOekkogrBjDp2tQivJoWH59FuyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704300647; 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=NBDm3N+0t0M3IQre2Md+uSEONKr81w7I+UKHUvFjsaQ=; b=fXWV6dAORzwLDTlilYiP1v5aJiF/BMsj+GasSYv0w4i3MLmSxg/bqDPczY4OSpIXjilW/e resuWsUdv1ha6Qdo66fZQ76R+sk8pOVpqf1NHINrQdiKQW0bZdOFh+k+puIU/8c+hbZE0c /BgrGmGtfWins8TfT+WQOopvNr0PXEUeu+v5bakyoCE3JFz08Z4ttVi2zMMEQ9Tx2L3Q3H TmJV47Lw5dWT3E6f8mDbdu45FbWXG3HUqpWRqXqUEfJElUq+rmdoEGwIwr8IPRuNsYW9S+ M1q8Msy9QIAvzUVc/RumXS05ugU0lXxg4k+UKZrfntGAhzDypBQI47HKjNgfkA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704300647; a=rsa-sha256; cv=none; b=jlqtdRXyEgZTQCWSWp5/oXsuZbHMARDJ0Y5+GcojY2Jtm0oMCSV9lEscBkCe7E1Nm5HKsa 0x7Ld69gFleFID1nylUk5ytek53aZ/RKLPxnAlggA7IQNOyJ+T25SJnjdd76JcSPAaaNuc DvF5HCeNdvsfpOrVhXIJtuHSRA7FdsairxZXI0GtynTsmKZIoPWBx/QbhkI+7VUlLPJcoy /R61luhKRSFuk0mWxudzBouIAyglCtJ4VPF8ULUejVorZJyYxPnNctzWLUqDM/AjEqynvh 1Gu79fQwAbEGDsbMo4fkwSxTvwwtCJ30Df5hkXsPUwhdWLbeot13BXpHyqR6sg== 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 4T4whR3LHXzsLr; Wed, 3 Jan 2024 16:50:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 403GolD7042349; Wed, 3 Jan 2024 16:50:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 403Gollb042346; Wed, 3 Jan 2024 16:50:47 GMT (envelope-from git) Date: Wed, 3 Jan 2024 16:50:47 GMT Message-Id: <202401031650.403Gollb042346@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: a9174861eab9 - main - posixshm largepage_mmap: fix a racy test 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9174861eab9e786f6873fbe6374a1ac19a5e46a Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=a9174861eab9e786f6873fbe6374a1ac19a5e46a commit a9174861eab9e786f6873fbe6374a1ac19a5e46a Author: Brooks Davis AuthorDate: 2024-01-03 16:39:53 +0000 Commit: Brooks Davis CommitDate: 2024-01-03 16:39:53 +0000 posixshm largepage_mmap: fix a racy test You can't ever safely map a single page and then map a superpage sized mapping over it with MAP_FIXED. Even in a single-threaded program, ASLR might mean you land too close to another mapping and on CheriBSD we don't allow the initial reservation to grow because doing so requires program changes that are hard to automate. To avoid this, map the entire region we want to use upfront. Reviewed by: markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43282 --- tests/sys/posixshm/posixshm_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c index efc903d4ee04..ade07a118707 100644 --- a/tests/sys/posixshm/posixshm_test.c +++ b/tests/sys/posixshm/posixshm_test.c @@ -1407,7 +1407,7 @@ ATF_TC_BODY(largepage_mmap, tc) ATF_REQUIRE(munmap(addr, ps[i] == 0)); /* Clobber an anonymous mapping with a superpage. */ - addr1 = mmap(NULL, ps[0], PROT_READ | PROT_WRITE, + addr1 = mmap(NULL, ps[i], PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_ALIGNED(ffsl(ps[i]) - 1), -1, 0); ATF_REQUIRE_MSG(addr1 != MAP_FAILED,