Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp599786pxj; Fri, 11 Jun 2021 06:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH6WYTN10rFXGet3Hz6NqMaECVXh14sBaL43M3liG1Rqvh/7IynmU+dNd/nvinvKu/EsOF X-Received: by 2002:a17:906:68c1:: with SMTP id y1mr3838046ejr.32.1623419940188; Fri, 11 Jun 2021 06:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623419940; cv=none; d=google.com; s=arc-20160816; b=XrYwtzisSfU5jTbV1ZYTclalr0cFb7dbJwVvmFSpTwr5dLPIGcUeo4cviGDD50kSSl MiD/AQwqVjQQuyhdvMnz0rbk9hqI4sAuVXSu0PXScb9Ik0fvgNMcBVgInCGC+eXxO+K+ ke5tbhKygFPENjnpV4mnM/dGzx/h5MqKb2Z+Z70gEtgDzd2zFxy6ShsakreWe3koInR/ 20uleuqzyjRR9cGE8itasvC/TOtAHBVQK74gKR2rN1dhbWbPB6Z87DFQogaKgjwYvHG3 35bLqHJbf80z7Hzhgh078l4RSHehj05ps53Cci4yITp68Q6LBthmNOiRgwO+jcKBzvSD mmmw== 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=3zURn0UPPN9V50/Gx7hW/OjynHzyy+hIqEJ1Y6Xj4DQ=; b=nup4qxEEz5m81KMDcby+0By4Eb77cMq3DeZ5hAKhF3X2xCzU5jp6L1d4fBJZLZqETI 6wZLXkKQzFPOt4GLKcNPWV9s7Ior7SYOy6eQfe3GB+SiUOgjQkrfn3bps8eskxzjKpmq itXv4F5+jyZhKFBWYWc7gN/rGzCp1ycW/GxFI2Qe0L3/DUCdXklFUDbkaGmjhLygTJtU P3Qv4idMa1xKoYrXF8Oux20DpicTgSZjTmqimBBRry8ig6E20voosAyxtjRehfQUyqN3 dmnclvV0fZbgeqYJQExBl47J66d4d+wzVhr0ltOgMADbqpg5hQwUrx9Y8t3iqZoqmDDB FHGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VPQOq5Oj; 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 yh3si2082187ejb.290.2021.06.11.06.58.36; Fri, 11 Jun 2021 06:59:00 -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=VPQOq5Oj; 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 S232159AbhFKN6F (ORCPT + 99 others); Fri, 11 Jun 2021 09:58:05 -0400 Received: from mail-pj1-f43.google.com ([209.85.216.43]:40913 "EHLO mail-pj1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbhFKN46 (ORCPT ); Fri, 11 Jun 2021 09:56:58 -0400 Received: by mail-pj1-f43.google.com with SMTP id mp5-20020a17090b1905b029016dd057935fso5872037pjb.5; Fri, 11 Jun 2021 06:55:00 -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=3zURn0UPPN9V50/Gx7hW/OjynHzyy+hIqEJ1Y6Xj4DQ=; b=VPQOq5OjYH29Xl5bqY/833Y5XFKbg9z75HMXxIg8KGavJTIEtjtD3u3s0BaLvLChGM Qt2TBf37DPkTWA6xscwui3Tp8UpwOXqn7eVv6bw8ptJhJ54puHAPSZttRcEcLIJrdsmr 8CHYfb267FTpS7plEIz7RwGclMdlllbJtDc4APd9aeR0/mKfeYsaoEVh2KQ9eKLODBr8 8HntPF/tG6EbQVIPRq6sAn1frMZTIZFXUeD/GGeMl9cjHKAvYQMtKgeuW4jAj112S1r5 xRkVuh9YuCxpC3FfipXymb9Sx8XKNSgrY6Eg4Q0nzMy2+JLxjRyF6eYtjMyR+4HOAsE8 6FbQ== 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=3zURn0UPPN9V50/Gx7hW/OjynHzyy+hIqEJ1Y6Xj4DQ=; b=EeC9e9c7j0FACyTsXQd7ebmeVVJdy9C+dSBr9JwhF866TEbskre+6G4PYbMGZs5Puh puPcs3wDJRDX7zMSynbkTG2A89RW1vDcZF4u8MsXky4uB/fL/kpdKkOno+wAi93nWR2s exnd/XgVbzFNvFKrVSBGrXv7UyIJPI3+eGC0r6qKAUzTYCR/yHzinv/jpU1Lj/+WzSRx LsMjxK4pC8FoQa7fEh5gP+JGlYUYxFj31UM0d/r+cksajQX778dFX6lu8sEuIwqtw1vl 0es+pKfCAEy3vVrF6dCjHhYiuay4ikhesatgRsHHwiTXgmIMM0fYytEi4ZMvxQwSxXMj 7VjQ== X-Gm-Message-State: AOAM5316O/7OcwWTonFv1Ei7Og3To5Y4nic/o7c+OGhLCjFvRF2okKiw j77i0QIp/BxdfjzyzlaDhbI= X-Received: by 2002:a17:90b:d95:: with SMTP id bg21mr4549059pjb.115.1623419640566; Fri, 11 Jun 2021 06:54:00 -0700 (PDT) Received: from mail.google.com ([141.164.41.4]) by smtp.gmail.com with ESMTPSA id e2sm6721682pjc.37.2021.06.11.06.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 06:54:00 -0700 (PDT) Date: Fri, 11 Jun 2021 21:53:50 +0800 From: Changbin Du To: Jakub Kicinski Cc: Changbin Du , Alexander Viro , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Cong Wang , David Laight , Christian Brauner Subject: Re: [PATCH v3] net: make get_net_ns return error if NET_NS is disabled Message-ID: <20210611135350.ba2rsbggb3zmunqg@mail.google.com> References: <20210610153941.118945-1-changbin.du@gmail.com> <20210610105112.787a0d5f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610105112.787a0d5f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 10:51:12AM -0700, Jakub Kicinski wrote: > On Thu, 10 Jun 2021 23:39:41 +0800 Changbin Du wrote: > > 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. > > I'm assuming you went from EOPNOTSUPP to EINVAL to follow what the > existing helpers in the header do? > yes, make them behaviour in the same manner. > Acked-by: Jakub Kicinski > > Thanks! -- Cheers, Changbin Du