public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] statfs: add missing f_flags assignment
@ 2020-10-12  5:46 Chen Li
  2020-10-14  8:01 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Li @ 2020-10-12  5:46 UTC (permalink / raw)
  To: libc-alpha

f_flags is added into struct statfs since Linux 2.6.36, which is lacked
in glibc's statfs64.c until now. So mount flags is uninitialized on
platforms having no statfs64 syscall in kernel, e.g., alpha and its derivation

Signed-off-by: chenli <chenli@uniontech.com>
---
 sysdeps/unix/sysv/linux/statfs64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c
index c941128637..2c293badc8 100644
--- a/sysdeps/unix/sysv/linux/statfs64.c
+++ b/sysdeps/unix/sysv/linux/statfs64.c
@@ -78,6 +78,7 @@ __statfs64 (const char *file, struct statfs64 *buf)
   buf->f_fsid = buf32.f_fsid;
   buf->f_namelen = buf32.f_namelen;
   buf->f_frsize = buf32.f_frsize;
+  buf->f_flags = buf32.f_flags;
   memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
 
   return 0;
-- 
2.28.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] statfs: add missing f_flags assignment
  2020-10-12  5:46 [PATCH] statfs: add missing f_flags assignment Chen Li
@ 2020-10-14  8:01 ` Florian Weimer
  2020-10-15  9:00   ` Chen Li
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2020-10-14  8:01 UTC (permalink / raw)
  To: Chen Li; +Cc: libc-alpha

* Chen Li:

> f_flags is added into struct statfs since Linux 2.6.36, which is lacked
> in glibc's statfs64.c until now. So mount flags is uninitialized on
> platforms having no statfs64 syscall in kernel, e.g., alpha and its derivation
>
> Signed-off-by: chenli <chenli@uniontech.com>
> ---
>  sysdeps/unix/sysv/linux/statfs64.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c
> index c941128637..2c293badc8 100644
> --- a/sysdeps/unix/sysv/linux/statfs64.c
> +++ b/sysdeps/unix/sysv/linux/statfs64.c
> @@ -78,6 +78,7 @@ __statfs64 (const char *file, struct statfs64 *buf)
>    buf->f_fsid = buf32.f_fsid;
>    buf->f_namelen = buf32.f_namelen;
>    buf->f_frsize = buf32.f_frsize;
> +  buf->f_flags = buf32.f_flags;
>    memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
>  
>    return 0;

I've checked that this builds on all architectures.

Does this result in a user-visible bug on some architectures besides
alpha?

May we drop the “Signed-off-by: chenli <chenli@uniontech.com>” line?
glibc does not use DCO <https://developercertificate.org/>, but due to
the size of the change, no additional paperwork is required for this
contribution.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] statfs: add missing f_flags assignment
  2020-10-14  8:01 ` Florian Weimer
@ 2020-10-15  9:00   ` Chen Li
  2020-10-15  9:42     ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Li @ 2020-10-15  9:00 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha


> Does this result in a user-visible bug on some architectures besides alpha?

all arch have no statfs64 syscall support should suffer from this bug. I search
my 4.4 kernel, and found "alpha arc c6x h8300 hexagon metag nios2 openrisc score
tile um unicore32 x86" all don't have this syscall.

AFAIK, some uses of statvfs will also take use of statfs64 internally, e.g.,
systemd's Protect*:

static int get_mount_flags(const char *path, unsigned long *flags) {
        struct statvfs buf;

        if (statvfs(path, &buf) < 0)
                return -errno;
        *flags = buf.f_flag;
        return 0;
}

So, on architectures I mentioned above, this bug may also cause some secure
services fail to start due to uninitialized f_flags.

> May we drop the “Signed-off-by: chenli <chenli@uniontech.com>” line?
> glibc does not use DCO <https://developercertificate.org/>, but due to
> the size of the change, no additional paperwork is required for this
> contribution.

Of course, feel free to remove this line. Also, please tell me if I should
remove this line and reposted this patch by myself, thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] statfs: add missing f_flags assignment
  2020-10-15  9:00   ` Chen Li
@ 2020-10-15  9:42     ` Florian Weimer
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2020-10-15  9:42 UTC (permalink / raw)
  To: Chen Li; +Cc: libc-alpha

* Chen Li:

>> Does this result in a user-visible bug on some architectures besides alpha?
>
> all arch have no statfs64 syscall support should suffer from this
> bug. I search my 4.4 kernel, and found "alpha arc c6x h8300 hexagon
> metag nios2 openrisc score tile um unicore32 x86" all don't have this
> syscall.

Hmm, I think everything except alpha has either a 64-bit statfs, or
statfs64.  So I'm not bothering with adding a test case or filing a bug.

> Of course, feel free to remove this line. Also, please tell me if I should
> remove this line and reposted this patch by myself, thanks.

Thanks, I've pushed your patch.

Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-15  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12  5:46 [PATCH] statfs: add missing f_flags assignment Chen Li
2020-10-14  8:01 ` Florian Weimer
2020-10-15  9:00   ` Chen Li
2020-10-15  9:42     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).