tree:
https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
debugfs_namespaces
head: aa77168aed303d914b4c11a2edaddbca3f1feda1
commit: 738289244f9f67ce3281dfece66c6e2f728b6501 [1/3] debugfs: add ns entry
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 8.1.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 738289244f9f67ce3281dfece66c6e2f728b6501
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
fs/nsfs.c:19:30: error: conflicting type qualifiers for 'ns_file_operations'
const struct file_operations ns_file_operations = {
^~~~~~~~~~~~~~~~~~
In file included from fs/nsfs.c:12:
include/linux/nsfs.h:6:31: note: previous declaration of 'ns_file_operations'
was here
extern struct file_operations ns_file_operations;
^~~~~~~~~~~~~~~~~~
fs/nsfs.c: In function 'ns_ioctl':
fs/nsfs.c:196:7: error: 'NS_GET_USERNS' undeclared (first use in this
function); did you mean 'F_GET_SEALS'?
case NS_GET_USERNS:
^~~~~~~~~~~~~
F_GET_SEALS
fs/nsfs.c:196:7: note: each undeclared identifier is reported only once for each
function it appears in
> fs/nsfs.c:198:7: error: 'NS_GET_PARENT' undeclared (first
use in this function); did you mean 'CLONE_PARENT'?
case
NS_GET_PARENT:
^~~~~~~~~~~~~
CLONE_PARENT
> fs/nsfs.c:202:7: error: 'NS_GET_NSTYPE' undeclared (first
use in this function)
case NS_GET_NSTYPE:
^~~~~~~~~~~~~
fs/nsfs.c:204:7: error: 'NS_GET_OWNER_UID' undeclared (first use in this
function); did you mean 'F_GETOWNER_UIDS'?
case NS_GET_OWNER_UID:
^~~~~~~~~~~~~~~~
F_GETOWNER_UIDS
fs/nsfs.c: In function 'proc_ns_fget':
fs/nsfs.c:244:15: error: implicit declaration of function 'debugfs_real_fops'
[-Werror=implicit-function-declaration]
real_fops = debugfs_real_fops(file);
^~~~~~~~~~~~~~~~~
> fs/nsfs.c:244:13: warning: assignment to 'const struct
file_operations *' from 'int' makes pointer from integer without a cast
[-Wint-conversion]
real_fops = debugfs_real_fops(file);
^
cc1: some warnings being treated as errors
vim +198 fs/nsfs.c
6786741dbf99e4 Andrey Vagin 2016-09-06 186
6786741dbf99e4 Andrey Vagin 2016-09-06 187 static long ns_ioctl(struct
file *filp, unsigned int ioctl,
6786741dbf99e4 Andrey Vagin 2016-09-06 188 unsigned long arg)
6786741dbf99e4 Andrey Vagin 2016-09-06 189 {
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 190) struct user_namespace
*user_ns;
6786741dbf99e4 Andrey Vagin 2016-09-06 191 struct ns_common *ns =
get_proc_ns(file_inode(filp));
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 192) uid_t __user *argp;
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 193) uid_t uid;
6786741dbf99e4 Andrey Vagin 2016-09-06 194
6786741dbf99e4 Andrey Vagin 2016-09-06 195 switch (ioctl) {
6786741dbf99e4 Andrey Vagin 2016-09-06 @196 case NS_GET_USERNS:
6786741dbf99e4 Andrey Vagin 2016-09-06 197 return open_related_ns(ns,
ns_get_owner);
a7306ed8d94af7 Andrey Vagin 2016-09-06 @198 case NS_GET_PARENT:
a7306ed8d94af7 Andrey Vagin 2016-09-06 199 if
(!ns->ops->get_parent)
a7306ed8d94af7 Andrey Vagin 2016-09-06 200 return -EINVAL;
a7306ed8d94af7 Andrey Vagin 2016-09-06 201 return open_related_ns(ns,
ns->ops->get_parent);
e5ff5ce6e20ee2 Michael Kerrisk (man-pages 2017-01-25 @202) case NS_GET_NSTYPE:
e5ff5ce6e20ee2 Michael Kerrisk (man-pages 2017-01-25 203) return ns->ops->type;
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 @204) case NS_GET_OWNER_UID:
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 205) if (ns->ops->type !=
CLONE_NEWUSER)
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 206) return -EINVAL;
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 207) user_ns = container_of(ns,
struct user_namespace, ns);
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 208) argp = (uid_t __user *)
arg;
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 209) uid =
from_kuid_munged(current_user_ns(), user_ns->owner);
d95fa3c76a66b6 Michael Kerrisk (man-pages 2017-01-25 210) return put_user(uid, argp);
6786741dbf99e4 Andrey Vagin 2016-09-06 211 default:
6786741dbf99e4 Andrey Vagin 2016-09-06 212 return -ENOTTY;
6786741dbf99e4 Andrey Vagin 2016-09-06 213 }
6786741dbf99e4 Andrey Vagin 2016-09-06 214 }
6786741dbf99e4 Andrey Vagin 2016-09-06 215
e149ed2b805fef Al Viro 2014-11-01 216 int ns_get_name(char *buf,
size_t size, struct task_struct *task,
e149ed2b805fef Al Viro 2014-11-01 217 const struct
proc_ns_operations *ns_ops)
e149ed2b805fef Al Viro 2014-11-01 218 {
e149ed2b805fef Al Viro 2014-11-01 219 struct ns_common *ns;
e149ed2b805fef Al Viro 2014-11-01 220 int res = -ENOENT;
25b14e92af1a56 Kirill Tkhai 2017-05-08 221 const char *name;
e149ed2b805fef Al Viro 2014-11-01 222 ns = ns_ops->get(task);
e149ed2b805fef Al Viro 2014-11-01 223 if (ns) {
25b14e92af1a56 Kirill Tkhai 2017-05-08 224 name =
ns_ops->real_ns_name ? : ns_ops->name;
25b14e92af1a56 Kirill Tkhai 2017-05-08 225 res = snprintf(buf, size,
"%s:[%u]", name, ns->inum);
e149ed2b805fef Al Viro 2014-11-01 226 ns_ops->put(ns);
e149ed2b805fef Al Viro 2014-11-01 227 }
e149ed2b805fef Al Viro 2014-11-01 228 return res;
e149ed2b805fef Al Viro 2014-11-01 229 }
e149ed2b805fef Al Viro 2014-11-01 230
e149ed2b805fef Al Viro 2014-11-01 231 struct file *proc_ns_fget(int
fd)
e149ed2b805fef Al Viro 2014-11-01 232 {
e149ed2b805fef Al Viro 2014-11-01 233 struct file *file;
738289244f9f67 Christian Brauner 2019-10-11 234 const struct file_operations
*real_fops;
e149ed2b805fef Al Viro 2014-11-01 235
e149ed2b805fef Al Viro 2014-11-01 236 file = fget(fd);
e149ed2b805fef Al Viro 2014-11-01 237 if (!file)
e149ed2b805fef Al Viro 2014-11-01 238 return ERR_PTR(-EBADF);
e149ed2b805fef Al Viro 2014-11-01 239
738289244f9f67 Christian Brauner 2019-10-11 240 if (file->f_op !=
&ns_file_operations) {
738289244f9f67 Christian Brauner 2019-10-11 241 if
(file_dentry(file)->d_sb->s_magic != DEBUGFS_MAGIC)
e149ed2b805fef Al Viro 2014-11-01 242 goto out_invalid;
e149ed2b805fef Al Viro 2014-11-01 243
738289244f9f67 Christian Brauner 2019-10-11 @244 real_fops =
debugfs_real_fops(file);
738289244f9f67 Christian Brauner 2019-10-11 245 if (real_fops !=
&ns_file_operations)
738289244f9f67 Christian Brauner 2019-10-11 246 goto out_invalid;
738289244f9f67 Christian Brauner 2019-10-11 247 }
738289244f9f67 Christian Brauner 2019-10-11 248
e149ed2b805fef Al Viro 2014-11-01 249 return file;
e149ed2b805fef Al Viro 2014-11-01 250
e149ed2b805fef Al Viro 2014-11-01 251 out_invalid:
e149ed2b805fef Al Viro 2014-11-01 252 fput(file);
e149ed2b805fef Al Viro 2014-11-01 253 return ERR_PTR(-EINVAL);
e149ed2b805fef Al Viro 2014-11-01 254 }
e149ed2b805fef Al Viro 2014-11-01 255
:::::: The code at line 198 was first introduced by commit
:::::: a7306ed8d94af729ecef8b6e37506a1c6fc14788 nsfs: add ioctl to get a parent namespace
:::::: TO: Andrey Vagin <avagin(a)openvz.org>
:::::: CC: Eric W. Biederman <ebiederm(a)xmission.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation