Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2010 16:22:02 -0500
From:      "Sam Fourman Jr." <sfourman@gmail.com>
To:        Garrett Cooper <yanefbsd@gmail.com>
Cc:        Kostik Belousov <kostikbel@gmail.com>, freebsd-hackers@freebsd.org
Subject:   Re: kernel patch needed for wine?
Message-ID:  <AANLkTinNMaMH_5TSUL8PN1D0J-IBjIZV8K_sBTeB1H64@mail.gmail.com>
In-Reply-To: <AANLkTilusilVimfscZdj3QAOOFYs3Gh3pt5V6SXe3VHP@mail.gmail.com>
References:  <AANLkTik5Owwpk5O6eUbSKgHxpjvcEXwilGECgtX0hx5a@mail.gmail.com> <20100630105027.GJ13238@deviant.kiev.zoral.com.ua> <AANLkTikDxVGpc6LfYlqFZLo-QiJFr8lbj2MVZMUci-lI@mail.gmail.com> <AANLkTilusilVimfscZdj3QAOOFYs3Gh3pt5V6SXe3VHP@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 30, 2010 at 11:26 AM, Garrett Cooper <yanefbsd@gmail.com> wrote=
:
> On Wed, Jun 30, 2010 at 8:43 AM, Sam Fourman Jr. <sfourman@gmail.com> wro=
te:
>>> Which patch ? icebp generates the SIGTRAP on latest 8-stable, verified
>>> by the following trivival assembler program:
>>> =A0 =A0 =A0 =A0.text
>>> =A0 =A0 =A0 =A0.globl =A0main
>>> main:
>>> =A0 =A0 =A0 =A0.byte =A0 0xf1
>>> =A0 =A0 =A0 =A0xorl =A0 =A0%edi,%edi
>>> =A0 =A0 =A0 =A0call =A0 =A0exit
>>>
>>

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[] =3D "\xf1\xc3";
typedef void (*icebp_call)(void);

int main(int argc, char **argv)
{
	icebp_call func =3D (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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinNMaMH_5TSUL8PN1D0J-IBjIZV8K_sBTeB1H64>