From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964990AbbDPPJF (ORCPT ); Thu, 16 Apr 2015 11:09:05 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:34901 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932168AbbDPPIz (ORCPT ); Thu, 16 Apr 2015 11:08:55 -0400 Date: Thu, 16 Apr 2015 18:08:47 +0300 From: Azat Khuzhin To: Wuqixuan Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs/sync.c : Add CAP_SYS_ADMIN checking before sync Message-ID: <20150416150847.GA16917@azat> References: <552FA066.3010905@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552FA066.3010905@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2015 at 07:43:34PM +0800, Wuqixuan wrote: > 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 > --- > 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; So after this patch I can't call sync as a regular user? (even without containers). But nothing in sync(2) says about special permissions for this.