mbox series

[v3,0/2] Let illegal access to user-space memory die

Message ID 20201204054259.32684-1-tesheng@andestech.com (mailing list archive)
Headers show
Series Let illegal access to user-space memory die | expand

Message

Eric Lin Dec. 4, 2020, 5:42 a.m. UTC
Accesses to user-space memory without calling uaccess routine
leads to hanging in page fault handler. Like arm64, we let it
die earlier in page fault handler.

Changes in v3:
	-Let no_context() use die_kernel_fault() helper

Changes in v2:
    -Add a die_kernel_fault() helper
    -Split one long line code into two

Eric Lin (2):
  riscv/mm: Introduce a die_kernel_fault() helper function
  riscv/mm: Prevent kernel module to access user memory without uaccess
    routines

 arch/riscv/mm/fault.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

Comments

Eric Lin Dec. 18, 2020, 4:03 a.m. UTC | #1
On Fri, Dec 04, 2020 at 01:42:57PM +0800, Eric Te-Sheng Lin(?L?w??) wrote:
> Accesses to user-space memory without calling uaccess routine
> leads to hanging in page fault handler. Like arm64, we let it
> die earlier in page fault handler.

Hi Palmer, kindly ping.

Thanks.
> 
> Changes in v3:
> 	-Let no_context() use die_kernel_fault() helper
> 
> Changes in v2:
>     -Add a die_kernel_fault() helper
>     -Split one long line code into two
> 
> Eric Lin (2):
>   riscv/mm: Introduce a die_kernel_fault() helper function
>   riscv/mm: Prevent kernel module to access user memory without uaccess
>     routines
> 
>  arch/riscv/mm/fault.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)
> 
> -- 
> 2.17.0
>
Palmer Dabbelt Dec. 22, 2020, 2:35 a.m. UTC | #2
On Thu, 03 Dec 2020 21:42:57 PST (-0800), tesheng@andestech.com wrote:
> Accesses to user-space memory without calling uaccess routine
> leads to hanging in page fault handler. Like arm64, we let it
> die earlier in page fault handler.
>
> Changes in v3:
> 	-Let no_context() use die_kernel_fault() helper
>
> Changes in v2:
>     -Add a die_kernel_fault() helper
>     -Split one long line code into two
>
> Eric Lin (2):
>   riscv/mm: Introduce a die_kernel_fault() helper function
>   riscv/mm: Prevent kernel module to access user memory without uaccess
>     routines
>
>  arch/riscv/mm/fault.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)

Thanks, these will be on for-next when the merge window ends.
Ben Dooks Feb. 1, 2021, 1:18 p.m. UTC | #3
On 22/12/2020 02:35, Palmer Dabbelt wrote:
> On Thu, 03 Dec 2020 21:42:57 PST (-0800), tesheng@andestech.com wrote:
>> Accesses to user-space memory without calling uaccess routine
>> leads to hanging in page fault handler. Like arm64, we let it
>> die earlier in page fault handler.
>>
>> Changes in v3:
>>     -Let no_context() use die_kernel_fault() helper
>>
>> Changes in v2:
>>     -Add a die_kernel_fault() helper
>>     -Split one long line code into two
>>
>> Eric Lin (2):
>>   riscv/mm: Introduce a die_kernel_fault() helper function
>>   riscv/mm: Prevent kernel module to access user memory without uaccess
>>     routines
>>
>>  arch/riscv/mm/fault.c | 28 ++++++++++++++++++++++------
>>  1 file changed, 22 insertions(+), 6 deletions(-)
> 
> Thanks, these will be on for-next when the merge window ends.

Just tested this and it seems to be working.