[IA64] set_thread_area fails in IA32 chroot
authorIan Wienand <ianw@gelato.unsw.edu.au>
Tue, 20 Nov 2007 03:12:46 +0000 (14:12 +1100)
committerTony Luck <tony.luck@intel.com>
Wed, 19 Dec 2007 19:06:40 +0000 (11:06 -0800)
commite384f41409cb9e543fbc84b375e2ba46cbcbec6a
treeb0b47dd81e493ebc3c06878ad61dcb8882231c9c
parentee211b37aa98123b1d9b19d228011e632a4bbe75
[IA64] set_thread_area fails in IA32 chroot

I tried to upgrade an IA32 chroot on my IA64 to a new glibc with TLS.
It kept dying because set_thread_area was returning -ESRCH
(bugs.debian.org/451939).

I instrumented arch/ia64/ia32/sys_ia32.c:get_free_idx() and ended up
seeing output like

[pid] idx   desc->a  desc->b
-----------------------------
[2710] 0 -> c6b0ffff 40dff31b
[2710] 1 -> 0 0
[2710] 2 -> 0 0

[2710] 0 -> c6b0ffff 40dff31b
[2710] 1 -> c6b0ffff 40dff31b
[2710] 2 -> 0 0

[2711] 0 -> c6b0ffff 40dff31b
[2711] 1 -> c6b0ffff 40dff31b
[2711] 2 -> 48c0ffff 40dff317

which suggested to me that TLS pointers were surviving exec() calls,
leading to GDT pointers filling up and the eventual failure of
get_free_idx().

I think the solution is flushing the tls array on exec.

Signed-Off-By: Ian Wienand <ianw@gelato.unsw.edu.au>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/kernel/process.c