All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Xiang Yang <xiangyang3@huawei.com>,
	mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org,
	keescook@chromium.org, linux-arm-kernel@lists.infradead.org,
	stable@vger.kernel.org, xiujianfeng@huawei.com,
	liaochang1@huawei.com
Subject: Re: [PATCH 5.10.y v2] Revert "arm64: Stash shadow stack pointer in the task struct on interrupt"
Date: Tue, 20 Feb 2024 16:31:57 +0100	[thread overview]
Message-ID: <2024022049-worst-dividable-0f1c@gregkh> (raw)
In-Reply-To: <CAMj1kXFwTLJ77MYy3Pm+S9WGgkMw0hAGdTKOF05xdqqBg8giMw@mail.gmail.com>

On Mon, Feb 19, 2024 at 05:57:07PM +0100, Ard Biesheuvel wrote:
> On Mon, 19 Feb 2024 at 14:24, Xiang Yang <xiangyang3@huawei.com> wrote:
> >
> > This reverts commit 3f225f29c69c13ce1cbdb1d607a42efeef080056.
> >
> > The shadow call stack for irq now is stored in current task's thread info
> > in irq_stack_entry. There is a possibility that we have some soft irqs
> > pending at the end of hard irq, and when we process softirq with the irq
> > enabled, irq_stack_entry will enter again and overwrite the shadow call
> > stack whitch stored in current task's thread info, leading to the
> > incorrect shadow call stack restoration for the first entry of the hard
> > IRQ, then the system end up with a panic.
> >
> > task A                               |  task A
> > -------------------------------------+------------------------------------
> > el1_irq        //irq1 enter          |
> >   irq_handler  //save scs_sp1        |
> >     gic_handle_irq                   |
> >     irq_exit                         |
> >       __do_softirq                   |
> >                                      | el1_irq         //irq2 enter
> >                                      |   irq_handler   //save scs_sp2
> >                                      |                 //overwrite scs_sp1
> >                                      |   ...
> >                                      |   irq_stack_exit //restore scs_sp2
> >   irq_stack_exit //restore wrong     |
> >                  //scs_sp2           |
> >
> > So revert this commit to fix it.
> >
> > Fixes: 3f225f29c69c ("arm64: Stash shadow stack pointer in the task struct on interrupt")
> >
> > Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
> 
> Acked-by: Ard Biesheuvel <ardb@kernel.org>

Now queued up, thanks.

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@linuxfoundation.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Xiang Yang <xiangyang3@huawei.com>,
	mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org,
	keescook@chromium.org, linux-arm-kernel@lists.infradead.org,
	stable@vger.kernel.org, xiujianfeng@huawei.com,
	liaochang1@huawei.com
Subject: Re: [PATCH 5.10.y v2] Revert "arm64: Stash shadow stack pointer in the task struct on interrupt"
Date: Tue, 20 Feb 2024 16:31:57 +0100	[thread overview]
Message-ID: <2024022049-worst-dividable-0f1c@gregkh> (raw)
In-Reply-To: <CAMj1kXFwTLJ77MYy3Pm+S9WGgkMw0hAGdTKOF05xdqqBg8giMw@mail.gmail.com>

On Mon, Feb 19, 2024 at 05:57:07PM +0100, Ard Biesheuvel wrote:
> On Mon, 19 Feb 2024 at 14:24, Xiang Yang <xiangyang3@huawei.com> wrote:
> >
> > This reverts commit 3f225f29c69c13ce1cbdb1d607a42efeef080056.
> >
> > The shadow call stack for irq now is stored in current task's thread info
> > in irq_stack_entry. There is a possibility that we have some soft irqs
> > pending at the end of hard irq, and when we process softirq with the irq
> > enabled, irq_stack_entry will enter again and overwrite the shadow call
> > stack whitch stored in current task's thread info, leading to the
> > incorrect shadow call stack restoration for the first entry of the hard
> > IRQ, then the system end up with a panic.
> >
> > task A                               |  task A
> > -------------------------------------+------------------------------------
> > el1_irq        //irq1 enter          |
> >   irq_handler  //save scs_sp1        |
> >     gic_handle_irq                   |
> >     irq_exit                         |
> >       __do_softirq                   |
> >                                      | el1_irq         //irq2 enter
> >                                      |   irq_handler   //save scs_sp2
> >                                      |                 //overwrite scs_sp1
> >                                      |   ...
> >                                      |   irq_stack_exit //restore scs_sp2
> >   irq_stack_exit //restore wrong     |
> >                  //scs_sp2           |
> >
> > So revert this commit to fix it.
> >
> > Fixes: 3f225f29c69c ("arm64: Stash shadow stack pointer in the task struct on interrupt")
> >
> > Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
> 
> Acked-by: Ard Biesheuvel <ardb@kernel.org>

Now queued up, thanks.

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-02-20 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 13:21 [PATCH 5.10.y v2] Revert "arm64: Stash shadow stack pointer in the task struct on interrupt" Xiang Yang
2024-02-19 13:21 ` Xiang Yang
2024-02-19 16:57 ` Ard Biesheuvel
2024-02-19 16:57   ` Ard Biesheuvel
2024-02-20 15:31   ` Greg KH [this message]
2024-02-20 15:31     ` Greg KH
2024-02-20 15:31 ` Patch "Revert "arm64: Stash shadow stack pointer in the task struct on interrupt"" has been added to the 5.10-stable tree gregkh

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=2024022049-worst-dividable-0f1c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=keescook@chromium.org \
    --cc=liaochang1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=xiangyang3@huawei.com \
    --cc=xiujianfeng@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.