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

Dennis Brendel dbrendel@redhat.com
Wed Mar 6 10:00:27 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.

Dennis



More information about the ltp mailing list