mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: "Michael Weiß" <michael.weiss@aisec.fraunhofer.de>
Cc: Pravin B Shelar <pshelar@ovn.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, dev@openvswitch.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] net: openvswitch: allow metering in non-initial user namespace
Date: Tue, 20 Sep 2022 11:43:33 +0200	[thread overview]
Message-ID: <4697415ff25b60b83a649c6b832d9694c2cba807.camel@redhat.com> (raw)
In-Reply-To: <20220911173825.167352-2-michael.weiss@aisec.fraunhofer.de>

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ß <michael.weiss@aisec.fraunhofer.de>
> ---
>  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


  reply	other threads:[~2022-09-20  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11 17:38 [PATCH 0/2] net: openvswitch: metering and conntrack in userns Michael Weiß
2022-09-11 17:38 ` [PATCH 1/2] net: openvswitch: allow metering in non-initial user namespace Michael Weiß
2022-09-20  9:43   ` Paolo Abeni [this message]
2022-09-11 17:38 ` [PATCH 2/2] net: openvswitch: allow conntrack " Michael Weiß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4697415ff25b60b83a649c6b832d9694c2cba807.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.weiss@aisec.fraunhofer.de \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®