All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-06-25 10:41 Jan Beulich
  2018-08-15  6:19   ` Jan Beulich
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2018-06-25 10:41 UTC (permalink / raw)
  To: akpm, Boris Ostrovsky, Juergen Gross; +Cc: xen-devel, linux-kernel

While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
require more work), it at least allows some simple operations (like
"xl dmesg") which have always been available on XenoLinux to work again
with a 64-bit kernel underneath a 32-bit distro.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 fs/compat_ioctl.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- 4.18-rc2/fs/compat_ioctl.c
+++ 4.18-rc2-xen-privcmd-compat-ioctls/fs/compat_ioctl.c
@@ -115,6 +115,12 @@
 #include <asm/fbio.h>
 #endif
 
+#ifdef CONFIG_XEN
+#include <xen/interface/xen.h>
+#include <xen/evtchn.h>
+#include <xen/privcmd.h>
+#endif
+
 #define convert_in_user(srcptr, dstptr)			\
 ({							\
 	typeof(*srcptr) val;				\
@@ -1300,6 +1306,17 @@ IGNORE_IOCTL(FBIOGETCMAP32)
 IGNORE_IOCTL(FBIOSCURSOR32)
 IGNORE_IOCTL(FBIOGCURSOR32)
 #endif
+
+#ifdef CONFIG_XEN
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_RESTRICT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_VIRQ)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_INTERDOMAIN)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_UNBOUND_PORT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_UNBIND)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_NOTIFY)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_RESET)
+#endif
 };
 
 /*




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

* [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
  2018-06-25 10:41 [PATCH] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd Jan Beulich
@ 2018-08-15  6:19   ` Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2018-08-15  6:19 UTC (permalink / raw)
  To: Boris Ostrovsky, Juergen Gross, viro; +Cc: xen-devel, linux-fsdevel

While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
require more work), it at least allows some simple operations (like
"xl dmesg") which have always been available on XenoLinux to work again
with a 64-bit kernel underneath a 32-bit distro.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Juergen Gross <jgross@suse.com>
---
Resend due to prior omission of file system related addressees.
---
 fs/compat_ioctl.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- 4.18/fs/compat_ioctl.c
+++ 4.18-xen-privcmd-compat-ioctls/fs/compat_ioctl.c
@@ -115,6 +115,12 @@
 #include <asm/fbio.h>
 #endif
 
