From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42C5CC54EE9 for ; Tue, 20 Sep 2022 09:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbiITJnp (ORCPT ); Tue, 20 Sep 2022 05:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbiITJnl (ORCPT ); Tue, 20 Sep 2022 05:43:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9506C48CBD for ; Tue, 20 Sep 2022 02:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663667019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KxJc4EwdNPOPw/+t4sVZ14DqF5XTa5bzeTRnaZ5IV5A=; b=RA0wST6QXLs6UY4kvT8HIG+juPWuvhLZbojTSUHsNzVb90+7V5UGXDaKARo7TMKoFQHiu4 qY8guW93zmXJbfuIjiIHUSnpoyiThW5yqFQCSOGwlna7fmqGDB6By24/7dKUa34DrW4PPw 6V+uF4fnNlgZ/0KZPcTvKW23vF8dre8= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-323-okfGqi_kM06EW44qVXAQ2Q-1; Tue, 20 Sep 2022 05:43:38 -0400 X-MC-Unique: okfGqi_kM06EW44qVXAQ2Q-1 Received: by mail-qv1-f70.google.com with SMTP id g4-20020ad45424000000b004a9bb302c85so1579000qvt.22 for ; Tue, 20 Sep 2022 02:43:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date; bh=KxJc4EwdNPOPw/+t4sVZ14DqF5XTa5bzeTRnaZ5IV5A=; b=E9s7ViMg2xBtM8B/QLdNTqA1I8Po9RE0N+FI+P3dSjIh82J4ytu73O+xPP280NDri5 LEBaLZApJ2qYbFhweNSxAVAJUjtXD3wpZrlZyJUkaMKFcXxD6lBHdG/R7RrlcIuRrvR1 JHX30v1UmnzeFshK71Ir9NhtIBDKOQCYthcFN7axH+EgMo5NDzJfONaSbZ2PgP5OP2Xq LlJHhyPN1z7scrBrk5sHpwMlHorpZUVqSN4i+jE6QY4o2FShqsAzWNdSIE/UQwBLvOD5 FdWSeBSNluenW6N63DjY0iaQpunWqE7TZ3z3gRPoxxFKP2sfNoW8uPCOhBEjId9Mj58O Hy9g== X-Gm-Message-State: ACrzQf1pIdUIT1D37NA9gUNWlxmaMHICXzNN4OD1V0JUoAYPIajvaJxV Z8n/0VVJfTVPD1qR7FbMcQ/756LIKn4kdifj8BBmCxoeScd2kjdRLUBVQn5XT6kD3cPjhY64VaK cIn2C64Cn/FUC3ULad5u7HgSw X-Received: by 2002:ad4:5c6f:0:b0:4aa:a393:fe85 with SMTP id i15-20020ad45c6f000000b004aaa393fe85mr18124729qvh.124.1663667017768; Tue, 20 Sep 2022 02:43:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EHobH+Cg0wFbiwpGjrOYGZH8L9AGUDFxY5LfTZXhip0iniWZeT8JNoZ5YwoD/7aFHxPicoQ== X-Received: by 2002:ad4:5c6f:0:b0:4aa:a393:fe85 with SMTP id i15-20020ad45c6f000000b004aaa393fe85mr18124721qvh.124.1663667017552; Tue, 20 Sep 2022 02:43:37 -0700 (PDT) Received: from gerbillo.redhat.com (146-241-114-90.dyn.eolo.it. [146.241.114.90]) by smtp.gmail.com with ESMTPSA id f9-20020ac840c9000000b0035a7070e909sm617157qtm.38.2022.09.20.02.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 02:43:37 -0700 (PDT) Message-ID: <4697415ff25b60b83a649c6b832d9694c2cba807.camel@redhat.com> Subject: Re: [PATCH 1/2] net: openvswitch: allow metering in non-initial user namespace From: Paolo Abeni To: Michael =?ISO-8859-1?Q?Wei=DF?= Cc: Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org Date: Tue, 20 Sep 2022 11:43:33 +0200 In-Reply-To: <20220911173825.167352-2-michael.weiss@aisec.fraunhofer.de> References: <20220911173825.167352-1-michael.weiss@aisec.fraunhofer.de> <20220911173825.167352-2-michael.weiss@aisec.fraunhofer.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2022-09-11 at 19:38 +0200, Michael Weiß wrote: > The Netlink interface for metering was restricted to global CAP_NET_ADMIN > by using GENL_ADMIN_PERM. To allow metring in a non-inital user namespace, > e.g., a container, this is changed to GENL_UNS_ADMIN_PERM. > > Signed-off-by: Michael Weiß > --- > net/openvswitch/meter.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c > index 04a060ac7fdf..e9ef050a0dd5 100644 > --- a/net/openvswitch/meter.c > +++ b/net/openvswitch/meter.c > @@ -687,9 +687,9 @@ static const struct genl_small_ops dp_meter_genl_ops[] = { > }, > { .cmd = OVS_METER_CMD_SET, > .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, > - .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN > - * privilege. > - */ > + .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN > + * privilege. > + */ > .doit = ovs_meter_cmd_set, > }, > { .cmd = OVS_METER_CMD_GET, > @@ -699,9 +699,9 @@ static const struct genl_small_ops dp_meter_genl_ops[] = { > }, > { .cmd = OVS_METER_CMD_DEL, > .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, > - .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN > - * privilege. > - */ > + .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN > + * privilege. > + */ > .doit = ovs_meter_cmd_del > }, > }; It looks like the user namespace can allocate quite a bit of memory with multiple meters, I think it's better additionally change GFP_KERNEL to GFP_KERNEL_ACCOUNT in dp_meter_create(). Also plese add an explicit target tree in the subj when posting the next revision, thanks! Paolo