* [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
@ 2017-11-04 18:59 Aleksa Sarai
0 siblings, 0 replies; 6+ messages in thread
From: Aleksa Sarai @ 2017-11-04 18:59 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA, cyphar-gVpy/LI/lHzQT0dZR+AlfA,
Eric W. Biederman
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: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
---
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
+
if (count > PROC_BLOCK_SIZE)
return -EOVERFLOW;
@@ -313,6 +316,9 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
char *buffer, *p;
int err;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (!buf || length > PAGE_SIZE)
return -EINVAL;
--
2.14.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
2017-11-04 20:20 ` Randy Dunlap
@ 2017-11-04 20:26 ` Aleksa Sarai
0 siblings, 0 replies; 6+ messages in thread
From: Aleksa Sarai @ 2017-11-04 20:26 UTC (permalink / raw)
To: Randy Dunlap, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA, cyphar-gVpy/LI/lHzQT0dZR+AlfA,
Eric W. Biederman
>> 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: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
>> Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
>> Signed-off-by: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
>> ---
>> 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
@ 2017-11-04 20:26 ` Aleksa Sarai
0 siblings, 0 replies; 6+ messages in thread
From: Aleksa Sarai @ 2017-11-04 20:26 UTC (permalink / raw)
To: Randy Dunlap, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, containers, Valentin Rothberg, cyphar,
stable, Eric W. Biederman
>> 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: <stable@vger.kernel.org>
>> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
>> Signed-off-by: Aleksa Sarai <asarai@suse.de>
>> ---
>> 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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
[not found] ` <20171104185913.10658-1-asarai-l3A5Bk7waGM@public.gmane.org>
@ 2017-11-04 20:20 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2017-11-04 20:20 UTC (permalink / raw)
To: Aleksa Sarai, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA, cyphar-gVpy/LI/lHzQT0dZR+AlfA,
Eric W. Biederman
On 11/04/2017 11:59 AM, Aleksa Sarai wrote:
> 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: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
> Cc: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
> ---
> 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 ';' ?
> +
> if (count > PROC_BLOCK_SIZE)
> return -EOVERFLOW;
>
> @@ -313,6 +316,9 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
> char *buffer, *p;
> int err;
>
> + if (!capable(CAP_SYS_ADMIN))
> + return -EPERM;
> +
> if (!buf || length > PAGE_SIZE)
> return -EINVAL;
>
>
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
2017-11-04 18:59 Aleksa Sarai
@ 2017-11-04 20:20 ` Randy Dunlap
[not found] ` <7595538b-c203-0af4-810e-e3f97334a314-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
[not found] ` <20171104185913.10658-1-asarai-l3A5Bk7waGM@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2017-11-04 20:20 UTC (permalink / raw)
To: Aleksa Sarai, James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, containers, Valentin Rothberg, cyphar,
stable, Eric W. Biederman
On 11/04/2017 11:59 AM, Aleksa Sarai wrote:
> 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: <stable@vger.kernel.org>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Aleksa Sarai <asarai@suse.de>
> ---
> 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 ';' ?
> +
> if (count > PROC_BLOCK_SIZE)
> return -EOVERFLOW;
>
> @@ -313,6 +316,9 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
> char *buffer, *p;
> int err;
>
> + if (!capable(CAP_SYS_ADMIN))
> + return -EPERM;
> +
> if (!buf || length > PAGE_SIZE)
> return -EINVAL;
>
>
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface
@ 2017-11-04 18:59 Aleksa Sarai
2017-11-04 20:20 ` Randy Dunlap
[not found] ` <20171104185913.10658-1-asarai-l3A5Bk7waGM@public.gmane.org>
0 siblings, 2 replies; 6+ messages in thread
From: Aleksa Sarai @ 2017-11-04 18:59 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: linux-scsi, linux-kernel, containers, Valentin Rothberg, cyphar,
Aleksa Sarai, stable, Eric W. Biederman
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: <stable@vger.kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Aleksa Sarai <asarai@suse.de>
---
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
+
if (count > PROC_BLOCK_SIZE)
return -EOVERFLOW;
@@ -313,6 +316,9 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
char *buffer, *p;
int err;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (!buf || length > PAGE_SIZE)
return -EINVAL;
--
2.14.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-04 20:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-04 18:59 [PATCH] scsi: require CAP_SYS_ADMIN to write to procfs interface Aleksa Sarai
-- strict thread matches above, loose matches on Subject: below --
2017-11-04 18:59 Aleksa Sarai
2017-11-04 20:20 ` Randy Dunlap
[not found] ` <7595538b-c203-0af4-810e-e3f97334a314-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-11-04 20:26 ` Aleksa Sarai
2017-11-04 20:26 ` Aleksa Sarai
[not found] ` <20171104185913.10658-1-asarai-l3A5Bk7waGM@public.gmane.org>
2017-11-04 20:20 ` Randy Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.