Re: Linux Compat Query

2007-05-29 Thread Hannah Schroeter
Hello!

On Tue, May 29, 2007 at 12:10:46AM +0100, Edd Barrett wrote:
On 29/05/07, Ted Unangst [EMAIL PROTECTED] wrote:
On 5/28/07, Edd Barrett [EMAIL PROTECTED] wrote:
 The program was built like so:
 g++ -static -m32 -Wall bsdtest.cpp

wouldn't it be a lot easier to copy bsdtest.cpp to the openbsd machine
and compile it there?

Yes, this time.

It was just a proof of concept test at this stage, but the binary we
are really interested in will need xerces which is not ported to
OpenBSD. Hence this whole thread.

$ cd /usr/ports/   
$ make search key=xerc
Port:   xerces-2.4.0p3
Path:   textproc/xerces
Info:   xml parser for Java
Maint:  Kevin Lo [EMAIL PROTECTED]
Index:  textproc
L-deps: 
B-deps: gtar-*:archivers/gtar
R-deps: jdk-1.3.1*
Archs:  jre-1.3.1*
$

Kind regards,

Hannah.



Re: Linux Compat Query

2007-05-29 Thread Edd Barrett

HI,

On 29/05/07, Hannah Schroeter [EMAIL PROTECTED] wrote:

$ cd /usr/ports/
$ make search key=xerc
Port:   xerces-2.4.0p3
Path:   textproc/xerces
Info:   xml parser for Java
Maint:  Kevin Lo [EMAIL PROTECTED]
Index:  textproc
L-deps:
B-deps: gtar-*:archivers/gtar
R-deps: jdk-1.3.1*
Archs:  jre-1.3.1*


Thats a java implementation yes.

We are using a xerces-c with g++.

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-29 Thread Adriaan

On 5/29/07, Edd Barrett [EMAIL PROTECTED] wrote:


We are using a xerces-c with g++


OpenBSD has a port/package of Sablotron, a XML parser in C.

Or you may have better luck with the FreeBSD or NetBSD  port/package
of xerces-c.

=Adriaan=



Re: Linux Compat Query

2007-05-29 Thread Hannah Schroeter
Hello!

On Tue, May 29, 2007 at 03:49:07PM +0100, Edd Barrett wrote:
On 29/05/07, Hannah Schroeter [EMAIL PROTECTED] wrote:
$ cd /usr/ports/
$ make search key=xerc
Port:   xerces-2.4.0p3
Path:   textproc/xerces
Info:   xml parser for Java
Maint:  Kevin Lo [EMAIL PROTECTED]
Index:  textproc
L-deps:
B-deps: gtar-*:archivers/gtar
R-deps: jdk-1.3.1*
Archs:  jre-1.3.1*

Thats a java implementation yes.

We are using a xerces-c with g++.

What about porting it yourself? It's not so difficult to create a port,
you know, at least if the original code isn't in the all the world is
Linux style.

Kind regards,

Hannah.



Re: Linux Compat Query

2007-05-29 Thread Edd Barrett

HI,

On 29/05/07, Hannah Schroeter [EMAIL PROTECTED] wrote:

What about porting it yourself? It's not so difficult to create a port,
you know, at least if the original code isn't in the all the world is
Linux style.


Maybe, but I'm a little tied down on the TeXLive port right now :P



--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Tobias Ulmer
On Mon, May 28, 2007 at 12:09:01AM +0100, Edd Barrett wrote:
 [...]
 So I try as root (I know I shouldnt have to):
 # whoami
 root
 # ./a.out
 ksh: ./a.out: Operation not permitted
 # exec a.out
 ksh: a.out: not found
 $ whoami
 edd
 
 Notice how it logged my root shell out?!?!

That's ok, exec replaces the current process with the new one.

 
 Can anyone enlighten me?

Probably not, but make sure you didn't mount with noexec... Been there,
done that ;)

Tobias

 
 Thanks
 
 -- 
 Best Regards
 
 Edd
 
 ---
 http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hello,

The binary definitely runs on gentoo linux.

scp a.out [EMAIL PROTECTED]:~
[EMAIL PROTECTED]'s password:
a.out
   100% 1149KB   1.1MB/s   00:01
