I've found that I can narrow it down similar to bug #63365: As long as I

don't compile src/sysdep.c with -D_FORTIFY_SOURCE, the resulting

binaries seem to behave normally. Does that maybe suggest an upstream

problem? I compiled it as follows:

 

git clean -xdf

git checkout emacs-28.2

./autogen.sh

./configure

cd src

make sysdep.o CFLAGS='-g3 -O2 -gdwarf-2 -Wp,-D_FORTIFY_SOURCE=2'

make sysdep.o -W sysdep.c

cd ..

make CFLAGS='-g3 -O2 -gdwarf-2 -Wp,-D_FORTIFY_SOURCE=2'

 

I've attached the objects as well as their dumps in case anyone wants to

take a look.