From: Peter Zijlstra <peterz@infradead.org>
To: Darren Hart <dvhart@infradead.org>
Cc: Cheng Jian <cj.chengjian@huawei.com>,
tglx@linutronix.de, mingo@redhat.com,
linux-kernel@vger.kernel.org, xiexiuqi@huawei.com,
huawei.libin@huawei.com
Subject: Re: [PATCH] futex: use fault_in to avoid infinite loop
Date: Fri, 8 Dec 2017 11:50:04 +0100 [thread overview]
Message-ID: <20171208105004.5o2vuagtfaayf3ej@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20171208052136.GA28773@fury>
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/errno.h
> > +++ b/include/uapi/asm-generic/errno.h
> > @@ -119,5 +119,6 @@
> > #define ERFKILL 132 /* Operation not possible due to RF-kill */
> >
> > #define EHWPOISON 133 /* Memory page has hardware error */
> > +#define EMORON 134 /* User did something particularly silly */
>
> It's baaa-aaack...
>
Had to try... will keep trying, we need this! :-)
> > --- a/kernel/futex.c
> > +++ b/kernel/futex.c
> > @@ -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;
> > +
> > if (!futex_cmpxchg_enabled)
> > return -ENOSYS;
> > /*
> > @@ -3270,6 +3272,9 @@ SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
> > if (unlikely(len != sizeof(*head)))
> > return -EINVAL;
> >
> > + if (unlikely(address % __alignof__(*head)))
> > + return -EMORON;
>
> Seeing as how this is performing the test as early as possible, would it make
> sense to also catch unaligned uaddr and uaddr2 as early as possible too - in
> sys_futex?
Probably makes it clearer that we have this requirement, yes.
next prev parent reply other threads:[~2017-12-08 10:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 14:21 Cheng Jian
2017-12-06 16:04 ` Peter Zijlstra
2017-12-06 21:40 ` Peter Zijlstra
2017-12-08 5:21 ` Darren Hart
2017-12-08 10:50 ` Peter Zijlstra [this message]
2017-12-08 12:42 ` chengjian (D)
2017-12-28 14:21 ` [tip:locking/urgent] futex: Sanitize user address in set_robust_list() tip-bot for Peter Zijlstra
2017-12-30 7:40 ` [PATCH] futex: use fault_in to avoid infinite loop Michael Kerrisk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171208105004.5o2vuagtfaayf3ej@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=cj.chengjian@huawei.com \
--cc=dvhart@infradead.org \
--cc=huawei.libin@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=xiexiuqi@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®