Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-29 Thread Michael Kerrisk
Peter, On Wed, Dec 6, 2017 at 10:40 PM, Peter Zijlstra wrote: > On Wed, Dec 06, 2017 at 05:04:00PM +0100, Peter Zijlstra wrote: >> On Wed, Dec 06, 2017 at 10:21:07PM +0800, Cheng Jian wrote: >> > It will cause softlockup(infinite loop) in kernel >> > space when we use SYS_set_robust_list in futex

Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-08 Thread chengjian (D)
On 2017/12/7 5:40, Peter Zijlstra wrote: @@ -3262,6 +3262,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head, size_t, len) { + unsigned long address = (unsigned long)head

Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-08 Thread Peter Zijlstra
On Thu, Dec 07, 2017 at 09:21:36PM -0800, Darren Hart wrote: > On Wed, Dec 06, 2017 at 10:40:08PM +0100, Peter Zijlstra wrote: > > diff --git a/include/uapi/asm-generic/errno.h > > b/include/uapi/asm-generic/errno.h > > index cf9c51ac49f9..4cb80d4ac160 100644 > > --- a/include/uapi/asm-generic/err

Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-07 Thread Darren Hart
On Wed, Dec 06, 2017 at 10:40:08PM +0100, Peter Zijlstra wrote: > On Wed, Dec 06, 2017 at 05:04:00PM +0100, Peter Zijlstra wrote: > > On Wed, Dec 06, 2017 at 10:21:07PM +0800, Cheng Jian wrote: > > > It will cause softlockup(infinite loop) in kernel > > > space when we use SYS_set_robust_list in fu

Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-06 Thread Peter Zijlstra
On Wed, Dec 06, 2017 at 05:04:00PM +0100, Peter Zijlstra wrote: > On Wed, Dec 06, 2017 at 10:21:07PM +0800, Cheng Jian wrote: > > It will cause softlockup(infinite loop) in kernel > > space when we use SYS_set_robust_list in futex which > > incoming a misaligned address from user space. > > Urgh,

Re: [PATCH] futex: use fault_in to avoid infinite loop

2017-12-06 Thread Peter Zijlstra
On Wed, Dec 06, 2017 at 10:21:07PM +0800, Cheng Jian wrote: > It will cause softlockup(infinite loop) in kernel > space when we use SYS_set_robust_list in futex which > incoming a misaligned address from user space. Urgh, we should not allow that in the first place. See how get_futex_key() does:

[PATCH] futex: use fault_in to avoid infinite loop

2017-12-06 Thread Cheng Jian
It will cause softlockup(infinite loop) in kernel space when we use SYS_set_robust_list in futex which incoming a misaligned address from user space. It can be triggered by the following demo // futex_align.c #include #include #include #include