linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fw@strlen.de (Florian Westphal)
To: linux-security-module@vger.kernel.org
Subject: [PATCH v2 1/2] netfilter: nf_tables: add SECMARK support
Date: Sun, 23 Sep 2018 15:55:55 +0200	[thread overview]
Message-ID: <20180923135555.7kwa3kyachwcfy24@breakpoint.cc> (raw)
In-Reply-To: <20180923091611.19815-1-cgzones@googlemail.com>

Christian G?ttsche <cgzones@googlemail.com> wrote:
> Add the ability to set the security context of packets within the nf_tables framework.
> Add a nft_object for holding security contexts in the kernel and manipulating packets on the wire.
> 
> Convert the security context strings at rule addition time to security identifiers.
> This is the same behavior like in xt_SECMARK and offers better performance than computing it per packet.
> 
> Set the maximum security context length to 256.

Looks good, one minor suggestion.

> +#ifdef CONFIG_NETWORK_SECMARK
> +
> +struct nft_secmark {
> +	char ctx[NFT_SECMARK_CTX_MAXLEN];
> +	int len;
> +	u32 secid;
> +};

Can you change this to:

struct nft_secmark {
	u32 secid;
	char *ctx;
};

?
We don't need ctx in the packetpath, so better to keep
the struct size small.

> +	nla_strlcpy(priv->ctx, tb[NFTA_SECMARK_CTX], NFT_SECMARK_CTX_MAXLEN);

You can change this to
	priv->ctx = nla_strdup(tb[NFTA_SECMARK_CTX], GFP_KERNEL);
	if (!priv->ctx)
		return -ENOMEM;

> +	err = nft_secmark_secconversion(priv);
> +	if (err) {
		kfree(priv->ctx);

> +static void nft_secmark_obj_destroy(const struct nft_ctx *ctx, struct nft_object *obj)
> +{
	kfree(priv->ctx);

But other than this i think this is ready to be applied,
thanks a lot for making this happen.

  parent reply	other threads:[~2018-09-23 13:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23  9:16 [PATCH v2 1/2] netfilter: nf_tables: add SECMARK support Christian Göttsche
2018-09-23  9:16 ` [PATCH 2/2] netfilter: nf_tables: add requirements for connsecmark support Christian Göttsche
2018-09-23 13:51   ` Florian Westphal
2018-09-23 17:13   ` kbuild test robot
2018-09-24  3:03   ` kbuild test robot
2018-09-23 13:55 ` Florian Westphal [this message]
2018-09-23 15:31   ` [PATCH v2 1/2] netfilter: nf_tables: add SECMARK support Christian Göttsche
2018-09-23 15:41     ` Florian Westphal

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=20180923135555.7kwa3kyachwcfy24@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=linux-security-module@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).