Message ID | 20240614023009.221547-6-jhubbard@nvidia.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | cleanups, fixes, and progress towards avoiding "make headers" | expand |
On 14.06.24 04:30, John Hubbard wrote: > On Ubuntu 23.04, the kvm and mdwe selftests/mm build fails due to > missing a few items that are found in prctl.h. Here is an excerpt of the > build failures: > > ksm_tests.c:252:13: error: use of undeclared identifier 'PR_SET_MEMORY_MERGE' > ... > mdwe_test.c:26:18: error: use of undeclared identifier 'PR_SET_MDWE' > mdwe_test.c:38:18: error: use of undeclared identifier 'PR_GET_MDWE' > > Fix these errors by adding the missing items to vm_util.h, and include > vm_util.h from mdwe_test.c. > > Cc: David Hildenbrand <david@redhat.com> > Signed-off-by: John Hubbard <jhubbard@nvidia.com> > --- > tools/testing/selftests/mm/mdwe_test.c | 1 + > tools/testing/selftests/mm/vm_util.h | 15 +++++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/tools/testing/selftests/mm/mdwe_test.c b/tools/testing/selftests/mm/mdwe_test.c > index 200bedcdc32e..cfe0b64d1567 100644 > --- a/tools/testing/selftests/mm/mdwe_test.c > +++ b/tools/testing/selftests/mm/mdwe_test.c > @@ -15,6 +15,7 @@ > #include <unistd.h> > > #include "../kselftest_harness.h" > +#include "vm_util.h" > > #ifndef __aarch64__ > # define PROT_BTI 0 > diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h > index 9007c420d52c..99cbb7c0ea9d 100644 > --- a/tools/testing/selftests/mm/vm_util.h > +++ b/tools/testing/selftests/mm/vm_util.h > @@ -61,3 +61,18 @@ unsigned long get_free_hugepages(void); > > #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) > #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) > + > +#ifndef PR_SET_MEMORY_MERGE > +#define PR_SET_MEMORY_MERGE 67 > +#endif > + > +#ifndef PR_GET_MEMORY_MERGE > +#define PR_GET_MEMORY_MERGE 68 > +#endif > + > +#ifndef PR_SET_MDWE > +#define PR_SET_MDWE 65 > +#define PR_MDWE_REFUSE_EXEC_GAIN (1UL << 0) > +#define PR_MDWE_NO_INHERIT (1UL << 1) > +#define PR_GET_MDWE 66 > +#endif What's the reason we don't target "linux/prctl.h" here? :)
On 6/14/24 5:31 AM, David Hildenbrand wrote: > On 14.06.24 04:30, John Hubbard wrote: ... >> +#ifndef PR_SET_MEMORY_MERGE >> +#define PR_SET_MEMORY_MERGE 67 >> +#endif >> + >> +#ifndef PR_GET_MEMORY_MERGE >> +#define PR_GET_MEMORY_MERGE 68 >> +#endif >> + >> +#ifndef PR_SET_MDWE >> +#define PR_SET_MDWE 65 >> +#define PR_MDWE_REFUSE_EXEC_GAIN (1UL << 0) >> +#define PR_MDWE_NO_INHERIT (1UL << 1) >> +#define PR_GET_MDWE 66 >> +#endif > > What's the reason we don't target "linux/prctl.h" here? :) Very good point. This is the Old Way of fixing these up, and I overlooked that even though I'm busy adding the New Way. :) I'll change this to use a new tools/include/uapi/linux/prctl.h and post a v3, thanks for pointing this out. thanks,
diff --git a/tools/testing/selftests/mm/mdwe_test.c b/tools/testing/selftests/mm/mdwe_test.c index 200bedcdc32e..cfe0b64d1567 100644 --- a/tools/testing/selftests/mm/mdwe_test.c +++ b/tools/testing/selftests/mm/mdwe_test.c @@ -15,6 +15,7 @@ #include <unistd.h> #include "../kselftest_harness.h" +#include "vm_util.h" #ifndef __aarch64__ # define PROT_BTI 0 diff --git a/tools/testing/selftests/mm/vm_util.h b/tools/testing/selftests/mm/vm_util.h index 9007c420d52c..99cbb7c0ea9d 100644 --- a/tools/testing/selftests/mm/vm_util.h +++ b/tools/testing/selftests/mm/vm_util.h @@ -61,3 +61,18 @@ unsigned long get_free_hugepages(void); #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) + +#ifndef PR_SET_MEMORY_MERGE +#define PR_SET_MEMORY_MERGE 67 +#endif + +#ifndef PR_GET_MEMORY_MERGE +#define PR_GET_MEMORY_MERGE 68 +#endif + +#ifndef PR_SET_MDWE +#define PR_SET_MDWE 65 +#define PR_MDWE_REFUSE_EXEC_GAIN (1UL << 0) +#define PR_MDWE_NO_INHERIT (1UL << 1) +#define PR_GET_MDWE 66 +#endif
On Ubuntu 23.04, the kvm and mdwe selftests/mm build fails due to missing a few items that are found in prctl.h. Here is an excerpt of the build failures: ksm_tests.c:252:13: error: use of undeclared identifier 'PR_SET_MEMORY_MERGE' ... mdwe_test.c:26:18: error: use of undeclared identifier 'PR_SET_MDWE' mdwe_test.c:38:18: error: use of undeclared identifier 'PR_GET_MDWE' Fix these errors by adding the missing items to vm_util.h, and include vm_util.h from mdwe_test.c. Cc: David Hildenbrand <david@redhat.com> Signed-off-by: John Hubbard <jhubbard@nvidia.com> --- tools/testing/selftests/mm/mdwe_test.c | 1 + tools/testing/selftests/mm/vm_util.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+)