On 02 July 2005 06:48, Donald Bruce Stewart wrote:

>
>> The asm version is a bit dodgy.  It might be safer to put the inline
>> asm inside a function definition - could you try the patch below?
> 
> The way=ghci tests still crash.
> With the wrapper over obscure_ccall_ret_code gcc 3.3.2 generates (run
> though ghc): 
> 
>             .type   obscure_ccall_wrapper, @function
>     obscure_ccall_wrapper:
>     #APP
>             .globl obscure_ccall_ret_code
>     obscure_ccall_ret_code:
>             addl $0x4, %esp
>             ret
>     #NO_APP
>             ret
>             .size   obscure_ccall_wrapper, .-obscure_ccall_wrapper
> 
> And without, we just get the inner asm.
> 
>     #APP
>             .globl obscure_ccall_ret_code
>     obscure_ccall_ret_code:
>             addl $0x4, %esp
>             ret
>     #NO_APP
> 
> So the asm itself doesn't seem to be the problem.

I thought the issue might be that the inline asm wasn't going into the
.text section as it should do, or perhaps it was something to do with
the .type directive, hence the wrapper function.  Oh well, I guess it
was neither of those.

> I suspect one of the security features of OpenBSD is kicking in.
> Either the memory protection over the text segment, or something
> else. mprotecting the 
> bytes after obscure_ccall_ret_code didn't work though. I don't
> understand either why it is only way=ghci that fails.

Neither do I, this is a weird one!

> The following does work. It uses the inline asm to fill 4
> mallocBytesRWX 
> bytes, as well as using your wrappper patch. At least this avoids code
> duplication of the asm fragment.

Ok, do you want to go ahead and commit that as a workaround for now?

Cheers,
        Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to