shm: allow for older versions of Linux without MFD_NOEXEC_SEAL

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/794>
This commit is contained in:
Rudi Heitbaum 2023-08-13 09:37:32 +00:00
parent eb302240cc
commit 421cf15486

View file

@ -164,7 +164,11 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m
#endif #endif
#ifdef HAVE_MEMFD #ifdef HAVE_MEMFD
case PA_MEM_TYPE_SHARED_MEMFD: case PA_MEM_TYPE_SHARED_MEMFD:
/* For linux >= 6.3 create fd with MFD_NOEXEC_SEAL flag */
fd = memfd_create("pulseaudio", MFD_ALLOW_SEALING|MFD_CLOEXEC|MFD_NOEXEC_SEAL); fd = memfd_create("pulseaudio", MFD_ALLOW_SEALING|MFD_CLOEXEC|MFD_NOEXEC_SEAL);
/* Retry creating fd without MFD_NOEXEC_SEAL to support linux < 6.3 */
if (fd < 0)
fd = memfd_create("pulseaudio", MFD_ALLOW_SEALING|MFD_CLOEXEC);
break; break;
#endif #endif
default: default: