glibc/sysdeps/mach/hurd/x86
Sergey Bugaev c7fcce38c8 hurd: Make sure to not use tcb->self
Unlike sigstate->thread, tcb->self did not hold a Mach port reference on
the thread port it names. This means that the port can be deallocated,
and the name reused for something else, without anyone noticing. Using
tcb->self will then lead to port use-after-free.

Fortunately nothing was accessing tcb->self, other than it being
intially set to then-valid thread port name upon TCB initialization. To
assert that this keeps being the case without altering TCB layout,
rename self -> self_do_not_use, and stop initializing it.

Also, do not (re-)allocate a whole separate and unused stack for the
main thread, and just exit __pthread_setup early in this case.

Found upon attempting to use tcb->self and getting unexpected crashes.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230517191436.73636-7-bugaevc@gmail.com>
2023-05-17 22:59:50 +02:00
..
htl hurd: Make sure to not use tcb->self 2023-05-17 22:59:50 +02:00
sys hurd: Move some i386 bits to x86 2023-02-02 00:27:26 +01:00
dl-sysdep.c Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
exc2signal.c hurd: Move a couple of signal-related files to x86 2023-04-03 01:14:51 +02:00
init-first.c hurd: Don't migrate reply port into __init1_tcbhead 2023-04-21 03:02:04 +02:00
ioperm.c [hurd] Fix i686 build breakage caused by 4fedebc911 2023-02-17 11:21:28 +01:00
Makefile hurd: Move some i386 bits to x86 2023-02-02 00:27:26 +01:00
set-hooks-arch.h Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
signal-defines.sym hurd: Move a couple of signal-related files to x86 2023-04-03 01:14:51 +02:00
trampoline.c hurd: Fix sc_i386_thread_state layout 2023-05-16 16:09:00 +02:00