public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 3/3] Provide a PATH_MAX-long buffer when expecting ENAMETOOLONG
Date: Mon, 23 Oct 2023 17:06:18 +0200	[thread overview]
Message-ID: <ZTaL6rLETxHwvFDr@yuki> (raw)
In-Reply-To: <87291cdf-0245-c825-d3a3-235e4a4d1f9d@arm.com>

Hi!
> >> A number of tests check that syscalls manipulating paths return
> >> -ENAMETOOLONG when the specified path is longer than allowed. There
> >> are actually two ways this error can be triggered:
> >>
> >> 1. If the given string is longer than PATH_MAX, i.e. 4096 as far as
> >>    the kernel is concerned, then the getname() helper will fail and
> >>    the kernel will return -ENAMETOOLONG right away.
> >>
> >> 2. If the string fits in PATH_MAX, but the filesystem rejects the
> >>    path name, for instance because one of its components is longer
> >>    than the support file name length (e.g. 255 for ext4).
> > Ideally we should have at least one test that would hit the 1. as well...
> 
> This is what patch 3 is meant to achieve: instead of hitting 2. we now
> systematically hit 1.

Sigh, I meant 2. I guess that we would have to loop over filesystems
(easily done with .all_filesystems = 1) and pass very long filename. Or
do we have such test already?

Looking at our tests, the rename10.c is actually one of two tests that
sets .all_fileystems and checks for ENAMETOOLONG. Looking at the
filesystem limits, all seems to have limits that are <= 255 characters,
the only problem is a definition of character. For utf8 character 255
characters are around 1021 (including nul terminator). So I suppose that
if we pass another buffer that is PATH_MAX in length and has PATH_MAX-1
characters we should consistenly hit 2. Or do I miss something?

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2023-10-23 15:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 13:56 [LTP] [PATCH 0/3] Various fixes for out-of-bound uaccess Kevin Brodsky
2023-10-23 13:56 ` [LTP] [PATCH 1/3] syscalls/{, f}setxattr: Fix passing of value pointer Kevin Brodsky
2023-10-23 13:56 ` [LTP] [PATCH 2/3] syscalls/msgctl06: Pass an appropriate struct to msgsnd() Kevin Brodsky
2023-10-23 13:56 ` [LTP] [PATCH 3/3] Provide a PATH_MAX-long buffer when expecting ENAMETOOLONG Kevin Brodsky
2023-10-23 14:40   ` Cyril Hrubis
2023-10-23 14:50     ` Kevin Brodsky
2023-10-23 15:06       ` Cyril Hrubis [this message]
2023-10-24  9:07         ` Kevin Brodsky
2023-10-24  9:36           ` Cyril Hrubis
2023-10-24 10:36             ` Kevin Brodsky
2023-10-23 14:39 ` [LTP] [PATCH 0/3] Various fixes for out-of-bound uaccess Cyril Hrubis

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=ZTaL6rLETxHwvFDr@yuki \
    --to=chrubis@suse.cz \
    --cc=kevin.brodsky@arm.com \
    --cc=ltp@lists.linux.it \
    /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