On Wed, Jun 30, 2010 at 11:26 AM, Garrett Cooper <yanef...@gmail.com> wrote:
> On Wed, Jun 30, 2010 at 8:43 AM, Sam Fourman Jr. <sfour...@gmail.com> wrote:
>>> Which patch ? icebp generates the SIGTRAP on latest 8-stable, verified
>>> by the following trivival assembler program:
>>>        .text
>>>        .globl  main
>>> main:
>>>        .byte   0xf1
>>>        xorl    %edi,%edi
>>>        call    exit
>>>
>>

Here is the C program that the linux people used as a test case.

***************************************************************
#include <stdio.h>
#include <signal.h>



void trap_handler(int sig)
{
        printf("trapped\n");
}


/*
 * icebp
 * ret
 */
char icebp_func[] = "\xf1\xc3";
typedef void (*icebp_call)(void);

int main(int argc, char **argv)
{
        icebp_call func = (icebp_call)icebp_func;

        signal(SIGTRAP, trap_handler);

        func();

        return 0;
}

***************************************************************

My question is why doe the above code not print trapped on amd64?

FreeBSD 8.1 i386 this code prints "Trapped" as intended
FreeBSD 8.1 amd64 this code prints "Segmentation fault: 11"
FreeBSD 8.1 amd64 chrooted to 32bit prints "Segmentation fault"

I did verify that from Linux amd64 this works and prints "Trapped"
uname -a
Linux workstation 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28
UTC 2010 x86_64 GNU/Linux


Thank you much for everyones help


Sam Fourman Jr.
Fourman Networks
http://www.fourmannetworks.com
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to