mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] virtio: nsm: require CAP_SYS_ADMIN for raw messages
@ 2026-06-24 17:36 Yousef Alhouseen
  2026-06-25 22:19 ` Graf (AWS), Alexander
  0 siblings, 1 reply; 3+ messages in thread
From: Yousef Alhouseen @ 2026-06-24 17:36 UTC (permalink / raw)
  To: Alexander Graf
  Cc: The AWS Nitro Enclaves Team, Arnd Bergmann, Greg Kroah-Hartman,
	linux-kernel, Yousef Alhouseen

NSM_IOCTL_RAW is documented as CAP_SYS_ADMIN-only.

/dev/nsm is mode 0666, but the ioctl handler did not check that capability.

Reject unprivileged raw messages before sending them to the device.

Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
---
 drivers/misc/nsm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/nsm.c b/drivers/misc/nsm.c
index e39ff0071..8153edff3 100644
--- a/drivers/misc/nsm.c
+++ b/drivers/misc/nsm.c
@@ -9,6 +9,7 @@
  * space can use to issue these commands.
  */
 
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
@@ -361,6 +362,9 @@ static long nsm_dev_ioctl(struct file *file, unsigned int cmd,
 	if (cmd != NSM_IOCTL_RAW)
 		return -EINVAL;
 
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
 	if (_IOC_SIZE(cmd) != sizeof(raw))
 		return -EINVAL;
 
-- 
2.54.0


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

* Re: [PATCH] virtio: nsm: require CAP_SYS_ADMIN for raw messages
  2026-06-24 17:36 [PATCH] virtio: nsm: require CAP_SYS_ADMIN for raw messages Yousef Alhouseen
@ 2026-06-25 22:19 ` Graf (AWS), Alexander
  2026-06-26 22:38   ` Yousef Alhouseen
  0 siblings, 1 reply; 3+ messages in thread
From: Graf (AWS), Alexander @ 2026-06-25 22:19 UTC (permalink / raw)
  To: Yousef Alhouseen
  Cc: The AWS Nitro Enclaves Team, Arnd Bergmann, Greg Kroah-Hartman,
	linux-kernel


On 24.06.26 19:36, Yousef Alhouseen wrote:
> NSM_IOCTL_RAW is documented as CAP_SYS_ADMIN-only.
>
> /dev/nsm is mode 0666, but the ioctl handler did not check that capability.
>
> Reject unprivileged raw messages before sending them to the device.
>
> Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>


This looks like a direct duplicate of 
https://lore.kernel.org/lkml/20260621085743.76329-1-khoavna.tin.2225@gmail.com/?


Alex



Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597

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

* Re: [PATCH] virtio: nsm: require CAP_SYS_ADMIN for raw messages
  2026-06-25 22:19 ` Graf (AWS), Alexander
@ 2026-06-26 22:38   ` Yousef Alhouseen
  0 siblings, 0 replies; 3+ messages in thread
From: Yousef Alhouseen @ 2026-06-26 22:38 UTC (permalink / raw)
  To: Alexander Graf
  Cc: The AWS Nitro Enclaves Team, Arnd Bergmann, Greg Kroah-Hartman,
	linux-kernel

Thanks for catching that. You are right; this duplicates the earlier patch.

Please drop this one. Sorry for the noise.

Yousef

On Thu, 25 Jun 2026 22:19:06 +0000, "Graf (AWS), Alexander"
<graf@amazon.de> wrote:
> On 24.06.26 19:36, Yousef Alhouseen wrote:
> > NSM_IOCTL_RAW is documented as CAP_SYS_ADMIN-only.
> >
> > /dev/nsm is mode 0666, but the ioctl handler did not check that capability.
> >
> > Reject unprivileged raw messages before sending them to the device.
> >
> > Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
>
> This looks like a direct duplicate of
> https://lore.kernel.org/lkml/20260621085743.76329-1-khoavna.tin.2225@gmail.com/?
>
> Alex
>
> Amazon Web Services Development Center Germany GmbH
> Tamara-Danz-Str. 13
> 10243 Berlin
> Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
> Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
> Sitz: Berlin
> Ust-ID: DE 365 538 597

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

end of thread, other threads:[~2026-06-26 22:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24 17:36 [PATCH] virtio: nsm: require CAP_SYS_ADMIN for raw messages Yousef Alhouseen
2026-06-25 22:19 ` Graf (AWS), Alexander
2026-06-26 22:38   ` Yousef Alhouseen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome