From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f65.google.com ([209.85.218.65]:42551 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388621AbeG1AjN (ORCPT ); Fri, 27 Jul 2018 20:39:13 -0400 Received: by mail-oi0-f65.google.com with SMTP id n84-v6so11853929oib.9 for ; Fri, 27 Jul 2018 16:15:08 -0700 (PDT) MIME-Version: 1.0 References: <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> <153271291017.9458.7827028432894772673.stgit@warthog.procyon.org.uk> In-Reply-To: <153271291017.9458.7827028432894772673.stgit@warthog.procyon.org.uk> From: Jann Horn Date: Sat, 28 Jul 2018 01:14:40 +0200 Message-ID: Subject: Re: [PATCH 34/38] vfs: syscall: Add fsinfo() to query filesystem information [ver #10] To: David Howells Cc: Al Viro , Linux API , Linus Torvalds , linux-fsdevel@vger.kernel.org, kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Jul 27, 2018 at 7:36 PM David Howells wrote: > > Add a system call to allow filesystem information to be queried. A request > value can be given to indicate the desired attribute. Support is provided > for enumerating multi-value attributes. [...] > +static int fsinfo_generic_ids(struct dentry *dentry, > + struct fsinfo_ids *p) > +{ [...] > + strcpy(p->f_fs_name, dentry->d_sb->s_type->name); Can you use strlcpy() instead? From a quick look, I don't see anything that actually limits the size of filesystem names, even though everything in-kernel probably fits into the 16 bytes you've allocated for the name. [...] > +static int fsinfo_generic_name_encoding(struct dentry *dentry, char *buf) > +{ > + static const char encoding[] = "utf8"; > + > + if (buf) > + memcpy(buf, encoding, sizeof(encoding) - 1); > + return sizeof(encoding) - 1; > +} Is this meant to be "encoding to be used by userspace" or "encoding of on-disk filenames"? If the former: That's always utf8, right? Are there any plans to create filesystems that behave differently? If the latter: This is wrong for e.g. a vfat mount that uses a codepage, right? Should the default in that case not be "I don't know"?