All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Paul Moore <paul@paul-moore.com>, linux-security-module@vger.kernel.org
Cc: selinux@vger.kernel.org,
	"John Johansen" <john.johansen@canonical.com>,
	"Mickaël Salaün" <mic@digikod.net>,
	"Casey Schaufler" <casey@schaufler-ca.com>
Subject: Re: [RFC PATCH 1/3] lsm: cleanup the size counters in security_getselfattr()
Date: Tue, 24 Oct 2023 15:23:07 -0700	[thread overview]
Message-ID: <8fcaab11-6340-4056-b9e0-4650be05b270@schaufler-ca.com> (raw)
In-Reply-To: <20231024213525.361332-5-paul@paul-moore.com>

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.

>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
> ---
>  security/security.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/security/security.c b/security/security.c
> index 988483fcf153..9c63acded4ee 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -3951,8 +3951,9 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx,
>  			continue;
>  		}
>  		if (rc == -E2BIG) {
> -			toobig = true;
> +			rc = 0;
>  			left = 0;
> +			toobig = true;
>  		} else if (rc < 0)
>  			return rc;
>  		else

  reply	other threads:[~2023-10-24 22:23 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 [this message]
2023-10-25  1:43     ` Paul Moore
2023-10-25 15:19       ` Casey Schaufler
2023-10-25 22:06         ` Paul Moore
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=8fcaab11-6340-4056-b9e0-4650be05b270@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=john.johansen@canonical.com \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=paul@paul-moore.com \
    --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.