[PATCH] loongarch: Support RANDOMIZE_KSTACK_OFFSET

2024-07-18 Thread Jinjie Ruan
Add support of kernel stack offset randomization while handling syscall, the offset is defaultly limited by KSTACK_OFFSET_MAX(). In order to avoid trigger stack canaries (due to __builtin_alloca) and slowing down the entry path, use __no_stack_protector attribute to disable stack protector for do_

Re: [PATCH] proc: add config to block FOLL_FORCE in mem writes

2024-07-18 Thread Adrian Ratiu
On Thursday, July 18, 2024 03:04 EEST, Linus Torvalds wrote: > On Wed, 17 Jul 2024 at 15:24, Kees Cook wrote: > > > > > In particular, this patch would make it easy to make that > > > SECURITY_PROC_MEM_RESTRICT_FOLL_FORCE config option be a "choice" > > > where you pick "never, ptrace, always"

Re: [PATCH] execve: Move KUnit tests to tests/ subdirectory

2024-07-18 Thread SeongJae Park
On Thu, 18 Jul 2024 14:04:14 +0800 David Gow wrote: > On Thu, 18 Jul 2024 at 05:22, Kees Cook wrote: > > > > Move the exec KUnit tests into a separate directory to avoid polluting > > the local directory namespace. Additionally update MAINTAINERS for the > > new files and mark myself as Maintain

Re: [PATCH] loongarch: Support RANDOMIZE_KSTACK_OFFSET

2024-07-18 Thread Huacai Chen
Hi, Jinjie, Thank you for your patch, but I think it is better to use drdtime() instead of get_random_u16()? drdtime() is similar to rdtsc() of x86 which is defined in arch/loongarch/include/asm/loongarch.h. Huacai On Thu, Jul 18, 2024 at 8:42 PM Jinjie Ruan wrote: > > Add support of kernel sta

Re: [PATCH] loongarch: Support RANDOMIZE_KSTACK_OFFSET

2024-07-18 Thread Jinjie Ruan
On 2024/7/19 9:22, Huacai Chen wrote: > Hi, Jinjie, > > Thank you for your patch, but I think it is better to use drdtime() > instead of get_random_u16()? drdtime() is similar to rdtsc() of x86 > which is defined in arch/loongarch/include/asm/loongarch.h. Thank you, you are right. "DRDTIME" c

[PATCH v2] loongarch: Support RANDOMIZE_KSTACK_OFFSET

2024-07-18 Thread Jinjie Ruan
Add support of kernel stack offset randomization while handling syscall, the offset is defaultly limited by KSTACK_OFFSET_MAX(). In order to avoid trigger stack canaries (due to __builtin_alloca) and slowing down the entry path, use __no_stack_protector attribute to disable stack protector for do_