Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 20:52:43 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e74b03451f55 - stable/14 - abort2: Generate a core dump
Message-ID:  <202401022052.402KqhF5037198@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

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

commit e74b03451f552088c6d82c51331b5ad8657aa800
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-11-14 01:00:52 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-02 19:20:37 +0000

    abort2: Generate a core dump
    
    Call sigexit rather than exit1 so that a core is generated.
    
    If running the SIGABRT handler is desired, this would need to use
    kern_psignal() instead.  In that case a userspace wrapper in libc
    would be needed to force an exit if the handler doesn't exit.  Given
    that abort2(2)'s intended use case is when userland is in a
    sufficiently bad state such that it can't safely call syslog(3) before
    abort(3), a userspace abort2(3) wrapper in libc might be dubious.
    
    Reviewed by:    Olivier Certner <olce.freebsd@certner.fr>, emaste
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D42163
    
    (cherry picked from commit 9b57e30cf5b6036263a1a2551df8574571c6f5a4)
---
 sys/kern/kern_exit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 965f4a431755..f9445a481d92 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -827,8 +827,9 @@ out:
 	sbuf_finish(sb);
 	log(LOG_INFO, "%s", sbuf_data(sb));
 	sbuf_delete(sb);
-	exit1(td, 0, sig);
-	return (0);
+	PROC_LOCK(p);
+	sigexit(td, sig);
+	/* NOTREACHED */
 }
 
 #ifdef COMPAT_43



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401022052.402KqhF5037198>