Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #71206 > unrolled thread

Bug#988027: klibc: sigsetjmp ignores second argument, siglongjmp always restores signals

Started byThorsten Glaser <tg@debian.org>
First post2021-05-03 23:00 +0200
Last post2021-10-11 00:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.debian.kernel


Contents

  Bug#988027: klibc: sigsetjmp ignores second argument, siglongjmp always restores signals Thorsten Glaser <tg@debian.org> - 2021-05-03 23:00 +0200
    Bug#988027: klibc: sigsetjmp ignores second argument, siglongjmp always restores signals Thorsten Glaser <tg@mirbsd.de> - 2021-10-11 00:30 +0200

#71206 — Bug#988027: klibc: sigsetjmp ignores second argument, siglongjmp always restores signals

FromThorsten Glaser <tg@debian.org>
Date2021-05-03 23:00 +0200
SubjectBug#988027: klibc: sigsetjmp ignores second argument, siglongjmp always restores signals
Message-ID<CaNPA-1R6-5@gated-at.bofh.it>
Package: libklibc-dev
Version: 2.0.8-6
Severity: serious
Justification: spec violation, affecting release architectures
X-Debbugs-Cc: tg@debian.org

Found during debugging of #943425:

- usr/include/setjmp.h

	struct __sigjmp_buf {
		jmp_buf __jmpbuf;
		sigset_t __sigs;
	};
  => does not contain information whether __sigs was saved

	#define sigsetjmp(__env, __save) \
	({ \
	  struct __sigjmp_buf *__e = (__env); \
	  sigprocmask(0, NULL, &__e->__sigs); \
	  setjmp(__e->__jmpbuf); \
	})
  => ignores the __save argument

- usr/klibc/siglongjmp.c

	__noreturn siglongjmp(sigjmp_buf buf, int retval)
	{
		sigprocmask(SIG_SETMASK, &buf->__sigs, NULL);
		longjmp(buf->__jmpbuf, retval);
  => always restores __sigs

This is in direct violation to the Debian sigsetjmp(3) docs...

       If, and only if, the savesigs argument provided to sigsetjmp() is  non-
       zero, the process's current signal mask is saved in env and will be re-
       stored if a siglongjmp() is later performed with this env.

... and POSIX:

     * The siglongjmp() function shall restore the saved signal mask if and
       only if the env argument was initialized by a call to [9]sigsetjmp()
       with a non-zero savemask argument.
  Q: https://pubs.opengroup.org/onlinepubs/9699919799/functions/siglongjmp.html


If necessary I can provide a patch to fix this.

-- System Information:
Debian Release: 11.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: s390x

Kernel: Linux 4.19.0-16-s390x (SMP w/2 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages libklibc-dev depends on:
ii  libklibc        2.0.8-6
ii  linux-libc-dev  5.10.28-1

libklibc-dev recommends no packages.

libklibc-dev suggests no packages.

-- no debconf information

[toc] | [next] | [standalone]


#73256

FromThorsten Glaser <tg@mirbsd.de>
Date2021-10-11 00:30 +0200
Message-ID<D6Puq-1U1-5@gated-at.bofh.it>
In reply to#71206
close 988027
thanks

I guess it works as documented for klibc, even though this is a porting
hindrance so no need to keep this bugreport open. Deliberately closing
per control instead of done as the underlying issue is still present.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web