From patchwork Wed Jul 15 07:41:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 235557 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp384579ilg; Wed, 15 Jul 2020 00:41:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/o1VhpzeOG0Wrr52B1wGNocAtWqTwyxUKgvoPSZmWf8A9bu+JbO+1OqeO0P2X4mMCFL33 X-Received: by 2002:a17:906:6442:: with SMTP id l2mr7872820ejn.383.1594798895531; Wed, 15 Jul 2020 00:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594798895; cv=none; d=google.com; s=arc-20160816; b=H875rbT67wzqcJ6lQrGQhWDtm5LJ9VKitDGosdSx1zJM9PvESEicpZXaZe5Ap7zFgP BbyYl3zkeBUqcTG1P0WR+QRZjM18jogNervdG6ZCDVaiUPEeofgDe+mw/04LQAiJ9IBQ ZtAjjk4H0W5KbtkBEM5/KipBRFz1UjA4imHS/bloETfLYmRHxHEmxAF9qnErnugFMfI9 nqZCXdtNdN6Q7+9gDp2GbqP4spYmr3gn8waZSTPA0niu10iVdn2PjEeKkOHkYnZm1Fpe c2UwtHrfyj544tKMwAYxBEbIpfyPm+KE6a2VkXd7eQ2t3eZenXqBEvpYpqTKXIzMse8e UYTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=E9XEYq/MHbkILWO/QWhLuCxUG2ifrVTReTn92/Ess1vdVYUx8lz5NFg/bHmBATvTzK tMdTGLL9iqh2sFZUeoiuAn79SQNxMDhK16uDpN/upc8MX8+DKOmYfHR7z8Tc98Ncq3Sk QBiQzap+cjwr4He05NKxFAuJAOI5gAKpqQ36cL0ZNEmJ+jnXvv7+zevO3z2BMez8ybPx JBKnwfqJVo262+hL9Yyc+JbkJuGP1bpQuKdOvkHEV69w0SrJzYlSeDGld3UlcOYx8nc2 I3CEal6KhiE2iDt8BPs/6hJrYEOyI4x8ttVlMsgWhvVW02K+/fpdXDqfPGkPya61GXiq F+5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XPTbra3Z; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t28si793679edc.97.2020.07.15.00.41.35; Wed, 15 Jul 2020 00:41:35 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XPTbra3Z; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729403AbgGOHld (ORCPT + 9 others); Wed, 15 Jul 2020 03:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729036AbgGOHlc (ORCPT ); Wed, 15 Jul 2020 03:41:32 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A79C061755 for ; Wed, 15 Jul 2020 00:41:32 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id g75so4352400wme.5 for ; Wed, 15 Jul 2020 00:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=XPTbra3ZOzVgnz5JAKFC8v0Agx2i05NYi4IOxJjdCn+CJ3soiT4ZTYkL9OfYp7qT3v 6xigK5yRETDbWC2odMm2ahd/ZEEyNWbaBxUpT61j5wTjSP9J5DvOa2xKfMR76dai1lzE 4/uAUhebVItP0adiJSFxvM8DAixnd5wBvS1iMQjvIe9ftZYeB3WAdY4WPbriwEQhapmD DEEdfxHtEccyTonf+aq3fs38hkGd36uzgkMSttOAGXQ9NaVkSQ6CySEXstQw7Jm2m0Xp uGb6JpHs7Nbtr6C+ONH1UDCiL2bqIDkpbZhkcyze2EmMx7STJm1x03qdquoBnG9emdyl jTNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fPZAAh6XsmYVOwEtQ9QgTBMrLWPHTOlempZ6e2w/4sU=; b=MmKNJhxMGa3bCo8exoUy1QJVLibpCBamelW0E48v/gKKVz0kQb+ygFtR59L+iSkWKz TjdVe+jlN1hXHqO7pkQaFEw0GmPFKrMDfSo9LdOG6XxN2fu53GwqMy/KprLGa/mtCQ52 dQ2mgVsjfGYTAMrD8fFzSGbN9rZRlU3GcoNbnkkuRH2bH0DuASQ5QBXBm73ixSmTM8L0 u29osESoqKmaQftCi0CI7aQ2NM0M4+SThCKosdvNqZK39OMKUIm2/mflgMlI9wneOBp/ GtIMY8PL6i0nSHNuvkDKQo1qwbgYhrZx53YR6EFzFZQmwpWA+AsySlAGawnTWLZIxsTz Y4YA== X-Gm-Message-State: AOAM533ykFVe9Qi2t+1PpFCZ9rao6RMYYBQxyPmm2KxCJe/ntznlY+FN UMQvZrjhUCevtOPGuIpdL9yK1A== X-Received: by 2002:a7b:c013:: with SMTP id c19mr7188412wmb.158.1594798890987; Wed, 15 Jul 2020 00:41:30 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-131-168.adsl.proxad.net. [82.252.131.168]) by smtp.gmail.com with ESMTPSA id k11sm2303745wrd.23.2020.07.15.00.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 00:41:30 -0700 (PDT) From: Daniel Lezcano To: davem@davemloft.net Cc: daniel.lezcano@linaro.org, Jakub Kicinski , Jiri Pirko , Cong Wang , Johannes Berg , Michal Kubecek , netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] net: genetlink: Move initialization to core_initcall Date: Wed, 15 Jul 2020 09:41:18 +0200 Message-Id: <20200715074120.8768-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The generic netlink is initialized far after the netlink protocol itself at subsys_initcall. The devlink is initialized at the same level, but after, as shown by a disassembly of the vmlinux: [ ... ] 374 ffff8000115f22c0 <__initcall_devlink_init4>: 375 ffff8000115f22c4 <__initcall_genl_init4>: [ ... ] The function devlink_init() calls genl_register_family() before the generic netlink subsystem is initialized. As the generic netlink initcall level is set since 2005, it seems that was not a problem, but now we have the thermal framework initialized at the core_initcall level which creates the generic netlink family and sends a notification which leads to a subtle memory corruption only detectable when the CONFIG_INIT_ON_ALLOC_DEFAULT_ON option is set with the earlycon at init time. The thermal framework needs to be initialized early in order to begin the mitigation as soon as possible. Moving it to postcore_initcall is acceptable. This patch changes the initialization level for the generic netlink family to the core_initcall and comes after the netlink protocol initialization. Signed-off-by: Daniel Lezcano --- net/netlink/genetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Acked-by: David S. Miller Tested-by: Marek Szyprowski Reviewed-by: Amit Kucheria diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 55ee680e9db1..36b8a1909826 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -1263,7 +1263,7 @@ static int __init genl_init(void) panic("GENL: Cannot register controller: %d\n", err); } -subsys_initcall(genl_init); +core_initcall(genl_init); static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group, gfp_t flags)