All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
	"John Johansen" <john.johansen@canonical.com>,
	"Mickaël Salaün" <mic@digikod.net>
Subject: Re: [RFC PATCH 1/3] lsm: cleanup the size counters in security_getselfattr()
Date: Wed, 25 Oct 2023 18:06:52 -0400	[thread overview]
Message-ID: <CAHC9VhTXV+TmfmWy+ysZ8eoLhSVKC8ycnM-MBFL3UHyRbXPaEA@mail.gmail.com> (raw)
In-Reply-To: <5df43557-7261-47a1-9066-b7ba42145af0@schaufler-ca.com>

On Wed, Oct 25, 2023 at 11:19 AM Casey Schaufler <casey@schaufler-ca.com> wrote:
> On 10/24/2023 6:43 PM, Paul Moore wrote:
> > On Tue, Oct 24, 2023 at 6:23 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
> >> On 10/24/2023 2:35 PM, Paul Moore wrote:
> >>> Zero out all of the size counters in the -E2BIG case (buffer too
> >>> small) to help make the current code a bit more robust in the face of
> >>> future code changes.
> >> I don't see how this change would have the described effect.
> >> What it looks like it would do is change the return from -E2BIG
> >> to 0, which would not have the desired result.
> > When @toobig is true, which it will be when one of the individual LSMs
> > return -E2BIG, the return value of security_getselfattr() is fixed to
> > -E2BIG (check the if-statements at the end of the function).  Setting
> > @rc to zero as in this patch simply preserves some sanity in the
> > @count variable as we are no longer subtracting the E2BIG errno from
> > the @count value.  Granted, in the @toobig case, @count doesn't do
> > anything meaningful, but I believe this does harden the code against
> > future changes.
> >
> > Look at the discussion between Mickaël and I in the v15 04/11 patch
> > for more background.
> >
> > https://lore.kernel.org/linux-security-module/20230912205658.3432-5-casey@schaufler-ca.com
>
> OK. My bad for not looking beyond the patch.

No problem, we all get caught out from time to time, thanks for the review/ACK.

-- 
paul-moore.com

  reply	other threads:[~2023-10-25 22:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 21:35 [RFC PATCH 0/3] LSM syscall tweaks Paul Moore
2023-10-24 21:35 ` [RFC PATCH 1/3] lsm: cleanup the size counters in security_getselfattr() Paul Moore
2023-10-24 22:23   ` Casey Schaufler
2023-10-25  1:43     ` Paul Moore
2023-10-25 15:19       ` Casey Schaufler
2023-10-25 22:06         ` Paul Moore [this message]
2023-10-26 14:59   ` Mickaël Salaün
2023-10-24 21:35 ` [RFC PATCH 2/3] lsm: correct error codes " Paul Moore
2023-10-24 22:23   ` Casey Schaufler
2023-10-26 15:00   ` Mickaël Salaün
2023-10-24 21:35 ` [RFC PATCH 3/3] lsm: consolidate buffer size handling into lsm_fill_user_ctx() Paul Moore
2023-10-26 15:13   ` Mickaël Salaün
2023-10-26 15:38     ` Paul Moore
2023-12-20 22:31   ` Aishwarya TCV
2023-12-21  1:40     ` Paul Moore
2023-12-21 13:01       ` Mark Brown
2023-12-21 15:21         ` Paul Moore
2023-12-21 18:50           ` Mark Brown
2023-11-01 21:24 ` [RFC PATCH 0/3] LSM syscall tweaks Paul Moore
2023-11-01 22:26   ` Casey Schaufler
2023-11-13  4:07 ` Paul Moore

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=CAHC9VhTXV+TmfmWy+ysZ8eoLhSVKC8ycnM-MBFL3UHyRbXPaEA@mail.gmail.com \
    --to=paul@paul-moore.com \
    --cc=casey@schaufler-ca.com \
    --cc=john.johansen@canonical.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=selinux@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 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.