I have pushed the latest graalvm-example example so anyone can reproduce 
the problem.

So the mystery is why even though libhello.so was compiled without -fPIC 
(or maybe it was) it still works just fine on Linux and does not on OSv. 
How is it possible?

If it is a valid ELF than it looks like we could simply make the segment 
writable if TEXTREL present and fix permissions later after relacations.

Waldek

On Saturday, October 20, 2018 at 12:42:10 AM UTC-4, Waldek Kozaczuk wrote:
>
> Thanks but I think my issue is different - very repeatable and does not 
> depend on GCC version.
>
> After all I think that the shared library libhello.so was compiled without 
> -fPIC (even though I pass -H:+GeneratePIC option to GraalVM native-image) 
> based on this test:
> readelf -a libhello.so | grep -i textrel
>  0x0000000000000016 (TEXTREL)            0x0
>
> which is weird because as I understand for 64-bit shared library (not pie) 
> gcc requires passing -fPIC I think. So something seems smells not right 
> with native-image.
>
> Anyhow it would be nice OSv detected TEXTREL and logged that instead of 
> crashing with page fault.
>
> Waldek
>
> On Friday, October 19, 2018 at 4:53:52 PM UTC-4, rickp wrote:
>>
>> On Fri, 2018-10-19 at 10:58 -0700, Waldek Kozaczuk wrote: 
>> > Recently I have been playing with GraalVM ( 
>> > https://github.com/oracle/graal) to see if it is possible to run it 
>> > on OSv. To that extent I created new OSv app - 
>> > 
>> https://github.com/cloudius-systems/osv-apps/tree/master/graalvm-example 
>> > . As you can see it has a simple bootstrap main.so that loads a 
>> > shared library libhello.so generated by GraalVM (similar to golang). 
>> > The checked in line to build main.so is actually incorrect and should 
>> > be 
>> > $(CC) -pie -o $@ $(CFLAGS) -I. main.c -L. -lhello -ldl 
>> > 
>> > In any case the app crashes like so: 
>> > page fault outside application, addr: 0x0000100000d3f000 
>> > [registers] 
>>
>> This looks very similar to the issue I had with GNU_RELRO sections. In 
>> my case the getenv symbol was the cause of failure. I tried a few of 
>> Nadav's suggestions but got no closer to solving it - then the problem 
>> went away for me. Sorry I can't be much help. 
>>
>> (See my thread 'Page fault outside of application'). 
>>
>> Rick 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to