[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling |
Date: |
Sat, 29 Apr 2023 17:01:20 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Sergey Bugaev, le sam. 29 avril 2023 16:13:54 +0300, a ecrit:
> We need to set file_name, not update retryname. This is what the other
> branches do.
>
> Before this change, any attempt to access such a file would segfault due
> to file_name being unset:
>
> $ settrans -ac /tmp/my-machtype /hurd/magic machtype
> $ cat /tmp/my-machtype
> Segmentation fault
>
> Checked on i686-gnu.
>
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
> hurd/lookup-retry.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c
> index 99c98104..62f94bbc 100644
> --- a/hurd/lookup-retry.c
> +++ b/hurd/lookup-retry.c
> @@ -277,7 +277,6 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
> error_t err;
> struct host_basic_info hostinfo;
> mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT;
> - char *p;
> /* XXX want client's host */
> if (err = __host_info (__mach_host_self (), HOST_BASIC_INFO,
> (integer_t *) &hostinfo,
> @@ -288,13 +287,11 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
> err = EGRATUITOUS;
> goto out;
> }
> - p = _itoa (hostinfo.cpu_subtype, &retryname[8], 10, 0);
> - *--p = '/';
> - p = _itoa (hostinfo.cpu_type, &retryname[8], 10, 0);
> - if (p < retryname)
> + file_name = _itoa (hostinfo.cpu_subtype, &retryname[8], 10,
> 0);
> + *--file_name = '/';
> + file_name = _itoa (hostinfo.cpu_type, file_name, 10, 0);
> + if (file_name < retryname)
> abort (); /* XXX write this right if this ever happens */
> - if (p > retryname)
> - memmove (retryname, p, strlen(p) + 1);
> startdir = *result;
> }
> else
> --
> 2.40.1
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- Re: [PATCH 2/7] hurd: Move libc_hidden_def's around, (continued)
- [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
- [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 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling,
Samuel Thibault <=
- Re: [PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit, Samuel Thibault, 2023/04/29