[LTP] [PATCH 1/1] mremap06: Add mremap() reproducer for 7e7757876f25
Petr Vorel
pvorel@suse.cz
Tue Jul 4 13:46:58 CEST 2023
Hi Cyril,
> > +#define PAGE_SIZE 4096
> This wouldn't work on 64k page size.
> > +#define MMAP_SIZE ((ARRAY_SIZE(tcases)+1)*PAGE_SIZE)
> > +#define MREMAP_SIZE (ARRAY_SIZE(tcases)*PAGE_SIZE)
> These have to be variables initialized on the fly with getpagesize()
> instead of PAGE_SIZE.
Yep, I thought about getpagesize().
...
> > +static int check_pages(void)
> > +{
> > + int fail = 0, i;
> > + char val;
> > +
> > + for (i = 0; i < (int)ARRAY_SIZE(tcases); i++) {
> > + val = buf[i * PAGE_SIZE];
> > + if (val != 0x30 + i) {
> > + tst_res(TFAIL, "page %d wrong value %d (0x%x)", i, val - 0x30, val);
> Woudn't this generate too many FAILURE messages? Maybe we should just
> break the for cycle here.
It could be. I wasn't sure if it's important to know which pages were wrong.
Kind regards,
Petr
More information about the ltp
mailing list