Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2564462pxv; Sun, 27 Jun 2021 01:59:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFnYHhU46joe7VBW26UTawtbdYQfaVX6RTZyyDbtwICC3d/89HbZrHxYnYJlEyH3u9Rtl1 X-Received: by 2002:a17:907:9854:: with SMTP id jj20mr19586445ejc.365.1624784371909; Sun, 27 Jun 2021 01:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624784371; cv=none; d=google.com; s=arc-20160816; b=at9opHg2J0HVnMN3i9KK6XtQ7FtoK1REhfK8Khz/B/n9fRoMPtVRVXWFZmtTK7ZRR+ PAHxq628fufcDlFW+Lg5Jv8BpCWuVwlK3mOKM3fpN7Jf4uEnFcUbfb6K3znWKu4JCUHM ayjOzUlnZDKxiZ1js9V4xKub/oKInE9CmHk/zdc6kO/k4eE19JYkkAYHGMnjBM/D9NH5 7mYspKblzgS0zaiQPJjTJA5sgsaRrllJi3Ov1y+Q9Kteq8SU8tKHLQdq/QJYmcTyWHdc xdtpPd6mGse0p1QWlqLBR5/GEQA5B2J8PdQnsBoDTXObiGDYW0CyiCjIWtzogN8ayVhD dQiQ== 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:dkim-signature; bh=sJzQYMfdLr/FWwnhoBx+HcrPD/wFgYM+uN9MRIrljR8=; b=maGV7aUBz8j6p+qf5rt1xO5+U/iSADpEoAeT921GxJF74K9hdTYZG6Ec7MGQZ8GXPn jn/g0qiksf/ooYR5pxdOWmPS0FnqPPD4wymNANSyl/cOcl0k2SVEP6k3sqKScc+h1W+6 D8q9WBFvpCOn5Zo0xbhZCYaD4XxrMAYMcBIb7Wx4cirmBFUvQcK1MSqjsgl8WB7ftHgW dZjYBEHXUCdOXk6GQRSokeB5JKMlEROHCjaoWVhPUehb8Wl2gGgIY1DMZpCa1bpqD6o5 +P4Ld+K0eXijIxK8gpBUZ+jnmkm5iBrWvGp8c9OZVaA9UGu/eP83ydC4vqDOCQ4Djm9m 3nvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k8usj9rD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy25si11651309edb.564.2021.06.27.01.59.08; Sun, 27 Jun 2021 01:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=k8usj9rD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230092AbhF0JAl (ORCPT + 99 others); Sun, 27 Jun 2021 05:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbhF0JAg (ORCPT ); Sun, 27 Jun 2021 05:00:36 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBC88C061574; Sun, 27 Jun 2021 01:58:11 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso8331594pjp.2; Sun, 27 Jun 2021 01:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sJzQYMfdLr/FWwnhoBx+HcrPD/wFgYM+uN9MRIrljR8=; b=k8usj9rD4Us1Ta2dllTQVyixS/TGHTvls5PhYg2D8pvVJVVnKWHZ7qHavotUcT+kF5 8hbmY2v5C9rvFFZ136lNQ86JYIHN5n0BC0vxTtA/VK91AFvovH2d5Xje/wXeC3xqcZcQ fHLu6RNMVXQ6ncA/dmnHeoxbUhN07tJKlmTyEjH5+T4yTPry2NTNwg6VuNLJCapovvLc 6pEVHw8LzpugSiw7i4zxvCbWCQTK13HCXD2rLBVPtNFPwdgylFDGW7yeyeLIkTFBpGEk 4iiUYLBJgb3Pevw+qrEGaQKrrhajwBWoL1zjC+udpgnK0S3sYF7cnG7ueduuWe5reWx2 z/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sJzQYMfdLr/FWwnhoBx+HcrPD/wFgYM+uN9MRIrljR8=; b=WgkV4RmZ24YoIPgOfTzcM7DxJFT4dDfPNSGXIGiIbJvR8uYc5+8YzLUUXBkZVTZKgo jxZvam/Nt3YULuiFQwthoaXD2hLSTs0P49gfVbrw2AF+4Wklf2mp70GoqjHLfvahAkBb Wps9vUu6OaYZbhoB0eRAryw9Q/bBw45MAgf8LWs7oQUGhDvb7Bu6Tv/OzA4gtodYxMiJ D4mPvA0CvAWEQwFcLIJK3u5DU6r06xykuYMWEqnNmW3D5YpoGGTUZT4SKT9SZt2ilx/i /VLKlX3/zdmAk9r8AD5LoySas3F/ZVZ+ZkuM4ldII9ValagSnRZ1CJQn76nXkz3oyf8k 7Nqw== X-Gm-Message-State: AOAM531MN90ReejY6HSTaXKQzIdQztalHQpf4qHOgVfY18+KBVanYsNQ Vg8AKngddMXslF9ZwoeajfhJoVyKxyM= X-Received: by 2002:a17:90a:d09:: with SMTP id t9mr16134874pja.66.1624784291144; Sun, 27 Jun 2021 01:58:11 -0700 (PDT) Received: from mail.google.com ([141.164.41.4]) by smtp.gmail.com with ESMTPSA id n34sm4256697pji.45.2021.06.27.01.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Jun 2021 01:58:10 -0700 (PDT) Date: Sun, 27 Jun 2021 16:57:59 +0800 From: Changbin Du To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Changbin Du , Cong Wang , Jakub Kicinski , David Laight , Christian Brauner , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.10 045/146] net: make get_net_ns return error if NET_NS is disabled Message-ID: <20210627085759.n75m3uulvll47bdf@mail.google.com> References: <20210621154911.244649123@linuxfoundation.org> <20210621154912.823486108@linuxfoundation.org> <20210623142635.GB27348@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210623142635.GB27348@amd> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 04:26:35PM +0200, Pavel Machek wrote: > Hi! > > > > There is a panic in socket ioctl cmd SIOCGSKNS when NET_NS is not enabled. > > The reason is that nsfs tries to access ns->ops but the proc_ns_operations > > is not implemented in this case. > > > > [7.670023] Unable to handle kernel NULL pointer dereference at virtual address 00000010 > > [7.670268] pgd = 32b54000 > > [7.670544] [00000010] *pgd=00000000 > > [7.671861] Internal error: Oops: 5 [#1] SMP ARM > > [7.672315] Modules linked in: > > [7.672918] CPU: 0 PID: 1 Comm: systemd Not tainted 5.13.0-rc3-00375-g6799d4f2da49 #16 > > [7.673309] Hardware name: Generic DT based system > > [7.673642] PC is at nsfs_evict+0x24/0x30 > > [7.674486] LR is at clear_inode+0x20/0x9c > > > > The same to tun SIOCGSKNS command. > > > > To fix this problem, we make get_net_ns() return -EINVAL when NET_NS is > > disabled. Meanwhile move it to right place net/core/net_namespace.c. > > -EINVAL sounds like wrong error code for valid operation kernel was > configured to do. -ENOTSUPP? > This is to align with the existing code which returns -EINVAL. For the issue we fixed, yes, -EOPNOTSUPP (not -ENOTSUPP) should be better. > Best regards, > Pavel > > -- > http://www.livejournal.com/~pavelmachek -- Cheers, Changbin Du