[EMAIL PROTECTED] ~/ctest $ uname -a
Linux alpha 2.6.17-gentoo-r8 #15 SMP Tue Nov 28 00:48:08 GMT 2006
x86_64 AMD Atlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD
GNU/Linux
[EMAIL PROTECTED] ~/ctest $ ./a.out
Hello World!
[EMAIL PROTECTED] ~/ctest $ ssh [EMAIL PROTECTED]
[EMAIL PROTECTED]'s password:
Last login: Sun May 27 23:48:55 2007 from 192.168.0.9
OpenBSD 4.1 (GENERIC) #1435: Sat Mar 10 19:07:45 MST 2007
$ uname -a
OpenBSD my.bsd.box 4.1 GENERIC#1435 i386
$ ./a.out
ksh: ./a.out: Operation not permitted

The program was built like so:
g++ -static -m32 -Wall bsdtest.cpp

Yes, thats cross-compilation. Is this a problem?

Linux emulation is certainly on.

$ sysctl -a | grep linux
kern.emul.linux=1

But I knew this as acroread and opera run fine.

With regards to Tylers suggestion (recompiling kernel):
OpenBSD aims to work out of the box using the GENERIC kernel.

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi,

On 28/05/07, Andreas Kahari [EMAIL PROTECTED] wrote:

Could it have something to do with the linux box being an amd64
machine and the openbsd box a i386 machine?  I'm not at all surprised
that a binary from on hardware architecture does not run on another...


It's cross compiled. AMD64 - i386

Forgive me if I misunderstand, but that might work?


--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

Hey Ed

I never saw where you ran it using ktrace.  Can you try that and take a 
look at the results with kdump?


diana



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi Diana,

On 28/05/07, Diana Eichert [EMAIL PROTECTED] wrote:

Hey Ed

I never saw where you ran it using ktrace.  Can you try that and take a
look at the results with kdump?

diana




# file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped
# ktra
ktrace   ktradertest  ktrash
# ktrace a.out
ktrace: exec of 'a.out' failed: No such file or directory

Im sure we have done something fundamentally wrong.

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Steve Williams

Edd Barrett wrote:

Hi Diana,

On 28/05/07, Diana Eichert [EMAIL PROTECTED] wrote:

Hey Ed

I never saw where you ran it using ktrace.  Can you try that and take a
look at the results with kdump?

diana




# file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped
# ktra
ktrace   ktradertest  ktrash
# ktrace a.out
ktrace: exec of 'a.out' failed: No such file or directory

Im sure we have done something fundamentally wrong.


Try..

ktrace ./a.out
or
ktrace /full_path_to/a.out

Maybe your path is not set correctly (for this specific problem).

Cheers,
Steve W.



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

On Mon, 28 May 2007, Edd Barrett wrote:


Hi Diana,

On 28/05/07, Diana Eichert [EMAIL PROTECTED] wrote:


... take a look at the results with kdump?

diana

# ktrace a.out
ktrace: exec of 'a.out' failed: No such file or directory


You only did one part of my suggestion, the easy one, now you need to 
finish the task by looking at the kernel trace with kdump(1).


I suggest you familiarize yourself with both ktrace(1) and kdump(1).

diana



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

On Mon, 28 May 2007, Steve Williams wrote:


Try..

ktrace ./a.out
or
ktrace /full_path_to/a.out

Maybe your path is not set correctly (for this specific problem).

Cheers,
Steve W.


Geez, it's good that some people actually read the error message.  I'm in 
kdump troubleshooting mode, but you're right, you have to get the program 
to run first.


diana



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi,


 Maybe your path is not set correctly (for this specific problem).


Today has been one dumb mistake after another. I apologize.

I'll do it properly shall I:

