Skip to contentSkip to conversation

char/agp: Disable frontend without CONFIG_DRM_LEGACY

PATCH Applied Daniel Vetter 5 participants 8 messages Nov 17, 2020 – Nov 18, 2020 Agpgart driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char/agp: Disable frontend without CONFIG_DRM_LEGACY

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>
---
 drivers/char/agp/Makefile | 6 +++++-
 drivers/char/agp/agp.h    | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +5 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
 agpgart-$(CONFIG_COMPAT)	+= compat_ioctl.o
+agpgart-y			+= frontend.o
+endif
+
 
 obj-$(CONFIG_AGP)		+= agpgart.o
 obj-$(CONFIG_AGP_ALI)		+= ali-agp.o
drivers/char/agp/agp.h +5 -0
index 4eb1c772ded7..bb09d64cd51e 100644
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
 void agp_remove_bridge(struct agp_bridge_data *bridge);
 
 /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int agp_frontend_initialize(void);
 void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif
 
 /* Generic routines. */
 void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi

Am 17.11.20 um 22:40 schrieb Daniel Vetter:

Quoted 34 lines

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>
---
 drivers/char/agp/Makefile | 6 +++++-
 drivers/char/agp/agp.h    | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +5 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
 agpgart-$(CONFIG_COMPAT)	+= compat_ioctl.o
+agpgart-y			+= frontend.o
+endif
+
 
 obj-$(CONFIG_AGP)		+= agpgart.o
 obj-$(CONFIG_AGP_ALI)		+= ali-agp.o
drivers/char/agp/agp.h +0 -0
index 4eb1c772ded7..bb09d64cd51e 100644

drivers/char/agp/agp.h int agp_add_bridge(struct agp_bridge_data *bridge); · line 195

Quoted 10 lines
drivers/char/agp/agp.h +5 -0
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
 void agp_remove_bridge(struct agp_bridge_data *bridge);
 
 /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
 int agp_frontend_initialize(void);
 void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif

There's one non-legacy driver that uses these agp structures, which is radeon. Does this change affect radeon?

Best regards
Thomas

Quoted 4 lines
drivers/char/agp/agp.h +0 -0
 /* Generic routines. */
 void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
 
Signature · 10 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Am 18.11.20 um 09:02 schrieb Thomas Zimmermann:

Quoted 39 lines

Hi

Am 17.11.20 um 22:40 schrieb Daniel Vetter:

Quoted 36 lines

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>
---
  drivers/char/agp/Makefile | 6 +++++-
  drivers/char/agp/agp.h    | 5 +++++
  2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +5 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
  # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
  agpgart-$(CONFIG_COMPAT)	+= compat_ioctl.o
+agpgart-y			+= frontend.o
+endif
+
 
  obj-$(CONFIG_AGP)		+= agpgart.o
  obj-$(CONFIG_AGP_ALI)		+= ali-agp.o
drivers/char/agp/agp.h +0 -0
index 4eb1c772ded7..bb09d64cd51e 100644
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
  void agp_remove_bridge(struct agp_bridge_data *bridge);
 
Quoted 10 lines

drivers/char/agp/agp.h int agp_add_bridge(struct agp_bridge_data *bridge); · line 195

Quoted 8 lines
drivers/char/agp/agp.h +5 -0
  /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
  int agp_frontend_initialize(void);
  void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif

There's one non-legacy driver that uses these agp structures, which is radeon. Does this change affect radeon?

Nouveau uses AGP as well, but I'm not sure if both drivers use any of this stuff.

Regards,
Christian.

Quoted 8 lines

Best regards
Thomas

Quoted 4 lines
drivers/char/agp/agp.h +0 -0
  /* Generic routines. */
  void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 52 lines · Christian König

Am 18.11.20 um 09:02 schrieb Thomas Zimmermann:

Quoted 39 lines

Hi

Am 17.11.20 um 22:40 schrieb Daniel Vetter:

Quoted 36 lines

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>
---
  drivers/char/agp/Makefile | 6 +++++-
  drivers/char/agp/agp.h    | 5 +++++
  2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +5 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
  # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
  agpgart-$(CONFIG_COMPAT)   += compat_ioctl.o
+agpgart-y                   += frontend.o
+endif
+
 
  obj-$(CONFIG_AGP)          += agpgart.o
  obj-$(CONFIG_AGP_ALI)              += ali-agp.o
drivers/char/agp/agp.h +0 -0
index 4eb1c772ded7..bb09d64cd51e 100644
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
  void agp_remove_bridge(struct agp_bridge_data *bridge);
 
Quoted 10 lines

drivers/char/agp/agp.h int agp_add_bridge(struct agp_bridge_data *bridge); · line 195

Quoted 8 lines
drivers/char/agp/agp.h +5 -0
  /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
  int agp_frontend_initialize(void);
  void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif

There's one non-legacy driver that uses these agp structures, which is radeon. Does this change affect radeon?

Quoted 2 lines

Nouveau uses AGP as well, but I'm not sure if both drivers use any of this stuff.

frontend = /dev/agp chardev interface for userspace drivers. If you're looking at kernel drivers, you're looking at the wrong thing, the kernel-internal interface is in char/agp/backend.c and still enabled. So no impact at all on any kernel code.

Now the impact this does have on kms drivers using agp is that there's no longer a userspace ioctl interface to change the agp setup and mappings and fight the kms driver (which assumes it's fully in control of agp configuration).
-Daniel

Quoted 13 lines

Regards,
Christian.

Quoted 8 lines

Best regards
Thomas

Quoted 4 lines
drivers/char/agp/agp.h +0 -0
  /* Generic routines. */
  void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
 
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Hi

Am 18.11.20 um 09:53 schrieb Daniel Vetter:

Quoted 62 lines
Quoted 52 lines · Christian König

Am 18.11.20 um 09:02 schrieb Thomas Zimmermann:

Quoted 39 lines

Hi

Am 17.11.20 um 22:40 schrieb Daniel Vetter:

Quoted 36 lines

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>
---
   drivers/char/agp/Makefile | 6 +++++-
   drivers/char/agp/agp.h    | 5 +++++
   2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +5 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
   # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)
   agpgart-$(CONFIG_COMPAT)   += compat_ioctl.o
+agpgart-y                   += frontend.o
+endif
+
 
   obj-$(CONFIG_AGP)          += agpgart.o
   obj-$(CONFIG_AGP_ALI)              += ali-agp.o
drivers/char/agp/agp.h +0 -0
index 4eb1c772ded7..bb09d64cd51e 100644
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data *bridge);
   void agp_remove_bridge(struct agp_bridge_data *bridge);
 
Quoted 10 lines

drivers/char/agp/agp.h int agp_add_bridge(struct agp_bridge_data *bridge); · line 195

Quoted 8 lines
drivers/char/agp/agp.h +5 -0
   /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
   int agp_frontend_initialize(void);
   void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif

There's one non-legacy driver that uses these agp structures, which is radeon. Does this change affect radeon?

Quoted 2 lines

Nouveau uses AGP as well, but I'm not sure if both drivers use any of this stuff.

frontend = /dev/agp chardev interface for userspace drivers. If you're looking at kernel drivers, you're looking at the wrong thing, the kernel-internal interface is in char/agp/backend.c and still enabled. So no impact at all on any kernel code.

Quoted 4 lines

Now the impact this does have on kms drivers using agp is that there's no longer a userspace ioctl interface to change the agp setup and mappings and fight the kms driver (which assumes it's fully in control of agp configuration).

Thanks for clarifying. I'm certainly not qualified, but still

Best regards
Thomas

Quoted 17 lines

-Daniel

Quoted 13 lines

Regards,
Christian.

Quoted 8 lines

Best regards
Thomas

Quoted 4 lines
drivers/char/agp/agp.h +0 -0
   /* Generic routines. */
   void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Am 18.11.20 um 10:02 schrieb Thomas Zimmermann:

Quoted 70 lines

Hi

Am 18.11.20 um 09:53 schrieb Daniel Vetter:

