Re: [PATCH v14 3/4] futex_wake05: Add EFAULT error coverage test
Cyril Hrubis <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
Hi! > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (C) 2026 Red Hat, Inc. > + * Copyright (C) 2026 Michael Menasherov <[email protected]> > + */ > + > +/*\ > + * Check that futex(FUTEX_WAKE) returns EFAULT when uaddr points to > + * unmapped or PROT_NONE memory. > + * > + * The test uses opflags=0 (no FUTEX_PRIVATE_FLAG), so futex_wake() takes > + * the shared-futex path in get_futex_key() which must resolve the physical > + * page. For PROT_NONE memory this page lookup fails with EFAULT, even though > + * futex_wake() never reads *uaddr. Maybe this should be more explicit and say that the unmapped address takes different codepath than the PROT_NONE one. I had to check the get_futex_key() to realize that this is one of the syscalls where different types of EFAULT memory actually matters. Also we have specific EFAULT handling for kernel addresses at the start of the futex, so figuring out a kernel address and passing it to the syscall would be a good idea as well. Also there is a lot of NUMA specific code in there, so adding one more test that requires NUMA and tries to hit the NUMA specific codepaths would make sense as well. -- Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp