Re: [vserver] Kernel compile warnings

From: Ghislain Adnet <gadnet_at_aqueos.com>
Date: Thu 04 Jan 2018 - 17:17:48 GMT
Message-ID: <ac10d287-740e-77bb-f34e-e0687c39a84c@aqueos.com>

hi,

  i havent seen all the function that use this, it is 4 functions:

----------------------------
static int proc_xid_iterate(struct file *filp, struct dir_context *ctx)
                if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)

static int proc_nid_iterate(struct file *filp, struct dir_context *ctx)
                if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)

static struct dentry *proc_virtnet_lookup(struct inode *dir,
                if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)

static struct inode_operations proc_virtual_dir_inode_operations = {
                if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
                if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
----------------------------

  If i remove on by one the struct and function the kernel do not compile in any cases i tried

----------------------------
static struct file_operations proc_xid_file_operations = {
        .iterate = proc_xid_iterate,

static struct file_operations proc_nid_file_operations = {
        .iterate = proc_nid_iterate,

static struct inode_operations proc_virtnet_dir_inode_operations = {
        .lookup = proc_virtnet_lookup,
----------------------------

 so it seems some part are really used. I then used to change on kernel/linux-4.1.48/kernel/vserver/proc.c all of:

- if (!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0)
+ if (dir_emit(ctx, ".", 1, ino, DT_DIR))

- if (!dir_emit(ctx, "..", 2, ino, DT_DIR) < 0)
+ if (dir_emit(ctx, "..", 2, ino, DT_DIR))

Someone need to check if i do not made an error in replacing this. my logic was:
!dir_emit(ctx, ".", 1, ino, DT_DIR) < 0 equal dir_emit(ctx, ".", 1, ino, DT_DIR) >= 0) this means allways true
because a boolen is 0 or 1 so i decided it means:

                if (dir_emit(ctx, ".", 1, ino, DT_DIR))
                        goto out;
                ctx->pos++;

 if dir emit is ok then goto out (it is allways goto out; after the test) else you continue to ctx->pos++;. I dont know
what the fucntion do nor what dir_emit do so it was pure guess here.

after compile and reboot testme and testfs are ok:

Linux-VServer Test [V0.17] Copyright (C) 2003-2006 H.Poetzl
chcontext is working.
chbind is working.
chcontext 0.30.216-pre3126 -- allocates/enters a security context
This program is part of util-vserver 0.30.216-pre3126

Copyright (C) 2004 Enrico Scholz
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
Linux 4.1.48-vs2.3.8.6aq #1 SMP Thu Jan 4 16:34:49 CET 2018 x86_64
Ea 0.30.216 236/glibc (DSa) <compat,v11,fscompat,v13,net,v21,v22,v23,netv2>
VCI: 0002:0308 236 13113f11 (TbsPWD)
(root@buildbuster64.aqueos.net)
(gcc version 7.2.0 (Debian 7.2.0-18)
)
#1 SMP Thu Jan 4 16:34:49 CET 2018

---
[000]# chcontext --xid 49151 true && chcontext --xid 45678 true
[000]# succeeded.
[001]# chcontext --xid 45678 egrep 'context|VxID' /proc/self/status
[001]# succeeded.
[011]# chcontext --secure --xid 45678 mknod /tmp/testme.sh.y7w6jE/node c 0 0
[011]# succeeded.
[031]# chcontext --xid 49151 --hostname zaphod.2278 uname -a | grep -q zaphod.2278
[031]# succeeded.
[101]# chbind --nid 49151 --ip 192.168.0.42 true
[101]# succeeded.
[102]# chbind --nid 49151 --ip 192.168.0.1/255.255.255.0 --ip 10.0.0.1/24 true
[102]# succeeded.
[201]# chcontext --xid 45678 --flag fakeinit bash -c 'test $$ -eq 1'
[201]# succeeded.
[202]# chcontext --xid 49151 --flag fakeinit bash -c 'test $$ -eq 1'
[202]# succeeded.
---
[L01]# chcontext --xid 45601 bash -c 'true &'
[L01]# succeeded.
[L02]# chcontext --xid 45602 bash -c 'true | true'
[L02]# succeeded.
[L03]# chcontext --xid 45603 bash -c 'true & true'
[L03]# succeeded.
[L11]# chcontext --xid 45611 bash -c 'true >/dev/null' </dev/zero
[L11]# succeeded.
[L12]# chcontext --xid 45612 bash -c 'true </dev/zero' >/dev/null
[L12]# succeeded.
[L21]# chcontext --xid 45621 bash -c 'bash -c "true &"&'
[L21]# succeeded.
[L22]# chcontext --xid 45622 bash -c 'bash -c "false | true &"&'
[L22]# succeeded.
[L31]# chcontext --xid 45631 bash -c 'echo `ls`'
[L31]# succeeded.
losetup: /dev/loop7: detach failed: No such device or address
/dev/loop7: [2429]:131843 (/var/tmp/1gb.testfile)
Linux-VServer FS Test [V0.23] Copyright (C) 2005-2009 H.Poetzl
Linux 4.1.48-vs2.3.8.6aq x86_64/0.30.216
VCI:  0002:0308 236 13113f11 (ID24)
---
testing ext4 filesystem ...
mke2fs 1.42.12 (29-Aug-2014)
[000]# succeeded.
[001]# succeeded.
mount: /mnt not mounted or bad option
       In some cases useful info is found in syslog - try
       dmesg | tail or so.
[002]# succeeded.
tag related tests ...
[011]# succeeded.
[012]# succeeded.
[014]# succeeded.
cat: /mnt//file_2: Permission denied
cat: /mnt//file_3: Permission denied
[015]# succeeded.
[019]# succeeded.
[020]# succeeded.
[021]# succeeded.
[022]# succeeded.
[023]# succeeded.
[024]# succeeded.
cat: /mnt//file_2: Permission denied
cat: /mnt//file_3: Permission denied
[025]# succeeded.
[026]# succeeded.
tee: /mnt//file_2: Permission denied
tee: /mnt//file_3: Permission denied
[027]# succeeded.
[028]# succeeded.
[033]# succeeded.
[034]# succeeded.
cat: /mnt//file_1: Permission denied
[035]# succeeded.
tee: /mnt//file_1: Permission denied
tee: /mnt//file_2: Permission denied
[037]# succeeded.
[045]# succeeded.
[047]# succeeded.
xattr related tests ...
[101]# succeeded.
[103]# succeeded.
[104]# succeeded.
[106]# succeeded.
[107]# succeeded.
[109]# succeeded.
[112]# succeeded.
[113]# succeeded.
[114]# succeeded.
chattr: Permission denied while reading flags on /mnt//dir_2494
[115]# succeeded.
chmod: changing permissions of ‘/mnt//dir_2494’: Permission denied
[116]# succeeded.
[118]# succeeded.
[119]# succeeded.
[122]# succeeded.
[123]# succeeded.
[124]# succeeded.
[125]# succeeded.
[127]# succeeded.
[128]# succeeded.
[129]# succeeded.
[131]# succeeded.
[132]# succeeded.
[133]# succeeded.
[134]# succeeded.
[135]# succeeded.
[138]# succeeded.
[139]# succeeded.
[148]# succeeded.
[149]# succeeded.
disk limit related tests ...
[201]# succeeded.
16+0 records in
16+0 records out
16384 bytes (16 kB) copied, 0,00011371 s, 144 MB/s
[202]# succeeded.
[203]# succeeded.
[204]# succeeded.
[205]# succeeded.
dd: error writing ‘/mnt//space-300’: No space left on device
33+0 records in
32+0 records out
32768 bytes (33 kB) copied, 0,206925 s, 158 kB/s
[206]# succeeded.
touch: cannot touch ‘/mnt//inodes-300-5’: No space left on device
[207]# succeeded.
[208]# succeeded.
[211]# succeeded.
5+0 records in
5+0 records out
5120 bytes (5,1 kB) copied, 8,3542e-05 s, 61,3 MB/s
[212]# succeeded.
[213]# succeeded.
43+0 records in
43+0 records out
44032 bytes (44 kB) copied, 0,000138483 s, 318 MB/s
touch: cannot touch ‘/mnt//cow-300-1’: No space left on device
[222]# succeeded.
[223]# succeeded.
[231]# succeeded.
3+0 records in
3+0 records out
3072 bytes (3,1 kB) copied, 7,7898e-05 s, 39,4 MB/s
touch: cannot touch ‘/mnt//cow-300-9’: No space left on device
[232]# succeeded.
[233]# succeeded.
[239]# succeeded.
[999]# succeeded.
not that it means my change is rigth as i dont know if this is the right change to make.
i could start/stop a guest, mount seems ok, /proc too , networking too.
Ghislain.

Received on Thu Jan 4 17:15:47 2018
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 04 Jan 2018 - 17:15:47 GMT by hypermail 2.1.8