# sysctl -a | grep linux
kern.emul.linux=1
# ls -al a.out
-rwxr-xr-x  1 edd  edd  1176578 May 28 13:18 a.out
# file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped
# uname -a
OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
# ktrace ./a.out
ktrace: exec of './a.out' failed: Operation not permitted
# kdump -f ktrace.out
 8108 ktrace   RET   ktrace 0
 8108 ktrace   CALL  execve(0xcfbdc9d3,0xcfbdc89c,0xcfbdc8a4)
 8108 ktrace   NAMI  ./a.out
 8108 ktrace   RET   execve -1 errno 1 Operation not permitted
 8108 ktrace   CALL  mprotect(0x7e522000,0x1000,0x3)
 8108 ktrace   RET   mprotect 0
 8108 ktrace   CALL  mprotect(0x7e522000,0x1000,0x1)
 8108 ktrace   RET   mprotect 0
 8108 ktrace   CALL  write(0x2,0xcfbdbeb0,0x8)
 8108 ktrace   GIO   fd 2 wrote 8 bytes
  ktrace: 
 8108 ktrace   RET   write 8
 8108 ktrace   CALL  write(0x2,0xcfbdbed0,0x18)
 8108 ktrace   GIO   fd 2 wrote 24 bytes
  exec of './a.out' failed
 8108 ktrace   RET   write 24/0x18
 8108 ktrace   CALL  write(0x2,0x3c00213c,0x2)
 8108 ktrace   GIO   fd 2 wrote 2 bytes
  : 
 8108 ktrace   RET   write 2
 8108 ktrace   CALL  issetugid()
 8108 ktrace   RET   issetugid 0
 8108 ktrace   CALL  open(0xcfbdc280,0,0)
 8108 ktrace   NAMI  /usr/share/nls/C/libc.cat
 8108 ktrace   RET   open 3
 8108 ktrace   CALL  fstat(0x3,0xcfbdc1e0)
 8108 ktrace   RET   fstat 0
 8108 ktrace   CALL  mmap(0,0xe5a,0x1,0x1,0x3,0,0,0)
 8108 ktrace   RET   mmap -2046947328/0x85fe1000
 8108 ktrace   CALL  close(0x3)
 8108 ktrace   RET   close 0
 8108 ktrace   CALL  readlink(0x3c002168,0xcfbdc120,0x3f)
 8108 ktrace   NAMI  /etc/malloc.conf
 8108 ktrace   RET   readlink -1 errno 2 No such file or directory
 8108 ktrace   CALL  issetugid()
 8108 ktrace   RET   issetugid 0
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap 2086334464/0x7c5af000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -2141827072/0x80565000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap 2143391744/0x7fc19000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1960751104/0x8b215000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1952120832/0x8ba5
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1965772800/0x8ad4b000
 8108 ktrace   CALL  munmap(0x85fe1000,0xe5a)
 8108 ktrace   RET   munmap 0
 8108 ktrace   CALL  __sysctl(1.37,0xcfbdc540,0xcfbdc534,0,0)
 8108 ktrace   RET   __sysctl 0
 8108 ktrace   CALL  getpid()
 8108 ktrace   RET   getpid 8108/0x1fac
 8108 ktrace   CALL  write(0x2,0xcfbdbeb0,0x18)
 8108 ktrace   GIO   fd 2 wrote 24 bytes
  Operation not permitted
  
 8108 ktrace   RET   write 24/0x18
 8108 ktrace   CALL  munmap(0x7e522000,0x1000)
 8108 ktrace   RET   munmap 0
 8108 ktrace   CALL  exit(0x1)

The above was run as root.

I iterate again, this binary was cross compiled with g++, and has
proven to work when copied onto an linux i386 machine. This was all
done by my friend who uses linux. He tells me he used the -m32 switch
of g++ to do so.

I hope this is all the information this time.

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread mickey
On Mon, May 28, 2007 at 09:59:19PM +0100, Edd Barrett wrote:
 Hi,
 
  Maybe your path is not set correctly (for this specific problem).
 
 Today has been one dumb mistake after another. I apologize.
 
 I'll do it properly shall I:
 
 # sysctl -a | grep linux
 kern.emul.linux=1
 # ls -al a.out
 -rwxr-xr-x  1 edd  edd  1176578 May 28 13:18 a.out
 # file a.out
 a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
 GNU/Linux 2.6.9, statically linked, not stripped
 # uname -a
 OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
 # ktrace ./a.out
 ktrace: exec of './a.out' failed: Operation not permitted
 # kdump -f ktrace.out
  8108 ktrace   RET   ktrace 0
  8108 ktrace   CALL  execve(0xcfbdc9d3,0xcfbdc89c,0xcfbdc8a4)
  8108 ktrace   NAMI  ./a.out
  8108 ktrace   RET   execve -1 errno 1 Operation not permitted

you sure the file system where a.out is allows execution?
cu
-- 
paranoic mickey   (my employers have changed but, the name has remained)



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi Mickey,

On 28/05/07, mickey [EMAIL PROTECTED] wrote:

you sure the file system where a.out is allows execution?


$ cat /etc/fstab
/dev/wd0a / ffs rw 1 1
/dev/wd0d /home ffs rw 1 1
/dev/wd1a /mnt/media ffs rw 1 2

