From: Will Deacon <will@kernel.org>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Kees Cook <keescook@chromium.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
LKML <linux-kernel@vger.kernel.org>,
James Morse <james.morse@arm.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] arm64: scs: use vmapped IRQ and SDEI shadow stacks
Date: Tue, 1 Dec 2020 10:26:36 +0000 [thread overview]
Message-ID: <20201201102636.GB26471@willie-the-truck> (raw)
In-Reply-To: <20201201101819.GA26471@willie-the-truck>
On Tue, Dec 01, 2020 at 10:18:19AM +0000, Will Deacon wrote:
> On Mon, Nov 30, 2020 at 01:13:07PM -0800, Sami Tolvanen wrote:
> > On Mon, Nov 30, 2020 at 3:49 AM Will Deacon <will@kernel.org> wrote:
> > > On Tue, Nov 24, 2020 at 11:59:40AM -0800, Sami Tolvanen wrote:
> > > > for_each_possible_cpu(cpu) {
> > > > - err = _init_sdei_stack(&sdei_stack_normal_ptr, cpu);
> > > > - if (err)
> > > > - break;
> > > > - err = _init_sdei_stack(&sdei_stack_critical_ptr, cpu);
> > > > - if (err)
> > > > - break;
> > > > + if (IS_ENABLED(CONFIG_VMAP_STACK)) {
> > > > + err = _init_sdei_stack(&sdei_stack_normal_ptr, cpu);
> > > > + if (err)
> > > > + break;
> > > > + err = _init_sdei_stack(&sdei_stack_critical_ptr, cpu);
> > > > + if (err)
> > > > + break;
> > > > + }
> > > > + if (IS_ENABLED(CONFIG_SHADOW_CALL_STACK)) {
> > > > + err = _init_sdei_scs(&sdei_shadow_call_stack_normal_ptr, cpu);
> > > > + if (err)
> > > > + break;
> > > > + err = _init_sdei_scs(&sdei_shadow_call_stack_critical_ptr, cpu);
> > > > + if (err)
> > > > + break;
> > >
> > > This looks ok to me, but I think it would be better to follow the same
> > > approach as you have for the IRQ stacks and instead have a separate
> > > init_sdei_scs() function (similarly for the free() path), which means
> > > you can simply the IS_ENABLED() checks too.
> >
> > OK, I can change this in v3. It makes error handling in
> > sdei_arch_get_entry_point() a bit more awkward though. We'll need
> > something like this:
> >
> > if (IS_ENABLED(CONFIG_VMAP_STACK)) {
> > if (init_sdei_stacks())
> > return 0;
> > }
> >
> > if (IS_ENABLED(CONFIG_SHADOW_CALL_STACK)) {
> > if (init_sdei_scs()) {
> > if (IS_ENABLED(CONFIG_VMAP_STACK))
> > free_sdei_stacks();
> > return 0;
> > }
>
> Can you push the IS_ENABLED() checks into their respective functions?
> Then you can do something like:
>
> if (init_sdei_stacks())
> return 0;
>
> if (init_sdei_scs())
> goto out_free_stacks;
>
> ...
>
> out_free_stacks:
> free_sdei_stacks();
> return 0;
Wait, I see you already posted a v3. Maybe I can just hack this up on top...
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-12-01 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-24 19:59 [PATCH v2 0/2] scs: switch to vmapped shadow stacks Sami Tolvanen
2020-11-24 19:59 ` [PATCH v2 1/2] " Sami Tolvanen
2020-11-24 22:04 ` Kees Cook
2020-11-30 11:44 ` Will Deacon
2020-11-30 20:03 ` Sami Tolvanen
2020-11-24 19:59 ` [PATCH v2 2/2] arm64: scs: use vmapped IRQ and SDEI " Sami Tolvanen
2020-11-30 11:49 ` Will Deacon
2020-11-30 21:13 ` Sami Tolvanen
2020-12-01 10:18 ` Will Deacon
2020-12-01 10:26 ` Will Deacon [this message]
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=20201201102636.GB26471@willie-the-truck \
--to=will@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=samitolvanen@google.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