Re: [PATCH 1/4] mm/mlock: return EINVAL for illegal user memory range in mlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 5 Dec 2022 11:41:05 +0800 Wupeng Ma <mawupeng1@xxxxxxxxxx> wrote:

> While testing mlock, we have a problem if the len of mlock is ULONG_MAX.
> The return value of mlock is zero. But nothing will be locked since the
> len in do_mlock overflows to zero due to the following code in mlock:
> 
>   len = PAGE_ALIGN(len + (offset_in_page(start)));
> 
> The same problem happens in munlock.
> 
> Since TASK_SIZE is the maximum user space address. The start or len of
> mlock shouldn't be bigger than this. Function access_ok can be used to
> check this issue, so return -EINVAL if bigger.

What happens if userspace uses a value somewhat smaller than ULONG_MAX?

	mlock(addr, ULONG_MAX - 1000000);

?

Because if the above works successfully and if it no longer works
successfully with this patchset then that could be a
backward-compatibility problem.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux