Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexanderS/6506e3d8b71c6bee8938b6faba39c175 to your computer and use it in GitHub Desktop.
Save AlexanderS/6506e3d8b71c6bee8938b6faba39c175 to your computer and use it in GitHub Desktop.
IATTR_WRITE support for linux-vserver
diff -ur linux-3.18.21-vs2.3.7.4/fs/namei.c linux-3.18.21-iattr_write/fs/namei.c
--- linux-3.18.21-vs2.3.7.4/fs/namei.c 2016-07-19 23:40:13.028001274 +0200
+++ linux-3.18.21-iattr_write/fs/namei.c 2016-07-19 23:44:24.660007559 +0200
@@ -326,7 +326,8 @@
struct task_struct *tsk;
if (vx_check(0, VS_ADMIN | VS_WATCH_P) ||
- vx_flags(VXF_STATE_SETUP, 0))
+ vx_flags(VXF_STATE_SETUP, 0) ||
+ (de && (de->vx_flags & IATTR_WRITE)))
return 0;
pid = PROC_I(inode)->pid;
diff -ur linux-3.18.21-vs2.3.7.4/include/uapi/vserver/inode.h linux-3.18.21-iattr_write/include/uapi/vserver/inode.h
--- linux-3.18.21-vs2.3.7.4/include/uapi/vserver/inode.h 2016-07-19 23:40:13.096001276 +0200
+++ linux-3.18.21-iattr_write/include/uapi/vserver/inode.h 2016-07-20 00:06:45.743995265 +0200
@@ -7,7 +7,8 @@
#define IATTR_ADMIN 0x00000001
#define IATTR_WATCH 0x00000002
#define IATTR_HIDE 0x00000004
-#define IATTR_FLAGS 0x00000007
+#define IATTR_WRITE 0x00000008
+#define IATTR_FLAGS 0x0000000F
#define IATTR_BARRIER 0x00010000
#define IATTR_IXUNLINK 0x00020000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment