From: Richard Weinberger <richard@nod.at>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
Ley Foon Tan <lftan@altera.com>,
linux-kernel@vger.kernel.org, Daniel Walter <sahne@0x90.at>,
user-mode-linux-devel
<user-mode-linux-devel@lists.sourceforge.net>
Subject: Re: [BUG] uml panics with "Segfault with no mm" in v3.19-rc
Date: Wed, 10 Dec 2014 13:05:36 +0100 [thread overview]
Message-ID: <54883710.7030305@nod.at> (raw)
In-Reply-To: <2739506.ACK9B2Kt4q@wuerfel>
Am 10.12.2014 um 12:03 schrieb Arnd Bergmann:
> On Wednesday 10 December 2014 11:49:23 Richard Weinberger wrote:
>> Hi!
>>
>> Am 10.12.2014 um 11:46 schrieb Miklos Szeredi:
>>> The guilty commit is:
>>>
>>> 00f634bc522d "asm-generic: add generic futex for !CONFIG_SMP"
>>
>> Thanks a lot Miklos!
>> Your bisecting faster than I do.
>>
>> Let's dig into the issue!
>>
>
> Did this happen on linux-next as well?
>
> Does this happen only on non-SMP UML running on an SMP host, or also
> in other combinations?
Had some time to look into the issue.
UML dies because of futex_detect_cmpxchg().
/*
* This will fail and we want it. Some arch implementations do
* runtime detection of the futex_atomic_cmpxchg_inatomic()
* functionality. We want to know that before we call in any
* of the complex code paths. Also we want to prevent
* registration of robust lists in that case. NULL is
* guaranteed to fault and we get -EFAULT on functional
* implementation, the non-functional ones will return
* -ENOSYS.
*/
if (cmpxchg_futex_value_locked(&curval, NULL, 0, 0) == -EFAULT)
futex_cmpxchg_enabled = 1;
The said commit adds an futex_atomic_cmpxchg_inatomic() implementation for the non-SMP case.
As UML is non-SMP it will from now on use that code.
This line of code makes UML die because the kernel tries to access address 0.
if (unlikely(get_user(val, uaddr) != 0)
return -EFAULT;
On UML you can access user space memory only from process context.
Theoretically init calls are process context but not in terms of UML.
As no user space process called into the kernel UML has no process
to fetch the data using ptrace(), it will fall back to the "kernel did a boo boo"
case and panic().
Maybe we can find an easy way to detect this case in arch/um/kernel/trap.c
but the real question is, does UML need futex_cmpxchg?
Is there a big benefit?
I fear it will open a can of worms.
Thanks,
//richard
next prev parent reply other threads:[~2014-12-10 12:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 10:46 [BUG] uml panics with "Segfault with no mm" in v3.19-rc Miklos Szeredi
2014-12-10 10:49 ` Richard Weinberger
2014-12-10 11:03 ` Arnd Bergmann
2014-12-10 12:05 ` Richard Weinberger [this message]
2014-12-10 11:59 ` Geert Uytterhoeven
2014-12-10 12:13 ` Richard Weinberger
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=54883710.7030305@nod.at \
--to=richard@nod.at \
--cc=arnd@arndb.de \
--cc=lftan@altera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=sahne@0x90.at \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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