Skip to contentSkip to conversation

proc: fix ->stack_start in compat mode

PATCH In review Alexey Dobriyan 2 participants 6 messages Oct 28, 2009 – Nov 1, 2009 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: fix ->stack_start in compat mode

Assign tsk->stack_start even when doing compat execve(2).

As side effect, fix segfault inside boehm-gc library.
http://bugzilla.kernel.org/show_bug.cgi?id=14478

---

Michael, please, confirm.

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

 fs/compat.c |    2 ++
 1 file changed, 2 insertions(+)
fs/compat.c +2 -0
@@ -1532,6 +1532,8 @@ int compat_do_execve(char * filename,
 	if (retval < 0)
 		goto out;
 
+	current->stack_start = current->mm->start_stack;
+
 	/* execve succeeded */
 	current->fs->in_exec = 0;
 	current->in_execve = 0;
#1 lore raw

Am Mittwoch, den 28.10.2009, 14:56 +0300 schrieb Alexey Dobriyan:

Quoted 5 lines

Assign tsk->stack_start even when doing compat execve(2).

As side effect, fix segfault inside boehm-gc library.
http://bugzilla.kernel.org/show_bug.cgi?id=14478

Quoted 7 lines

---

Michael, please, confirm.

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

Under which circumstance do you get 0 kb reported? What is your system (mmu/nommu, 32bit/64bit, architecture and so on).

Stefani

#2 lore raw
Quoted 9 lines · Stefani Seibold

Am Mittwoch, den 28.10.2009, 14:56 +0300 schrieb Alexey Dobriyan:

Quoted 8 lines

Assign tsk->stack_start even when doing compat execve(2).

As side effect, fix segfault inside boehm-gc library.
http://bugzilla.kernel.org/show_bug.cgi?id=14478

---

Quoted 7 lines
Quoted 4 lines

Michael, please, confirm.

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

Under which circumstance do you get 0 kb reported? What is your system (mmu/nommu, 32bit/64bit, architecture and so on).

i386 userpace, x86_64 kernel

#3 lore raw
In reply to Stefani Seibold
Quoted 9 lines · Stefani Seibold

Am Mittwoch, den 28.10.2009, 14:56 +0300 schrieb Alexey Dobriyan:

Quoted 8 lines

Assign tsk->stack_start even when doing compat execve(2).

As side effect, fix segfault inside boehm-gc library.
http://bugzilla.kernel.org/show_bug.cgi?id=14478

---

Quoted 7 lines
Quoted 4 lines

Michael, please, confirm.

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

Under which circumstance do you get 0 kb reported? What is your system (mmu/nommu, 32bit/64bit, architecture and so on).

Well, no wonder it doesn't work:

	#define KSTK_ESP(tsk)           -1 /* sorry. doesn't work for syscall. */

How does it supposed to work on live task?

#4 lore raw

Am Sonntag, den 01.11.2009, 15:43 +0300 schrieb Alexey Dobriyan:

Quoted 15 lines · Stefani Seibold
Quoted 14 lines

Am Mittwoch, den 28.10.2009, 14:56 +0300 schrieb Alexey Dobriyan:

Quoted 12 lines

Assign tsk->stack_start even when doing compat execve(2).

As side effect, fix segfault inside boehm-gc library.
http://bugzilla.kernel.org/show_bug.cgi?id=14478

---

Michael, please, confirm.

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

Quoted 8 lines
Quoted 2 lines

Under which circumstance do you get 0 kb reported? What is your system (mmu/nommu, 32bit/64bit, architecture and so on).

Well, no wonder it doesn't work:

	#define KSTK_ESP(tsk)           -1 /* sorry. doesn't work for syscall. */

How does it supposed to work on live task?

Can you write it in a full sentence? Where did you located this define?

#5 lore raw
In reply to Alexey Dobriyan

Am Sonntag, den 01.11.2009, 15:43 +0300 schrieb Alexey Dobriyan:

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

Stefani, I get "Stack usage: 0 kB", you may want to look at it.

Under which circumstance do you get 0 kb reported? What is your system (mmu/nommu, 32bit/64bit, architecture and so on).

Well, no wonder it doesn't work:

	#define KSTK_ESP(tsk)           -1 /* sorry. doesn't work for syscall. */

How does it supposed to work on live task?

Okay, you are right. That's really strange. I just build a 64 bit kernel i will try to fix this odd behavior. This is a break in the kernel API. KSTP_ESP should return the value of the kernel stack and not a -1. Sh..