Bug 14914 - Liboil doesn't unblock SIGILL
Summary: Liboil doesn't unblock SIGILL
Status: RESOLVED FIXED
Alias: None
Product: liboil
Classification: Unclassified
Component: unknown (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Schleef
QA Contact: David Schleef
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-09 05:08 UTC by Bastien Nocera
Modified: 2008-03-13 01:05 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
liboil-better-altivec-detect.patch (2.09 KB, patch)
2008-03-11 07:35 UTC, Bastien Nocera
Details | Splinter Review
liboil-better-altivec-detect.patch (2.28 KB, patch)
2008-03-11 08:19 UTC, Bastien Nocera
Details | Splinter Review

Description Bastien Nocera 2008-03-09 05:08:45 UTC
From: https://bugzilla.redhat.com/show_bug.cgi?id=435771

On a PPC without Altivec, the Altivec detection causes a SIGILL, but crashes when run as part of GStreamer's plugins cache rebuild, with the libvisual plugins installed.

"
This works...

int main(void)
{
        visual_cpu_initialize();
        oil_init();
        return 0;
}


... and this doesn't...

int main(void)
{
        oil_init();
        visual_cpu_initialize();
       return 0;
}

I blame liboil, for leaving SIGILL blocked.
"
Comment 1 David Woodhouse 2008-03-09 09:28:20 UTC
I can provide an account on a suitable machine without Altivec, if that's helpful.
Comment 2 David Woodhouse 2008-03-10 19:06:06 UTC
I recommend replacing the SIGILL-based Altivec check with the one at https://bugzilla.redhat.com/show_bug.cgi?id=435771#c21
Comment 3 Bastien Nocera 2008-03-11 07:35:06 UTC
Created attachment 15033 [details] [review]
liboil-better-altivec-detect.patch

Untested patch, based on David Woodhouse's code in the RH bugzilla.
Comment 4 Bastien Nocera 2008-03-11 08:19:44 UTC
Created attachment 15034 [details] [review]
liboil-better-altivec-detect.patch

And the same one but that actually compiles.
Comment 5 David Schleef 2008-03-11 12:06:42 UTC
Looks good.  Catching SIGILL cleanly is still important for other reasons, though, so I'd appreciate any help getting that fixed.
Comment 6 David Schleef 2008-03-13 00:17:57 UTC
Any reason why /proc/self/auxv wouldn't work?
Comment 7 David Woodhouse 2008-03-13 00:39:29 UTC
(In reply to comment #6)
> Any reason why /proc/self/auxv wouldn't work?

None that I can think of. Running a binary compiled for Linux under a non-Linux system in emulation? Or running a PPC binary in qemu-ppc? :)

Correction: None that I can think of and care about. And it'll fail safe in those cases anyway, assuming no Altivec.

Why else do you need to catch SIGILL? Mucking with signal handlers from libraries is best avoided if possible, surely?

Comment 8 David Schleef 2008-03-13 01:05:45 UTC
Ok, /proc/self/auxv it is.

Liboil turns on the SIGILL handler because occasionally implementations get tagged with the wrong flags.  This is much more of a concern on x86, with N different CPU flags and M different CPUs, some of which don't *exactly* correspond to the flags.    It's not supposed to ever be triggered.

In any case, the current SIGILL trapping code works correctly multiple times on x86-linux, so one would expect this should also be the case on powerpc-linux.  Or maybe not.

commit df0e54862b788e44e4bc21fab4c10032be664056
Author: David Schleef <ds@ginger.bigkitten.com>
Date:   Thu Mar 13 00:23:21 2008 -0700

    Use /proc/self/auxv to test for altivec on Linux.  Patch from #14914



Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.