Martijn van Duren <openbsd+po...@list.imperialat.at> wrote: > tl;dr: should we disable alloca in gettext and what's the best way to > do this if so? > > So msgfmt crashes an insane amount of times on alpha (rough guess is 75% > of the time) which is a pain when building other packages. > I managed to trace the issue to gettet-runtime/gnulib-lib/malloca.c: > freea(), which (from a best guess) passes a stack-pointer to free. > > I set HAVE_ALLOCA in all config.h files to 0 after make configure and > rebuild the package. After that I've seen zero crashes anymore. So > apparently gettext butchers their calculations on if the pointer is > in a stack (alloca) region or not.
It probably tries to make the guess using address ranges. Our malloc is mmap'd backed which means it is random, and can be anywhere in the address space. Similarily, stacks are randomly allocated for threads, as well as for the main process. So there is no calculation one could make. It would need to seperately track whether it used malloc or alloca. > Since alloca(3) has a big fat warning on it for reasons other than > what I've seen on my alpha station it might be wise to just butcher > HAVE_ALLOCA on the port. I don't know why it uses alloca. Maybe it is intended to also work in threads, has poor locking for malloc. More likely alloca was used due to GNU cargoculting (fair target, software which ignores problems with alloca is exceedingly rare from others)