Re: [PATCH v2] usercopy/csky: Do not fail on memory from former init sections

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

 



Helge Deller <deller@xxxxxx> writes:

> While working on the parisc port I suddenly noticed that with
> HARDENED_USERCOPY=y the usercopy checks randomly reported errors which even
> prevented the kernel to boot into userspace.
>
> Specifically the function check_kernel_text_object() reported those errors, as
> it thought the kernel variable I was using belongs to the kernel text area, and
> as such was invalid to be used.
> [..]
> diff --git a/mm/usercopy.c b/mm/usercopy.c
> index b3de3c4eefba..37a35c6051bc 100644
> --- a/mm/usercopy.c
> +++ b/mm/usercopy.c
> @@ -113,6 +113,15 @@ static bool overlaps(const unsigned long ptr, unsigned long n,
>  	return true;
>  }
>
> +static bool inside_init_area(const unsigned long ptr, unsigned long n,
> +		char *start, char *end)
> +{
> +	unsigned long initlow = (unsigned long) start;
> +	unsigned long inithigh = (unsigned long) end;
> +
> +	return (ptr >= initlow && (ptr + n) < inithigh);
> +}

Gerald added something similar with 7a5da02de8d6 ("locking/lockdep:
check for freed initmem in static_obj()"), so i wonder whether that
could be used?

Regards
Sven



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux