All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian Göttsche" <cgzones@googlemail.com>
To: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH] sepolgen: parse gen_tunable as bool
Date: Thu, 28 May 2020 14:54:48 +0200	[thread overview]
Message-ID: <CAJ2a_Dcm30H+sOK0LKXV7Ypv7MBcqFgtS+iTh+No=R3kiQpnpA@mail.gmail.com> (raw)
In-Reply-To: <CAEjxPJ4qJj4-of0F=TKZ1wb-s82_wbMCYLbFPuxJ57dqbNRjeQ@mail.gmail.com>

Am Mi., 27. Mai 2020 um 17:04 Uhr schrieb Stephen Smalley
<stephen.smalley.work@gmail.com>:
>
> On Tue, May 5, 2020 at 3:03 PM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > Currently sepolgen-ifgen parses a gen_tunable statement as interface
> > and reports:
> >
> >     Missing interface definition for gen_tunable
> >
> > Add grammar for gen_tunable statements in the refparser
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> This looks correct to me but I don't see that warning/error when
> running sepolgen-ifgen without this patch.
> Is this reproducible?
>

It should be when running in verbose mode. (running against Refpolicy)

> > ---
> >  python/sepolgen/src/sepolgen/refparser.py | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
> > index 2e521a0f..be7e7890 100644
> > --- a/python/sepolgen/src/sepolgen/refparser.py
> > +++ b/python/sepolgen/src/sepolgen/refparser.py
> > @@ -126,6 +126,7 @@ tokens = (
> >      'GEN_REQ',
> >      'TEMPLATE',
> >      'GEN_CONTEXT',
> > +    'GEN_TUNABLE',
> >      #   m4
> >      'IFELSE',
> >      'IFDEF',
> > @@ -192,6 +193,7 @@ reserved = {
> >      'gen_require' : 'GEN_REQ',
> >      'template' : 'TEMPLATE',
> >      'gen_context' : 'GEN_CONTEXT',
> > +    'gen_tunable' : 'GEN_TUNABLE',
> >      # M4
> >      'ifelse' : 'IFELSE',
> >      'ifndef' : 'IFNDEF',
> > @@ -518,6 +520,7 @@ def p_policy_stmt(p):
> >                     | range_transition_def
> >                     | role_transition_def
> >                     | bool
> > +                   | gen_tunable
> >                     | define
> >                     | initial_sid
> >                     | genfscon
> > @@ -844,6 +847,17 @@ def p_bool(p):
> >          b.state = False
> >      p[0] = b
> >
> > +def p_gen_tunable(p):
> > +    '''gen_tunable : GEN_TUNABLE OPAREN IDENTIFIER COMMA TRUE CPAREN
> > +                   | GEN_TUNABLE OPAREN IDENTIFIER COMMA FALSE CPAREN'''
> > +    b = refpolicy.Bool()
> > +    b.name = p[3]
> > +    if p[5] == "true":
> > +        b.state = True
> > +    else:
> > +        b.state = False
> > +    p[0] = b
> > +
> >  def p_conditional(p):
> >      ''' conditional : IF OPAREN cond_expr CPAREN OBRACE interface_stmts CBRACE
> >                      | IF OPAREN cond_expr CPAREN OBRACE interface_stmts CBRACE ELSE OBRACE interface_stmts CBRACE
> > --
> > 2.26.2
> >

      parent reply	other threads:[~2020-05-28 12:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 19:01 [PATCH] sepolgen: parse gen_tunable as bool Christian Göttsche
2020-05-27 15:04 ` Stephen Smalley
2020-05-28 12:51   ` [PATCH v2 1/3] " Christian Göttsche
2020-05-28 12:51     ` [PATCH v2 2/3] refparser: add missing newline after error message Christian Göttsche
2020-05-29 14:35       ` Stephen Smalley
2020-05-28 12:51     ` [PATCH v2 3/3] sepolgen-ifgen: refactor default policy path retrieval Christian Göttsche
2020-05-29 14:45       ` Stephen Smalley
2020-05-28 14:23     ` [PATCH v2 1/3] sepolgen: parse gen_tunable as bool Stephen Smalley
2020-05-28 14:51       ` Christian Göttsche
2020-06-04 20:26         ` Stephen Smalley
2020-06-05 14:49     ` [PATCH v3 " Christian Göttsche
2020-06-05 14:49       ` [PATCH v3 2/3] refparser: add missing newline after error message Christian Göttsche
2020-06-08 15:28         ` Stephen Smalley
2020-06-05 14:49       ` [PATCH v3 3/3] sepolgen-ifgen: refactor default policy path retrieval Christian Göttsche
2020-06-08 15:51         ` Stephen Smalley
2020-06-08 15:27       ` [PATCH v3 1/3] sepolgen: parse gen_tunable as bool Stephen Smalley
2020-06-11 13:53     ` [PATCH v4 " Christian Göttsche
2020-06-11 13:53       ` [PATCH v4 2/3] refparser: add missing newline after error message Christian Göttsche
2020-06-11 13:53       ` [PATCH v4 3/3] sepolgen-ifgen: refactor default policy path retrieval Christian Göttsche
2020-06-11 14:03         ` Stephen Smalley
2020-06-15 14:19         ` [PATCH v5 " Christian Göttsche
2020-06-15 15:07         ` [PATCH v6 " Christian Göttsche
2020-06-15 16:30           ` Stephen Smalley
2020-06-18 19:32             ` Petr Lautrbach
2020-05-28 12:54   ` Christian Göttsche [this message]

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='CAJ2a_Dcm30H+sOK0LKXV7Ypv7MBcqFgtS+iTh+No=R3kiQpnpA@mail.gmail.com' \
    --to=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    --cc=stephen.smalley.work@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.