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 43A51C433F5 for ; Tue, 18 Jan 2022 11:36:45 +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=DwM65C7biN85YIkGfMUzOcrQ8D605xbfBejBW6dnsV4=; b=XfvKdG46f+mn0r q3c3ujmdElwSZx8qe0XWSlr5JSXnSLhfy3eoXgGqWEUF9B+Ijeuw5LpoiRWGPROhPvtdd2NmgB2yD aKsior8PgS5ZTmrKbRiuU4jW9dgQettakvQwgjClqoAVydxfymsgZgiEqa2iQP7tMhkJUjRn+BzWt kevYU0J5AFw532/7A3cq8GWLvz3DBKIiEUTQRcge65xhsWnKQRQ+6zWKQKtppc6w6SoA4fgRbtnBF JkVfkaTRoei7X91/ql4Ajty+q900bquTNIaOnuzgp6E4FSEGZsIDqQX65NOq0lhIewjPNUhDeKR+z 4m+uF74xZXKTrf+S/5pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9mlt-001Kob-I7; Tue, 18 Jan 2022 11:35:29 +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 1n9mlq-001Knw-Nb for linux-arm-kernel@lists.infradead.org; Tue, 18 Jan 2022 11:35:28 +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=wq16ARThkkzqOHE2RX7AL/zGNvzaVQplga00bV+mA9Y=; b=BpvoH/q9nwh2OepOE97z/QnkK4 8noWv/AsTGQhENiVZti/EorahKQWvp1H14WlXJJgvPU4eNKhp183aT8acFYwi7BPy1e0jxNjFwkGk HetzQ5yHHdgWp3+F8ow0BWmU8tMoAzjnv4dZ9uTi68M9i2JZllW/AFUWy7GnRckmzaLys8kKRWqbu Xdc8/l5GqOhXZLYWtksEQRMNSUktEzj2uAge2xkaZgh5UL8qYHsxUM3quO+tUNUaeKk059fZeMgjU QT4dblM/lVzNYaIb58lDd8AQon9AbX6q6gLkOVVgkQBdEeTHMlGFhQZ/5TVyhrhiBqpX/OD+j/6aM 3CbJoZpg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56754) 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 1n9mln-0003hC-Rx; Tue, 18 Jan 2022 11:35:23 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1n9mlm-0004FN-U5; Tue, 18 Jan 2022 11:35:22 +0000 Date: Tue, 18 Jan 2022 11:35:22 +0000 From: "Russell King (Oracle)" To: Ard Biesheuvel Cc: Linux ARM , Arnd Bergmann , Linus Walleij , "# 3.4.x" Subject: Re: [PATCH] ARM: Thumb2: align ALT_UP() sections sufficiently Message-ID: References: <20220118102756.1259149-1-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220118_033526_795511_F0A17626 X-CRM114-Status: GOOD ( 22.43 ) 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 Tue, Jan 18, 2022 at 12:32:55PM +0100, Ard Biesheuvel wrote: > On Tue, 18 Jan 2022 at 12:21, Russell King (Oracle) > wrote: > > > > On Tue, Jan 18, 2022 at 11:27:56AM +0100, Ard Biesheuvel wrote: > > > When building for Thumb2, the .alt.smp.init sections that are emitted by > > > the ALT_UP() patching code may not be 32-bit aligned, even though the > > > fixup_smp_on_up() routine expects that. This results in alignment faults > > > at module load time, which need to be fixed up by the fault handler. > > > > > > So let's align those sections explicitly, and avoid this from occurring. > > > > Are you seeing a problem that this patch fixes? > > > > This really should not matter. .alt.smp.init contents are always a whole > > number of 32-bit words. These are gathered by the linker into the > > .init.smpalt section, so the contents should always be a whole number > > of 32-bit words. > > > > This follows the .init.tagtable section, which is also a 32-bit word > > aligned structure built by the linker... which follows the > > .init.arch.info section and .init.proc.info sections which all have > > 32-bit alignment requirements. > > > > This only affects modules, not the core kernel. The .alt.smp.init > section in a module is visible to the module loader, which means the > module loader will make no attempt to position it at a 32-bit aligned > address if the ELF alignment is only 16 bits, which appears to be the > default in my Thumb2 build [gcc version 10.3.1 20211117 (Debian > 10.3.0-13)] > > I only spotted this because do_fixup_smp_on_up() was shown as the most > recent in-kernel fixup location in /proc/cpu/alignment. Ok, thanks for the explanation. -- 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 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 475FBC433EF for ; Tue, 18 Jan 2022 11:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235258AbiARLfa (ORCPT ); Tue, 18 Jan 2022 06:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234332AbiARLfa (ORCPT ); Tue, 18 Jan 2022 06:35:30 -0500 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 C4479C061574 for ; Tue, 18 Jan 2022 03:35:29 -0800 (PST) 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=wq16ARThkkzqOHE2RX7AL/zGNvzaVQplga00bV+mA9Y=; b=BpvoH/q9nwh2OepOE97z/QnkK4 8noWv/AsTGQhENiVZti/EorahKQWvp1H14WlXJJgvPU4eNKhp183aT8acFYwi7BPy1e0jxNjFwkGk HetzQ5yHHdgWp3+F8ow0BWmU8tMoAzjnv4dZ9uTi68M9i2JZllW/AFUWy7GnRckmzaLys8kKRWqbu Xdc8/l5GqOhXZLYWtksEQRMNSUktEzj2uAge2xkaZgh5UL8qYHsxUM3quO+tUNUaeKk059fZeMgjU QT4dblM/lVzNYaIb58lDd8AQon9AbX6q6gLkOVVgkQBdEeTHMlGFhQZ/5TVyhrhiBqpX/OD+j/6aM 3CbJoZpg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56754) 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 1n9mln-0003hC-Rx; Tue, 18 Jan 2022 11:35:23 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1n9mlm-0004FN-U5; Tue, 18 Jan 2022 11:35:22 +0000 Date: Tue, 18 Jan 2022 11:35:22 +0000 From: "Russell King (Oracle)" To: Ard Biesheuvel Cc: Linux ARM , Arnd Bergmann , Linus Walleij , "# 3.4.x" Subject: Re: [PATCH] ARM: Thumb2: align ALT_UP() sections sufficiently Message-ID: References: <20220118102756.1259149-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Tue, Jan 18, 2022 at 12:32:55PM +0100, Ard Biesheuvel wrote: > On Tue, 18 Jan 2022 at 12:21, Russell King (Oracle) > wrote: > > > > On Tue, Jan 18, 2022 at 11:27:56AM +0100, Ard Biesheuvel wrote: > > > When building for Thumb2, the .alt.smp.init sections that are emitted by > > > the ALT_UP() patching code may not be 32-bit aligned, even though the > > > fixup_smp_on_up() routine expects that. This results in alignment faults > > > at module load time, which need to be fixed up by the fault handler. > > > > > > So let's align those sections explicitly, and avoid this from occurring. > > > > Are you seeing a problem that this patch fixes? > > > > This really should not matter. .alt.smp.init contents are always a whole > > number of 32-bit words. These are gathered by the linker into the > > .init.smpalt section, so the contents should always be a whole number > > of 32-bit words. > > > > This follows the .init.tagtable section, which is also a 32-bit word > > aligned structure built by the linker... which follows the > > .init.arch.info section and .init.proc.info sections which all have > > 32-bit alignment requirements. > > > > This only affects modules, not the core kernel. The .alt.smp.init > section in a module is visible to the module loader, which means the > module loader will make no attempt to position it at a 32-bit aligned > address if the ELF alignment is only 16 bits, which appears to be the > default in my Thumb2 build [gcc version 10.3.1 20211117 (Debian > 10.3.0-13)] > > I only spotted this because do_fixup_smp_on_up() was shown as the most > recent in-kernel fixup location in /proc/cpu/alignment. Ok, thanks for the explanation. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!