Bug 276119 - mail: typing ^C twice during compose causes SIGBUS
Summary: mail: typing ^C twice during compose causes SIGBUS
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL: https://github.com/freebsd/freebsd-sr...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-04 21:58 UTC by Lexi Winter
Modified: 2024-01-19 14:27 UTC (History)
2 users (show)

See Also:
linimon: mfc-stable14?
linimon: mfc-stable13?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lexi Winter freebsd_triage 2024-01-04 21:58:08 UTC
# mail root
Subject: ^C
^CBus error
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-05 02:42:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6c951b37170f1fb2ae8b4827070743e61b6eaed2

commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-01-04 22:34:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-05 02:40:53 +0000

    mail: add volatile in grabh()

    setjmp() requires that any stack variables modified between the setjmp
    call and the longjmp() must be volatile.  This means that 'saveint' in
    grabh() must be volatile, since it's modified after the setjmp().
    Otherwise, the signal handler is not properly restored, resulting in a
    crash (SIGBUS) if ^C is typed twice while composing.

    PR:             276119
    Reported by:    Christopher Davidson <christopher.davidson@gmail.com>
    MFC after:      2 weeks
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/993

 usr.bin/mail/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2024-01-10 04:51:57 UTC
^Triage: assign to committer that resolved.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-01-19 14:26:31 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f2ad8d3a1397660127f22ba9c0785ef4122a8ba5

commit f2ad8d3a1397660127f22ba9c0785ef4122a8ba5
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-01-04 22:34:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-19 14:25:05 +0000

    mail: add volatile in grabh()

    setjmp() requires that any stack variables modified between the setjmp
    call and the longjmp() must be volatile.  This means that 'saveint' in
    grabh() must be volatile, since it's modified after the setjmp().
    Otherwise, the signal handler is not properly restored, resulting in a
    crash (SIGBUS) if ^C is typed twice while composing.

    PR:             276119
    Reported by:    Christopher Davidson <christopher.davidson@gmail.com>
    MFC after:      2 weeks
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/993

    (cherry picked from commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2)

 usr.bin/mail/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-01-19 14:27:32 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6d78f3a6310d0f873a8515541e6fbf62ef7237d6

commit 6d78f3a6310d0f873a8515541e6fbf62ef7237d6
Author:     Lexi Winter <lexi@le-Fay.ORG>
AuthorDate: 2024-01-04 22:34:58 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-19 14:26:53 +0000

    mail: add volatile in grabh()

    setjmp() requires that any stack variables modified between the setjmp
    call and the longjmp() must be volatile.  This means that 'saveint' in
    grabh() must be volatile, since it's modified after the setjmp().
    Otherwise, the signal handler is not properly restored, resulting in a
    crash (SIGBUS) if ^C is typed twice while composing.

    PR:             276119
    Reported by:    Christopher Davidson <christopher.davidson@gmail.com>
    MFC after:      2 weeks
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/993

    (cherry picked from commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2)

 usr.bin/mail/tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2024-01-19 14:27:41 UTC
Thanks for the patch.