Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning in system log #26

Open
padgettr opened this issue Oct 14, 2023 · 0 comments
Open

Warning in system log #26

padgettr opened this issue Oct 14, 2023 · 0 comments

Comments

@padgettr
Copy link

Hi, I'm getting a warning in the system log:
dwlb[492]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set

This appears to be due to this kernel patch applied to kernels 6.3 onwards:
https://lore.kernel.org/linux-security-module/20221209160453.3246150-4-jeffxu@google.com/

Changing memfd_create() in allocate_shm_file() apears to fix this for me, but note the call can fail on older kernels before 6.3, solution seems to be just to try to allocate, if fails, try again without the new flag, but I haven't tested that:
int fd = memfd_create("surface", MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_NOEXEC_SEAL);
I also added:
if (fcntl(fd, F_ADD_SEALS,
F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL) < 0)
{
fprintf(stderr, "Warning: failed to seal SHM memory file.");
}
before returning the fd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant