[LTP] [PATCH v2] munlockall: add test case that verifies memory has been unlocked

Petr Vorel pvorel@suse.cz
Wed Mar 6 11:07:15 CET 2024


> On 3/5/24 22:30, Petr Vorel wrote:
> >> +	SAFE_FILE_LINES_SCANF("/proc/self/status", "VmLck: %ld", &size);
> >> +
> >> +	if (size == 0UL)
> >> +		tst_brk(TBROK, "Locked memory after mlockall() should be "
> >> +			       "greater than 0, but is %ld", size);
> > I suppose < 0 really means no memory locked, thus really safe to quit before
> > munlockall(), right?

> Forgot to reply to that.

> < 0 should not happen due to unsigned type.

> If the size is 0 then it is safe to quit. In general it should always be safe
> to exit even if there was memory locked, i.e. when the parsing of
> /proc/self/status is faulty or when wrong numbers are reported.

Good point, thanks!

Kind regards,
Petr

> Dennis



More information about the ltp mailing list