linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. Greg" <greg@enjellic.com>
To: Paul Moore <paul@paul-moore.com>
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH 02/14] Add TSEM specific documentation.
Date: Fri, 7 Apr 2023 09:10:24 -0500	[thread overview]
Message-ID: <20230407141024.GA17078@wind.enjellic.com> (raw)
In-Reply-To: <CAHC9VhTQCLHQjEnBbGBZ7ya5s01hMr6WLLf_N54AmfYp_6TwsQ@mail.gmail.com>

On Wed, Apr 05, 2023 at 04:45:26PM -0400, Paul Moore wrote:

Good morning, I hope the week has gone well for everyone.

> On Wed, Mar 29, 2023 at 11:35???PM Dr. Greg <greg@enjellic.com> wrote:
> > On Wed, Mar 22, 2023 at 07:45:26PM -0400, Paul Moore wrote:
> > > On Mon, Mar 13, 2023 at 6:52???PM Dr. Greg <greg@enjellic.com> wrote:
> > > > On Thu, Mar 02, 2023 at 11:15:56PM -0500, Paul Moore wrote:
> > > >
> > > > Hi Paul, thanks for sending along further comments.
> > > >
> > > > You note below that you haven't had time to look at the code since you
> > > > wanted to confirm the TSEM security model before moving forward.
> > > >
> > > > From a development perspective we are now three weeks into what will
> > > > become version 2 of the patch series.  So at this point I wouldn't
> > > > advocate spending a lot of time on the current patchset.
> > > >
> > > > That being said, if you some have time, we would appreciate a quick
> > > > look at the code on your part, with respect to style changes and the
> > > > like we can enforce in the second series, ie. ordering of local
> > > > variable declarations by length and the like.
> >
> > > To be perfectly honest I'm still very concerned about some of the
> > > issues that I've seen in the docs, until that is sorted out I'm not
> > > sure there is much point in looking at the code.
> >
> > I think those concerns can be resolved, see below for more
> > information, the second patch series that we are closing in on should
> > help address the concerns that are currently on the table.

> In that case, I think it might be best to wrap up this thread and we
> can resume the discussion on the next patchset.

Very good, we will look forward to the review of V2, which has now
been enhanced on a number of fronts.

> > That being said, since TSEM is a new codebase, we were hoping that you
> > could give us some guidance on function local variable ordering.
> > Reverse Christmas tree seems popular writ large in the kernel, I
> > believe that you commented in a posting a month or two ago that you
> > prefer standard Christmas tree, SMACK and SeLinux don't seem to
> > religiously embrace a style.
> >
> > Our codebase uses ordering based on least complex to most complex
> > variables and has worked for us, both in the kernel and elsewhere, but
> > we are ambivalent, as our primary objective is to avoid wasting
> > everyone's time on issues such as this.
> 
> The canonical guidance on coding style within the kernel is in the kernel docs:
> 
> https://www.kernel.org/doc/html/latest/process/coding-style.html
> 
> When in doubt, I would recommend following that as closely as possible.
> 
> As far as local variable ordering is concerned, I don't believe I've
> ever rejected patches due to that.  My own personal preference usually
> follows what you've described above: the least complex (simple
> scalars) at the top, with the more complex variables (composites) at
> the bottom.  In practice this tends to result in a "Christmas Tree"
> ordering, but it can be a bit lumpy (?) in some cases; that is fine.
> 
> There are two style nitpicks which annoy me enough to make it worth mentioning:
> 
> * Stick to 80 characters as much as possible, yes we all have
> terminals that can go wider, but I like to have several terminals on
> my screen and if they all need to be 100 chars wide I can't fit as
> many.  There are going to be some exceptions, e.g. error message
> string literals, but that should only happen a few times in a given
> file.  If you are finding that every function you write has a line
> that goes past 80 characters you are doing *something* wrong.
> 
> * If/when you split a single line across multiple lines due to the
> above, make sure the
> lines are indented properly such that they line up properly with the
> code above.  It's tricky to give all of the different examples so I'm
> not going to even try.  I realize that is garbage guidance, but the
> kernel coding style is a help here.
> 
> If you are really lost, I use the following 'astyle' command in other
> projects, and it should produce fairly kernel-style friendly code:
> 
> % astyle --options=none --lineend=linux --mode=c \
>     --style=linux \
>     --indent=force-tab=8 \
>     --indent-preprocessor \
>     --indent-col1-comments \
>     --min-conditional-indent=0 \
>     --max-instatement-indent=80 \
>     --pad-oper \
>     --align-pointer=name \
>     --align-reference=name \
>     --max-code-length=80 \
>     --break-after-logical

