GNOME Bugzilla – Bug 736077
Recursive templates may cause stack overflow
Last modified: 2021-07-05 11:00:17 UTC
When process some files, xsltproc met bus error on some architecture, include armhf, mips64el, i386 etc. This problem make lots of packages ftbfs on Debian. When try to use gdb or valgrind, we cannot get crash. With '--verbose', we can get crash, wish it be helpful. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750593 for more details
Created attachment 285410 [details] example for bus error
Created attachment 285411 [details] example for bus error 1
Created attachment 285412 [details] verbose log for xsltproc bus error
Created attachment 285876 [details] gdb backtrace of error
Can you please - Use gzip if you attach compressed files. - Try to reduce the problem to a short, self-contained test case. - If that's not possible, tell us at least which version of docbook.xsl produced the error.
Hmm, the call trace is 5381 functions deep and definitely looks like a stack overflow from a recursive XSLT template. Your options are: - Increase stack size. - Isolate the recursive template that causes the error and ask the docbook-xsl maintainers whether they can replace it with a non-recursive version.
*** Bug 751764 has been marked as a duplicate of this bug. ***
See this thread for a patch to docbook-xsl that fixes the issue: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765567 https://bugs.debian.org/cgi-bin/bugreport.cgi?filename=nonrecursive-string-subst.patch;bug=765567;msg=72;att=1
See https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1471029 A few versions of the linux kernel around 3.19 and 4.0 laid out the memory in PIE executables on 32 bit machines in a way that gives the stack and heap very little room and they bang into each other.
(In reply to Douglas Bagnall from comment #9) > A few versions of the linux kernel around 3.19 and 4.0 laid out the memory in > PIE executables on 32 bit machines in a way that gives the stack and heap > very little room and they bang into each other. Well, it doesn't seem to be limited to 32-bit architectures. We're seeing this issue on sparc64 as well and apparently also on mips64el (although I don't know whether it has been fixed on this architecture already). Adrian
(In reply to Douglas Bagnall from comment #9) > A few versions of the linux kernel around 3.19 and 4.0 laid out the memory in > PIE executables on 32 bit machines in a way that gives the stack and heap > very little room and they bang into each other. Even kernel 4.3.3 does not make a difference on sparc64, unfortunately: > https://people.debian.org/~glaubitz/systemd_228-2_sparc64-20151231-1419.build So this is apparently a bug in xsltproc. It shouldn't segfault under any circumstances when churning input files. Adrian
Hello! Is there any chances that xsltproc is somehow improved? I don't agree that this isn't a bug in xsltproc as the application randomly segfaults on various platforms: > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1471029 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203250 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195044 > https://forums.gentoo.org/viewtopic-t-248184-start-0.html > https://trac.macports.org/ticket/24060 It's really starting to become annoying as it hinders the porting efforts for Debian on sparc64 as well randomly lets packages to build from source on platforms like FreeBSD. Adrian
The root cause of the issue is excessive stack usage by recursive templates. A proper fix would require tail call optimization in libxslt which is unlikely to be implemented.
*** Bug 778769 has been marked as a duplicate of this bug. ***
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxslt/-/issues/ Thank you for your understanding and your help.