From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aleksa Sarai Subject: Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface Date: Sun, 5 Nov 2017 07:26:51 +1100 Message-ID: <8769e150-db7b-b020-66e6-7f5e9c102977@suse.de> References: <20171104185913.10658-1-asarai@suse.de> <7595538b-c203-0af4-810e-e3f97334a314@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <7595538b-c203-0af4-810e-e3f97334a314-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Randy Dunlap , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org, "Eric W. Biederman" List-Id: linux-scsi@vger.kernel.org >> Previously, the only capability effectively required to operate on the >> /proc/scsi interface was CAP_DAC_OVERRIDE (or for some other files, >> having an fsuid of GLOBAL_ROOT_UID was enough). This means that >> semi-privileged processes could interfere with core components of a >> system (such as causing a DoS by removing the underlying SCSI device of >> the host's / mount). >> >> Cc: >> Cc: "Eric W. Biederman" >> Signed-off-by: Aleksa Sarai >> --- >> drivers/scsi/scsi_proc.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c >> index 480a597b3877..486aedce2f05 100644 >> --- a/drivers/scsi/scsi_proc.c >> +++ b/drivers/scsi/scsi_proc.c >> @@ -51,7 +51,10 @@ static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf, >> struct Scsi_Host *shost = PDE_DATA(file_inode(file)); >> ssize_t ret = -ENOMEM; >> char *page; >> - >> + >> + if (!capable(CAP_SYS_ADMIN)) >> + return -EPERM > > did that build without a trailing ';' ? D'oh. Re-sent, thanks. -- Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH https://www.cyphar.com/