All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: selinux@vger.kernel.org
Subject: Re: [PATCH] selinux: reject a 65535-byte xfrm context that ctx_len cannot hold
Date: Mon, 23 Nov 2026 23:45:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-230225@kernel.org> (raw)
In-Reply-To: <20261124-dev-v1-1-00b99ee684ec@mbzuai.ac.ae>

> From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> 
> Commit 86c8db86af43 ("selinux: fix selinux_xfrm_alloc_user() to set
> correct ctx_len") made ctx_len count the terminating NUL. ctx_len is a
> __u16 and selinux_xfrm_alloc_user() only rejects str_len >= PAGE_SIZE.
> With 64K pages, str_len = 65535 passes, and ctx_len = str_len + 1 wraps
> to 0 (kmalloc_flex() stores the same truncated value first).
> 
> ctx_str[] is __counted_by(ctx_len), so the following memcpy() of
> str_len bytes is checked against a buffer of size 0. With
> CONFIG_FORTIFY_SOURCE this ends in __fortify_panic():
> 
>   memcpy: detected buffer overflow: 65535 byte write of buffer size 0
>   kernel BUG at lib/string_helpers.c:1044!
>   ...
> [ ... ]
> exercised.
> 
> Fixes: 86c8db86af43 ("selinux: fix selinux_xfrm_alloc_user() to set correct ctx_len")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-dev-v1-1-00b99ee684ec@mbzuai.ac.ae?part=1

  reply	other threads:[~2026-11-23 23:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 23:37 [PATCH] selinux: reject a 65535-byte xfrm context that ctx_len cannot hold Arina Kharlamova via B4 Relay
2026-11-23 23:37 ` Arina Kharlamova
2026-11-23 23:45 ` sashiko-bot [this message]
2026-11-24  2:19 ` 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=sashiko-outbox-230225@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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.