+#ifdef CONFIG_XEN
+#include <xen/interface/xen.h>
+#include <xen/evtchn.h>
+#include <xen/privcmd.h>
+#endif
+
 #define convert_in_user(srcptr, dstptr)			\
 ({							\
 	typeof(*srcptr) val;				\
@@ -1300,6 +1306,17 @@ IGNORE_IOCTL(FBIOGETCMAP32)
 IGNORE_IOCTL(FBIOSCURSOR32)
 IGNORE_IOCTL(FBIOGCURSOR32)
 #endif
+
+#ifdef CONFIG_XEN
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_RESTRICT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_VIRQ)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_INTERDOMAIN)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_UNBOUND_PORT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_UNBIND)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_NOTIFY)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_RESET)
+#endif
 };
 
 /*

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

* [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-08-15  6:19   ` Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2018-08-15  6:19 UTC (permalink / raw)
  To: Boris Ostrovsky, Juergen Gross, viro; +Cc: linux-fsdevel, xen-devel

While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
require more work), it at least allows some simple operations (like
"xl dmesg") which have always been available on XenoLinux to work again
with a 64-bit kernel underneath a 32-bit distro.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Juergen Gross <jgross@suse.com>
---
Resend due to prior omission of file system related addressees.
---
 fs/compat_ioctl.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- 4.18/fs/compat_ioctl.c
+++ 4.18-xen-privcmd-compat-ioctls/fs/compat_ioctl.c
@@ -115,6 +115,12 @@
 #include <asm/fbio.h>
 #endif
 
+#ifdef CONFIG_XEN
+#include <xen/interface/xen.h>
+#include <xen/evtchn.h>
+#include <xen/privcmd.h>
+#endif
+
 #define convert_in_user(srcptr, dstptr)			\
 ({							\
 	typeof(*srcptr) val;				\
@@ -1300,6 +1306,17 @@ IGNORE_IOCTL(FBIOGETCMAP32)
 IGNORE_IOCTL(FBIOSCURSOR32)
 IGNORE_IOCTL(FBIOGCURSOR32)
 #endif
+
+#ifdef CONFIG_XEN
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_RESTRICT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_VIRQ)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_INTERDOMAIN)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_UNBOUND_PORT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_UNBIND)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_NOTIFY)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_RESET)
+#endif
 };
 
 /*





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
  2018-08-15  6:19   ` Jan Beulich
@ 2018-08-15 12:41     ` Christoph Hellwig
  -1 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2018-08-15 12:41 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Boris Ostrovsky, Juergen Gross, viro, xen-devel, linux-fsdevel

Please wire up a compat_ioctl handler for the xen privcmd handler
instead of adding these to a global table.

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-08-15 12:41     ` Christoph Hellwig
  0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2018-08-15 12:41 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Juergen Gross, xen-devel, Boris Ostrovsky, linux-fsdevel, viro

Please wire up a compat_ioctl handler for the xen privcmd handler
instead of adding these to a global table.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
  2018-08-15  6:19   ` Jan Beulich
@ 2018-08-15 12:51     ` Al Viro
  -1 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2018-08-15 12:51 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Boris Ostrovsky, Juergen Gross, xen-devel, linux-fsdevel

On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
> require more work), it at least allows some simple operations (like
> "xl dmesg") which have always been available on XenoLinux to work again
> with a 64-bit kernel underneath a 32-bit distro.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Acked-by: Juergen Gross <jgross@suse.com>


Nacked-by: Al Viro <viro@zeniv.linux.org.uk>

	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
*ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
method and any patches dumping such stuff into fs/compat_ioctl.c will be
rejected.

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-08-15 12:51     ` Al Viro
  0 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2018-08-15 12:51 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Juergen Gross, xen-devel, Boris Ostrovsky, linux-fsdevel

On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
> require more work), it at least allows some simple operations (like
> "xl dmesg") which have always been available on XenoLinux to work again
> with a 64-bit kernel underneath a 32-bit distro.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Acked-by: Juergen Gross <jgross@suse.com>


Nacked-by: Al Viro <viro@zeniv.linux.org.uk>

	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
*ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
method and any patches dumping such stuff into fs/compat_ioctl.c will be
rejected.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
  2018-08-15 12:51     ` Al Viro
@ 2018-08-15 13:16       ` Jan Beulich
  -1 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2018-08-15 13:16 UTC (permalink / raw)
  To: viro; +Cc: xen-devel, Boris Ostrovsky, Juergen Gross, linux-fsdevel

>>> On 15.08.18 at 14:51, <viro@ZenIV.linux.org.uk> wrote:
> On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
>> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
>> require more work), it at least allows some simple operations (like
>> "xl dmesg") which have always been available on XenoLinux to work again
>> with a 64-bit kernel underneath a 32-bit distro.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Juergen Gross <jgross@suse.com>
> 
> 
> Nacked-by: Al Viro <viro@zeniv.linux.org.uk>
> 
> 	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
> *ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
> method and any patches dumping such stuff into fs/compat_ioctl.c will be
> rejected.

Okay, I'll see about doing this; I have to admit I was unaware of
->compat_ioctl()'s existence. It would be rather helpful if the header
of compat_ioctl.c indicated what you say. Without that, I've simply
gone by the observation that there are things in the file which
according to what you say shouldn't be there, and I've then wrongly
implied adding the Xen stuff here would be fine.

Jan

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-08-15 13:16       ` Jan Beulich
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Beulich @ 2018-08-15 13:16 UTC (permalink / raw)
  To: viro; +Cc: Juergen Gross, xen-devel, Boris Ostrovsky, linux-fsdevel

>>> On 15.08.18 at 14:51, <viro@ZenIV.linux.org.uk> wrote:
> On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
>> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
>> require more work), it at least allows some simple operations (like
>> "xl dmesg") which have always been available on XenoLinux to work again
>> with a 64-bit kernel underneath a 32-bit distro.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Acked-by: Juergen Gross <jgross@suse.com>
> 
> 
> Nacked-by: Al Viro <viro@zeniv.linux.org.uk>
> 
> 	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
> *ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
> method and any patches dumping such stuff into fs/compat_ioctl.c will be
> rejected.

Okay, I'll see about doing this; I have to admit I was unaware of
->compat_ioctl()'s existence. It would be rather helpful if the header
of compat_ioctl.c indicated what you say. Without that, I've simply
gone by the observation that there are things in the file which
according to what you say shouldn't be there, and I've then wrongly
implied adding the Xen stuff here would be fine.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
  2018-08-15 13:16       ` Jan Beulich
@ 2018-08-15 13:27         ` Al Viro
  -1 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2018-08-15 13:27 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Boris Ostrovsky, Juergen Gross, linux-fsdevel

On Wed, Aug 15, 2018 at 07:16:43AM -0600, Jan Beulich wrote:
> >>> On 15.08.18 at 14:51, <viro@ZenIV.linux.org.uk> wrote:
> > On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
> >> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
> >> require more work), it at least allows some simple operations (like
> >> "xl dmesg") which have always been available on XenoLinux to work again
> >> with a 64-bit kernel underneath a 32-bit distro.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> Acked-by: Juergen Gross <jgross@suse.com>
> > 
> > 
> > Nacked-by: Al Viro <viro@zeniv.linux.org.uk>
> > 
> > 	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
> > *ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
> > method and any patches dumping such stuff into fs/compat_ioctl.c will be
> > rejected.
> 
> Okay, I'll see about doing this; I have to admit I was unaware of
> ->compat_ioctl()'s existence. It would be rather helpful if the header
> of compat_ioctl.c indicated what you say. Without that, I've simply
> gone by the observation that there are things in the file which
> according to what you say shouldn't be there, and I've then wrongly
> implied adding the Xen stuff here would be fine.

Originally fs/compat_ioctl.c was a result of merger between several such
beasts in arch/*; it's *old* - well before ->compat_ioctl() introduction.
If you check the history of that thing, you'll see crap getting removed
over the years.  Sometimes the things sneak in, but generally it keeps
shrinking...

The only stuff that might belong there is widely-implemented ioctls.
Anything that is natively handled in a couple of ->ioctl() instances
should be getting ->compat_ioctl() instance to go with that one.

And yes, big fat warning along the lines of "don't dump here" is
probably a good idea...

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

* Re: [PATCH RESEND] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd
@ 2018-08-15 13:27         ` Al Viro
  0 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2018-08-15 13:27 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Juergen Gross, xen-devel, Boris Ostrovsky, linux-fsdevel

On Wed, Aug 15, 2018 at 07:16:43AM -0600, Jan Beulich wrote:
> >>> On 15.08.18 at 14:51, <viro@ZenIV.linux.org.uk> wrote:
> > On Wed, Aug 15, 2018 at 12:19:00AM -0600, Jan Beulich wrote:
> >> While this is only a start (IOCTL_PRIVCMD_MMAP* and IOCTL_PRIVCMD_DM_OP
> >> require more work), it at least allows some simple operations (like
> >> "xl dmesg") which have always been available on XenoLinux to work again
> >> with a 64-bit kernel underneath a 32-bit distro.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> Acked-by: Juergen Gross <jgross@suse.com>
> > 
> > 
> > Nacked-by: Al Viro <viro@zeniv.linux.org.uk>
> > 
> > 	This belongs in drivers/xen/privcmd.c, not in fs/compat_ioctl.c
> > *ANY* single-driver ioctl definitely should be handled by ->compat_ioctl()
> > method and any patches dumping such stuff into fs/compat_ioctl.c will be
> > rejected.
> 
> Okay, I'll see about doing this; I have to admit I was unaware of
> ->compat_ioctl()'s existence. It would be rather helpful if the header
> of compat_ioctl.c indicated what you say. Without that, I've simply
> gone by the observation that there are things in the file which
> according to what you say shouldn't be there, and I've then wrongly
> implied adding the Xen stuff here would be fine.

Originally fs/compat_ioctl.c was a result of merger between several such
beasts in arch/*; it's *old* - well before ->compat_ioctl() introduction.
If you check the history of that thing, you'll see crap getting removed
over the years.  Sometimes the things sneak in, but generally it keeps
shrinking...

The only stuff that might belong there is widely-implemented ioctls.
Anything that is natively handled in a couple of ->ioctl() instances
should be getting ->compat_ioctl() instance to go with that one.

And yes, big fat warning along the lines of "don't dump here" is
probably a good idea...

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-08-15 16:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25 10:41 [PATCH] compat-ioctl/Xen: support at least some IOCTLs of evtchn and privcmd Jan Beulich
2018-08-15  6:19 ` [PATCH RESEND] " Jan Beulich
2018-08-15  6:19   ` Jan Beulich
2018-08-15 12:41   ` Christoph Hellwig
2018-08-15 12:41     ` Christoph Hellwig
2018-08-15 12:51   ` Al Viro
2018-08-15 12:51     ` Al Viro
2018-08-15 13:16     ` Jan Beulich
2018-08-15 13:16       ` Jan Beulich
2018-08-15 13:27       ` Al Viro
2018-08-15 13:27         ` Al Viro

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.