From: Borislav Petkov <bp@alien8.de>
To: linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
Jiashuo Liang <liangjs@pku.edu.cn>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Subject: Re: [tip: x86/urgent] x86/fault: Fix wrong signal when vsyscall fails with pkey
Date: Mon, 20 Sep 2021 16:43:55 +0200 [thread overview]
Message-ID: <YUieKy6bqcYEVVq3@zn.tnic> (raw)
In-Reply-To: <163213455900.25758.11915876484367505676.tip-bot2@tip-bot2>
On Mon, Sep 20, 2021 at 10:42:39AM -0000, tip-bot2 for Jiashuo Liang wrote:
> The following commit has been merged into the x86/urgent branch of tip:
>
> Commit-ID: 0829d0b6bf0fb3453608798442deaf00c4a1abec
> Gitweb: https://git.kernel.org/tip/0829d0b6bf0fb3453608798442deaf00c4a1abec
> Author: Jiashuo Liang <liangjs@pku.edu.cn>
> AuthorDate: Fri, 30 Jul 2021 11:01:52 +08:00
> Committer: Borislav Petkov <bp@suse.de>
> CommitterDate: Mon, 20 Sep 2021 12:31:06 +02:00
>
> x86/fault: Fix wrong signal when vsyscall fails with pkey
>
> The function __bad_area_nosemaphore() calls kernelmode_fixup_or_oops()
> with the parameter @signal being actually @pkey, which will send a
> signal numbered with the argument in @pkey.
>
> This bug can be triggered when the kernel fails to access user-given
> memory pages that are protected by a pkey, so it can go down the
> do_user_addr_fault() path and pass the !user_mode() check in
> __bad_area_nosemaphore().
>
> Most cases will simply run the kernel fixup code to make an -EFAULT. But
> when another condition current->thread.sig_on_uaccess_err is met, which
> is only used to emulate vsyscall, the kernel will generate the wrong
> signal.
>
> Add a new parameter @pkey to kernelmode_fixup_or_oops() to fix this.
>
> [ bp: Massage commit message. ]
>
> Fixes: 5042d40a264c ("x86/fault: Bypass no_context() for implicit kernel faults from usermode")
> Signed-off-by: Jiashuo Liang <liangjs@pku.edu.cn>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
> Link: https://lkml.kernel.org/r/20210730030152.249106-1-liangjs@pku.edu.cn
> ---
> arch/x86/mm/fault.c | 26 ++++++++++++++++++--------
> 1 file changed, 18 insertions(+), 8 deletions(-)
Zapping it again because the 0day bot found some randconfig which fails:
https://lkml.kernel.org/r/202109202245.APvuT8BX-lkp@intel.com
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2021-09-20 14:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 3:01 [PATCH v2] x86/fault: Fix wrong signal when vsyscall fails with pkey Jiashuo Liang
2021-08-23 14:55 ` Dave Hansen
2021-09-19 4:39 ` Jiashuo Liang
2021-09-20 10:42 ` [tip: x86/urgent] " tip-bot2 for Jiashuo Liang
2021-09-20 14:43 ` Borislav Petkov [this message]
2021-09-20 20:37 ` tip-bot2 for Jiashuo Liang
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=YUieKy6bqcYEVVq3@zn.tnic \
--to=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=liangjs@pku.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).