Bug 579622 - [abrt] Arithmetic expansion does not trap 2 ** 63 / -1
Summary: [abrt] Arithmetic expansion does not trap 2 ** 63 / -1
Alias: None
Product: Fedora
Classification: Fedora
Component: bash
Version: 12
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
Whiteboard: abrt_hash:fed561a6216f6b7f596b077f7e7...
: 594473 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2010-04-06 04:58 UTC by Matt McCutchen
Modified: 2014-01-13 00:11 UTC (History)
2 users (show)

Clone Of:
: 579808 (view as bug list)
Last Closed: 2010-05-20 11:44:42 UTC

Attachments (Terms of Use)
File: backtrace (6.91 KB, text/plain)
2010-04-06 04:58 UTC, Matt McCutchen
no flags Details

Description Matt McCutchen 2010-04-06 04:58:18 UTC
abrt 1.0.8 detected a crash.

architecture: x86_64
Attached file: backtrace
cmdline: bash -c '$((2 ** 63 / -1))'
comment: I saw this case mentioned in the sigaction(2) man page and wondered how bash handled it.
component: bash
executable: /bin/bash
package: bash-4.0.35-2.fc12
rating: 4
reason: Process /bin/bash was killed by signal 8 (SIGFPE)
release: Fedora release 12 (Constantine)
How to reproduce: 1. bash -c '$((2 ** 63 / -1))'

Comment 1 Matt McCutchen 2010-04-06 04:58:20 UTC
Created attachment 404601 [details]
File: backtrace

Comment 2 Matt McCutchen 2010-04-06 05:01:32 UTC
Bash specifically traps division by zero.  If 2 ** 63 / -1 can result in a SIGFPE, bash should trap that too.

(I'll admit it's unlikely that anyone will ever hit this in practice.)

Comment 3 Roman Rakus 2010-04-06 11:16:39 UTC
Thanks for the report. I will ask upstream what he thinks about it.

Comment 4 Matt McCutchen 2010-04-06 14:38:51 UTC
This case is so easy to forget that it might be worth having a gnulib module for "division of untrusted integers without incurring SIGFPE".

Comment 5 Roman Rakus 2010-04-08 11:43:30 UTC
You can track the discussion on bash bug mailing list; http://www.mail-archive.com/bug-bash@gnu.org/msg07182.html

Chet is not convinced of the need. I think you can easily use trap to catch it.

Comment 6 Matt McCutchen 2010-04-08 13:01:38 UTC
It's not really possible to "catch" the SIGFPE with trap.  When the trap handler returns, the faulting division will be performed again and the trap handler will be called again.  There is no way to resume normal execution after the division.

Comment 7 Roman Rakus 2010-04-08 15:11:41 UTC
Ah, yes. You're right.

Comment 8 Roman Rakus 2010-05-20 11:44:42 UTC
There will not be any change here as discussed upstream.

Comment 9 Matt McCutchen 2010-05-20 19:12:05 UTC
WONTFIX is a more accurate description of the decision made.

Comment 10 Matt McCutchen 2010-05-20 19:12:57 UTC
The upstream discussion:


Comment 11 Matt McCutchen 2010-05-20 19:16:44 UTC
*** Bug 594473 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.