Re: [RFC PATCH glibc v2 26/34] hurd: Remove __hurd_local_reply_port

2023-04-14 Thread Samuel Thibault
Hello, Sergey Bugaev, le ven. 14 avril 2023 23:29:51 +0300, a ecrit: > On Fri, Apr 14, 2023 at 8:33 PM Samuel Thibault > wrote: > > Applied with fixing the __mig_dealloc_reply_port(NULL) cases, thanks! > > By the way: that __mig_dealloc_reply_port () inside > _dl_sysdep_start_cleanup () is not

Re: [PATCH hurd] Remove default_pager_paging_file RPC from default pager

2023-04-14 Thread Samuel Thibault
Applied, thanks! Flavio Cruz, le sam. 15 avril 2023 01:12:20 -0400, a ecrit: > The default_pager_paging_storage RPC has already it more than 20 years > ago. Given that we want to change the type of default_pager_filename_t > to use c_string, we can just remove the unused RPC. > > Tested that swap

[PATCH hurd] Remove default_pager_paging_file RPC from default pager

2023-04-14 Thread Flavio Cruz
The default_pager_paging_storage RPC has already it more than 20 years ago. Given that we want to change the type of default_pager_filename_t to use c_string, we can just remove the unused RPC. Tested that swapon/swapoff still work with the new binaries. --- hurd/default_pager.defs | 8 +--

Re: [RFC PATCH glibc v2 26/34] hurd: Remove __hurd_local_reply_port

2023-04-14 Thread Sergey Bugaev
On Fri, Apr 14, 2023 at 8:33 PM Samuel Thibault wrote: > Applied with fixing the __mig_dealloc_reply_port(NULL) cases, thanks! By the way: that __mig_dealloc_reply_port () inside _dl_sysdep_start_cleanup () is not doing what the author of that code wanted it to do. It deallocates the current repl

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Sergey Bugaev
On Fri, Apr 14, 2023 at 8:34 PM Samuel Thibault wrote: > Reapplied on top of "Remove __hurd_local_reply_port", thanks! Awesome, thank you! I have implemented the changes we talked about (replacing the receive right with a dead name...), and they even seem to pass the few tests from the testsuite

[PATCH 5/5] hurd: Avoid leaking task & thread ports

2023-04-14 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- hurd/catch-exc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hurd/catch-exc.c b/hurd/catch-exc.c index d375bf67..bec850f9 100644 --- a/hurd/catch-exc.c +++ b/hurd/catch-exc.c @@ -35,6 +35,7 @@ _S_catch_exception_raise (mach_port_t port, #endif

[PATCH 3/5] hurd: Implement sigreturn for x86_64

2023-04-14 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- This supersedes the previous version of this patch, and contains the same improvements the last two patches made to the i386 version. sysdeps/mach/hurd/x86_64/sigreturn.c | 166 +++ 1 file changed, 166 insertions(+) create mode 100644 sys

[PATCH 4/5] hurd: Simplify _S_catch_exception_raise

2023-04-14 Thread Sergey Bugaev
_hurd_thread_sigstate () already handles finding an existing sigstate before allocating a new one, so just use that. Bonus: this will only lock the _hurd_siglock once. Signed-off-by: Sergey Bugaev --- hurd/catch-exc.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hur

[PATCH 2/5] hurd: Microoptimize sigreturn

2023-04-14 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- I'll understand if this patch will be rejected, since this is not a hot path. But I just couldn't help myself when I saw what this was being compiled to! Much cleaner now. If you don't like THREAD_GETMEM (THREAD_SELF, _hurd_sigstate), we could have _hurd_self_sig

[PATCH 1/5] hurd: Fix restoring reply port in sigreturn

2023-04-14 Thread Sergey Bugaev
We must not use the user's reply port (scp->sc_reply_port) for any of our own RPCs, otherwise various things break. So, use MACH_PORT_DEAD as a reply port when destroying our reply port, and make sure to do this after _hurd_sigstate_unlock (), which may do a gsync_wake () RPC. Signed-off-by: Serge

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Samuel Thibault
Reapplied on top of "Remove __hurd_local_reply_port", thanks! Sergey Bugaev, le dim. 19 mars 2023 18:10:07 +0300, a ecrit: > When glibc is built as a shared library, TLS is always initialized by > the call of TLS_INIT_TP () macro made inside the dynamic loader, prior > to running the main program

Re: [RFC PATCH glibc v2 26/34] hurd: Remove __hurd_local_reply_port

2023-04-14 Thread Samuel Thibault
Applied with fixing the __mig_dealloc_reply_port(NULL) cases, thanks! Sergey Bugaev, le jeu. 13 avril 2023 14:58:12 +0300, a ecrit: > Now that the signal code no longer accesses it, the only real user of it > was mig-reply.c, so move the logic for managing the port there. > > If we're in SHARED a

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Samuel Thibault
Sergey Bugaev via Libc-alpha, le ven. 14 avril 2023 12:23:00 +0300, a ecrit: > On Fri, Apr 14, 2023 at 12:12 PM Samuel Thibault > wrote: > > Sergey Bugaev via Libc-alpha, le ven. 14 avril 2023 11:53:43 +0300, a ecrit: > > > It's in _hurdsig_abort_rpcs, if the interrupt_operation call fails. > > >

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Sergey Bugaev
On Fri, Apr 14, 2023 at 12:12 PM Samuel Thibault wrote: > Sergey Bugaev via Libc-alpha, le ven. 14 avril 2023 11:53:43 +0300, a ecrit: > > It's in _hurdsig_abort_rpcs, if the interrupt_operation call fails. > > > > Let's maybe not do that either? We're already making mach_msg seem to > > have retu

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Samuel Thibault
Sergey Bugaev via Libc-alpha, le ven. 14 avril 2023 11:53:43 +0300, a ecrit: > It's in _hurdsig_abort_rpcs, if the interrupt_operation call fails. > > Let's maybe not do that either? We're already making mach_msg seem to > have returned EINTR, which intr-msg knows how to handle. Mmm, yes, but we

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Sergey Bugaev
On Fri, Apr 14, 2023 at 11:39 AM Samuel Thibault wrote: > Sergey Bugaev, le ven. 14 avril 2023 11:29:37 +0300, a ecrit: > > But secondly, if we are not destroying the user's reply port, but > > restoring it, then I don't think the "port = MACH_PORT_NULL, arg = > > stale name" case can happen? So w

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Samuel Thibault
Sergey Bugaev, le ven. 14 avril 2023 11:29:37 +0300, a ecrit: > But secondly, if we are not destroying the user's reply port, but > restoring it, then I don't think the "port = MACH_PORT_NULL, arg = > stale name" case can happen? So we don't need to handle it? > > We should really just assert (arg

Re: [RFC PATCH glibc 24/34] hurd: Only check for TLS initialization inside rtld or in static builds

2023-04-14 Thread Sergey Bugaev
On Fri, Apr 14, 2023 at 12:47 AM Samuel Thibault wrote: > #10 0x0106bc20 in __libc_assert_fail (assertion=0x1222762 "port == arg", > file=0x121c2a0 "../sysdeps/mach/hurd/mig-reply.c", line=92, > function=0x121c2c4 <__PRETTY_FUNCTION__.0> "__mig_dealloc_reply_port") > at __libc_assert_f