All of the above is consistent with what we have used for years,
particularly 80 columns, given that the principles of TSEM extend from
programming with a Model 29 keypunch and a drum card to applying
machine learning to security.

> paul-moore.com

Have a good weekend.

As always,
Dr. Greg

The Quixote Project - Flailing at the Travails of Cybersecurity

  reply	other threads:[~2023-04-07 14:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04  5:09 [PATCH 00/14] Implement Trusted Security Event Modeling Dr. Greg
2023-02-04  5:09 ` [PATCH 01/14] Update MAINTAINERS file Dr. Greg
2023-02-04  5:09 ` [PATCH 02/14] Add TSEM specific documentation Dr. Greg
2023-02-09 11:47   ` Greg KH
2023-02-09 23:47     ` Dr. Greg
2023-02-13  4:33   ` Paul Moore
2023-02-14 11:58     ` Dr. Greg
2023-02-14 12:18       ` Roberto Sassu
2023-02-15 16:26         ` Dr. Greg
2023-03-03  4:15       ` Paul Moore
2023-03-13 22:52         ` Dr. Greg
2023-03-22 23:45           ` Paul Moore
2023-03-30  3:34             ` Dr. Greg
2023-04-05 20:45               ` Paul Moore
2023-04-07 14:10                 ` Dr. Greg [this message]
2023-02-04  5:09 ` [PATCH 03/14] Add magic number for tsemfs Dr. Greg
2023-02-04  5:09 ` [PATCH 04/14] Implement CAP_TRUST capability Dr. Greg
2023-02-06 17:28   ` Serge Hallyn (shallyn)
2023-02-11  0:32     ` Dr. Greg
     [not found]   ` <a12483d1-9d57-d429-789b-9e47ff575546@schaufler-ca.com>
2023-02-13 11:43     ` Dr. Greg
2023-02-13 18:02       ` Casey Schaufler
2023-02-16 21:47         ` Dr. Greg
2023-02-04  5:09 ` [PATCH 05/14] Add TSEM master header file Dr. Greg
     [not found]   ` <ecb168ef-b82d-fd61-f2f8-54a4ef8c3b48@schaufler-ca.com>
2023-02-06  0:10     ` Dr. Greg
2023-02-04  5:09 ` [PATCH 06/14] Add primary TSEM implementation file Dr. Greg
2023-02-04  5:09 ` [PATCH 07/14] Add root domain trust implementation Dr. Greg
2023-02-04  5:09 ` [PATCH 08/14] Implement TSEM control plane Dr. Greg
2023-02-09 11:30   ` Greg KH
2023-02-11  0:18     ` Dr. Greg
2023-02-11 10:59       ` Greg KH
2023-02-12  6:54         ` Dr. Greg
2023-02-16  6:53           ` Greg KH
2023-02-18 18:03             ` Dr. Greg
2023-02-04  5:09 ` [PATCH 09/14] Add namespace implementation Dr. Greg
2023-02-04  5:09 ` [PATCH 10/14] Add security event description export facility Dr. Greg
2023-02-04  5:09 ` [PATCH 11/14] Add event description implementation Dr. Greg
2023-02-04  5:09 ` [PATCH 12/14] Implement security event mapping Dr. Greg
2023-02-04  5:09 ` [PATCH 13/14] Implement an internal Trusted Modeling Agent Dr. Greg
2023-02-04  5:09 ` [PATCH 14/14] Activate the configuration and build of the TSEM LSM Dr. Greg
2023-02-08 22:15   ` Casey Schaufler
2023-02-09 22:21     ` Dr. Greg
     [not found] ` <20230204115917.1015-1-hdanton@sina.com>
2023-02-23 18:41   ` [PATCH 09/14] Add namespace implementation Dr. Greg

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=20230407141024.GA17078@wind.enjellic.com \
    --to=greg@enjellic.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.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 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).