From: Andrea Parri <parri.andrea@gmail.com>
To: Guo Ren <guoren@kernel.org>
Cc: Jisheng Zhang <jszhang@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: fix race when vmap stack overflow
Date: Fri, 21 Oct 2022 10:36:35 +0200 [thread overview]
Message-ID: <Y1JaE/ot91Z0KXuC@andrea> (raw)
In-Reply-To: <CAJF2gTRAEX_jQ_w5H05dyafZzHq+P5j05TJ=C+v+OL__GQam4A@mail.gmail.com>
> > > + atomic_set_release(&spin_shadow_stack, 0);
> >
> > Have not really looked the details: should there be a matching acquire?
>
> I use atomic_set_release here, because I need earlier memory
> operations finished to make sure the sp is ready then set the spin
> flag.
>
> The following memory operations order is not important, because we
> just care about sp value.
>
> Also, we use relax amoswap before, because sp has naturelly
> dependency. But giving them RCsc is okay here, because we don't care
> about performance here.
Thanks for the clarification.
I'm not really suggesting to add unneeded synchronization, even more
so in local/private constructs as in this case. It just felt odd to
see the release without a pairing acquire, so I asked. ;-)
Thanks,
Andrea
> eg:
> handle_kernel_stack_overflow:
> +1: la sp, spin_shadow_stack
> + amoswap.w.aqrl sp, sp, (sp)
> + bnez sp, 1b
> +
> ....
> + smp_store_release(&spin_shadow_stack, 0);
> + smp_mb();
next prev parent reply other threads:[~2022-10-21 8:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 15:47 [PATCH] riscv: fix race when vmap stack overflow Jisheng Zhang
2022-10-20 1:02 ` Guo Ren
2022-10-20 2:16 ` Guo Ren
2022-10-20 14:38 ` Jisheng Zhang
2022-10-21 0:35 ` Guo Ren
2022-10-20 23:26 ` Andrea Parri
2022-10-21 1:11 ` Guo Ren
2022-10-21 8:36 ` Andrea Parri [this message]
2022-10-21 12:08 ` Tong Tiangen
2022-10-21 13:22 ` Andrea Parri
2022-10-21 13:46 ` Tong Tiangen
2022-10-21 14:41 ` Guo Ren
2022-10-21 15:17 ` Tong Tiangen
2022-10-21 14:35 ` Guo Ren
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=Y1JaE/ot91Z0KXuC@andrea \
--to=parri.andrea@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=guoren@kernel.org \
--cc=jszhang@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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