test_utils: Test whether mmap PROT_WRITE fails
Writing is what our guard is supposed to prevent, let's try to mmap it for writing. It seems FreeBSD still allows PROT_READ for sealed-for-writing mmaps.
This commit is contained in:
parent
7da79f5ec4
commit
1393f524ff
1 changed files with 2 additions and 2 deletions
|
@ -57,10 +57,10 @@ void TestUtils::testSealedRamFile()
|
|||
QCOMPARE(written, -1);
|
||||
|
||||
// Cannot use MAP_SHARED on sealed file descriptor.
|
||||
void *data = mmap(nullptr, file.size(), PROT_READ, MAP_SHARED, file.fd(), 0);
|
||||
void *data = mmap(nullptr, file.size(), PROT_WRITE, MAP_SHARED, file.fd(), 0);
|
||||
QCOMPARE(data, MAP_FAILED);
|
||||
|
||||
data = mmap(nullptr, file.size(), PROT_READ, MAP_PRIVATE, file.fd(), 0);
|
||||
data = mmap(nullptr, file.size(), PROT_WRITE, MAP_PRIVATE, file.fd(), 0);
|
||||
QVERIFY(data != MAP_FAILED);
|
||||
#else
|
||||
QSKIP("Sealing requires memfd suport.");
|
||||
|
|
Loading…
Reference in a new issue