Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3800502yba; Mon, 29 Apr 2019 08:43:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqypC/KrbLBMowmOR5D05pEKXaK6VAxtDz2kCygw1br0tpZOBimecqar3T3Lg7mwBYuxJp8r X-Received: by 2002:a63:cc0d:: with SMTP id x13mr59502338pgf.280.1556552626071; Mon, 29 Apr 2019 08:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556552626; cv=none; d=google.com; s=arc-20160816; b=pUZHpguIhUVpCZRcaEcc5hGlIJxjTjwHVvsnqb8e2JPI3xvVj146pyPmEhOv84SxA3 2iZI2JTMxGPfY/wjRBze366jUAXlR+Ljl/OgJiDAKUcvsuUulDjONNVwDdwLP6yYTKfo UfXKWYqgnL9ra8uzDucqu/mNdhJmARYRqH6cY60zK8GSFP+n6qmbsJO99VtT7LlLGS6d 0fHImbXxexLNyoKlIYNzStdLAFo5UkaRSuyQoNZg5hzRodZG/gUvR+eEuTZoxuH8wrJi atBfa6gqYl3KpmJ4IUyhPqlmUT6XSutAJkVaEqLh8GdoykOKdzmSDh7CgGtpgfRGv0rs Q8Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uPWRyFwOnHxJrmou63FjPEpH1GTpfepGPs3japprjXw=; b=mNfuWLvLLKvIzcfa9q8UAljIk9kuWNwFZ3HmaPANpdS9195B47wnMmNUS6NS0rVKyB HKklrcNVCu16Q+aSLGONcueHXNy4dG0N6AGToNA5JVl6X3b6H/CwaCVkyL80p7+wqLKw 4vzt5pZ+Sji1CPptDx5jM4FJKYppkItmbc/f3wJaaRorMjItGyWK9Q8ImSAWQ+WOeCPu hF7pW0mXaz5iDywV/6jaf7nBjjPGdOuPzO2A75tcbhv8NNZDyiTHnIP8VlnbzENzTqW9 Ui3nS2ZUq09NbCnQPV/MyFZ8TkCWCiqkw7uXnFJaIFScbv2Vn8KpDsYhuLQPVxpqL9Ss yd4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=lqnRekWa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j34si31366123pgb.64.2019.04.29.08.43.29; Mon, 29 Apr 2019 08:43:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=lqnRekWa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728632AbfD2Pmj (ORCPT + 99 others); Mon, 29 Apr 2019 11:42:39 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:44740 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728541AbfD2Pmj (ORCPT ); Mon, 29 Apr 2019 11:42:39 -0400 Received: by mail-ot1-f65.google.com with SMTP id d24so8988110otl.11 for ; Mon, 29 Apr 2019 08:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kinvolk.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uPWRyFwOnHxJrmou63FjPEpH1GTpfepGPs3japprjXw=; b=lqnRekWa9dbIraNi5UiSY4ohDHSwF6B9xg46rAn6Fzw5cvwjUVJjo4VzTBcXb6Jo2o fyIB/+34Sk3xW1ijxE/4hNyvMjziGTrncHvQEF80t4MkTmZWrFwvANV1bwHStRaxTC9f 1j/f28yth6HeynPkxHP4JL4lLGPi8xDzrGkLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uPWRyFwOnHxJrmou63FjPEpH1GTpfepGPs3japprjXw=; b=FTbsxRRXjPOhbC9tF2jcT+g1mfkM6xCm2Vq/mIw2jC4BHJ1DxfhiNfawaTKPUgdJkI /JsMMcw4e9F07aCwg4CqvMU1W0RNQVhR6lzzec6uRy2+vaDYJwU085eMRaIQpRrSLslM egEuGvJ4AQuGv/E6prMhIMLoZ9zWy36QQIJMj+C+pIoSeRYABqvDu0W0830jT2h7W/mu TtsO0FFiSB8Kzh879TyfUyh9nBV59nZSWOVofMCPc+ooV77jc7jjQV53JK6hqNTOAqYQ iDh++AN36vlqR0lthLyd0Ez428oZcYLYLmWNBiCC0fY19lF+V81wjj1R4Lnfme6iONxA k/zA== X-Gm-Message-State: APjAAAVwawZ93JboOvM/M/xojVfeeQePaU9XHc4GXJ6tFj17GkhueL08 OUg6ycgps9v/hy89XWvaxABL5+v0x6NDO1QKRoPBow== X-Received: by 2002:a9d:4d91:: with SMTP id u17mr33805040otk.356.1556552558265; Mon, 29 Apr 2019 08:42:38 -0700 (PDT) MIME-Version: 1.0 References: <20190426154848.23490-1-alban@kinvolk.io> <20190426140323.4edf1127@cakuba.netronome.com> <20190427113940.223fd4d1@cakuba.netronome.com> In-Reply-To: <20190427113940.223fd4d1@cakuba.netronome.com> From: Alban Crequy Date: Mon, 29 Apr 2019 17:42:27 +0200 Message-ID: Subject: Re: [PATCH bpf-next v3 1/4] bpf: sock ops: add netns ino and dev in bpf context To: Jakub Kicinski Cc: Alban Crequy , John Fastabend , Alexei Starovoitov , Daniel Borkmann , bpf , netdev , LKML , =?UTF-8?Q?Iago_L=C3=B3pez_Galeiras?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 27, 2019 at 8:39 PM Jakub Kicinski wrote: > > On Sat, 27 Apr 2019 12:48:25 +0200, Alban Crequy wrote: > > On Fri, Apr 26, 2019 at 11:03 PM Jakub Kicinski > > wrote: > > > > > > On Fri, 26 Apr 2019 17:48:45 +0200, Alban Crequy wrote: > > > > In the unlikely case where network namespaces are not compiled in > > > > (CONFIG_NET_NS=n), the verifier will not allow access to ->netns_*. > > > > > > Naive question - why return an error? init_net should always be there, > > > no? > > > > True for netns_dev. However, without CONFIG_NET_NS, we cannot access netns_ino: > > > > (struct sock_common).possible_net_t.(struct net *): > > > > typedef struct { > > #ifdef CONFIG_NET_NS > > struct net *net; > > #endif > > } possible_net_t; > > > > And I don't think it would make much sense to allow access to > > netns_dev but not netns_ino. > > Right, if CONFIG_NET_NS=n we could just take the pointer to init_net > directly, and not worry about the field. IMHO it'd be preferable to > changing the UAPI based on kernel config, but I don't feel super > strongly. I see the point about not changing the UAPI. So I will update the patch to: - return netns_dev unconditionally, regardless of CONFIG_NET_NS - return netns_ino with either the correct value or zero depending on CONFIG_NET_NS.