mbox series

[00/21] i915/display: split and constify vtable

Message ID 20210908003944.2972024-1-airlied@gmail.com (mailing list archive)
Headers show
Series i915/display: split and constify vtable | expand

Message

Dave Airlie Sept. 8, 2021, 12:39 a.m. UTC
This is orthogonal to my display ptr refactoring and should probably
be applied first.

The display funcs vtable was a bit of mess, lots of intermixing of
internal display functionality and interfaces to watermarks/irqs.

It's also considered not great security practice to leave writeable
function pointers around for exploits to get into.

This series attempts to address both problems, first there are a
few cleanups, then it splits the function table into multiple pieces.
Some of the splits might be bikesheds but I think we should apply first
and merge things later if there is good reason.

The second half converts all the vtables to static const structs,
I've used macros in some of them to make it less messy, the cdclk
one is probably the worst one.

Dave.

Comments

Jani Nikula Sept. 8, 2021, 12:04 p.m. UTC | #1
On Wed, 08 Sep 2021, Patchwork <patchwork@emeril.freedesktop.org> wrote:
> == Series Details ==
>
> Series: i915/display: split and constify vtable
> URL   : https://patchwork.freedesktop.org/series/94459/
> State : warning
>
> == Summary ==
>
> $ make htmldocs 2>&1 > /dev/null | grep i915
> ./drivers/gpu/drm/i915/display/intel_display.c:164: warning: Excess function parameter 'crtc' description in 'intel_update_watermarks'

Seems legit, please update the kernel-doc.

BR,
Jani.
Jani Nikula Sept. 8, 2021, 12:19 p.m. UTC | #2
On Wed, 08 Sep 2021, Dave Airlie <airlied@gmail.com> wrote:
> This is orthogonal to my display ptr refactoring and should probably
> be applied first.

Yeah, overall nice cleanups, and a much easier bandwagon to jump onto
than the other one. ;)

Nothing too bad, a few bugs had crept in, and I had some nitpicks.

> The display funcs vtable was a bit of mess, lots of intermixing of
> internal display functionality and interfaces to watermarks/irqs.
>
> It's also considered not great security practice to leave writeable
> function pointers around for exploits to get into.

On the one hand I get this, but on the other hand the pointers to the
structs do remain writable. I suppose it increases the complexity of an
exploit by some margin?

In any case, I think this is cleaner in general, and that's enough merit
for the change, regardless of the security aspect.

BR,
Jani.

>
> This series attempts to address both problems, first there are a
> few cleanups, then it splits the function table into multiple pieces.
> Some of the splits might be bikesheds but I think we should apply first
> and merge things later if there is good reason.
>
> The second half converts all the vtables to static const structs,
> I've used macros in some of them to make it less messy, the cdclk
> one is probably the worst one.
>
> Dave.
>
>