mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1901996: apply code formatting via Lando
# ignore-this-changeset
This commit is contained in:
parent
c8f1c7016f
commit
1235dca15f
@ -177,19 +177,18 @@ static Maybe<unsigned> HaveMemfd() {
|
||||
#ifdef USE_MEMFD_CREATE
|
||||
static const Maybe<unsigned> kHave = []() -> Maybe<unsigned> {
|
||||
unsigned flags = MFD_CLOEXEC | MFD_ALLOW_SEALING;
|
||||
#ifdef MFD_NOEXEC_SEAL
|
||||
# ifdef MFD_NOEXEC_SEAL
|
||||
flags |= MFD_NOEXEC_SEAL;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
mozilla::UniqueFileHandle fd(
|
||||
memfd_create("mozilla-ipc-test", flags));
|
||||
mozilla::UniqueFileHandle fd(memfd_create("mozilla-ipc-test", flags));
|
||||
|
||||
#ifdef MFD_NOEXEC_SEAL
|
||||
# ifdef MFD_NOEXEC_SEAL
|
||||
if (!fd && errno == EINVAL) {
|
||||
flags &= ~MFD_NOEXEC_SEAL;
|
||||
fd.reset(memfd_create("mozilla-ipc-test", flags));
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (!fd) {
|
||||
DCHECK_EQ(errno, ENOSYS);
|
||||
|
@ -298,6 +298,7 @@ TEST(IPCSharedMemory, BasicIsZero)
|
||||
class IPCSharedMemoryLinuxTest : public ::testing::Test {
|
||||
int mMajor = 0;
|
||||
int mMinor = 0;
|
||||
|
||||
protected:
|
||||
void SetUp() override {
|
||||
if (mMajor != 0) {
|
||||
@ -313,21 +314,16 @@ class IPCSharedMemoryLinuxTest : public ::testing::Test {
|
||||
return mMajor > aMajor || (mMajor == aMajor && mMinor >= aMinor);
|
||||
}
|
||||
|
||||
bool ShouldHaveMemfd() {
|
||||
return HaveKernelVersion(3, 17);
|
||||
}
|
||||
bool ShouldHaveMemfd() { return HaveKernelVersion(3, 17); }
|
||||
|
||||
bool ShouldHaveMemfdNoExec() {
|
||||
return HaveKernelVersion(6, 3);
|
||||
}
|
||||
bool ShouldHaveMemfdNoExec() { return HaveKernelVersion(6, 3); }
|
||||
};
|
||||
|
||||
// Test that memfd_create is used where expected.
|
||||
//
|
||||
// More precisely: if memfd_create support is expected, verify that
|
||||
// shared memory isn't subject to a filesystem size limit.
|
||||
TEST_F(IPCSharedMemoryLinuxTest, IsMemfd)
|
||||
{
|
||||
TEST_F(IPCSharedMemoryLinuxTest, IsMemfd) {
|
||||
auto shm = MakeRefPtr<ipc::SharedMemory>();
|
||||
ASSERT_TRUE(shm->Create(1));
|
||||
UniqueFileHandle fd = shm->TakeHandleAndUnmap();
|
||||
@ -347,8 +343,7 @@ TEST_F(IPCSharedMemoryLinuxTest, IsMemfd)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(IPCSharedMemoryLinuxTest, MemfdNoExec)
|
||||
{
|
||||
TEST_F(IPCSharedMemoryLinuxTest, MemfdNoExec) {
|
||||
const bool expectExec = ShouldHaveMemfd() && !ShouldHaveMemfdNoExec();
|
||||
|
||||
auto shm = MakeRefPtr<ipc::SharedMemory>();
|
||||
|
Loading…
Reference in New Issue
Block a user