Commit 3d00daf4 authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

x86: tls prevent_tail_call

Fix a kernel bug (vmware boot problem) reported by Tomasz Grobelny,
which occurs with certain .config variants and gccs.

The x86 TLS cleanup in commit efd1ca52
made the sys_set_thread_area and sys_get_thread_area functions ripe for
tail call optimization.  If the compiler chooses to use it for them, it
can clobber the user trap frame because these are asmlinkage functions.
Reported-by: default avatarTomasz Grobelny <tomasz@grobelny.oswiecenia.net>
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c0f4133b
...@@ -91,7 +91,9 @@ int do_set_thread_area(struct task_struct *p, int idx, ...@@ -91,7 +91,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) asmlinkage int sys_set_thread_area(struct user_desc __user *u_info)
{ {
return do_set_thread_area(current, -1, u_info, 1); int ret = do_set_thread_area(current, -1, u_info, 1);
prevent_tail_call(ret);
return ret;
} }
...@@ -139,7 +141,9 @@ int do_get_thread_area(struct task_struct *p, int idx, ...@@ -139,7 +141,9 @@ int do_get_thread_area(struct task_struct *p, int idx,
asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
{ {
return do_get_thread_area(current, -1, u_info); int ret = do_get_thread_area(current, -1, u_info);
prevent_tail_call(ret);
return ret;
} }
int regset_tls_active(struct task_struct *target, int regset_tls_active(struct task_struct *target,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment