From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88A29C433EF for ; Mon, 30 May 2022 16:54:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242001AbiE3Qyd (ORCPT ); Mon, 30 May 2022 12:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240341AbiE3Qya (ORCPT ); Mon, 30 May 2022 12:54:30 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC80A7761 for ; Mon, 30 May 2022 09:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MgAIfXuZbnO66UplqyXtbnNG1M1uphwmPAPlMZl/NsM=; b=tSh9PSln6DPu8EU2UgGJUTJM7k M9mcUReU4aaRVJosOtdMc3v5aI9sfFmp1rEG6L2u3E7wDYf4yTINLVhRhXVN/EqYlfaid9d7MEO8t xXMWRQmLev64HwjQ6W0X5Y65b66Z2MGU8EQxvD+Zap2oMEARGlqnSc/PfOy6QHglj/tadSYTvVniP AO4yP505lrU+L21yItjbZX64YqiJWOejR0Nsh8qobpuSMtwDybfi3gkkXOKwVuU8PJ3NwIMDkHBNK sjUWVQwNuk3+i5NgulP5F54Q4R0CFOfj3tLSSJrCtiq8L3R4nCCkZru8Zxm2xrsD3JQv379w5s5yl b3AdTxTA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60884) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nvieX-00045f-Ar; Mon, 30 May 2022 17:54:01 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nvieL-0001ZQ-Um; Mon, 30 May 2022 17:53:49 +0100 Date: Mon, 30 May 2022 17:53:49 +0100 From: "Russell King (Oracle)" To: Jani Nikula Cc: Linus Torvalds , Arnd Bergmann , Sudip Mukherjee , Viresh Kumar , Shiraz Hashim , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel , Linux Kernel Mailing List , Linux ARM , SoC Team Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") Message-ID: References: <87a6aztli2.fsf@intel.com> <877d63tleq.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877d63tleq.fsf@intel.com> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote: > On Mon, 30 May 2022, Jani Nikula wrote: > > On Sat, 28 May 2022, Linus Torvalds wrote: > >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann 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! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBD78C433F5 for ; Mon, 30 May 2022 16:54:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE1F310EEDB; Mon, 30 May 2022 16:54:24 +0000 (UTC) Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by gabe.freedesktop.org (Postfix) with ESMTPS id F3EDE10EEDB for ; Mon, 30 May 2022 16:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MgAIfXuZbnO66UplqyXtbnNG1M1uphwmPAPlMZl/NsM=; b=tSh9PSln6DPu8EU2UgGJUTJM7k M9mcUReU4aaRVJosOtdMc3v5aI9sfFmp1rEG6L2u3E7wDYf4yTINLVhRhXVN/EqYlfaid9d7MEO8t xXMWRQmLev64HwjQ6W0X5Y65b66Z2MGU8EQxvD+Zap2oMEARGlqnSc/PfOy6QHglj/tadSYTvVniP AO4yP505lrU+L21yItjbZX64YqiJWOejR0Nsh8qobpuSMtwDybfi3gkkXOKwVuU8PJ3NwIMDkHBNK sjUWVQwNuk3+i5NgulP5F54Q4R0CFOfj3tLSSJrCtiq8L3R4nCCkZru8Zxm2xrsD3JQv379w5s5yl b3AdTxTA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60884) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nvieX-00045f-Ar; Mon, 30 May 2022 17:54:01 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nvieL-0001ZQ-Um; Mon, 30 May 2022 17:53:49 +0100 Date: Mon, 30 May 2022 17:53:49 +0100 From: "Russell King (Oracle)" To: Jani Nikula Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") Message-ID: References: <87a6aztli2.fsf@intel.com> <877d63tleq.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877d63tleq.fsf@intel.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM , Arnd Bergmann , Viresh Kumar , Shiraz Hashim , Linux Kernel Mailing List , David Airlie , SoC Team , dri-devel , Thomas Zimmermann , Linus Torvalds , Sudip Mukherjee Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote: > On Mon, 30 May 2022, Jani Nikula wrote: > > On Sat, 28 May 2022, Linus Torvalds wrote: > >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann 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! From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAB42C433F5 for ; Mon, 30 May 2022 16:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1dQ57kX/6OJBWKEFCICeS9cbx7UyUmG1DWKTHcpiZ5s=; b=hXeZzzIr3IT11J BdgmeRLMm4Li22df1uWoSrk81TeU/SC3Bojfy7CFdHXDQdLaY96Z2SznOIAn+l6cxxfGrEGxKkDNt m/8yE7XspsLHzrV+3U39z/BF12FpnmY3Ce/Gfe/LY8VC9UDEqVZ3Q3tMJZE+kNerFhjwAg4feb84Q SrXQu68TuJRgEFi9NDhjlx4nnn87B4ZyEUvOvexm7zlGEsAWn4ZIE0gB7HRxdU4X7lQFn7DejoA10 5UfKuiQfVnoCtgfPuCtI7YdGSrSPz0+Q5k1SlwLyiKkp1/6KTUUORHZQIZYJv3+CuCK+B1qbPOfWu ObmLmcMwQdZb1c+BylUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvih7-007erB-56; Mon, 30 May 2022 16:56:41 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvih4-007eUE-8e for linux-arm-kernel@lists.infradead.org; Mon, 30 May 2022 16:56:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MgAIfXuZbnO66UplqyXtbnNG1M1uphwmPAPlMZl/NsM=; b=tSh9PSln6DPu8EU2UgGJUTJM7k M9mcUReU4aaRVJosOtdMc3v5aI9sfFmp1rEG6L2u3E7wDYf4yTINLVhRhXVN/EqYlfaid9d7MEO8t xXMWRQmLev64HwjQ6W0X5Y65b66Z2MGU8EQxvD+Zap2oMEARGlqnSc/PfOy6QHglj/tadSYTvVniP AO4yP505lrU+L21yItjbZX64YqiJWOejR0Nsh8qobpuSMtwDybfi3gkkXOKwVuU8PJ3NwIMDkHBNK sjUWVQwNuk3+i5NgulP5F54Q4R0CFOfj3tLSSJrCtiq8L3R4nCCkZru8Zxm2xrsD3JQv379w5s5yl b3AdTxTA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:60884) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nvieX-00045f-Ar; Mon, 30 May 2022 17:54:01 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nvieL-0001ZQ-Um; Mon, 30 May 2022 17:53:49 +0100 Date: Mon, 30 May 2022 17:53:49 +0100 From: "Russell King (Oracle)" To: Jani Nikula Cc: Linus Torvalds , Arnd Bergmann , Sudip Mukherjee , Viresh Kumar , Shiraz Hashim , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel , Linux Kernel Mailing List , Linux ARM , SoC Team Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") Message-ID: References: <87a6aztli2.fsf@intel.com> <877d63tleq.fsf@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <877d63tleq.fsf@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220530_095638_335476_CA09BC32 X-CRM114-Status: GOOD ( 27.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 30, 2022 at 12:33:17PM +0300, Jani Nikula wrote: > On Mon, 30 May 2022, Jani Nikula wrote: > > On Sat, 28 May 2022, Linus Torvalds wrote: > >> On Sat, May 28, 2022 at 11:59 AM Arnd Bergmann 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