GNU bug report logs - #42660
emacs-27.1-rc1 and UBsan findings

Previous Next

Package: emacs;

Reported by: noloader <at> gmail.com

Date: Sat, 1 Aug 2020 20:35:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42660 in the body.
You can then email your comments to 42660 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#42660; Package emacs. (Sat, 01 Aug 2020 20:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to noloader <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 01 Aug 2020 20:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jeffrey Walton <noloader <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: emacs-27.1-rc1 and UBsan findings
Date: Sat, 1 Aug 2020 16:34:22 -0400
[Message part 1 (text/plain, inline)]
I believe these additional failures are due to -fsanitize=undefined
-fno-sanitize-recover=all.

SUMMARY OF TEST RESULTS
-----------------------
Files examined: 267
Ran 3850 tests, 7 failed to run, 3763 results as expected, 1
unexpected, 86 skipped
1 files did not contain any tests:
  src/emacs-module-tests.log
1 files did not finish:
  lisp/international/ccl-tests.log
1 files contained unexpected results:
  lisp/cedet/srecode-utest-template.log
Makefile:319: recipe for target 'check-doit' failed
make[2]: *** [check-doit] Error 2
make[2]: Leaving directory '/home/jwalton/Build-Scripts/emacs-27.1/test'
Makefile:289: recipe for target 'check' failed
make[1]: *** [check] Error 2
make[1]: Leaving directory '/home/jwalton/Build-Scripts/emacs-27.1/test'
Makefile:959: recipe for target 'check' failed
make: *** [check] Error 2

Here's a typical failure:

$ cat emacs-27.1/test/lisp/international/ccl-tests.log
Running 7 tests (2020-08-01 16:28:12-0400, selector `(not (or (tag
:expensive-test) (tag :unstable)))')
   passed  1/7  ccl-compile-midi (0.000181 sec)
   passed  2/7  ccl-compile-pgg (0.000093 sec)
   passed  3/7  ccl-dump-midi (0.005956 sec)
   passed  4/7  ccl-dump-pgg (0.000111 sec)
Package pgg-def is deprecated
Package pgg-parse is deprecated
Package pgg is deprecated
ccl.c:1146:29: runtime error: left shift of 1246883553 by 1 places
cannot be represented in type 'int'
[config.log.zip (application/zip, attachment)]
[test-suite.log.zip (application/zip, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42660; Package emacs. (Sun, 09 Aug 2020 23:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 42660 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jeffrey Walton <noloader <at> gmail.com>
Cc: 42660 <at> debbugs.gnu.org
Subject: Re: bug#42660: emacs-27.1-rc1 and UBsan findings
Date: Mon, 10 Aug 2020 01:00:40 +0200
Jeffrey Walton <noloader <at> gmail.com> writes:

> $ cat emacs-27.1/test/lisp/international/ccl-tests.log
> Running 7 tests (2020-08-01 16:28:12-0400, selector `(not (or (tag
> :expensive-test) (tag :unstable)))')
>    passed  1/7  ccl-compile-midi (0.000181 sec)
>    passed  2/7  ccl-compile-pgg (0.000093 sec)
>    passed  3/7  ccl-dump-midi (0.005956 sec)
>    passed  4/7  ccl-dump-pgg (0.000111 sec)
> Package pgg-def is deprecated
> Package pgg-parse is deprecated
> Package pgg is deprecated
> ccl.c:1146:29: runtime error: left shift of 1246883553 by 1 places
> cannot be represented in type 'int'

I get the same, basically:

Running 7 tests (2020-08-10 00:55:35+0200, selector `(not (tag :unstable))')
   passed  1/7  ccl-compile-midi (0.000614 sec)
   passed  2/7  ccl-compile-pgg (0.000371 sec)
   passed  3/7  ccl-dump-midi (0.001032 sec)
   passed  4/7  ccl-dump-pgg (0.000531 sec)
Package pgg-def is deprecated
Package pgg-parse is deprecated
Package pgg is deprecated
ccl.c:1153:29: runtime error: left shift of 1239426054 by 1 places cannot be represented in type 'int'
make[1]: *** [Makefile:183: lisp/international/ccl-tests.log] Error 1

This is the test that fails:

(ert-deftest pgg-parse-crc24 ()
  ;; Compiler
  (require 'pgg)
  (should (equal pgg-parse-crc24 prog-pgg-code))
  ;; Interpreter
  (should (equal (pgg-parse-crc24-string "foo") (concat [#x4f #xc2 #x55])))
  (should (equal (pgg-parse-crc24-string "bar") (concat [#x51 #xd9 #x53])))
  (should (equal (pgg-parse-crc24-string "baz") (concat [#xf0 #x58 #x6a]))))

All three of those pgg-parse calls make Emacs signal a runtime error
with this checking turned on.

So this is with:

CFLAGS="-fsanitize=undefined -fno-sanitize-recover=all" ./configure && make

Now, pgg is obsolete, so that's a test that probably should go away.
So is this a bug?  The thing that fails is this:

	    case CCL_LSH: reg[rrr] <<= i; break;

So it's doing a left shift on a too-high number...  which is something
that pgg does, but since that's obsolete, do we care?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#42660; Package emacs. (Mon, 10 Aug 2020 10:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 42660 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jeffrey Walton <noloader <at> gmail.com>
Cc: 42660 <at> debbugs.gnu.org
Subject: Re: bug#42660: emacs-27.1-rc1 and UBsan findings
Date: Mon, 10 Aug 2020 12:37:12 +0200
(Please keep the debbugs address in the Cc field.)

Jeffrey Walton <noloader <at> gmail.com> writes:

>> So it's doing a left shift on a too-high number...  which is something
>> that pgg does, but since that's obsolete, do we care?
>
> Integer wrap is well defined. Cast reg[rrr] to an unsigned. If
> reg[rrr] is left as signed, then it overflows (sign change) and
> wanders into undefined behavior and is subject to removal.
>
> Or you can remove the test.

It would obviously be better to fix the undefined behaviour (if the
compiler is correct here?), but as the only thing that seems to tickle
this behaviour is an obsolete package, I'm not sure we care?

But perhaps we do?

The CCL isn't the most popular stuff in Emacs these days...




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 18 Aug 2020 01:00:02 GMT) Full text and rfc822 format available.

Notification sent to noloader <at> gmail.com:
bug acknowledged by developer. (Tue, 18 Aug 2020 01:00:03 GMT) Full text and rfc822 format available.

Message #16 received at 42660-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: noloader <at> gmail.com
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 42660-done <at> debbugs.gnu.org
Subject: emacs-27.1-rc1 and UBsan findings
Date: Mon, 17 Aug 2020 17:58:59 -0700
[Message part 1 (text/plain, inline)]
The bug is unlikely to lead to a real problem, so I installed the attached 
low-priority patch into the master branch rather than into emacs-27. Closing the 
bug report as fixed.
[0001-Fix-glitch-uncovered-by-gcc-fsanitize-undefined.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 15 Sep 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.