[PATCH] powerpc/vdso: allow r30 in vDSO code generation of getrandom

Jason A. Donenfeld Jason at zx2c4.com
Thu Sep 26 09:21:45 AEST 2024


On Wed, Sep 25, 2024 at 08:48:31PM +0200, Christophe Leroy wrote:
> 
> 
> Le 25/09/2024 à 20:38, Jason A. Donenfeld a écrit :
> > On Wed, Sep 25, 2024 at 07:50:22PM +0200, Jason A. Donenfeld wrote:
> >> For gettimeofday, -ffixed-r30 was passed to work around a bug in Go
> >> code, where the vDSO trampoline forgot to save and restore this register
> >> across function calls. But Go requires a different trampoline for every
> >> call, and there's no reason that new Go code needs to be broken and add
> >> more bugs.  So remove -ffixed-r30 for getrandom.
> > 
> > Strangely, I am _unable to_ make the Go code not crash with this patch
> > applied. I'm not quite sure what I'm doing wrong yet, or if this points
> > to another issue.
> 
> Do you mean that without this patch the Go code works and with this 
> patch it crashes ? That's strange taken into account that the chacha 
> function plays up with r30 regardless of this patch.

Yea, that's what I meant.

It turned out to be a Go runtime bug, which won't affect other vDSO
functions but does affect getrandom(). I fixed the issue and sent a
patch up to Google. So this is not the kernel's issue.

Therefore, this patch can move forward.

Jason


More information about the Linuxppc-dev mailing list