Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp103627rdb; Mon, 22 Jan 2024 13:27:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqc6O4vnwNZkgRxKuHaxZf5PA8SnCW2UtUIAHEqeWqRXDjoMGYANkpR/xJxjtUb0xS/Yeo X-Received: by 2002:a05:6402:94c:b0:55a:6678:16d2 with SMTP id h12-20020a056402094c00b0055a667816d2mr240530edz.41.1705958853139; Mon, 22 Jan 2024 13:27:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705958853; cv=pass; d=google.com; s=arc-20160816; b=v0s4AN+NIphdo4HPZxm7O3lbDklbxh669dIgRovoPFL/KSG8DS1V08O6T9MsZYXpHF zbEB0NEn5c2O16KOFedVju+p1/DEPubz90//YSfGYTN5Xede7BPhgrGIOUpbEyFuQsHS LUXfPpaW43/uctpNT2mwQiz8guA4CVwbwxFELAo8mrfNiui9s0zeKFHJY12GDhPv0Did 4EOwBQSoXJitVvXutCpw7kKLIOQ9JEMzTaooDoeqkbrXxVAn0S6jXEo/mqfmy+6AfTEI qAUDZOn9/ZFQUhA0qexHQ2CG6N0Ur9ZY2jaNpTec7K6O9cyJhJL9VNW6aFAi1cBcT1pg H5dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:to:from:date:dkim-signature; bh=/Irlxbbeszo3ZqK/+Z586NQ3iiv83b42qjUFO1tQZ44=; fh=N98mG7ovqyotQz/g0IorhsRXlnkw1HKtEsuqB8v0Uwk=; b=05MYSEAXOLRnvEcZmnCf10Xsi69KoJjlxDN7bL7jUiom+fgz1Yjhs3jmiV1xoU5O1E u2w4LWN7e5FT06d6GEUl9vFGYyJfDwVuj8H8rA9+DoE2nIEQmiQQT811Ompy6spiEIWP mlFCmvCyZN3Q90B5nPA6+4ZXOGVJe2fCPRV738vYju7hrGujcGpZbfinL0GC9y4hImER 5xsiryspIoV2ObK5gJT77navDR/UXBoj5h0R+i84Rb9Zz3scqlRcd0LWrbAkppllLKzf 04m5SRcC9EXApxpbtgYp/zqPk3t1QU5CU6TPxuPpjMb5v68GJu5AIE/t6lyeWDHYoCRh 93Vg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B6FPeoic; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id es14-20020a056402380e00b0055a908eb533si2977323edb.54.2024.01.22.13.27.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 13:27:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B6FPeoic; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34178-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E37AD1F27E1C for ; Mon, 22 Jan 2024 21:27:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78877481C4; Mon, 22 Jan 2024 21:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B6FPeoic" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8480A481A8; Mon, 22 Jan 2024 21:27:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705958841; cv=none; b=MZkMjfq0yd/ga8Ztvl62laukDgLlEbF1f3uDHId0lehy/C7lr3FBJQZdmaji2BjVLcEP5fF4HjavebMCypzV6kW5LK3Ol3U9YgyUQoI4AfMbJWwbagHyxcqtJ0WfjGoijd2icGmb0URfDeG9gjPzBodCg84oIuCqOJ4zuoPzysI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705958841; c=relaxed/simple; bh=B4jg+wknI7bWQTo4YGuAgpR6c3hqlIFCNIfSJVyzWpI=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=hi5y9yOB7YoZUygU7Q1l3ey/5rxG4Tm4NVmsFGFL+dsnJepIhW9w0MZUNH5xunoUuolw3AYzwn3A/hY9XirgiWVArQk6NefCbU0WfnfkgQRNZsVxbyDfJfByeGXgFtmVzSRcyqNOz+3iW2edI+jVjz/LWRis7syhBIKxE5lics0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B6FPeoic; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0185C433F1; Mon, 22 Jan 2024 21:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705958840; bh=B4jg+wknI7bWQTo4YGuAgpR6c3hqlIFCNIfSJVyzWpI=; h=Date:From:To:Subject:From; b=B6FPeoic5mAklseNc8DVinZekJCs3gm2yeVq1FZiWEKQ8OhD4vCTm7Z26KO1F6vSP UCp0UeCrMc7gtYKPXcgFB36tWYBTWLfECX5vNKW3/no/3J1peECVFU6t4c93a9WSQr y4BtWUo83y6Ync0kgxA9L3e+ryczFPMIHZ0ACw1yg02oB3pAjXUib6a13Kgmi2xfns JsFFnzZmB500h5sX1+0GnLXmIWFKjAHK5iA6+4SJ7IqsPQgObcr0dsq2JeyR2TwPOj OfIkrsMAlrI/H7jA6aj7QuOtro/2If44RZ+u9NTtbxBtoRZMYKiNvIourW9jLFsmUA FTJ9QMJkq/0Sg== Date: Mon, 22 Jan 2024 22:27:15 +0100 From: Helge Deller To: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org Subject: [PATCH] ipv6: Ensure natural alignment of const ipv6 loopback and router addresses Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On a parisc64 kernel I notice sometimes this kernel warning: Kernel unaligned access to 0x40ff8814 at ndisc_send_skb+0xc0/0x4d8 The address 0x40ff8814 points to the in6addr_linklocal_allrouters variable and the warning simply means that some ipv6 function tries to read a 64-bit word directly from the not-64-bit aligned in6addr_linklocal_allrouters variable. The patch below ensures that those ipv6 loopback and router addresses always will be naturally aligned and as such prevents unaligned accesses for all architectures. Signed-off-by: Helge Deller diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c index 507a8353a6bd..813e009b4d0e 100644 --- a/net/ipv6/addrconf_core.c +++ b/net/ipv6/addrconf_core.c @@ -220,19 +220,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { EXPORT_SYMBOL_GPL(ipv6_stub); /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */ -const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +const struct in6_addr in6addr_loopback __aligned(BITS_PER_LONG/8) + = IN6ADDR_LOOPBACK_INIT; EXPORT_SYMBOL(in6addr_loopback); -const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; +const struct in6_addr in6addr_any __aligned(BITS_PER_LONG/8) + = IN6ADDR_ANY_INIT; EXPORT_SYMBOL(in6addr_any); -const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_linklocal_allnodes __aligned(BITS_PER_LONG/8) + = IN6ADDR_LINKLOCAL_ALLNODES_INIT; EXPORT_SYMBOL(in6addr_linklocal_allnodes); -const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; +const struct in6_addr in6addr_linklocal_allrouters __aligned(BITS_PER_LONG/8) + = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; EXPORT_SYMBOL(in6addr_linklocal_allrouters); -const struct in6_addr in6addr_interfacelocal_allnodes = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT; +const struct in6_addr in6addr_interfacelocal_allnodes __aligned(BITS_PER_LONG/8) + = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT; EXPORT_SYMBOL(in6addr_interfacelocal_allnodes); -const struct in6_addr in6addr_interfacelocal_allrouters = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT; +const struct in6_addr in6addr_interfacelocal_allrouters __aligned(BITS_PER_LONG/8) + = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT; EXPORT_SYMBOL(in6addr_interfacelocal_allrouters); -const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT; +const struct in6_addr in6addr_sitelocal_allrouters __aligned(BITS_PER_LONG/8) + = IN6ADDR_SITELOCAL_ALLROUTERS_INIT; EXPORT_SYMBOL(in6addr_sitelocal_allrouters); static void snmp6_free_dev(struct inet6_dev *idev)