Hi Charles,
Thanks for response. Rest inline
On Fri, Sep 26, 2025 at 03:29:19PM -0400, Charles Mirabile wrote:
Hi -
Hoping that I got everything right with git-send-email so that this is
delivered alright...
Wanted to jump in to head off a potential talking past one another /
miscommunication situation I see here.
On Wed, Sep 24, 2025 at 08:36:11AM -0600, Paul Walmsley wrote:
Hi,
On Thu, 31 Jul 2025, Deepak Gupta wrote:
[ ... ]
> vDSO related Opens (in the flux)
> =================================
>
> I am listing these opens for laying out plan and what to expect in future
> patch sets. And of course for the sake of discussion.
>
[ ... ]
> How many vDSOs
> ---------------
> Shadow stack instructions are carved out of zimop (may be operations) and if
CPU
> doesn't implement zimop, they're illegal instructions. Kernel could be
running on
> a CPU which may or may not implement zimop. And thus kernel will have to
carry 2
> different vDSOs and expose the appropriate one depending on whether CPU
implements
> zimop or not.
If we merge this series without this, then when CFI is enabled in the
Kconfig, we'll wind up with a non-portable kernel that won't run on older
hardware. We go to great lengths to enable kernel binary portability
across the presence or absence of other RISC-V extensions, and I think
these CFI extensions should be no different.
That is not true, this series does not contain the VDSO changes so it can
be merged as is.
Look at patch 23/27. It does have vDSO change. Although shadow stack
instruction are inserted as compiled flag for vDSO only when cfi config is
selected by user. Right now default is "No". So it won't impact anyone unles
user explicitly says "Yes".
So before considering this for merging, I'd like to see at least an
attempt to implement the dual-vDSO approach (or something equivalent)
where the same kernel binary with CFI enabled can run on both pre-Zimop
and post-Zimop hardware, with the existing userspaces that are common
today.
I agree that when the VDSO patches are submitted for inclusion they should
be written in a way that avoids limiting the entire kernel to either
pre-Zimop or post-Zimop hardware based on the config, but I think it
should be quite possible to perform e.g. runtime patching of the VDSO
to replace the Zimop instructions with nops if the config is enabled but
the hardware does not support Zimop.
Why kernel need to do this extra work of carry two binaries and patching it
runtime?
If for instance we do this, and then this allow this kernel to be taken to
pre-Zimop hardware, it is assumed that entire userspace for such hardware
was compiled without shadow stack (thus no zimop). In that case, kernel
should have been compiled without CFI option.
Just for sake of thought exercise, let's say Fedora 43 is first release with
RVA23 compatiblity (zimop and shadow stack), there is no way this and future
release will be able to run on pre-zimop hardware. Unless redhat is going to
start two different binary distribution. One for pre-zimop and one for
post-zimop. If that would be the case, then compiling two different kernel for
such two different hardware would be least of the worry.
Only other usecase is of a seasoned kernel developer or build your own stuff
in embedded environment, those users can anyways are advanced users. But it
forces complexity on rest of kernel. There will be more extensions taking zimop
encodings in future, we will end up patching vDSO and keep this complexity
while rest of the userspace will not be patched and will be separate binary
distribution (if OS distros endup distributing multiple binaries per release)
However, that concern should not hold up this patch series. Raise it again
when the VDSO patches are posted.
As I said earlier, these changes default cfi config to No. So whenever this
is selected "Yes" by a distro, they can drive such patches (if there is a real
need)
thanks Deepak,
- Paul
Best - Charlie