]> git.ipfire.org Git - thirdparty/glibc.git/commit
hurd: Improve reply port handling when exiting signal handlers
authorSergey Bugaev <bugaevc@gmail.com>
Sun, 19 Mar 2023 15:10:08 +0000 (18:10 +0300)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 10 Apr 2023 21:54:28 +0000 (23:54 +0200)
commit747812349d42427c835aeac987aa67641d84f1ad
treee9391fe71f0f029218155bb38bac64838b8df7fb
parentb37899d34d2190ef4b454283188f22519f096048
hurd: Improve reply port handling when exiting signal handlers

If we're doing signals, that means we've already got the signal thread
running, and that implies TLS having been set up. So we know that
__hurd_local_reply_port will resolve to THREAD_SELF->reply_port, and can
access that directly using the THREAD_GETMEM and THREAD_SETMEM macros.
This avoids potential miscompilations, and should also be a tiny bit
faster.

Also, use mach_port_mod_refs () and not mach_port_destroy () to destroy
the receive right. mach_port_destroy () should *never* be used on
mach_task_self (); this can easily lead to port use-after-free
vulnerabilities if the task has any other references to the same port.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230319151017.531737-26-bugaevc@gmail.com>
hurd/sigunwind.c
sysdeps/mach/hurd/i386/sigreturn.c