Date: Sat, 27 Jun 2026 09:56:01 +0000 From: Christos Margiolis <christos@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 9707d9f01e5c - stable/15 - sound tests: Add PROT_EXEC rejection test Message-ID: <6a3f9e31.325bb.48315c14@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=9707d9f01e5cf4c3ff817f71a95e9ef4c85a1746 commit 9707d9f01e5cf4c3ff817f71a95e9ef4c85a1746 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2026-06-12 06:20:26 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2026-06-27 09:55:28 +0000 sound tests: Add PROT_EXEC rejection test Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj, kib Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/30 (cherry picked from commit 730eaf466493315c1d1164eb6b59b14766f49322) (cherry picked from commit f6b3bd1f3384d262b893af123f3fc2df21c5b9ee) --- tests/sys/sound/mmap.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/sys/sound/mmap.c b/tests/sys/sound/mmap.c index b44b16e7f312..6ebfd2f7dec5 100644 --- a/tests/sys/sound/mmap.c +++ b/tests/sys/sound/mmap.c @@ -102,10 +102,38 @@ ATF_TC_BODY(mmap_buffer_lifetime, tc) ATF_REQUIRE(munmap(buf, len) == 0); } +ATF_TC(mmap_reject_prot_exec); +ATF_TC_HEAD(mmap_reject_prot_exec, tc) +{ + atf_tc_set_md_var(tc, "descr", "mmap PROT_EXEC rejection test"); + atf_tc_set_md_var(tc, "require.kmods", "snd_dummy"); +} + +ATF_TC_BODY(mmap_reject_prot_exec, tc) +{ + uint8_t *buf; + size_t len; + int fd; + + fd = open("/dev/dsp.dummy", O_RDWR); + ATF_REQUIRE_MSG(fd >= 0, FMT_ERR("open")); + + len = 8; + + buf = mmap(NULL, len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, + fd, 0); + ATF_REQUIRE_MSG(buf == MAP_FAILED, FMT_ERR("mmap")); + + munmap(buf, len); + + close(fd); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, mmap_offset_overflow); ATF_TP_ADD_TC(tp, mmap_buffer_lifetime); + ATF_TP_ADD_TC(tp, mmap_reject_prot_exec); return (atf_no_error()); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a3f9e31.325bb.48315c14>
