mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryam Vargas <hexlabsecurity@proton.me>
To: Michael Bommarito <michael.bommarito@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] isofs: bound Rock Ridge symlink components to the SL record
Date: Sun, 07 Jun 2026 01:18:22 +0000	[thread overview]
Message-ID: <20260607011817.217712-1-hexlabsecurity@proton.me> (raw)
In-Reply-To: <CAJJ9bXzdj6Xxa6wXApV_TtCni1sgEryHmV+=iy8yECGNYeMSvw@mail.gmail.com>

On Sat, 6 Jun 2026, Michael Bommarito <michael.bommarito@gmail.com> wrote:
> one note I'd mention is that I returned NULL here instead of breaking so
> that readlink() would fail with -EIO downstream. Maybe I'm missing
> something elsewhere, but I think this design results in silent truncation
> and a potentially confused caller who thinks the symlink was successful.

Agreed. In get_symlink_chunk() a break leaves rock_ridge_symlink_read_folio()
with rpnt != link, which it treats as success, so readlink() returns the
truncated target. v2 returns NULL there instead -- matching the existing
plimit-overflow checks in the same function -- so a malformed SL record now
fails with -EIO rather than silently truncating.

I left the break in parse_rock_ridge_inode_internal(): that site only bounds
the i_size walk, and the link is read back through get_symlink_chunk(), which
now errors on the same record, so the truncated i_size is never consumed. I'm
happy to make that site a hard error too if you'd rather both reject.

I checked the three behaviours on the exact loop, with one valid component
followed by an over-long one: unpatched -> 255-byte out-of-bounds read; break
-> readlink() returns the truncated "abc/"; return NULL -> -EIO; a well-formed
link is unaffected.

v2 below, with your suggestion.

Bryam


      reply	other threads:[~2026-06-07  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-06 22:29 Bryam Vargas
2026-06-06 23:44 ` Michael Bommarito
2026-06-07  1:18   ` Bryam Vargas [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=20260607011817.217712-1-hexlabsecurity@proton.me \
    --to=hexlabsecurity@proton.me \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.bommarito@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®