[PATCH v3 3/3] Add mremap tests
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue Jul 23 16:35:06 GMT 2024
On 22/07/24 18:13, H.J. Lu wrote:
> On Tue, Jul 23, 2024, 2:50 AM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote:
>
>
>
> On 17/07/24 04:59, H.J. Lu wrote:
> > +static int
> > +mremap_failure_exit (int err, int flags)
> > +{
> > + if (err != EINVAL)
> > + return EXIT_FAILURE;
> > +
> > + unsigned int kernel = get_linux_kernel_version ();
> > + TEST_VERIFY_EXIT (kernel != 0);
> > +
> > + /* Since MREMAP_FIXED was added to Linux kernel 2.3.31, return
> > + EXIT_FAILURE if the kernel is 2.3.31 or newer. */
> > + if (flags == MREMAP_FIXED
> > + && kernel >= make_linux_kernel_version (2, 3, 31))
> > + return EXIT_FAILURE;
> > +
> > + /* Since MREMAP_DONTUNMAP was added to Linux kernel 5.7, return
> > + EXIT_FAILURE if the kernel is 5.7 or newer. */
> > + if (flags == MREMAP_DONTUNMAP
> > + && kernel >= make_linux_kernel_version (5, 7, 0))
> > + return EXIT_FAILURE;
> > +
> > + return EXIT_UNSUPPORTED;
> > +}
>
> I still think we should test for functionality and not tie the tests
> for an specific Linux version. So just set unsupported if mremap
> MREMAP_DONTUNMAP fails with EINVAL.
>
>
> Do you have suggestions to make the test
> to fail on supported kernel without the
> mremap fix?
I don't think we should for this specific case, we are testing that the libc
is passing the correct arguments to the kernel; so either EINVAL (meaning
invalid/unsupported flags) or a successful call is expected (assuming that
the mremap usage is valid).
More information about the Libc-alpha
mailing list