[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/7] hurd: Make _exit work during early boot-up
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 4/7] hurd: Make _exit work during early boot-up |
Date: |
Sat, 29 Apr 2023 16:54:16 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Sergey Bugaev, le sam. 29 avril 2023 16:13:51 +0300, a ecrit:
> If any of the early boot-up tasks calls exit () or returns from main (),
> terminate it properly instead of crashing on trying to dereference
> _hurd_ports and getting forcibly terminated by the kernel.
>
> We sadly cannot make the __USEPORT macro do the check for _hurd_ports
> being unset, because it evaluates to the value of the expression
> provided as the second argument, and that can be of any type; so there
> is no single suitable fallback value for the macro to evaluate to in
> case _hurd_ports is unset. Instead, each use site that wants to care for
> this case will have to do its own checking.
>
> Checked on x86_64-gnu.
\o/
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
> sysdeps/mach/hurd/_exit.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c
> index 73957744..80cfe532 100644
> --- a/sysdeps/mach/hurd/_exit.c
> +++ b/sysdeps/mach/hurd/_exit.c
> @@ -24,8 +24,9 @@
> void
> _hurd_exit (int status)
> {
> - /* Give the proc server our exit status. */
> - __USEPORT (PROC, __proc_mark_exit (port, status, 0));
> + if (_hurd_ports != NULL)
> + /* Give the proc server our exit status. */
> + __USEPORT (PROC, __proc_mark_exit (port, status, 0));
>
> /* Commit suicide. */
> __task_terminate (__mach_task_self ());
> --
> 2.40.1
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit, Sergey Bugaev, 2023/04/29
- [PATCH 2/7] hurd: Move libc_hidden_def's around, Sergey Bugaev, 2023/04/29
- [PATCH 3/7] hurd: Mark various conditions as unlikely, Sergey Bugaev, 2023/04/29
- [PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd, Sergey Bugaev, 2023/04/29
- [PATCH 4/7] hurd: Make _exit work during early boot-up, Sergey Bugaev, 2023/04/29
- Re: [PATCH 4/7] hurd: Make _exit work during early boot-up,
Samuel Thibault <=
- [PATCH 5/7] hurd: Don't leak the auth port in msg* RPCs, Sergey Bugaev, 2023/04/29
- [PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling, Sergey Bugaev, 2023/04/29
- Re: [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit, Samuel Thibault, 2023/04/29