NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-mips/59345: kdump fails to dump signal info on n32



>Number:         59345
>Category:       port-mips
>Synopsis:       kdump fails to dump signal info on n32
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 23 11:35:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The Ktr_psig32/64 Foundation
>Environment:
>Description:
ktrace a process that receives signals, and when you kdump it, you'll find the occasional:

kdump: Unhandled size 168 for ktrpsig

This happens because the size of

	struct {
		struct ktr_psig	kp;
		siginfo_t	si;
	};

is 160 on n32, but 168 on n64, so it's not compatible.

In particular, sizeof(sig_t) and _Alignof(sig_t) are both 4 on n32, but both 8 on n64.  So sizeof(struct ktr_psig) is 28 and _Alignof(struct ktr_psig) is 4 on n32, but they are 40 and 8, respectively, on n64.
>How-To-Repeat:
# cat sig.c
#include <err.h>
#include <signal.h>

static void
onsig(int signo)
{
}

int
main(void)
{

        if (signal(SIGUSR1, &onsig) == SIG_ERR)
                err(1, "signal");

        raise(SIGUSR1);
        return 0;
}
# kdump | grep -A1 -i psig
kdump: Unhandled size 168 for ktrpsig
   223    223 sig      PSIG  SIGUSR1 SIG_DFL   223    223 sig      CALL  netbsd32_setcontext(0x7fff77c8)
   223    223 sig      RET   netbsd32_setcontext JUSTRETURN

Expected output to look more like:

 10263  10263 sig      PSIG  SIGUSR1 caught handler=0x8048917 mask=(): code=SI_LWP sent by pid=10263, uid=1000)
 10263  10263 sig      CALL  netbsd32_setcontext(0xfffd2a34)
>Fix:
Teach ktrace(2) to produce records of the correct size on n32, like we do in other compat32 (like i386 on amd64).



Home | Main Index | Thread Index | Old Index