Received: by 10.213.65.68 with SMTP id h4csp241965imn; Fri, 16 Mar 2018 01:24:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELvtHA6aQTbku5T+0Y2wFbiTSw9uWtAI1a9+95u3ifE/lR3qq9ZBoPrksxaFPLahUOxFLAVg X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr1118715pls.267.1521188680390; Fri, 16 Mar 2018 01:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521188680; cv=none; d=google.com; s=arc-20160816; b=L+AeNNGDuWokLFqeVKTLrVExraHBAqCVGW7LhibHr3D6q3U1vsseGMMg94iV80Rpcu h6REA+7ImgrQgAcZbJBIuBBmWfHZURNIVvIqua4QjT97AWNVGQLoa+1tZ0k5WrK8pVna VAtikagSTrnheYKkNc5VinOuMWaWmY9Ovsjo9J29zjM3oEeMOTcP1DCyQia58a8IcCU5 Tam46JpBcOrLlDtCjbmmYjLcD1fAhxKfRvoXx/bNoMAM4O+2DpwY3uu7LtkHiVA4pbls ep1m2Pb7gqtZmxra+lLNkOjBQ63BUbxEJVJhenJ4lQWvIwOAfjathkhepka3iBjZQ5Ny SALA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=+ZRyRBwreinn9cLz63ux0BmDKcg9gC4fCuo4+Cw2B/w=; b=pQnocLHLA4xli8PrphwX+uCq/LIzDIpY6eze/ffhlMqhVDQtfsGRmUv6HKsPebEHZk uJaVwdPfl0jZthEaa0+8Vm6OCX0/5kI3HXzG5S93dvAeDPJ6ZXNEh/Oo69t54dgLUwGz I4OiXf5x/ZrcmTescV2lZgMa89aqqrnCdjZ6w09H2cK1GnkcsICkxaipb7qaV0eNIcgv F74wFLZ2rd762LBTUIY8eKay4QKHQgFlIsva6pQYs2uLJfpd3GmOLX6aBQ7oNUzH//ya fOXSlpGFINW/nwtko66PxBs3lbEG9o8EvwYGF2awBA4K/87Pk7KBvj76AP/rpguFBEID eOLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=PxuAv2D4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si5785918plt.124.2018.03.16.01.24.26; Fri, 16 Mar 2018 01:24:40 -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=@virtuozzo.com header.s=selector1 header.b=PxuAv2D4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753164AbeCPIXT (ORCPT + 99 others); Fri, 16 Mar 2018 04:23:19 -0400 Received: from mail-ve1eur01on0117.outbound.protection.outlook.com ([104.47.1.117]:1664 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752585AbeCPIXO (ORCPT ); Fri, 16 Mar 2018 04:23:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+ZRyRBwreinn9cLz63ux0BmDKcg9gC4fCuo4+Cw2B/w=; b=PxuAv2D4yR6wSAcE+T2URkd5xQnKcSNvOjfKyOqD7rIHbjqd+clZxVI6ELVCPiriQhPNXj91YlOQlE9jzERZu135EvTglFQFt285dfSs5DKLyVa9RAG/bkvWT9gJu4hoQugcjMM3yZF2PMo2o9je304bm0HovldwEKTVc/jC/xk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.25.196] (195.214.232.6) by VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Fri, 16 Mar 2018 08:23:10 +0000 Subject: Re: netns: send uevent messages To: Christian Brauner Cc: Christian Brauner , ebiederm@xmission.com, gregkh@linuxfoundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, serge@hallyn.com, avagin@virtuozzo.com References: <20180315001214.19462-1-christian.brauner@ubuntu.com> <20180315133920.GA25733@gmail.com> <5779f3c6-7432-a3d5-1199-0b28df69ca90@virtuozzo.com> <20180315234634.GA520@gmail.com> From: Kirill Tkhai Message-ID: <5a2041d8-046a-bcee-b125-5e2aef8e3fae@virtuozzo.com> Date: Fri, 16 Mar 2018 11:23:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180315234634.GA520@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0172.eurprd05.prod.outlook.com (2603:10a6:3:f8::20) To VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9b88c5d-3c36-4710-18fa-08d58b172791 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020);S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vb3/c/f5CvMYRhig+xWxraMidsg8U4G4AkS2diTEtHaBMvcRbfpj1rg63svJxQhX81A9PVIKnf88wVmVDcbV/CXkzmrAPo5+qtli4IZzxLEWx3dvHq1J2uUrF0JzioGYG+a0pW26tpYLhc4Dj1dzruyC3UCU3naKDNGM8BEA+C6Xd/sWCGvhrIT6Fn1IO60yZRXBfVoGr7FTEf6MKZ3G5IW1z0XgZ8vVoA4jLvaHOI298BdJ5qV3KoyDCn5wssZHZsIXOjfnp7OcQVRQU1w2Nl6fqFJ9uTCkfziLaSWGU/pB9HtO3mR84Y4SzQTLX6IK5STnLBUsEPmmH7pUuI0cA1p5uuKm4+BV3ZZxorN1NDcjQUOB+9SmPp2hSuhndk/anS7evlSKRlbtWO8B+cUr/O;4:ZBfMh4HU1qq+182dzGpDHNC+LvnD3IJvtB2w5zLUtxZMWXIzzf0bh1xnJwI+gySP1L9DM2R7mBaW6F4X9MlZ63+nAM6EN61FdRRse143o3mPZpSynMR/FXnk6Jvxrq4aj0kWGU1SzQxl+ojTYhtKLeA4s0GCbRTmzEbhzjSC2L5YjA+MNvlYsbHaEd0S2WU7g3KANm+e9ISps2N9VomfgxsbYDvB9YNJlR94lpT1QF+NFg/hAuHwL6+H47M88Vee1LlQevAvTwo6T3ctKNlhd6GGOwMdHqZHgsj8TEYnU2tVtose/zMwt97Mg+Fgye70GfTB5XpCBo0hJYZHnQBb2abgjTZpNmUhuA+1fiZG2x3PcYz1OJJOFsQmOo7FrJ5L X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(788757137089)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501244)(52105095)(3002001)(10201501046)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:VI1PR0801MB1342;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB1342; X-Forefront-PRVS: 0613912E23 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(979002)(6049001)(366004)(376002)(39380400002)(346002)(396003)(39850400004)(199004)(189003)(65826007)(478600001)(50466002)(86362001)(68736007)(53546011)(106356001)(16526019)(6246003)(31696002)(64126003)(305945005)(229853002)(5660300001)(6486002)(6306002)(8936002)(7736002)(77096007)(6916009)(2950100002)(53936002)(31686004)(15650500001)(26005)(6666003)(966005)(97736004)(2486003)(76176011)(4326008)(52116002)(52146003)(16576012)(316002)(105586002)(58126008)(23676004)(25786009)(8676002)(47776003)(65806001)(65956001)(66066001)(230700001)(6116002)(36756003)(107886003)(386003)(81156014)(81166006)(59450400001)(2906002)(93886005)(3846002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB1342;H:[172.16.25.196];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjEzNDI7MjM6c2xvZGltMG0wMS9MY0F6Q3ZhV3N1Y2g2?= =?utf-8?B?cmdsZDFYQlZEUTdMYUFVdk0rbHU5cklXalY4TUs1YStvem1JSkRTSnZsd0F5?= =?utf-8?B?eTJvK0ZyRFdPNmpNR0lBNk9NaTlhMlAxSS9tZmszL0p3UTRYU0NSWmMyanhw?= =?utf-8?B?QmsvYUo3RkFsUXNsZEZRdHM0Y25uUjVRdlNQVzhrY2VMdVI3aVcyck9BQms1?= =?utf-8?B?NmRjcGo3aVorUW9EdmpWMnVFMWRYMkZiZkZNTDVlaVorMFNCUjdHY0FzS1Ry?= =?utf-8?B?QnVTMVViWGpNd01XdHJnWXBnVkxkalorTWZHblIrRHh0R1JwVnFCSWo1Q1cx?= =?utf-8?B?WFZDQnFlaVl2K0FMWkc0ZEhMaWsrU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t2kltyjoz9EMTV9fYz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1342;20:Owj06vFMWZq8FnXZihiwX0jPaSBfvFa4M9wF5FnpMs8vghkHxCXm2Sdvg9OJxhmlO3shUlqTTfJ41L4hKWhiDUdxIk50wTY5ppX0wjEq7OC4P1ajpKqGKAZCI5mJrg+my9UBN56eYsR4Aox14o1nKatwKZItGmEleiwN6aK20xk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2018 08:23:10.0247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a9b88c5d-3c36-4710-18fa-08d58b172791 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1342 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.03.2018 02:46, Christian Brauner wrote: > On Thu, Mar 15, 2018 at 05:14:13PM +0300, Kirill Tkhai wrote: >> On 15.03.2018 16:39, Christian Brauner wrote: >>> On Thu, Mar 15, 2018 at 12:47:30PM +0300, Kirill Tkhai wrote: >>>> CC Andrey Vagin >>> >>> Hey Kirill, >>> >>> Thanks for CCing Andrey. >>> >>>> >>>> On 15.03.2018 03:12, Christian Brauner wrote: >>>>> This patch adds a receive method to NETLINK_KOBJECT_UEVENT netlink sockets >>>>> to allow sending uevent messages into the network namespace the socket >>>>> belongs to. >>>>> >>>>> Currently non-initial network namespaces are already isolated and don't >>>>> receive uevents. There are a number of cases where it is beneficial for a >>>>> sufficiently privileged userspace process to send a uevent into a network >>>>> namespace. >>>>> >>>>> One such use case would be debugging and fuzzing of a piece of software >>>>> which listens and reacts to uevents. By running a copy of that software >>>>> inside a network namespace, specific uevents could then be presented to it. >>>>> More concretely, this would allow for easy testing of udevd/ueventd. >>>>> >>>>> This will also allow some piece of software to run components inside a >>>>> separate network namespace and then effectively filter what that software >>>>> can receive. Some examples of software that do directly listen to uevents >>>>> and that we have in the past attempted to run inside a network namespace >>>>> are rbd (CEPH client) or the X server. >>>>> >>>>> Implementation: >>>>> The implementation has been kept as simple as possible from the kernel's >>>>> perspective. Specifically, a simple input method uevent_net_rcv() is added >>>>> to NETLINK_KOBJECT_UEVENT sockets which completely reuses existing >>>>> af_netlink infrastructure and does neither add an additional netlink family >>>>> nor requires any user-visible changes. >>>>> >>>>> For example, by using netlink_rcv_skb() we can make use of existing netlink >>>>> infrastructure to report back informative error messages to userspace. >>>>> >>>>> Furthermore, this implementation does not introduce any overhead for >>>>> existing uevent generating codepaths. The struct netns gets a new uevent >>>>> socket member that records the uevent socket associated with that network >>>>> namespace. Since we record the uevent socket for each network namespace in >>>>> struct net we don't have to walk the whole uevent socket list. >>>>> Instead we can directly retrieve the relevant uevent socket and send the >>>>> message. This keeps the codepath very performant without introducing >>>>> needless overhead. >>>>> >>>>> Uevent sequence numbers are kept global. When a uevent message is sent to >>>>> another network namespace the implementation will simply increment the >>>>> global uevent sequence number and append it to the received uevent. This >>>>> has the advantage that the kernel will never need to parse the received >>>>> uevent message to replace any existing uevent sequence numbers. Instead it >>>>> is up to the userspace process to remove any existing uevent sequence >>>>> numbers in case the uevent message to be sent contains any. >>>>> >>>>> Security: >>>>> In order for a caller to send uevent messages to a target network namespace >>>>> the caller must have CAP_SYS_ADMIN in the owning user namespace of the >>>>> target network namespace. Additionally, any received uevent message is >>>>> verified to not exceed size UEVENT_BUFFER_SIZE. This includes the space >>>>> needed to append the uevent sequence number. >>>>> >>>>> Testing: >>>>> This patch has been tested and verified to work with the following udev >>>>> implementations: >>>>> 1. CentOS 6 with udevd version 147 >>>>> 2. Debian Sid with systemd-udevd version 237 >>>>> 3. Android 7.1.1 with ueventd >>>>> >>>>> Signed-off-by: Christian Brauner >>>>> --- >>>>> include/net/net_namespace.h | 1 + >>>>> lib/kobject_uevent.c | 88 ++++++++++++++++++++++++++++++++++++++++++++- >>>>> 2 files changed, 88 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h >>>>> index f306b2aa15a4..467bde763a9b 100644 >>>>> --- a/include/net/net_namespace.h >>>>> +++ b/include/net/net_namespace.h >>>>> @@ -78,6 +78,7 @@ struct net { >>>>> >>>>> struct sock *rtnl; /* rtnetlink socket */ >>>>> struct sock *genl_sock; >>>>> + struct sock *uevent_sock; /* uevent socket */ >>>> >>>> Since you add this per-net uevent_sock pointer, currently existing iterations in uevent_net_exit() >>>> become to look confusing. There are: >>>> >>>> mutex_lock(&uevent_sock_mutex); >>>> list_for_each_entry(ue_sk, &uevent_sock_list, list) { >>>> if (sock_net(ue_sk->sk) == net) >>>> goto found; >>>> } >>>> >>>> Can't we make a small cleanup in lib/kobject_uevent.c after this change >>>> and before the main part of the patch goes? >>> >>> Hm, not sure. It seems it makes sense to maintain them in a separate >>> list. Looks like this lets us keep the locking simpler. Otherwise we >>> would have to do something like for_each_net() and it seems that this >>> would force us to use rntl_{un}lock(). >> >> I'm about: >> >> mutex_lock(); >> list_del(net->ue_sk->list); >> mutex_unlock(); >> kfree(); >> >> Thus we avoid iterations in uevent_net_exit(). > > Ah right, but I only added struct sock *uevent_sock to struct net, not > struct uevent_sock. Thus there's no list member in there. I mainly only > added struct sock to keep it clean an aligned with the other sock > member. We can revisit this later though. In my opinion, we shouldn't leave the code in inconsistent state just because of it's not interesting for this patch. There are two logical changes: 1)add fast-access pointer to struct net 2)implement single-net uevent It's easy to do 1), and this may help further reader not to be confused by the inconsistency, so I don't see a reason why we shouldn't do that. >> >>>> >>>>> >>>>> struct list_head dev_base_head; >>>>> struct hlist_head *dev_name_head; >>>>> diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c >>>>> index 9fe6ec8fda28..10b2144b9fc3 100644 >>>>> --- a/lib/kobject_uevent.c >>>>> +++ b/lib/kobject_uevent.c >>>>> @@ -25,6 +25,7 @@ >>>>> #include >>>>> #include >>>>> #include >>>>> +#include >>>>> #include >>>>> >>>>> >>>>> @@ -602,12 +603,94 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) >>>>> EXPORT_SYMBOL_GPL(add_uevent_var); >>>>> >>>>> #if defined(CONFIG_NET) >>>>> +static int uevent_net_send(struct sock *usk, struct sk_buff *skb, >>>>> + struct netlink_ext_ack *extack) >>>>> +{ >>>>> + int ret; >>>>> + u64 seqnum; >>>>> + /* u64 to chars: 2^64 - 1 = 21 chars */ >>>> >>>> 18446744073709551615 -- 20 chars (+1 '\0'). Comment makes me think >>>> we forgot +1 in buf declaration. >>> >>> sizeof("SEQNUM=") will include the '\0' pointer in contrast to >>> strlen("SEQNUM=") so this is correct if I'm not completely mistaken. >> >> The code is OK, I'm worrying about comment. But I've missed this sizeof(). >> So, there is only 1 bytes excess allocated as 0xFFFFFFFFFFFFFFFF=18446744073709551615 >> Not so important... >> >>>> >>>>> + char buf[sizeof("SEQNUM=") + 21]; >>>>> + struct sk_buff *skbc; >>>>> + >>>>> + /* bump sequence number */ >>>>> + mutex_lock(&uevent_sock_mutex); >>>>> + seqnum = ++uevent_seqnum; >>>>> + mutex_unlock(&uevent_sock_mutex); >>>> >>>> Commit 7b60a18da393 from Andrew Vagin says: >>>> >>>> uevent: send events in correct order according to seqnum (v3) >>>> >>>> The queue handling in the udev daemon assumes that the events are >>>> ordered. >>>> >>>> Before this patch uevent_seqnum is incremented under sequence_lock, >>>> than an event is send uner uevent_sock_mutex. I want to say that code >>>> contained a window between incrementing seqnum and sending an event. >>>> >>>> This patch locks uevent_sock_mutex before incrementing uevent_seqnum. >>>> Signed-off-by: Andrew Vagin >>>> >>>> After this change the order will be lost. Also the rest of namespaces >>>> will have holes in uevent numbers, as they won't receive a number sent >>>> to specific namespace. >>> >>> Afaict from looking into udevd when I wrote the patch it only cares >>> about numbers being ordered (which is also what Andrey's patch states) >>> not that they are sequential so holes should be fine. udevd will use >>> the DEVPATH to determine whether the sequence number of the current >>> uevent should be used as "even->delaying_seqnum" number. All that >>> matters is that it is greater than the previous one. About the ordering, >>> if that's an issue then we should simply do what Andrey has been doing >>> for kobject_uevent_env() and extend the lock being held until after we >>> sent out the uevent. Since we're not serving all listeners but only >>> ever one this is also way more lightweight then kobject_uevent_env(). >> >> Yes, extending the lock to netlink_broadcast() should fix the problem. > > Yep, send another version of the patch but forgot to CC you, sorry: > https://lkml.org/lkml/2018/3/15/1098 > > Thanks! > Christian > >> >>>> >>>> It seems we should made uevent_seqnum per-net to solve this problem. >>> >>> Yes, Eric and I have been discussing this already. The idea was to do >>> this in a follow-up patch to keep this patch as simple as possible. If >>> we agree that it would make sense right away then I will dig out the >>> corresponding patch. >>> It would basically just involve giving each struct net a uevent_seqnum >>> member. >> >> pernet seqnum may have a sense if we introduce per-net locks to protect it. >> If there is single mutex, it does not matter either they are pernet or not. >> Per-net mutex may be useful only if we have many single-net messages like >> you introduce in this patch, or if we are going to filter net in existing >> kobject_uevent_net_broadcast() (by user_ns?!) in the future. >> >> Kirill