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

Reply via email to