Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp8114503rwn; Wed, 14 Sep 2022 09:08:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6uUssAuE2e4rSStuSOmkZFZw9pNvPtsp28Oqub5Goee41FP9plKIeYPTY30UmiZdaRx4fV X-Received: by 2002:a05:6402:ea1:b0:443:d90a:5d31 with SMTP id h33-20020a0564020ea100b00443d90a5d31mr31123103eda.121.1663171692505; Wed, 14 Sep 2022 09:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663171692; cv=none; d=google.com; s=arc-20160816; b=vUgpuRubovsOrle+82F3p08PmDkpKTkMMW7Nv/sbeabNXbIBgylEJ2fkZ/jzG8Thxe znF0I290F4h9wdSPrbu3ZHuqRLsu+Dchx7Zqg3LbK1g2IawlI3yxLRDtwnOItcUscTUc rBIrcNfmSIKWK18I/dhmSIHO9sSUivb/fsoGYIwWdunucyRZehGNuojr7CGg8Mof1WLJ O3/JLP3/sJ3SqW0PJXO7YuymRK6WtclxH7wxq8otmB2eOWXEMloNdb0vFpAAsnlP/+5w Yu9UdTa1lxFfVeSeI5jVMIHS+b8g6Qv05KG1oK5JOlfSXfU4+YS6ex2b1K3RCC71ax3w 3V9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=h167GJbr58GYNjPPrdQId1YXiLBY5PhUv/Q/LmnvJDY=; b=DdLxgBpj79SeZZ+KjiS3epFIm9W9w1cJ1vA9u5ai4Qd5Wcyv1/NLTgSIEsTOCl0cQ7 SdxKEfj598JKC2SaZX5mKzKhugV1pAj8CCSv/fJO6a2dXrpq9thlWx3Vie/yKHfORtnA VgfrvCjUE5Zp5xOn+khVLtPXhwsZ23pt6oa5P9DaQLpOG6sh+15bsRDMTLWfBP51GU0J zaU2a7y+oU9oT/dx7Y/34u4SWOJj6U2qTxkIKEzLrTrcXzTQr0oK1ySdA+5xfRgV7Dkb SDJk/DXTZRAhe4P7ZzRIc53dtYpXtSihF/IcDTzCuo2jZlzPutWkAkJcQuNphQFasC4o M4Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=zkrQU4Kf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id en26-20020a056402529a00b0044ed67be5e5si10187368edb.100.2022.09.14.09.07.46; Wed, 14 Sep 2022 09:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=zkrQU4Kf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230238AbiINPrY (ORCPT + 99 others); Wed, 14 Sep 2022 11:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiINPrW (ORCPT ); Wed, 14 Sep 2022 11:47:22 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FBAE7F12E; Wed, 14 Sep 2022 08:47:21 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E0DA75C00C0; Wed, 14 Sep 2022 11:47:17 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 14 Sep 2022 11:47:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1663170437; x=1663256837; bh=h167GJbr58GYNjPPrdQId1YXiLBY 5PhUv/Q/LmnvJDY=; b=zkrQU4KfxoCkH7L7NzS0HhjITPM62n2OSVSwNVBrFJol 1yWPN/BNUbtzwZ9iqcrqO3EoL7bmtvt3hUFtK783gTjcJ+pxCeizpK/QZjBAukko N8oGM5gRRX2iFubteeIpC8tCseSFo8V7Fen9vEHpicQLlaYic0cCw9UiRJ2zSNdG cTo8EDvuVQ28N0tNde+5HLHZ7icaVldzzHKQ81iAVNu73XfNpe5WOrLmzKbU30Bf 6niFkIcFA2AGYylc1vv6Fys6V4eoz/YHabaQiGi8pbnr5pDhIyp2PmBWt7j6zSDA vy5B6hwWnwm0M+5HSpBW+amlZ9tWKKL3ec1G9VoG+w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeduiedgleehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehttd ertddttddvnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihgu ohhstghhrdhorhhgqeenucggtffrrghtthgvrhhnpefgueeugeegvedvueevveetfeekhe ehveeffeehveeuhfdvvdelveeugeeivdevueenucffohhmrghinhepkhgvrhhnvghlrdho rhhgpdhqvghmuhdrohhrghdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhr gh X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Sep 2022 11:47:16 -0400 (EDT) Date: Wed, 14 Sep 2022 18:47:12 +0300 From: Ido Schimmel To: Roberto Ricci , edumazet@google.com Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: BUG: unable to handle page fault for address, with ipv6.disable=1 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + Eric Original report: https://lore.kernel.org/netdev/YyD0kMC7qIBNOE3j@riccipc/T/#u On Tue, Sep 13, 2022 at 11:22:24PM +0200, Roberto Ricci wrote: > Executing the `ss` command in a system with kernel 5.19.8, booted with > the "ipv6.disable=1" parameter, causes this oops: > > > [ 74.952477] BUG: unable to handle page fault for address: ffffffffffffffc8 > [ 74.952568] #PF: supervisor read access in kernel mode > [ 74.952632] #PF: error_code(0x0000) - not-present page > [ 74.952695] PGD 25814067 P4D 25814067 PUD 25816067 PMD 0 > [ 74.952770] Oops: 0000 [#1] PREEMPT SMP PTI > [ 74.952816] CPU: 0 PID: 704 Comm: ss Not tainted 5.19.8_1 #1 > [ 74.952869] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 > WARNING! Modules path isn't set, but is needed to parse this symbol > [ 74.953292] RIP: 0010:raw_diag_dump+0xea/0x1d0 raw_diag [...] > [ 74.954188] Call Trace: > [ 74.954221] > [ 74.954248] __inet_diag_dump (net/ipv4/inet_diag.c:1179) > [ 74.954462] netlink_dump (net/netlink/af_netlink.c:2276) > [ 74.954549] __netlink_dump_start (net/netlink/af_netlink.c:2380) > [ 74.954613] inet_diag_handler_cmd (net/ipv4/inet_diag.c:1347) > [ 74.954672] ? inet_diag_dump_start_compat (net/ipv4/inet_diag.c:1244) > [ 74.954725] ? inet_diag_dump_compat (net/ipv4/inet_diag.c:1197) > [ 74.954768] ? inet_diag_unregister (net/ipv4/inet_diag.c:1254) > [ 74.954811] sock_diag_rcv_msg (net/core/sock_diag.c:235 net/core/sock_diag.c:266) > [ 74.954905] ? sock_diag_bind (net/core/sock_diag.c:247) > [ 74.954950] netlink_rcv_skb (net/netlink/af_netlink.c:2501) > [ 74.954993] sock_diag_rcv (net/core/sock_diag.c:278) > [ 74.955032] netlink_unicast (net/netlink/af_netlink.c:1320 net/netlink/af_netlink.c:1345) > [ 74.955074] netlink_sendmsg (net/netlink/af_netlink.c:1921) > [ 74.955116] sock_sendmsg (net/socket.c:714 net/socket.c:734) > [ 74.955199] ____sys_sendmsg (net/socket.c:2488) > [ 74.955245] ? import_iovec (lib/iov_iter.c:2008) > [ 74.955302] ? sendmsg_copy_msghdr (net/socket.c:2429 net/socket.c:2519) > [ 74.955348] ___sys_sendmsg (net/socket.c:2544) > [ 74.955447] ? __schedule (kernel/sched/core.c:6476) > [ 74.955522] ? _raw_spin_unlock_irqrestore (./arch/x86/include/asm/preempt.h:103 ./include/linux/spinlock_api_smp.h:152 kernel/locking/spinlock.c:194) > [ 74.955583] ? do_notify_parent_cldstop (kernel/signal.c:2191) > [ 74.955656] ? preempt_count_add (./include/linux/ftrace.h:910 kernel/sched/core.c:5598 kernel/sched/core.c:5595 kernel/sched/core.c:5623) > [ 74.955712] ? _raw_spin_lock_irq (./arch/x86/include/asm/atomic.h:202 ./include/linux/atomic/atomic-instrumented.h:543 ./include/asm-generic/qspinlock.h:111 ./include/linux/spinlock.h:185 ./include/linux/spinlock_api_smp.h:120 kernel/locking/spinlock.c:170) > [ 74.955752] ? ptrace_stop.part.0 (kernel/signal.c:2331) > [ 74.955795] __sys_sendmsg (./include/linux/file.h:31 net/socket.c:2573) > [ 74.955835] do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) > [ 74.955914] ? syscall_exit_to_user_mode (./arch/x86/include/asm/jump_label.h:55 ./arch/x86/include/asm/nospec-branch.h:382 ./arch/x86/include/asm/entry-common.h:94 kernel/entry/common.c:133 kernel/entry/common.c:296) > [ 74.955965] ? do_syscall_64 (arch/x86/entry/common.c:87) > [ 74.957786] ? do_syscall_64 (arch/x86/entry/common.c:87) > [ 74.959896] ? handle_mm_fault (mm/memory.c:5144) > [ 74.961184] ? do_user_addr_fault (arch/x86/mm/fault.c:1422) > [ 74.962609] ? fpregs_assert_state_consistent (arch/x86/kernel/fpu/context.h:39 arch/x86/kernel/fpu/core.c:772) > [ 74.964171] ? exit_to_user_mode_prepare (./arch/x86/include/asm/entry-common.h:57 kernel/entry/common.c:203) > [ 74.965968] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120) > [ 74.967266] RIP: 0033:0x7f66aac577d3 [...] > I reproduced this with Void Linux x86_64 in a virtual machine. The kernels are > those provided by the distribution (Void uses vanilla kernels, I don't believe > these very small patches make any difference > https://github.com/void-linux/void-packages/tree/0a87c670f35e01a3ac1d850f628fe1bab5d3c433/srcpkgs/linux5.19/patches). > > Kernels 5.19.8 and 5.18.19 are affected, 5.16.20 is not. > I don't know about 5.17.x because Void doesn't package it. > The iproute2 version is 5.16.0 (but this also happens with 5.19.0). This is most likely caused by commit 0daf07e52709 ("raw: convert raw sockets to RCU") which is being back ported to stable kernels. It made the initialization of 'raw_v6_hashinfo' conditional on IPv6 being enabled. Can you try the following patch (works on my end)? diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 19732b5dce23..d40b7d60e00e 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -1072,13 +1072,13 @@ static int __init inet6_init(void) for (r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r) INIT_LIST_HEAD(r); + raw_hashinfo_init(&raw_v6_hashinfo); + if (disable_ipv6_mod) { pr_info("Loaded, but administratively disabled, reboot required to enable\n"); goto out; } - raw_hashinfo_init(&raw_v6_hashinfo); - err = proto_register(&tcpv6_prot, 1); if (err) goto out; Another approach is the following, but I prefer the first: diff --git a/net/ipv4/raw_diag.c b/net/ipv4/raw_diag.c index 999321834b94..4fbdd69a2be8 100644 --- a/net/ipv4/raw_diag.c +++ b/net/ipv4/raw_diag.c @@ -20,7 +20,7 @@ raw_get_hashinfo(const struct inet_diag_req_v2 *r) if (r->sdiag_family == AF_INET) { return &raw_v4_hashinfo; #if IS_ENABLED(CONFIG_IPV6) - } else if (r->sdiag_family == AF_INET6) { + } else if (r->sdiag_family == AF_INET6 && ipv6_mod_enabled()) { return &raw_v6_hashinfo; #endif } else {