@@ -332,7 +332,11 @@ static int ctnetlink_dump_secctx(struct sk_buff *skb, const struct nf_conn *ct)
char *secctx;
struct lsm_export le;
- lsm_export_to_all(&le, ct->secmark);
+ lsm_export_init(&le);
+ le.flags = LSM_EXPORT_SELINUX | LSM_EXPORT_SMACK;
+ le.selinux = ct->secmark;
+ le.smack = ct->secmark;
+
ret = security_secid_to_secctx(&le, &secctx, &len);
if (ret)
return 0;
@@ -619,7 +623,11 @@ static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
int len, ret;
struct lsm_export le;
- lsm_export_to_all(&le, ct->secmark);
+ lsm_export_init(&le);
+ le.flags = LSM_EXPORT_SELINUX | LSM_EXPORT_SMACK;
+ le.selinux = ct->secmark;
+ le.smack = ct->secmark;
+
ret = security_secid_to_secctx(&le, NULL, &len);
if (ret)
return 0;
@@ -177,7 +177,12 @@ static void ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
char *secctx;
struct lsm_export le;
- lsm_export_to_all(&le, ct->secmark);
+ /* Whichever LSM may be using the secmark */
+ lsm_export_init(&le);
+ le.flags = LSM_EXPORT_SELINUX | LSM_EXPORT_SMACK;
+ le.selinux = ct->secmark;
+ le.smack = ct->secmark;
+
ret = security_secid_to_secctx(&le, &secctx, &len);
if (ret)
return;
@@ -317,7 +317,11 @@ static u32 nfqnl_get_sk_secctx(struct sk_buff *skb, char **secdata)
read_lock_bh(&skb->sk->sk_callback_lock);
if (skb->secmark) {
- lsm_export_to_all(&le, skb->secmark);
+ /* Whichever LSM may be using the secmark */
+ lsm_export_init(&le);
+ le.flags = LSM_EXPORT_SELINUX | LSM_EXPORT_SMACK;
+ le.selinux = skb->secmark;
+ le.smack = skb->secmark;
security_secid_to_secctx(&le, secdata, &seclen);
}
Remove scaffolding functions from the netfilter code. Replace with direct access to lsm_export fields so as to be explicit about how the secmarks are being handled. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> --- net/netfilter/nf_conntrack_netlink.c | 12 ++++++++++-- net/netfilter/nf_conntrack_standalone.c | 7 ++++++- net/netfilter/nfnetlink_queue.c | 6 +++++- 3 files changed, 21 insertions(+), 4 deletions(-)