Message ID | 20230319151017.531737-9-bugaevc@gmail.com (mailing list archive) |
---|---|
State | Committed, archived |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1359D389EC69 for <patchwork@sourceware.org>; Sun, 19 Mar 2023 15:15:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1359D389EC69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679238910; bh=drHQwjtEKxmDE1qW2YqudRgabdfFASYN0vqRB/Vimjo=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=DxOKiLQFi31+s5bIglQtr14VdejLgHV6yNiZFwC6PkqJZPUHCEyWi6XXm0sRVwrtN F/U+eBhBqlhhNua8Hhh29ifu3QElWGqWTc2XAAhK7ryR5l11nodVGdDv+wYqN1ClEn v4EJAVIzjJePUIlE72U9icgpNhewlD5LcDhkj1KA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 480E3385B52A for <libc-alpha@sourceware.org>; Sun, 19 Mar 2023 15:11:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 480E3385B52A Received: by mail-lj1-x229.google.com with SMTP id b13so9691968ljf.6 for <libc-alpha@sourceware.org>; Sun, 19 Mar 2023 08:11:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679238663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=drHQwjtEKxmDE1qW2YqudRgabdfFASYN0vqRB/Vimjo=; b=Q+J5ssTAyAet2J4kygkfaQCPhj98AwKERC6wGV8dUkOChAZsbvjMRbZ1xsSvTftvcI lKlN+S1TWWq6DHNU4JWF9i4NAelKtA0egO29sxgc3Ht8YmkRrzAW8ykOe9mdRTLpp14f OF7yy4FenuXcvmfF4zNd+H7cyT3uT4a2e3TNChRQryFD7zFtGiBA8VX28YtAQhDgA/VE IzqbZRTgCF7LEQzuFM6g0bINwVWOsH02OgFjl64N4mY1RIysKqnllE0XRyG3JA6F/pnw tupwE5fq0vKtd3b+rqkf5AWfRDxu4o4CqI2llmltT1Z6c5jVndOe0/eYuVjUnNX+xNhQ QfGA== X-Gm-Message-State: AO0yUKW9eqmgA/qG+C6vGn1U/V20VMqtnmUh/KXXR8BZmVFGbk5BUaSQ re3jILLU7eN2uXvFCqiV5D5QLQAL5JPZYA== X-Google-Smtp-Source: AK7set+NbiFzg56lo5OGtpPQ3O+eHIkDkw5FKMXZ6LlJXUGj1aJfRLxu2KCxtMwureyZceXARBKLyw== X-Received: by 2002:a05:651c:505:b0:295:941c:fc54 with SMTP id o5-20020a05651c050500b00295941cfc54mr6417372ljp.26.1679238663392; Sun, 19 Mar 2023 08:11:03 -0700 (PDT) Received: from surface-pro-6.. ([2a00:1370:818c:4a57:577a:76f4:df43:5e66]) by smtp.gmail.com with ESMTPSA id m19-20020ac24253000000b004e90dee5469sm1274089lfl.157.2023.03.19.08.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 08:11:03 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault <samuel.thibault@gnu.org>, Sergey Bugaev <bugaevc@gmail.com> Subject: [RFC PATCH glibc 08/34] hurd: Disable O_TRUNC and FS_RETRY_MAGICAL in rtld Date: Sun, 19 Mar 2023 18:09:51 +0300 Message-Id: <20230319151017.531737-9-bugaevc@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230319151017.531737-1-bugaevc@gmail.com> References: <20230319151017.531737-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Sergey Bugaev via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Sergey Bugaev <bugaevc@gmail.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
The rest of the x86_64-gnu port
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
Commit Message
Sergey Bugaev
March 19, 2023, 3:09 p.m. UTC
hurd/lookup-retry.c is compiled into rtld, the dynamic linker/loader. To
avoid pulling in file_set_size, file_utimens, tty/ctty stuff, more
string/memory code (memmove, strncpy, strcpy), and more strtoul/itoa
code, compile out support for O_TRUNC and FS_RETRY_MAGICAL when building
hurd/lookup-retry.c for rtld. None of that functionality is useful to
rtld during startup anyway. Keep support for FS_RETRY_MAGICAL("/"),
since that does not pull in much, and is required for following absolute
symlinks.
The large number of extra code being pulled into rtld was noticed by
reviewing librtld.map & elf/librtld.os.map in the build tree.
It is worth noting that once libc.so is loaded, the real __open, __stat,
etc. replace the minimal versions used initially by rtld -- this is
especially important in the Hurd port, where the minimal rtld versions
do not use the dtable and just pass real Mach port names as fds. Thus,
once libc.so is loaded, rtld will gain access to the full
__hurd_file_name_lookup_retry () version, complete with FS_RETRY_MAGICAL
support, which is important in case the program decides to
dlopen ("/proc/self/fd/...") or some such.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
hurd/lookup-retry.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
Applied, thanks! Sergey Bugaev, le dim. 19 mars 2023 18:09:51 +0300, a ecrit: > hurd/lookup-retry.c is compiled into rtld, the dynamic linker/loader. To > avoid pulling in file_set_size, file_utimens, tty/ctty stuff, more > string/memory code (memmove, strncpy, strcpy), and more strtoul/itoa > code, compile out support for O_TRUNC and FS_RETRY_MAGICAL when building > hurd/lookup-retry.c for rtld. None of that functionality is useful to > rtld during startup anyway. Keep support for FS_RETRY_MAGICAL("/"), > since that does not pull in much, and is required for following absolute > symlinks. > > The large number of extra code being pulled into rtld was noticed by > reviewing librtld.map & elf/librtld.os.map in the build tree. > > It is worth noting that once libc.so is loaded, the real __open, __stat, > etc. replace the minimal versions used initially by rtld -- this is > especially important in the Hurd port, where the minimal rtld versions > do not use the dtable and just pass real Mach port names as fds. Thus, > once libc.so is loaded, rtld will gain access to the full > __hurd_file_name_lookup_retry () version, complete with FS_RETRY_MAGICAL > support, which is important in case the program decides to > dlopen ("/proc/self/fd/...") or some such. > > Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> > --- > hurd/lookup-retry.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c > index 8850c4fd..99c98104 100644 > --- a/hurd/lookup-retry.c > +++ b/hurd/lookup-retry.c > @@ -177,7 +177,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) > > /* We got a successful translation. Now apply any open-time > action flags we were passed. */ > - > +#if !IS_IN (rtld) > if (!err && (flags & O_TRUNC)) > { > /* Asked to truncate the file. */ > @@ -189,6 +189,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) > __file_utimens (*result, atime, mtime); > } > } > +#endif > > if (err) > __mach_port_deallocate (__mach_task_self (), *result); > @@ -214,6 +215,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) > file_name = &retryname[1]; > break; > > +#if !IS_IN (rtld) > case 'f': > if (retryname[1] == 'd' && retryname[2] == '/') > { > @@ -358,8 +360,9 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) > goto bad_magic; > break; > > - default: > bad_magic: > +#endif /* !IS_IN (rtld) */ > + default: > err = EGRATUITOUS; > goto out; > } > -- > 2.39.2 >
diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index 8850c4fd..99c98104 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -177,7 +177,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) /* We got a successful translation. Now apply any open-time action flags we were passed. */ - +#if !IS_IN (rtld) if (!err && (flags & O_TRUNC)) { /* Asked to truncate the file. */ @@ -189,6 +189,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) __file_utimens (*result, atime, mtime); } } +#endif if (err) __mach_port_deallocate (__mach_task_self (), *result); @@ -214,6 +215,7 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) file_name = &retryname[1]; break; +#if !IS_IN (rtld) case 'f': if (retryname[1] == 'd' && retryname[2] == '/') { @@ -358,8 +360,9 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port) goto bad_magic; break; - default: bad_magic: +#endif /* !IS_IN (rtld) */ + default: err = EGRATUITOUS; goto out; }