Bug#975242: segfault on all architectures if recompiled as of today
Re: Bernhard Übelacker > Attached patch attempts to fill in return statements to silence these > type of warnings, but they have to be double checked. With > these patch applied the example openjade call went through without crash. Hi Bernhard, I uploaded your patch as -21.4, thanks! Christoph No differences were encountered between the control files diff -Nru openjade-1.4devel1/debian/changelog openjade-1.4devel1/debian/changelog --- openjade-1.4devel1/debian/changelog 2020-12-17 16:43:43.0 +0100 +++ openjade-1.4devel1/debian/changelog 2020-12-17 16:43:44.0 +0100 @@ -1,3 +1,13 @@ +openjade (1.4devel1-21.4) unstable; urgency=medium + + * Non-maintainer upload. + + [ Bernhard Übelacker ] + * Fix segfault caused by "no return statement in function returning +non-void" and other warnings. (Closes: #975242, #489482) + + -- Christoph Berg Thu, 17 Dec 2020 16:25:32 +0100 + openjade (1.4devel1-21.3) unstable; urgency=low * Non-maintainer upload. diff -Nru openjade-1.4devel1/style/FlowObj.cxx openjade-1.4devel1/style/FlowObj.cxx --- openjade-1.4devel1/style/FlowObj.cxx 2020-12-17 16:43:43.0 +0100 +++ openjade-1.4devel1/style/FlowObj.cxx 2020-12-17 16:43:44.0 +0100 @@ -2958,6 +2958,7 @@ AcceptFlags af(fo.acceptFlags(context)); if (af & afTableCell) return true; + return false; } bool charsValid(size_t, const Location &loc, ProcessContext &context) { Interpreter &interp = *context.vm().interp; diff -Nru openjade-1.4devel1/style/Interpreter.cxx openjade-1.4devel1/style/Interpreter.cxx --- openjade-1.4devel1/style/Interpreter.cxx 2020-12-17 16:43:43.0 +0100 +++ openjade-1.4devel1/style/Interpreter.cxx 2020-12-17 16:43:44.0 +0100 @@ -2572,6 +2572,7 @@ interp.message(InterpreterMessages::charPropertyNotIntegerOrFalse, StringMessageArg(name), ELObjMessageArg(obj, interp)); + return true; } bool MaybeIntegerCharPropValues::setValue(const StringC &name, @@ -2692,28 +2693,34 @@ ELObj *PublicIdCharPropValues::value(Char, Interpreter &) const { + return NULL; } ELObj *PublicIdCharPropValues::defaultValue(Interpreter &) const { + return NULL; } bool SymbolCharPropValues::setDefault(const StringC &, const Location &, ELObj *, Interpreter &) { + return true; } bool SymbolCharPropValues::setValue(const StringC &, const StringC &, const Location &, ELObj *,Interpreter &) { + return true; } ELObj *SymbolCharPropValues::value(Char, Interpreter &) const { + return NULL; } ELObj *SymbolCharPropValues::defaultValue(Interpreter &) const { + return NULL; } bool ELObjCharPropValues::setDefault(const StringC &, const Location &, @@ -2722,6 +2729,7 @@ ASSERT(obj); interp.makePermanent (obj); def_ = obj; + return true; } bool ELObjCharPropValues::setValue(const StringC &, const StringC &chars, @@ -2732,6 +2740,7 @@ interp.makePermanent (obj); for(size_t i = 0; i < chars.size(); ++i) map_.setChar(chars[i], obj); + return true; } ELObj *ELObjCharPropValues::value(Char ch, Interpreter &) const diff -Nru openjade-1.4devel1/style/ProcessingMode.cxx openjade-1.4devel1/style/ProcessingMode.cxx --- openjade-1.4devel1/style/ProcessingMode.cxx 2000-03-27 18:34:07.0 +0200 +++ openjade-1.4devel1/style/ProcessingMode.cxx 2020-12-17 16:43:44.0 +0100 @@ -328,7 +328,7 @@ int ProcessingMode::RootRule::compareSpecificity(const Rule &rule) const { - rule.compareSpecificity2(this); + return rule.compareSpecificity2(this); } int ProcessingMode::RootRule::compareSpecificity2(const QueryRule *rule) const
Bug#975242: segfault on all architectures if recompiled as of today
On Mon, Dec 14, 2020 at 7:08 PM Bernhard Übelacker wrote: > > Dear Maintainer, > I tried to have a look and could reproduce the crash. Thanks for spending that time! ... > Attached patch attempts to fill in return statements to silence these > type of warnings, but they have to be double checked. With > these patch applied the example openjade call went through without crash. I rebuild this in Ubuntu with your patch and reverted my former Delta back to -O2 - it works fine for me now! Unfortunately upstream didn't reply yet on my request, so we can't continue there. IMHO we might - for now - apply this patch to the package as it seems clearly better than what we have without it.
Bug#975242: segfault on all architectures if recompiled as of today
Dear Maintainer, I tried to have a look and could reproduce the crash. As far as I see a virtual method is called through a shared library boundary and somehow returns with a wrong value in the $sp register. Therefore an instruction in memory without executable mapping is tried to be executed, which results in this "segfault at ... error 15". In the same area I found following warning, which I assume is responsible for this stackpointer error: ProcessingMode.cxx: In member function ‘virtual int OpenJade_DSSSL::ProcessingMode::RootRule::compareSpecificity(const OpenJade_DSSSL::ProcessingMode::Rule&) const’: ProcessingMode.cxx:332:1: warning: no return statement in function returning non-void [-Wreturn-type] 332 | } | ^ Attached patch attempts to fill in return statements to silence these type of warnings, but they have to be double checked. With these patch applied the example openjade call went through without crash. Kind regards, Bernhard (gdb) bt #0 0x55b539708b08 in ?? () #1 0x7ff0311eaf84 in OpenJade_DSSSL::ProcessingMode::addRootRule (this=0x55b539708b08, expr=..., ruleType=OpenJade_DSSSL::ProcessingMode::constructionRule, loc=..., interp=...) at ProcessingMode.cxx:376 #2 0x7ff0311f25a7 in OpenJade_DSSSL::SchemeParser::doRoot (this=0x7ffe734576c0) at SchemeParser.cxx:484 #3 0x7ff0311f9b91 in OpenJade_DSSSL::SchemeParser::parse (this=this@entry=0x7ffe734576c0) at SchemeParser.cxx:190 #4 0x7ff0311ff573 in OpenJade_DSSSL::StyleEngine::parseSpec (this=this@entry=0x55b5395edc30, specParser=..., charset=..., id=..., mgr=..., defVars=...) at StyleEngine.cxx:166 #5 0x7ff03117f61a in OpenJade_DSSSL::DssslApp::processSysid (this=0x7ffe73457970, sysid=...) at DssslApp.cxx:138 #6 0x7ff030c5bc7f in OpenSP::EntityApp::processArguments(int, char**) () from /lib/libosp.so.5 #7 0x7ff030c4b39b in OpenSP::CmdLineApp::run(int, char**) () from /lib/libosp.so.5 #8 0x55b538874a3b in main (argc=15, argv=0x7ffe73458088) at jade.cxx:206 From 1dbae3ee5a83418d9d590895ad73b76f900d9ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= Date: Mon, 14 Dec 2020 18:01:01 +0100 Subject: Fix some warnings. warning: control reaches end of non-void function [-Wreturn-type] warning: no return statement in function returning non-void [-Wreturn-type] Debian-Bug: https://bugs.debian.org/975242 --- style/FlowObj.cxx| 1 + style/Interpreter.cxx| 9 + style/ProcessingMode.cxx | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/style/FlowObj.cxx b/style/FlowObj.cxx index 49b09e9..2894e00 100644 --- a/style/FlowObj.cxx +++ b/style/FlowObj.cxx @@ -2958,6 +2958,7 @@ private: AcceptFlags af(fo.acceptFlags(context)); if (af & afTableCell) return true; + return false; } bool charsValid(size_t, const Location &loc, ProcessContext &context) { Interpreter &interp = *context.vm().interp; diff --git a/style/Interpreter.cxx b/style/Interpreter.cxx index 63b3022..8c8af4e 100644 --- a/style/Interpreter.cxx +++ b/style/Interpreter.cxx @@ -2572,6 +2572,7 @@ bool MaybeIntegerCharPropValues::setDefault(const StringC &name, interp.message(InterpreterMessages::charPropertyNotIntegerOrFalse, StringMessageArg(name), ELObjMessageArg(obj, interp)); + return true; } bool MaybeIntegerCharPropValues::setValue(const StringC &name, @@ -2692,28 +2693,34 @@ bool PublicIdCharPropValues::setValue(const StringC &name, ELObj *PublicIdCharPropValues::value(Char, Interpreter &) const { + return NULL; } ELObj *PublicIdCharPropValues::defaultValue(Interpreter &) const { + return NULL; } bool SymbolCharPropValues::setDefault(const StringC &, const Location &, ELObj *, Interpreter &) { + return true; } bool SymbolCharPropValues::setValue(const StringC &, const StringC &, const Location &, ELObj *,Interpreter &) { + return true; } ELObj *SymbolCharPropValues::value(Char, Interpreter &) const { + return NULL; } ELObj *SymbolCharPropValues::defaultValue(Interpreter &) const { + return NULL; } bool ELObjCharPropValues::setDefault(const StringC &, const Location &, @@ -2722,6 +2729,7 @@ bool ELObjCharPropValues::setDefault(const StringC &, const Location &, ASSERT(obj); interp.makePermanent (obj); def_ = obj; + return true; } bool ELObjCharPropValues::setValue(const StringC &, const StringC &chars, @@ -2732,6 +2740,7 @@ bool ELObjCharPropValues::setValue(const StringC &, const StringC &chars, interp.makePermanent (obj); for(size_t i = 0; i < chars.size(); ++i) map_.setChar(chars[i], obj); + return true; } ELObj *ELObjCharPropValues::value(Char ch, Interpreter &) const diff --git a/style/ProcessingMode.cxx b/style/ProcessingMode.cxx index 1a36996..dc25761 100644 --- a/style/ProcessingMode.cxx +++ b/style/ProcessingMode.cxx @@ -328,7 +328,7 @@ ProcessingMode::RootRule::RootRule(const Ptr &action) int ProcessingMod
Bug#975242: segfault on all architectures if recompiled as of today
Package: openjade Version: 1.4devel1-21.3+b1 Hi, you are not "yet" affected by this, but tests in debian-unstable have shown that you will be affected as soon as anyone re-builds openjade as it is today. What happened is that in Ubuntu first only on arm64 later on all architectures openjade segfaulted. That happened in various cases e.g. postgresql-13 or pgpool2 builds, see [2] for details. Repro: # enable sources for apt $ apt upgrade $ apt install dpkg-dev openjade docbook-dsssl $ apt source pgpool2 $ cd pgpool2-4.1.1/doc/src/sgml/ $ openjade -wall -wno-unused-param -wno-empty -wfully-tagged -c /usr/share/sgml/docbook/stylesheet/dsssl/modular/catalog -d stylesheet.dsl -t sgml -i output-html -V html-index pgpool.sgml Build openjade from the very same source: $ apt build-dep openjade $ apt source openjade $ cd openjade-1.4devel1 $ ./debian/rules build Then test with this path to the binary-wrapper /root/openjade-1.4devel1/jade/openjade, that will deliver the same segfault we see in Ubuntu: $ /root/openjade-1.4devel1/jade/openjade -wall -wno-unused-param -wno-empty -wfully-tagged -c /usr/share/sgml/docbook/stylesheet/dsssl/modular/catalog -d stylesheet.dsl -t sgml -i output-html -V html-index pgpool.sgml I was unable to find the root cause, but until that is done a working mitigation seems to be to set flags to "-O0". P.S. I'm not entirely convinced this is a Dup on, so I reported a new bug and leave it up to you to merge or not. P.P.S. I have tried building with gcc-9, but it exposes the same segfault - it must be something else than the compiler itself. [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489482 [2]: https://bugs.launchpad.net/ubuntu/+source/openjade/+bug/1869734 -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd