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

Re: Bug#875927: perl: SIGUNUSED removal in glibc 2.26 changes PL_sig_name / SIG_SIZE



On Tue, Oct 24, 2017 at 03:34:10PM +0100, Dominic Hargreaves wrote:
> On Sun, Oct 22, 2017 at 08:57:59PM +0300, Niko Tyni wrote:

> > I'm tempted to just declare that anything relying on these parts of the
> > ABI is buggy and get the known affected modules/packages fixed.
> 
> This does seem like the correct approach, given that all the alternatives
> are going against upstream, and are varying levels of hackiness (and remain
> fragile).

Yes. This is all unfortunate of course. Relying on the SIG_SIZE constant
staying constant doesn't seem too unreasonable an assumption...

> Am I correct that implementing Tony's suggestion is in itself
> a complete fix for the issue?

I'm not sure which suggestion that is. Tony had some ideas about turning
SIG_SIZE into a variable rather than a constant on the Perl core side,
but noted that they would still break Async::Interrupt as it uses SIG_SIZE
in another place (see sig_async[] in Interrupt.xs, which would probably
need a change too.)

To reiterate a bit, there are two relevant C arrays, PL_sig_name[]
and PL_sig_num[]. Both are NULL terminated, but the "fragile" schmorp.h
s_signum() implementations bake in the array size at compile time and use
that to iterate the PL_sig_name[] array at run time rather than looking
for the terminating NULL. This breaks if the array size at run time is
different from the size at compile time.

Tony noted that they also have an unrelated bug: they do not use
PL_sig_num[] at all, but assume that the index in PL_sig_name[] is
equivalent to the signal number. This is a false assumption. There are
some signal names that map to the same number (for instance, on amd64
SIGIO == SIGPOLL == 29 and SIGSYS == SIGUNUSED == 31.)

OTOH Leon noted that making the implementations use the whichsig() /
whichsig_sv() Perl core API functions would solve the whole thing in a
cleaner way while avoiding the above bug.  So that seems the way to go
(but I don't have a patch ready, and I haven't looked at how the other
use of SIG_SIZE in Async::Interrupt could be avoided.)

> I'm adding debian-perl@lists.debian.org for wider visibility of this
> issue, which might include patching these four packages:

Thanks. I dropped the other cc's at this point.

> libasync-interrupt-perl, libio-aio-perl, libcoro-perl and libev-perl.

libio-aio-perl and libcoro-perl are probably not affected after all, given
they don't seem to use s_signum() or SIG_SIZE anywhere in the actual code.
-- 
Niko


Reply to: