Messages in this thread Patch in this message | | | Date | Wed, 31 Mar 1999 13:45:43 +0200 (CEST) | From | "Markus F.X.J. Oberhumer" <> | Subject | subtle bug in <include/asm-i386/unistd.h> |
| |
While extending our UPX executable packer to support Linux/i386 executables I've stumbled over what I think is a subtle bug in the `asm volatile' statements.
The diff below is against 2.2.5.
I really wonder why noone has been hit by this before - might be due to a certain gcc/egcs register allocation scheme. Also I think that gcc should spit out some warning in this case.
If this turns out to be a true bug the glibc people might be interested as well - please forward this mail.
Markus
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
--- include/asm/unistd.h.orig Tue Jan 26 16:00:03 1999 +++ include/asm/unistd.h Wed Mar 31 13:35:30 1999 @@ -214,7 +214,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name)); \ + : "a" (__NR_##name)); \ __syscall_return(type,__res); \ } @@ -224,7 +224,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1))); \ + : "a" (__NR_##name),"b" ((long)(arg1))); \ __syscall_return(type,__res); \ } @@ -234,7 +234,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ + : "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ __syscall_return(type,__res); \ } @@ -244,7 +244,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + : "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3))); \ __syscall_return(type,__res); \ } @@ -255,7 +255,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + : "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4))); \ __syscall_return(type,__res); \ } @@ -267,7 +267,7 @@ long __res; \ __asm__ volatile ("int $0x80" \ : "=a" (__res) \ - : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + : "a" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ __syscall_return(type,__res); \ }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |