Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1363954imm; Fri, 27 Jul 2018 16:16:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeXxjQAmPrNQHyU02d+wrq2tp9nZ2WFSWbqFgjvaJvv9TjZqoWOoDCw5cpAmgv8CB4u/1Xz X-Received: by 2002:a17:902:e28b:: with SMTP id cf11-v6mr7797915plb.86.1532733414412; Fri, 27 Jul 2018 16:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532733414; cv=none; d=google.com; s=arc-20160816; b=c7n0FCiq7zBkeQrS4KvsGWYxwKvmFle0reHbQnecd5er5EVDB55G8PBRl/UwFUK93b WwqWcrnFQAL99Ab4kiNY8+q+bm4SOjz25ia40paFYeelPMZK3pU8KkBZovSju2zTX1jb lSejEde04RdUwbNGZUYmCAr8yfaw8EdTxevj3Uktrl9Lx9aE/Oc1KkrJYIB+/Wq4jf6x RgzCZiR/4elQqjmTEN37fmp0TJR9apumwXBclbFaN2KSg42mO5lPa0PFaXTBp2g3yPNS vPfrdwx29njg2rZhMNs4NfhHu8hqFGJ5JXWfLfqFoT3IN4kvV2YkTXHLV9Oq6obhURq5 eTxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=R3TvEBkiClcrYllBRC+rEaB41bTFLPUZ6g+nqgIiF1Q=; b=KPEAxrfdrabd353zjOg/U+ErF3y1ZQkQYmWEdTyOnzUo7tWhZjsXx1aXvhLToGfZY6 i1GxJMoBV3oSS7kJvBjaNszsPIj3cGnsr+64dLVX18w/1Z9+fKfLpoT/LiDFUHN6hTsA VPo3rkj9FyU6u5YjnFRDH5nVLSVTiKYkfFoHANzUGFUIKgDAoCN2AJwsVQK587Wphoeg idnmJVfTQlqb9l9gc5AjaswS2GZv5M8e41pehkA4XATxxkQrcM0M+vU/uHBtEV+el6Ww 0w0lUJS0GqvJ1YicvzQPBLngTcbhzdIkxzh2M6oJnm7sSx8IfY3ISzk19tQ/9i1FBBLT 5hvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fosne1aG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20-v6si4857167pls.237.2018.07.27.16.16.26; Fri, 27 Jul 2018 16:16:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fosne1aG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388899AbeG1AjN (ORCPT + 99 others); Fri, 27 Jul 2018 20:39:13 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:38623 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388660AbeG1AjN (ORCPT ); Fri, 27 Jul 2018 20:39:13 -0400 Received: by mail-oi0-f65.google.com with SMTP id v8-v6so11868201oie.5 for ; Fri, 27 Jul 2018 16:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R3TvEBkiClcrYllBRC+rEaB41bTFLPUZ6g+nqgIiF1Q=; b=fosne1aGDR2HV3BihBk2K5+PwFg/yh52cDxMpmxg+jCpaYpgIIljn4GD/VhYoyA+bQ X2yKxVOdzl3Y5f1oB0r4qNsMNXramwLrjUzD9cohoQjnXIy02N3smtJUG8Jhm+rYu/Hy nZ/EWxCx7vm/bNvxpqoOMBJPJkOj2IaYPNiGMWCzoRfd5lR5YjzDiCUHub2QGNY/51jm 0vMUch/z/wz0PhnS0kgeWBpQks4Oe5bAV6zGLXE/JTN1L0fgB1Bg/Sab0/1WAbOc+GKY UNKnvjBGvs39Uxt2bVOgm/Eg85AIEk+6X+2DQ45xyjVfRgczPmC1Bgo/Z/MqEthzI8Y+ PFtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R3TvEBkiClcrYllBRC+rEaB41bTFLPUZ6g+nqgIiF1Q=; b=uHXYjQ2J4udFiJhOxfxHflQDaIdaB/7gAl0lm1WAZRr2IxH1gzRfsG6MX3ROvM1z0B 8gk0N8cq/s8W/PYUoJUVh+qhmmgzaRHdM9PTiRmkWzidoZvMQnXUUzdcAmVKsVqQnDdO v8PsH/3yUlRsWs9vWaBZNaqVAbR5bokawfc2vTsM4qmyu0CxFGZ0IAX+9NR4MMdrVQHX O24VINNklGG97LgxOZtg2oW/+1ZE/60YZtUStyRRRj4r9iJHhttJhGpgZIF3jM7EKLmz E2Cmy5R4WXi3WSIx++s4InAWdon+BsuZILmx2NDvDehXde1QH1JEFV2KMo9R9UaXzSUI 4dzQ== X-Gm-Message-State: AOUpUlF9m9IB1V95IoORIrs7bqnNNGcpjTsM4rn0AMu9yeOGtnvoGZZ3 toK8lKgojQbUhtKUjq/HlFjyo5WKx2XLa9gyav4ZWA== X-Received: by 2002:aca:fc94:: with SMTP id a142-v6mr8035496oii.29.1532733307320; Fri, 27 Jul 2018 16:15:07 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"?