Re: [pcre-dev] Fwd: Bug#840354: src:pcre3: FTBFS on powerpc …

Top Page
Delete this message
Author: Christoph Biedl
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] Fwd: Bug#840354: src:pcre3: FTBFS on powerpc (G4 CPU)
Original submitter here, although I guess I'm not much of help ...

Zoltán Herczeg wrote:

> several PCRE2 improvements were migrated to PCRE in 8.39. That might
> be the cause of the issue. However from the report it is difficult
> to tell what is happening.


[ sane instructions according to gdb disassemble ]

> Is it possible that the SIGILL is imprecise and the previous
> instruction is the invalid one? E.g:
>
> disassemble addr-16,addr+16


Very likely not. I saw SIGILL from other code, gdb pointed right to
the place. So, just as another example:

| Running JIT regression tests
|   target CPU of SLJIT compiler: PowerPC 32bit (big endian + unaligned)
|   in  8 bit mode with UTF-8  enabled and ucp enabled:
|   in 16 bit mode with UTF-16 enabled and ucp enabled:
|   in 32 bit mode with UTF-32 enabled and ucp enabled:
| 
| Program received signal SIGILL, Illegal instruction.
| 0xb7fe40b8 in ?? ()
| (gdb) bt
| #0  0xb7fe40b8 in ?? ()
| #1  0x1ffb8c60 in _pcre_jit_exec (extra_data=0x200079f5, subject=<optimized out>, length=<optimized out>, 
|     start_offset=<optimized out>, options=<optimized out>, offsets=<optimized out>, offset_count=2)
|     at pcre_jit_compile.c:11465
| #2  0x200079f0 in ?? ()
| Backtrace stopped: previous frame inner to this frame (corrupt stack?)
| (gdb) disassemble 0xb7fe40a8,0xb7fe40c8
| Dump of assembler code from 0xb7fe40a8 to 0xb7fe40c8:
|    0xb7fe40a8:  blt     cr1,0xb7fe40b8
|    0xb7fe40ac:  addis   r8,r3,8188
|    0xb7fe40b0:  lbz     r3,13308(r8)
|    0xb7fe40b4:  add     r30,r30,r3
| => 0xb7fe40b8:  cmplw   cr1,r30,r29
|    0xb7fe40bc:  bge     cr1,0xb7fe40d8
|    0xb7fe40c0:  lbz     r3,0(r30)
|    0xb7fe40c4:  cmpwi   r3,65
| End of assembler dump.


Looks like sound ppc instructions.

> Or perhaps execution rights are not enabled for that instruction?
> 008, 060 is somewhere at the beginning of a 4K page, perhaps the
> page has invalid rights (or some security enhancement disallow RWX)?


I guess something went wrong earlier so gdb gets confused and looks at
the wrong place.

Can you enlighten me about the ways to debug JIT? For example, is
there a way to disassemble or at least dump the generated code for
further inspection?

Aside, I re-built 8.38 which passes all tests. Therefore the cause is
very likely in pcre (and not for example in gcc which was 5-ish in the
summer while it's 6.1 now).

Taking another look into the diff between 8.38 in sljit/ I see a lot
of renamed functions/ constants but otherwise no changes. Which leaves
me in the assumption I'm looking into a completely wrong place.

Puzzled,

    Christoph