Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <aID2TVvpPP52KSQZ@probook>
Date: Wed, 23 Jul 2025 16:48:45 +0200
From: J. Neuschäfer <j.neuschaefer@....net>
To: musl@...ts.openwall.com, Ariadne Conill <ariadne@...eferenced.org>
Subject: musl/arch/sh: Inconsistency between greg_t (int) and
 mcontext_t.gregs (unsigned long[]); libucontext fails to build

Hello,

I recently tried to build libucontext on top of musl-libc for sh4, and
ran into the following problem:

arch/sh/makecontext.c: In function ‘libucontext_makecontext’:
arch/sh/makecontext.c:45:14: error: assignment to ‘libucontext_greg_t *’ {aka ‘int *’} from incompatible pointer type ‘long unsigned int *’ [-Wincompatible-pointer-types]
   45 |         regp = &ucp->uc_mcontext.gregs[4];
      |              ^
make: *** [Makefile:155: arch/sh/makecontext.o] Error 1


The corresponding code in libucontext is:

void
libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...)
{
        libucontext_greg_t *sp, *regp;
	[...]
        regp = &ucp->uc_mcontext.gregs[4];
	[...]
}

The issue is that libucontext expects mcontext_t.gregs to use the same type as
greg_t (which seems reasonable to expect), but musl-libc doesn't do that:

	typedef int greg_t, gregset_t[16];
	[...]
	unsigned long gregs[16];


Should this be fixed in musl or in libucontext?


Best regards,
J. Neuschäfer

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.