Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Wen Yang <wenyang@linux.alibaba.com>
Cc: Sasha Levin <sashal@kernel.org>,
	Sai Praneeth <sai.praneeth.prakhya@intel.com>,
	Bhupesh Sharma <bhsharma@redhat.com>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Caspar Zhang <caspar@linux.alibaba.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] efi: Make efi_rts_work accessible to efi page fault handler
Date: Wed, 4 Mar 2020 09:04:28 +0100	[thread overview]
Message-ID: <20200304080428.GA1401372@kroah.com> (raw)
In-Reply-To: <20200304074444.7849-1-wenyang@linux.alibaba.com>

On Wed, Mar 04, 2020 at 03:44:44PM +0800, Wen Yang wrote:
> From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
> 
> [ Upstream commit 9dbbedaa6171247c4c7c40b83f05b200a117c2e0 ]
> 
> After the kernel has booted, if any accesses by firmware causes a page
> fault, the efi page fault handler would freeze efi_rts_wq and schedules
> a new process. To do this, the efi page fault handler needs
> efi_rts_work. Hence, make it accessible.
> 
> There will be no race conditions in accessing this structure, because
> all the calls to efi runtime services are already serialized.
> 
> [ Wen: This patch also fixes a memory corruption:
>        #define efi_queue_work(_rts, _arg1, _arg2, _arg3, _arg4, _arg5)\
>        ({                                                             \
>         struct efi_runtime_work efi_rts_work;                           \
>        …
>         init_completion(&efi_rts_work.efi_rts_comp);                    \
>         INIT_WORK(&efi_rts_work.work, efi_call_rts);                    \
>        …
> 
>        efi_rts_work is on the stack, registering it to workqueue will cause
>        the following error:
> 
>        ODEBUG: object (____ptrval____) is on stack (____ptrval____),
>        but NOT annotated.
>        ------------[ cut here ]------------
>        WARNING: CPU: 6 PID: 1 at lib/debugobjects.c:368
>        __debug_object_init+0x218/0x538
>        Modules linked in:
>        CPU: 6 PID: 1 Comm: swapper/0 Tainted: G        W         4.19.91 #19
>        …
>        Call trace:
>        __debug_object_init+0x218/0x538
>        debug_object_init+0x20/0x28
>        __init_work+0x34/0x58
>        virt_efi_get_time.part.5+0x6c/0x12c
>        virt_efi_get_time+0x4c/0x58
>        efi_read_time+0x40/0x9c
>        __rtc_read_time+0x50/0x118
>        rtc_read_time+0x60/0x1f0
>        rtc_hctosys+0x74/0x124
>        do_one_initcall+0xac/0x3d4
>        kernel_init_freeable+0x49c/0x59c
>        kernel_init+0x18/0x110 ]
> 
> Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> Suggested-by: Matt Fleming <matt@codeblueprint.co.uk>
> Based-on-code-from: Ricardo Neri <ricardo.neri@intel.com>
> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: 3eb420e70d87 (“efi: Use a work queue to invoke EFI Runtime Services”)
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> Cc: Caspar Zhang <caspar@linux.alibaba.com>
> Cc: Sasha Levin <sashal@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: stable@vger.kernel.org
> ---
>  drivers/firmware/efi/runtime-wrappers.c | 53 +++++--------------------
>  include/linux/efi.h                     | 36 +++++++++++++++++
>  2 files changed, 45 insertions(+), 44 deletions(-)

What stable tree(s) do you wish to see this patch applied to?

thanks,

greg k-h

  reply	other threads:[~2020-03-04  8:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04  7:44 [PATCH] efi: Make efi_rts_work accessible to efi page fault handler Wen Yang
2020-03-04  8:04 ` Greg Kroah-Hartman [this message]
2020-03-04  8:50   ` Wen Yang

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=20200304080428.GA1401372@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhsharma@redhat.com \
    --cc=caspar@linux.alibaba.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=sai.praneeth.prakhya@intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wenyang@linux.alibaba.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