The executable is in my home directory (/home/edd).

noexec is not set on any of my filesystems.

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Steve Williams

Edd Barrett wrote:

Hi,


 Maybe your path is not set correctly (for this specific problem).


Today has been one dumb mistake after another. I apologize.

I'll do it properly shall I:

# sysctl -a | grep linux
kern.emul.linux=1
# ls -al a.out
-rwxr-xr-x  1 edd  edd  1176578 May 28 13:18 a.out
# file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped
# uname -a
OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
# ktrace ./a.out
ktrace: exec of './a.out' failed: Operation not permitted
# kdump -f ktrace.out
 8108 ktrace   RET   ktrace 0
 8108 ktrace   CALL  execve(0xcfbdc9d3,0xcfbdc89c,0xcfbdc8a4)
 8108 ktrace   NAMI  ./a.out
 8108 ktrace   RET   execve -1 errno 1 Operation not permitted
 8108 ktrace   CALL  mprotect(0x7e522000,0x1000,0x3)
 8108 ktrace   RET   mprotect 0
 8108 ktrace   CALL  mprotect(0x7e522000,0x1000,0x1)
 8108 ktrace   RET   mprotect 0
 8108 ktrace   CALL  write(0x2,0xcfbdbeb0,0x8)
 8108 ktrace   GIO   fd 2 wrote 8 bytes
  ktrace: 
 8108 ktrace   RET   write 8
 8108 ktrace   CALL  write(0x2,0xcfbdbed0,0x18)
 8108 ktrace   GIO   fd 2 wrote 24 bytes
  exec of './a.out' failed
 8108 ktrace   RET   write 24/0x18
 8108 ktrace   CALL  write(0x2,0x3c00213c,0x2)
 8108 ktrace   GIO   fd 2 wrote 2 bytes
  : 
 8108 ktrace   RET   write 2
 8108 ktrace   CALL  issetugid()
 8108 ktrace   RET   issetugid 0
 8108 ktrace   CALL  open(0xcfbdc280,0,0)
 8108 ktrace   NAMI  /usr/share/nls/C/libc.cat
 8108 ktrace   RET   open 3
 8108 ktrace   CALL  fstat(0x3,0xcfbdc1e0)
 8108 ktrace   RET   fstat 0
 8108 ktrace   CALL  mmap(0,0xe5a,0x1,0x1,0x3,0,0,0)
 8108 ktrace   RET   mmap -2046947328/0x85fe1000
 8108 ktrace   CALL  close(0x3)
 8108 ktrace   RET   close 0
 8108 ktrace   CALL  readlink(0x3c002168,0xcfbdc120,0x3f)
 8108 ktrace   NAMI  /etc/malloc.conf
 8108 ktrace   RET   readlink -1 errno 2 No such file or directory
 8108 ktrace   CALL  issetugid()
 8108 ktrace   RET   issetugid 0
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap 2086334464/0x7c5af000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -2141827072/0x80565000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap 2143391744/0x7fc19000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1960751104/0x8b215000
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1952120832/0x8ba5
 8108 ktrace   CALL  mmap(0,0x1000,0x3,0x1002,0x,0,0,0)
 8108 ktrace   RET   mmap -1965772800/0x8ad4b000
 8108 ktrace   CALL  munmap(0x85fe1000,0xe5a)
 8108 ktrace   RET   munmap 0
 8108 ktrace   CALL  __sysctl(1.37,0xcfbdc540,0xcfbdc534,0,0)
 8108 ktrace   RET   __sysctl 0
 8108 ktrace   CALL  getpid()
 8108 ktrace   RET   getpid 8108/0x1fac
 8108 ktrace   CALL  write(0x2,0xcfbdbeb0,0x18)
 8108 ktrace   GIO   fd 2 wrote 24 bytes
  Operation not permitted
  
 8108 ktrace   RET   write 24/0x18
 8108 ktrace   CALL  munmap(0x7e522000,0x1000)
 8108 ktrace   RET   munmap 0
 8108 ktrace   CALL  exit(0x1)

The above was run as root.

I iterate again, this binary was cross compiled with g++, and has
proven to work when copied onto an linux i386 machine. This was all
done by my friend who uses linux. He tells me he used the -m32 switch
of g++ to do so.

I hope this is all the information this time.


Try showing us a pwd
and a mount

and perhaps cat /etc/fstab

I'm suspecting a noexec filesystem or some such thing.

Cheers,
Steve



Re: Linux Compat Query

2007-05-28 Thread Otto Moerbeek
On Mon, 28 May 2007, Edd Barrett wrote:

 Hi Mickey,
 
 On 28/05/07, mickey [EMAIL PROTECTED] wrote:
  you sure the file system where a.out is allows execution?
 
 $ cat /etc/fstab
 /dev/wd0a / ffs rw 1 1
 /dev/wd0d /home ffs rw 1 1
 /dev/wd1a /mnt/media ffs rw 1 2
 
 The executable is in my home directory (/home/edd).
 
 noexec is not set on any of my filesystems.

Did you try 'elf2olf -o linux a.out', as other's have suggested?

-Otto



Re: Linux Compat Query

2007-05-28 Thread mickey
On Mon, May 28, 2007 at 10:32:29PM +0100, Edd Barrett wrote:
 Hi Mickey,
 
 On 28/05/07, mickey [EMAIL PROTECTED] wrote:
 you sure the file system where a.out is allows execution?
 
 $ cat /etc/fstab
 /dev/wd0a / ffs rw 1 1
 /dev/wd0d /home ffs rw 1 1
 /dev/wd1a /mnt/media ffs rw 1 2

normally you'd do a mount -v to sure see how they are mounted.
but maybe that's not really a problem (looking at fstab).
cu
-- 
paranoic mickey   (my employers have changed but, the name has remained)



Re: Linux Compat Query

2007-05-28 Thread Otto Moerbeek
On Mon, 28 May 2007, Edd Barrett wrote:

 Hi Otto and Didi (on the CC),
 
 On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:
  Did you try 'elf2olf -o linux a.out', as other's have suggested?
 
 $ ./a.out
 Bad system call (core dumped)
 $ file a.out
 a.out: OLF 32-bit Linux unstripped LSB executable, Intel 80386,
 version 1, for GNU/Linux 2.6.9, statically linked, not stripped
 
 This is getting silly. I'm going to ask him to build the binary on an
 actual i386 in case it was that cross compilation. (Please Didi (cc)
 ).

But now the excutable starts so you can see with ktrace which
syscall is not implemented.

-Otto



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

On Mon, 28 May 2007, Edd Barrett wrote:


Hi Otto and Didi (on the CC),

On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:

Did you try 'elf2olf -o linux a.out', as other's have suggested?


$ ./a.out
Bad system call (core dumped)


ahhh, can you run ktrace on the rebranded program?  It would be 
interestting to see what system call it's failing on.


diana



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi Otto and Didi (on the CC),

On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:

Did you try 'elf2olf -o linux a.out', as other's have suggested?


$ ./a.out
Bad system call (core dumped)
$ file a.out
a.out: OLF 32-bit Linux unstripped LSB executable, Intel 80386,
version 1, for GNU/Linux 2.6.9, statically linked, not stripped

This is getting silly. I'm going to ask him to build the binary on an
actual i386 in case it was that cross compilation. (Please Didi (cc)
).

Thanks

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:

But now the excutable starts so you can see with ktrace which
syscall is not implemented.


 4362 ktrace   RET   ktrace 0
 4362 ktrace   CALL  execve(0xcfbe1d1b,0xcfbe1bdc,0xcfbe1be4)
 4362 ktrace   NAMI  ./a.out
 4362 a.outEMUL  linux
 4362 a.outRET   oldolduname 0
 4362 a.outCALL  uname(0xcfbe4e66)
 4362 a.outRET   uname 0
 4362 a.outCALL  brk(0)
 4362 a.outRET   brk 135491584/0x8137000
 4362 a.outCALL  brk(0x8137c70)
 4362 a.outRET   brk 135494768/0x8137c70
 4362 a.outCALL  #243 (unimplemented linux_sys_set_thread_area)()
 4362 a.outPSIG  SIGSYS SIG_DFL code 0
 4362 a.outNAMI  a.out.core

Something to do with threading?

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Otto Moerbeek
On Mon, 28 May 2007, Edd Barrett wrote:

 On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:
  But now the excutable starts so you can see with ktrace which
  syscall is not implemented.
 
  4362 ktrace   RET   ktrace 0
  4362 ktrace   CALL  execve(0xcfbe1d1b,0xcfbe1bdc,0xcfbe1be4)
  4362 ktrace   NAMI  ./a.out
  4362 a.outEMUL  linux
  4362 a.outRET   oldolduname 0
  4362 a.outCALL  uname(0xcfbe4e66)
  4362 a.outRET   uname 0
  4362 a.outCALL  brk(0)
  4362 a.outRET   brk 135491584/0x8137000
  4362 a.outCALL  brk(0x8137c70)
  4362 a.outRET   brk 135494768/0x8137c70
  4362 a.outCALL  #243 (unimplemented linux_sys_set_thread_area)()
  4362 a.outPSIG  SIGSYS SIG_DFL code 0
  4362 a.outNAMI  a.out.core
 
 Something to do with threading?

yes, it tries to do a system call our linux emulation does not have,

-Otto

 
 -- 
 Best Regards
 
 Edd
 
 ---
 http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Ted Unangst

On 5/28/07, Edd Barrett [EMAIL PROTECTED] wrote:

The program was built like so:
g++ -static -m32 -Wall bsdtest.cpp


wouldn't it be a lot easier to copy bsdtest.cpp to the openbsd machine
and compile it there?



Re: Linux Compat Query

2007-05-28 Thread Ted Unangst

On 5/28/07, Edd Barrett [EMAIL PROTECTED] wrote:

$ file a.out
a.out: OLF 32-bit Linux unstripped LSB executable, Intel 80386,
version 1, for GNU/Linux 2.6.9, statically linked, not stripped


you seem rather insistent on using file to prove this is a linux
binary.  the kernel doesn't run file to figure out what compat layer
to use; it's rather cruder in its assessment.



Re: Linux Compat Query

2007-05-28 Thread Edd Barrett

Hi Ted,

On 29/05/07, Ted Unangst [EMAIL PROTECTED] wrote:

On 5/28/07, Edd Barrett [EMAIL PROTECTED] wrote:
 The program was built like so:
 g++ -static -m32 -Wall bsdtest.cpp

wouldn't it be a lot easier to copy bsdtest.cpp to the openbsd machine
and compile it there?



Yes, this time.

It was just a proof of concept test at this stage, but the binary we
are really interested in will need xerces which is not ported to
OpenBSD. Hence this whole thread.

It's not really important, and Im not trying to prove that the file is
a linux bin.

All it was, my housemate made a very useful ISBN-bibtex converter
which looks up the books author and titile etc. It would have been
useful for our assignments.

Thanks anyway to all that replied!

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

On Mon, 28 May 2007, Edd Barrett wrote:


On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:

But now the excutable starts so you can see with ktrace which
syscall is not implemented.


4362 ktrace   RET   ktrace 0
4362 ktrace   CALL  execve(0xcfbe1d1b,0xcfbe1bdc,0xcfbe1be4)
4362 ktrace   NAMI  ./a.out
4362 a.outEMUL  linux
4362 a.outRET   oldolduname 0
4362 a.outCALL  uname(0xcfbe4e66)
4362 a.outRET   uname 0
4362 a.outCALL  brk(0)
4362 a.outRET   brk 135491584/0x8137000
4362 a.outCALL  brk(0x8137c70)
4362 a.outRET   brk 135494768/0x8137c70
4362 a.outCALL  #243 (unimplemented linux_sys_set_thread_area)()
4362 a.outPSIG  SIGSYS SIG_DFL code 0
4362 a.outNAMI  a.out.core

Something to do with threading?


my quick and dirty Google search brought this

http://www.mail-archive.com/misc@openbsd.org/msg37150.html



Re: Linux Compat Query

2007-05-28 Thread Diana Eichert

On Mon, 28 May 2007, Edd Barrett wrote:


On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:

But now the excutable starts so you can see with ktrace which
syscall is not implemented.


4362 ktrace   RET   ktrace 0
4362 ktrace   CALL  execve(0xcfbe1d1b,0xcfbe1bdc,0xcfbe1be4)
4362 ktrace   NAMI  ./a.out
4362 a.outEMUL  linux
4362 a.outRET   oldolduname 0
4362 a.outCALL  uname(0xcfbe4e66)
4362 a.outRET   uname 0
4362 a.outCALL  brk(0)
4362 a.outRET   brk 135491584/0x8137000
4362 a.outCALL  brk(0x8137c70)
4362 a.outRET   brk 135494768/0x8137c70
4362 a.outCALL  #243 (unimplemented linux_sys_set_thread_area)()
4362 a.outPSIG  SIGSYS SIG_DFL code 0
4362 a.outNAMI  a.out.core

Something to do with threading?


Bingo!

Your app is calling something that is not supported by OpenBSD's Linux 
emulation.


If you do a google search for linux_sys_set_thread_area openbsd you'll 
find this problem issue has been discussed before.


see ktrace and kdump are your friend

diana



Re: Linux Compat Query

2007-05-28 Thread a . velichinsky
On Mon, May 28, 2007 at 11:29:37PM +0100, Edd Barrett wrote:
 On 28/05/07, Otto Moerbeek [EMAIL PROTECTED] wrote:
 But now the excutable starts so you can see with ktrace which
 syscall is not implemented.
 
  4362 ktrace   RET   ktrace 0
  4362 ktrace   CALL  execve(0xcfbe1d1b,0xcfbe1bdc,0xcfbe1be4)
  4362 ktrace   NAMI  ./a.out
  4362 a.outEMUL  linux
  4362 a.outRET   oldolduname 0
  4362 a.outCALL  uname(0xcfbe4e66)
  4362 a.outRET   uname 0
  4362 a.outCALL  brk(0)
  4362 a.outRET   brk 135491584/0x8137000
  4362 a.outCALL  brk(0x8137c70)
  4362 a.outRET   brk 135494768/0x8137c70
  4362 a.outCALL  #243 (unimplemented linux_sys_set_thread_area)()

run the program as this:
$ LD_ASSUME_KERNEL=2.4.1 ./a.out

unless the program is a simple 'hello world', expect it to crash sooner
or later; the linux compat layer in OpenBSD is outdated, and doesn't
implement many syscalls from linux 2.6.x (and if you linked the binary
against a recent glibc, it may not work with older kernels).



Linux Compat Query

2007-05-27 Thread Edd Barrett

Hi there,

My friend has made an application that uses a shared library which is
not yet ported to OpenBSD (xereces-c). We have been trying to run it
on OpenBSD using linux-compat. I know this is all set up properly as I
use opera a lot.

We have a static binary for the correct arch:
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped
$ uname -a
OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
$ ldd a.out
a.out:
ldd: a.out: not a dynamic executable

It is executable:
$ ls -al | grep a.out
-rwxrwxrwx  1 didi  didi   1176578 May 27 23:48 a.out

So we should be able to run it:
$ ./a.out
ksh: ./a.out: Operation not permitted
$ exec a.out
ksh: a.out: Operation not permitted

So I try as root (I know I shouldnt have to):
# whoami
root
# ./a.out
ksh: ./a.out: Operation not permitted
# exec a.out
ksh: a.out: not found
$ whoami
edd

Notice how it logged my root shell out?!?!

Can anyone enlighten me?

Thanks

--
Best Regards

Edd

---
http://students.dec.bournemouth.ac.uk/ebarrett



Re: Linux Compat Query

2007-05-27 Thread Diana Eichert

On Mon, 28 May 2007, Edd Barrett wrote:


So we should be able to run it:
$ ./a.out
ksh: ./a.out: Operation not permitted
$ exec a.out
ksh: a.out: Operation not permitted


Okay, so you know for certain this will run under Linux?  If so have you 
tried invoking the program with ktrace on OpenBSD?  FWIW, I've never tried 
to ktrace a program using Linux emulation, however I would think it would 
show what the program is trying to do when it fails.


diana



Re: Linux Compat Query

2007-05-27 Thread a . velichinsky
On Mon, May 28, 2007 at 12:09:01AM +0100, Edd Barrett wrote:
 Hi there,
 
 My friend has made an application that uses a shared library which is
 not yet ported to OpenBSD (xereces-c). We have been trying to run it
 on OpenBSD using linux-compat. I know this is all set up properly as I
 use opera a lot.
 
 We have a static binary for the correct arch:
 $ file a.out
 a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
 GNU/Linux 2.6.9, statically linked, not stripped

try 'branding' it with 'elf2olf -o linux a.out'.
and sysctl kern.emul.linux should be set to 1, of course.



Re: Linux Compat Query

2007-05-27 Thread Ben Calvert

On May 27, 2007, at 6:22 PM, [EMAIL PROTECTED] wrote:


On Mon, May 28, 2007 at 12:09:01AM +0100, Edd Barrett wrote:

Hi there,

My friend has made an application that uses a shared library which is
not yet ported to OpenBSD (xereces-c). We have been trying to run it
on OpenBSD using linux-compat. I know this is all set up properly  
as I

use opera a lot.

We have a static binary for the correct arch:
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
GNU/Linux 2.6.9, statically linked, not stripped


try 'branding' it with 'elf2olf -o linux a.out'.
and sysctl kern.emul.linux should be set to 1, of course.



it's already branded, or file wouldn't give that output.



Re: Linux Compat Query

2007-05-27 Thread Otto Moerbeek
On Mon, 28 May 2007, Edd Barrett wrote:

 Hi there,
 
 My friend has made an application that uses a shared library which is
 not yet ported to OpenBSD (xereces-c). We have been trying to run it
 on OpenBSD using linux-compat. I know this is all set up properly as I
 use opera a lot.
 
 We have a static binary for the correct arch:
 $ file a.out
 a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
 GNU/Linux 2.6.9, statically linked, not stripped
 $ uname -a
 OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
 $ ldd a.out
 a.out:
 ldd: a.out: not a dynamic executable
 
 It is executable:
 $ ls -al | grep a.out
 -rwxrwxrwx  1 didi  didi   1176578 May 27 23:48 a.out
 
 So we should be able to run it:
 $ ./a.out
 ksh: ./a.out: Operation not permitted
 $ exec a.out
 ksh: a.out: Operation not permitted
 
 So I try as root (I know I shouldnt have to):
 # whoami
 root
 # ./a.out
 ksh: ./a.out: Operation not permitted
 # exec a.out
 ksh: a.out: not found
 $ whoami
 edd
 
 Notice how it logged my root shell out?!?!

That's completely normal behaviour of exec. See man ksh.

-Otto



Re: Linux Compat Query

2007-05-27 Thread Claudio Jeker
On Mon, May 28, 2007 at 12:09:01AM +0100, Edd Barrett wrote:
 Hi there,
 
 My friend has made an application that uses a shared library which is
 not yet ported to OpenBSD (xereces-c). We have been trying to run it
 on OpenBSD using linux-compat. I know this is all set up properly as I
 use opera a lot.
 
 We have a static binary for the correct arch:
 $ file a.out
 a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
 GNU/Linux 2.6.9, statically linked, not stripped
 $ uname -a
 OpenBSD puff.langash.lan 4.1 GENERIC#1435 i386
 $ ldd a.out
 a.out:
 ldd: a.out: not a dynamic executable
 
 It is executable:
 $ ls -al | grep a.out
 -rwxrwxrwx  1 didi  didi   1176578 May 27 23:48 a.out
 
 So we should be able to run it:
 $ ./a.out
 ksh: ./a.out: Operation not permitted
 $ exec a.out
 ksh: a.out: Operation not permitted

Did you actually enable the magic sysctl to enable linux emulation?
It is off by default.

-- 
:wq Claudio



Re: Linux Compat Query

2007-05-27 Thread a . velichinsky
On Sun, May 27, 2007 at 08:05:40PM -0700, Ben Calvert wrote:
 
 On May 27, 2007, at 6:22 PM, [EMAIL PROTECTED] wrote:
 
 On Mon, May 28, 2007 at 12:09:01AM +0100, Edd Barrett wrote:
 Hi there,
 
 My friend has made an application that uses a shared library which is
 not yet ported to OpenBSD (xereces-c). We have been trying to run it
 on OpenBSD using linux-compat. I know this is all set up properly  
 as I
 use opera a lot.
 
 We have a static binary for the correct arch:
 $ file a.out
 a.out: ELF 32-bit LSB executable, Intel 80386, version 1, for
 GNU/Linux 2.6.9, statically linked, not stripped
 
 try 'branding' it with 'elf2olf -o linux a.out'.
 and sysctl kern.emul.linux should be set to 1, of course.
 
 
 it's already branded, or file wouldn't give that output.

no.
the OpenBSD kernel doesn't seem to care about file(1) and its output.

$ file ./sln   
./sln: ELF 32-bit LSB executable, Intel 80386, version 1, for GNU/Linux 2.4.1, 
statically linked, stripped
$ ./sln ./sln ./slnx
ksh: ./sln: Operation not permitted
$ elf2olf -o linux /tmp/sln
$ ./sln ./sln ./slnx   
$ echo $?
0