All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
	"Viresh Kumar" <vireshk@kernel.org>,
	"Shiraz Hashim" <shiraz.linux.kernel@gmail.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"SoC Team" <soc@kernel.org>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 17:53:49 +0100	[thread overview]
Message-ID: <YpT2neim6b49Shky@shell.armlinux.org.uk> (raw)
In-Reply-To: <877d63tleq.fsf@intel.com>

On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote:
> On Mon, 30 May 2022, Jani Nikula <jani.nikula@intel.com> wrote:
> > On Sat, 28 May 2022, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >>>
> >>> It's CONFIG_ARM_AEABI, which is normally set everywhere. Without this
> >>> option, you the kernel is built for the old 'OABI' that forces all non-packed
> >>> struct members to be at least 16-bit aligned.
> >>
> >> Looks like forced word (32 bit) alignment to me.
> >>
> >> I wonder how many other structures that messes up, but I committed the
> >> EDID fix for now.
> >
> > Thanks for the fix, and the thorough commit message!
> >
> >> This has presumably been broken for a long time, but maybe the
> >> affected targets don't typically use EDID and kernel modesetting, and
> >> only use some fixed display setup instead.
> >>
> >> Those structure definitions go back a _loong_ time (from a quick 'git
> >> blame' I see November 2008).
> >>
> >> But despite that, I did not mark my fix 'cc:stable' because I don't
> >> know if any of those machines affected by this bad arm ABI issue could
> >> possibly care.
> >>
> >> At least my tree hopefully now builds on them, with the BUILD_BUG_ON()
> >> that uncovered this.
> >
> > Indeed the bug is ancient. I just threw in the BUILD_BUG_ON() on a whim
> > as an extra sanity check when doing pointer arithmetics on struct edid
> > *.
> >
> > If there are affected machines, buffer overflows are the real danger due
> > to edid->extensions indicating the number of extensions.
> 
> That is, for EDID. Makes you wonder about all the other packed structs
> with enum members across the kernel.

enum should not be used in structures if the layout of the struct
matters. ISTR there was a proposal for EABI to make enums just about
big enough to hold their enumerated constants - so you'd end up with
8-bit, 16-bit etc according to the largest enumerated value that the
compiler thinks it could hold.

That's a latent disaster when enums get used in structs where the
layout matters, __packed or not.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>,
	"Viresh Kumar" <vireshk@kernel.org>,
	"Shiraz Hashim" <shiraz.linux.kernel@gmail.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"SoC Team" <soc@kernel.org>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 17:53:49 +0100	[thread overview]
Message-ID: <YpT2neim6b49Shky@shell.armlinux.org.uk> (raw)
In-Reply-To: <877d63tleq.fsf@intel.com>

On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote:
> On Mon, 30 May 2022, Jani Nikula <jani.nikula@intel.com> wrote:
> > On Sat, 28 May 2022, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >>>
> >>> It's CONFIG_ARM_AEABI, which is normally set everywhere. Without this
> >>> option, you the kernel is built for the old 'OABI' that forces all non-packed
> >>> struct members to be at least 16-bit aligned.
> >>
> >> Looks like forced word (32 bit) alignment to me.
> >>
> >> I wonder how many other structures that messes up, but I committed the
> >> EDID fix for now.
> >
> > Thanks for the fix, and the thorough commit message!
> >
> >> This has presumably been broken for a long time, but maybe the
> >> affected targets don't typically use EDID and kernel modesetting, and
> >> only use some fixed display setup instead.
> >>
> >> Those structure definitions go back a _loong_ time (from a quick 'git
> >> blame' I see November 2008).
> >>
> >> But despite that, I did not mark my fix 'cc:stable' because I don't
> >> know if any of those machines affected by this bad arm ABI issue could
> >> possibly care.
> >>
> >> At least my tree hopefully now builds on them, with the BUILD_BUG_ON()
> >> that uncovered this.
> >
> > Indeed the bug is ancient. I just threw in the BUILD_BUG_ON() on a whim
> > as an extra sanity check when doing pointer arithmetics on struct edid
> > *.
> >
> > If there are affected machines, buffer overflows are the real danger due
> > to edid->extensions indicating the number of extensions.
> 
> That is, for EDID. Makes you wonder about all the other packed structs
> with enum members across the kernel.

enum should not be used in structures if the layout of the struct
matters. ISTR there was a proposal for EABI to make enums just about
big enough to hold their enumerated constants - so you'd end up with
8-bit, 16-bit etc according to the largest enumerated value that the
compiler thinks it could hold.

That's a latent disaster when enums get used in structs where the
layout matters, __packed or not.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Arnd Bergmann <arnd@arndb.de>, Viresh Kumar <vireshk@kernel.org>,
	Shiraz Hashim <shiraz.linux.kernel@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Airlie <airlied@linux.ie>, SoC Team <soc@kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers")
Date: Mon, 30 May 2022 17:53:49 +0100	[thread overview]
Message-ID: <YpT2neim6b49Shky@shell.armlinux.org.uk> (raw)
In-Reply-To: <877d63tleq.fsf@intel.com>

On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote:
> On Mon, 30 May 2022, Jani Nikula <jani.nikula@intel.com> wrote:
> > On Sat, 28 May 2022, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >>>
> >>> It's CONFIG_ARM_AEABI, which is normally set everywhere. Without this
> >>> option, you the kernel is built for the old 'OABI' that forces all non-packed
> >>> struct members to be at least 16-bit aligned.
> >>
> >> Looks like forced word (32 bit) alignment to me.
> >>
> >> I wonder how many other structures that messes up, but I committed the
> >> EDID fix for now.
> >
> > Thanks for the fix, and the thorough commit message!
> >
> >> This has presumably been broken for a long time, but maybe the
> >> affected targets don't typically use EDID and kernel modesetting, and
> >> only use some fixed display setup instead.
> >>
> >> Those structure definitions go back a _loong_ time (from a quick 'git
> >> blame' I see November 2008).
> >>
> >> But despite that, I did not mark my fix 'cc:stable' because I don't
> >> know if any of those machines affected by this bad arm ABI issue could
> >> possibly care.
> >>
> >> At least my tree hopefully now builds on them, with the BUILD_BUG_ON()
> >> that uncovered this.
> >
> > Indeed the bug is ancient. I just threw in the BUILD_BUG_ON() on a whim
> > as an extra sanity check when doing pointer arithmetics on struct edid
> > *.
> >
> > If there are affected machines, buffer overflows are the real danger due
> > to edid->extensions indicating the number of extensions.
> 
> That is, for EDID. Makes you wonder about all the other packed structs
> with enum members across the kernel.

enum should not be used in structures if the layout of the struct
matters. ISTR there was a proposal for EABI to make enums just about
big enough to hold their enumerated constants - so you'd end up with
8-bit, 16-bit etc according to the largest enumerated value that the
compiler thinks it could hold.

That's a latent disaster when enums get used in structs where the
layout matters, __packed or not.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  parent reply	other threads:[~2022-05-30 16:54 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  9:07 mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") Sudip Mukherjee
2022-05-27  9:07 ` Sudip Mukherjee
2022-05-27 18:56 ` Linus Torvalds
2022-05-27 18:56   ` Linus Torvalds
2022-05-27 23:40   ` Sudip Mukherjee
2022-05-27 23:40     ` Sudip Mukherjee
2022-05-28  1:04     ` Linus Torvalds
2022-05-28  1:04       ` Linus Torvalds
2022-05-28 10:07       ` Sudip Mukherjee
2022-05-28 10:07         ` Sudip Mukherjee
2022-05-28 12:13       ` Sudip Mukherjee
2022-05-28 12:13         ` Sudip Mukherjee
2022-05-28 17:40         ` Linus Torvalds
2022-05-28 17:40           ` Linus Torvalds
2022-05-28 18:08           ` Linus Torvalds
2022-05-28 18:08             ` Linus Torvalds
2022-05-28 18:08             ` Linus Torvalds
2022-05-28 18:58             ` Arnd Bergmann
2022-05-28 18:58               ` Arnd Bergmann
2022-05-28 18:58               ` Arnd Bergmann
2022-05-28 20:31               ` Linus Torvalds
2022-05-28 20:31                 ` Linus Torvalds
2022-05-28 20:31                 ` Linus Torvalds
2022-05-28 21:08                 ` Arnd Bergmann
2022-05-28 21:08                   ` Arnd Bergmann
2022-05-28 21:08                   ` Arnd Bergmann
2022-05-30  9:31                 ` Jani Nikula
2022-05-30  9:31                   ` Jani Nikula
2022-05-30  9:31                   ` Jani Nikula
2022-05-30  9:33                   ` Jani Nikula
2022-05-30  9:33                     ` Jani Nikula
2022-05-30  9:33                     ` Jani Nikula
2022-05-30 12:43                     ` Arnd Bergmann
2022-05-30 12:43                       ` Arnd Bergmann
2022-05-30 12:43                       ` Arnd Bergmann
2022-05-30 13:10                       ` Jani Nikula
2022-05-30 13:10                         ` Jani Nikula
2022-05-30 13:10                         ` Jani Nikula
2022-05-30 13:35                         ` Arnd Bergmann
2022-05-30 13:35                           ` Arnd Bergmann
2022-05-30 14:08                           ` Jani Nikula
2022-05-30 14:08                             ` Jani Nikula
2022-05-30 14:08                             ` Jani Nikula
2022-05-30 14:26                             ` Arnd Bergmann
2022-05-30 14:26                               ` Arnd Bergmann
2022-05-30 14:26                               ` Arnd Bergmann
2022-05-31  6:26                               ` Julia Lawall
2022-05-31  6:26                                 ` Julia Lawall
2022-05-31  6:26                                 ` Julia Lawall
2022-05-31  8:04                                 ` Arnd Bergmann
2022-05-31  8:04                                   ` Arnd Bergmann
2022-05-31  8:04                                   ` Arnd Bergmann
2022-05-31 16:41                                   ` Linus Torvalds
2022-05-31 16:41                                     ` Linus Torvalds
2022-05-31 16:41                                     ` Linus Torvalds
2022-06-01 22:28                                     ` Keisuke Nishimura
2022-06-01 22:28                                       ` Keisuke Nishimura
2022-06-01 22:28                                       ` Keisuke Nishimura
2022-06-02  1:08                                       ` Linus Torvalds
2022-06-02  1:08                                         ` Linus Torvalds
2022-06-02  1:08                                         ` Linus Torvalds
2022-06-02  7:38                                         ` Arnd Bergmann
2022-06-02  7:38                                           ` Arnd Bergmann
2022-06-02  7:38                                           ` Arnd Bergmann
2022-06-02 11:21                                           ` Tetsuo Handa
2022-06-02 11:21                                             ` Tetsuo Handa
2022-06-02 11:21                                             ` Tetsuo Handa
2022-06-02 12:11                                             ` Arnd Bergmann
2022-06-02 12:11                                               ` Arnd Bergmann
2022-06-02 12:11                                               ` Arnd Bergmann
2022-06-02 13:18                                               ` Ard Biesheuvel
2022-06-02 13:18                                                 ` Ard Biesheuvel
2022-06-02 13:18                                                 ` Ard Biesheuvel
2022-06-02 12:19                                           ` Christoph Hellwig
2022-06-02 12:19                                             ` Christoph Hellwig
2022-06-06 10:51                                           ` Keisuke Nishimura
2022-06-06 10:51                                             ` Keisuke Nishimura
2022-06-06 10:51                                             ` Keisuke Nishimura
2022-05-30 16:56                           ` Russell King (Oracle)
2022-05-30 16:56                             ` Russell King (Oracle)
2022-05-30 16:56                             ` Russell King (Oracle)
2022-05-30 16:54                       ` Russell King (Oracle)
2022-05-30 16:54                         ` Russell King (Oracle)
2022-05-30 16:54                         ` Russell King (Oracle)
2022-05-30 16:53                     ` Russell King (Oracle) [this message]
2022-05-30 16:53                       ` Russell King (Oracle)
2022-05-30 16:53                       ` Russell King (Oracle)
2022-05-28 20:32             ` Russell King (Oracle)
2022-05-28 20:32               ` Russell King (Oracle)
2022-05-28 20:32               ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YpT2neim6b49Shky@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=shiraz.linux.kernel@gmail.com \
    --cc=soc@kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.