mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 18:17:09 +00:00
28 lines
727 B
Diff
28 lines
727 B
Diff
---
|
|
fs/open.c | 3 +++
|
|
include/linux/fs.h | 1 +
|
|
2 files changed, 4 insertions(+)
|
|
|
|
--- a/fs/open.c
|
|
+++ b/fs/open.c
|
|
@@ -207,6 +207,9 @@ int do_truncate(struct dentry *dentry, s
|
|
newattrs.ia_size = length;
|
|
newattrs.ia_valid = ATTR_SIZE | time_attrs;
|
|
|
|
+ if (filp)
|
|
+ newattrs.ia_valid |= ATTR_FILE;
|
|
+
|
|
/* Remove suid/sgid on truncate too */
|
|
newattrs.ia_valid |= should_remove_suid(dentry);
|
|
|
|
--- a/include/linux/fs.h
|
|
+++ b/include/linux/fs.h
|
|
@@ -329,6 +329,7 @@ typedef void (dio_iodone_t)(struct kiocb
|
|
#define ATTR_ATTR_FLAG 1024
|
|
#define ATTR_KILL_SUID 2048
|
|
#define ATTR_KILL_SGID 4096
|
|
+#define ATTR_FILE 8192
|
|
#define ATTR_KILL_PRIV 16384
|
|
#define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */
|
|
|