Quoted 67 lines
Quoted 53 lines · Christian König

Am 18.11.20 um 09:02 schrieb Thomas Zimmermann:

Quoted 40 lines

Hi

Am 17.11.20 um 22:40 schrieb Daniel Vetter:

Quoted 37 lines

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Cc David Airlie <[email protected]>
Cc Adam Jackson <[email protected]>

---
   drivers/char/agp/Makefile | 6 +++++-
   drivers/char/agp/agp.h    | 5 +++++

   2 files changed, 10 insertions(+), 1 deletion(-)
drivers/char/agp/Makefile +2 -1
index cb2497d157f6..90ed8c789e48 100644
@@ -1,7 +1,11 @@
    # SPDX-License-Identifier: GPL-2.0
-agpgart-y := backend.o frontend.o generic.o isoch.o
+agpgart-y := backend.o generic.o isoch.o
 
+ifeq ($(CONFIG_DRM_LEGACY),y)

   agpgart-$(CONFIG_COMPAT)   += compat_ioctl.o

drivers/char/agp/Makefile +3 -0
+agpgart-y                   += frontend.o
+endif
+

   obj-$(CONFIG_AGP)          += agpgart.o obj-$(CONFIG_AGP_ALI)              += ali-agp.o

drivers/char/agp/agp.h +0 -0
index 4eb1c772ded7..bb09d64cd51e 100644
@@ -186,8 +186,13 @@ int agp_add_bridge(struct agp_bridge_data 
 *bridge);
    void agp_remove_bridge(struct agp_bridge_data *bridge);
 
Quoted 10 lines

drivers/char/agp/agp.h int agp_add_bridge(struct agp_bridge_data *bridge); · line 195

Quoted 8 lines
drivers/char/agp/agp.h +5 -0
    /* Frontend routines. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
    int agp_frontend_initialize(void);
    void agp_frontend_cleanup(void);
+#else
+static inline int agp_frontend_initialize(void) { return 0; }
+static inline void agp_frontend_cleanup(void) {}
+#endif

There's one non-legacy driver that uses these agp structures, which is radeon. Does this change affect radeon?

Quoted 2 lines

Nouveau uses AGP as well, but I'm not sure if both drivers use any of this stuff.

frontend = /dev/agp chardev interface for userspace drivers. If you're looking at kernel drivers, you're looking at the wrong thing, the kernel-internal interface is in char/agp/backend.c and still enabled. So no impact at all on any kernel code.

Now the impact this does have on kms drivers using agp is that there's no longer a userspace ioctl interface to change the agp setup and mappings and fight the kms driver (which assumes it's fully in control of agp configuration).

I was strongly assuming something like this, thanks for clarifying.

Quoted 4 lines

Thanks for clarifying. I'm certainly not qualified, but still

Regards,
Christian.

Quoted 22 lines

Best regards
Thomas

Quoted 17 lines

-Daniel

Quoted 13 lines

Regards,
Christian.

Quoted 8 lines

Best regards
Thomas

Quoted 4 lines
drivers/char/agp/agp.h +0 -0
    /* Generic routines. */
    void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by on v1 1/1
#6 lore raw
In reply to Daniel Vetter
Quoted 4 lines · Daniel Vetter

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Not quite true. The only UMS driver using this is i810, which needs it even with DRI disabled. I have difficulty caring though.

In related news, since i810 is only ever attached to 32-bit x86 we could disable the frontend unconditionally on amd64 (and everything else tbh).

- ajax

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 8 lines · Adam Jackson
Quoted 4 lines · Daniel Vetter

It's probably full of bugs ready for exploiting by userspace. And there's not going to be any userspace for this without any of the drm legacy drivers enabled too. So just couple it together.

Not quite true. The only UMS driver using this is i810, which needs it even with DRI disabled. I have difficulty caring though.

TIL.

Quoted 5 lines

In related news, since i810 is only ever attached to 32-bit x86 we could disable the frontend unconditionally on amd64 (and everything else tbh).

Pushed to drm-misc-next, thanks for taking a look. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel