linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/sync.c : Add CAP_SYS_ADMIN checking before sync
@ 2015-04-16 11:43 Wuqixuan
  2015-04-16 15:08 ` Azat Khuzhin
  0 siblings, 1 reply; 4+ messages in thread
From: Wuqixuan @ 2015-04-16 11:43 UTC (permalink / raw)
  To: viro, linux-fsdevel, linux-kernel

The process, supposed in one container, can't flush the metadata
and data of the all host's partitions without CAP_SYS_ADMIN
capability, like sys_mount is doing. The checking will prevent some
vicious programs impacting IO sequnces of those partitions,
particularly, the ones which can't be accessed in the container.

Signed-off-by: Last Wu <wuqixuan@huawei.com>
---
fs/sync.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/sync.c b/fs/sync.c
index fbc98ee..9f07909 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -103,6 +103,9 @@ SYSCALL_DEFINE0(sync)
{
int nowait = 0, wait = 1;

+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
wakeup_flusher_threads(0, WB_REASON_SYNC);
iterate_supers(sync_inodes_one_sb, NULL);
iterate_supers(sync_fs_one_sb, &nowait);
--
1.9.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-21 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16 11:43 [PATCH] fs/sync.c : Add CAP_SYS_ADMIN checking before sync Wuqixuan
2015-04-16 15:08 ` Azat Khuzhin
2015-04-16 19:31   ` Richard Weinberger
2015-04-21 11:30     ` Wuqixuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).