[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1545109481.4206.36.camel@linux.ibm.com>
Date: Tue, 18 Dec 2018 00:04:41 -0500
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-integrity@...r.kernel.org,
James Morris James Morris <jmorris@...ei.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ima: cleanup the match_token policy code
On Tue, 2018-12-18 at 04:06 +0000, Al Viro wrote:
> On Mon, Dec 17, 2018 at 10:00:07PM -0500, Mimi Zohar wrote:
>
> > Could you expand on commit 5b2ea6199614 ("selinux: switch away from
> > match_token()") patch description. All that it says is "It's not a
> > good fit, unfortunately, and the next step will make it even less so.
> > Open-code what we need here." And there's even less for the
> > equivalent Smack patch, which just says "same issue as with
> > selinux...".
>
> match_token() would require messing around with strsep() or something
> equivalent. It's not a regex; foo=%s has no idea that comma is in any
> way special, etc.
>
> As for the next commit... Killing the Cthulhu-awful mess in
> selinux_sb_eat_lsm_opts() (allocating two temproraries, concatenating
> (comma-separated) non-LSM options into one, concatenating (pipe-separated)
> dequoted LSM options into another, then splitting that another by '|'
> instances and figuring out which option each piece is, etc.)
> is a Good Thing(tm). And having to dance around the needs of
> match_token() adds extra headache, for no good reason.
Ok, so it is this particular combination of things, not the general
usage of strsep or match_token that you're objecting to. So fixing
the other match_token non-LSM instances is fine.
To prevent the enumeration and the match_table from going out of sync,
I was thinking about defining a macro to create the match_table_t:
#define __policy_tokens_match(ENUM, str) {Opt_ ## ENUM, #str},
static const match_table_t policy_tokens = {
__policy_tokens_id(__policy_tokens_match)
};
and the enumeration:
enum policy_tokens_id {
__policy_tokens_id(__policy_tokens_enumify)
};
Mimi
Powered by blists - more mailing lists