From: Julien Thierry <julien.thierry@arm.com>
To: Peter Anvin <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
James Morse <james.morse@arm.com>
Subject: Sleeping in user_access section
Date: Fri, 23 Nov 2018 09:27:02 +0000 [thread overview]
Message-ID: <3e881ee6-0ff6-b8b6-0633-3d4a7743411d@arm.com> (raw)
Hi,
I made an attempt at implementing the
user_access_begin()/user_access_end() macros along with the
get/put_user_unsafe() for arm64 by toggling the status of PAN (more or
less similar to x86's STAC/CTAC).
With a small mistake in my patch, we realized that directly calling
function that could reschedule while in a user_access section could lead to:
- scheduling another task keeping the user_access status enabled despite
the task never calling user_access_begin()
- when re-scheduling the task that was mid user_access section,
user_access would be disabled and the task would fault on the next
get/put_user_unsafe.
This is because __switch_to does not alter the user_access status when
switching from next to prev (at least on arm64 we currently don't, and
by looking at the x86 code I don't think this is done either).
From my understanding, this is not an issue when the task in
user_access mode gets scheduled out/in as a result of an interrupt as
PAN and EFLAGS.AC get saved/restore on exception entry/exit (at least I
know it is the case for PAN, I am less sure for the x86 side).
So, the question is, should __switch_to take care of the user_access
status when scheduling new tasks? Or should there be a restriction about
scheduling out a task with user_access mode enabled and maybe add a
warning if we can detect this?
(Or did we miss something and this is not an issue on x86?)
Thanks,
--
Julien Thierry
next reply other threads:[~2018-11-23 9:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 9:27 Julien Thierry [this message]
2018-11-23 9:57 ` hpa
2018-11-23 10:16 ` Julien Thierry
2018-11-23 10:50 ` Russell King - ARM Linux
2018-11-23 11:57 ` Julien Thierry
2018-11-23 13:04 ` Russell King - ARM Linux
2018-11-27 19:05 ` H. Peter Anvin
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=3e881ee6-0ff6-b8b6-0633-3d4a7743411d@arm.com \
--to=julien.thierry@arm.com \
--cc=catalin.marinas@arm.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=will.deacon@arm.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®