2017-11-04 20:28:10

by Aleksa Sarai

[permalink] [raw]
Subject: Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface

>> 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: <[email protected]>
>> Cc: "Eric W. Biederman" <[email protected]>
>> Signed-off-by: Aleksa Sarai <[email protected]>
>> ---
>> 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/

From 1583168262610516221@xxx Sat Nov 04 20:21:50 +0000 2017
X-GM-THRID: 1583163148146352510
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread