+2022-03-13 Bruno Haible <bruno@clisp.org>
+
+ sigsegv: Add support for Linux/PowerPC (32-bit) with musl libc.
+ Reported by Khem Raj <raj.khem@gmail.com> in
+ <https://lists.gnu.org/archive/html/m4-patches/2022-03/msg00000.html>.
+ * src/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): In the Linux/PowerPC
+ 32-bit case, handle musl libc differently.
+ * modules/sigsegv (Files): Add m4/musl.m4.
+ (configure.ac): Invoke gl_MUSL_LIBC.
+
2022-03-11 Paul Eggert <eggert@cs.ucla.edu>
regex: fix double-free
# if defined __powerpc64__ || defined __powerpc64_elfv2__ /* 64-bit */
# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gp_regs[1]
# else /* 32-bit */
-/* both should be equivalent */
-# if 0
-# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
+# if MUSL_LIBC
+/* musl libc has a different structure of ucontext_t in
+ musl/arch/powerpc/bits/signal.h. */
+/* The glibc comments say:
+ "Different versions of the kernel have stored the registers on signal
+ delivery at different offsets from the ucontext struct. Programs should
+ thus use the uc_mcontext.uc_regs pointer to find where the registers are
+ actually stored." */
+# if 0
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[1]
+# else
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_regs->gregs[1]
+# endif
# else
-# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
+/* Assume the structure of ucontext_t in
+ glibc/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h. */
+/* Because of the union, both definitions should be equivalent. */
+# if 0
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
+# else
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
+# endif
# endif
# endif
lib/stackvma.h
lib/stackvma.c
m4/mmap-anon.m4
+m4/musl.m4
m4/sigaltstack.m4
m4/stack-direction.m4
m4/libsigsegv.m4
dnl Persuade Solaris OpenIndiana <unistd.h> to declare mincore().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ gl_MUSL_LIBC
+
AC_REQUIRE([AC_CANONICAL_HOST])
case "$host_os" in
solaris2.11)