[LTP] [PATCH v3] Add regression test for CVE-2017-17052
Cyril Hrubis
chrubis@suse.cz
Fri Jan 19 18:54:03 CET 2018
Hi!
> > +static void setup(void)
> > +{
> > + shm = SAFE_MMAP(NULL, sizeof(struct my_shm_data), PROT_READ|PROT_WRITE,
> ^
> The system aligns the length to be a
> multiple of pagesize, so we may as well
> pass result of getpagesize() here.
> > + MAP_SHARED | MAP_ANONYMOUS, -1, 0);
> > +
> > + shm->exit = 0;
> > +}
> > +
> > +static void cleanup(void)
> > +{
> > + SAFE_MUNMAP(shm, sizeof(struct my_shm_data));
> ^
> Here we must pass length that is multiple of
> pagesize, at least manual pages says so.
Sorry, I've misread the manual page, that applies only for huge page
mappings, so passing sizeof(*shm) to mmap() and munmap() should work
just fine, it would still allocate whole page though.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list