Skip to content

Commit

Permalink
x86: tls prevent_tail_call
Browse files Browse the repository at this point in the history
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 efd1ca5
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: Tomasz Grobelny <tomasz@grobelny.oswiecenia.net>
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Roland McGrath authored and Ingo Molnar committed Feb 29, 2008
1 parent c0f4133 commit 3d00daf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/x86/kernel/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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;
}


Expand Down Expand Up @@ -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)
{
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,
Expand Down

0 comments on commit 3d00daf

Please sign in to comment.