]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[PATCH] x86: don't allow tail-calls in sys_ftruncate[64]()
authorLinus Torvalds <torvalds@osdl.org>
Tue, 18 Apr 2006 20:59:26 +0000 (20:59 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 24 Apr 2006 16:56:04 +0000 (09:56 -0700)
commit248c64d252a614b7d07ed85e1d714b25dd537d57
tree4778502dff46b3188f1d96c565863fea2893442b
parentfa39df2ff7f6102f1f37d3cf1f68243534d56253
[PATCH] x86: don't allow tail-calls in sys_ftruncate[64]()

x86: don't allow tail-calls in sys_ftruncate[64]()

Gcc thinks it owns the incoming argument stack, but that's not true for
"asmlinkage" functions, and it corrupts the caller-set-up argument stack
when it pushes the third argument onto the stack.  Which can result in
%ebx getting corrupted in user space.

Now, normally nobody sane would ever notice, since libc will save and
restore %ebx anyway over the system call, but it's still wrong.

I'd much rather have "asmlinkage" tell gcc directly that it doesn't own
the stack, but no such attribute exists, so we're stuck with our hacky
manual "prevent_tail_call()" macro once more (we've had the same issue
before with sys_waitpid() and sys_wait4()).

Thanks to Hans-Werner Hilse <hilse@sub.uni-goettingen.de> for reporting
the issue and testing the fix.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/open.c