Bug#328955: binutils: Simple assembly program crashes on i386.

2006-11-07 Thread Peter Cordes
Package: binutils
Followup-For: Bug #328955

 It works for me now, on an up to date unstable system, and on an
Ubuntu Dapper system.  i.e. binutils 2.17-3 and
2.16.1cvs20060117-1ubuntu2.1 both don't have this problem.  Sarge
doesn't have it either, so this bug should probably be closed.
 
cat exit.s EOF
.section .data
#   .long 0

.text
.globl _start

_start:
movl$1, %eax
movl$0, %ebx
int $0x80
EOF
(I can't actually paste this all at once
 because of whitespace after the ending EOF... :(

as exit.s -o exit.o
ld exit.o -o exit
strace ./exit
objdump -d ./exit

output:

execve(./exit, [./exit], [/* 31 vars */]) = 0
_exit(0)= ?
Process 1553 detached


./exit: file format elf32-i386

Disassembly of section .text:

08048074 _start:
 8048074:   b8 01 00 00 00  mov$0x1,%eax
 8048079:   bb 00 00 00 00  mov$0x0,%ebx
 804807e:   cd 80   int$0x80


 happy hacking,

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-1-k7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages binutils depends on:
ii  libc62.3.6.ds1-7 GNU C Library: Shared libraries

binutils recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#328955: binutils: Simple assembly program crashes on i386.

2005-09-18 Thread Takeshi Hakamata
Package: binutils
Version: 2.16.1cvs20050902-1
Severity: normal


When you run an assembly program without any data in the .data section,
you will get a segmentation fault in execve() and the binary won't run.
Here is an output from strace:

$ strace ./a.out
execve(./a.out, [./a.out], [/* 69 vars */]) = -1 EFAULT (Bad address)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
$

When I assemble and link the program with binutils 2.16.1-2, the binary
works fine.  I've attached a very simple assembly program exposing this
problem.  It just calls the exit system call.  If you uncomment the entry
in the .data section, the assembled binary will work fine.

To assemble the program, do the following steps:
$ as exit.s -o exit.o
$ ld exit.o -o exit

Takeshi

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13.1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages binutils depends on:
ii  libc6  2.3.5-6  GNU C Library: Shared libraries an binutils recommends no 
packages.

-- debconf information:
  binutils/oformat_warning:
* binutils/kernel_link_warning:
	.section .data
#	.long 0

	.text
.globl _start

_start:
	movl	$1, %eax
	movl	$0, %ebx
	int	$0x80