Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a39bc2337c321df9015ef31bc03a868a@ispras.ru>
Date: Tue, 24 Nov 2020 12:21:36 +0300
From: Alexey Izbyshev <izbyshev@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: realpath without procfs -- should be ready for inclusion

On 2020-11-24 09:30, Rich Felker wrote:
> I think before this goes upstream we should have a good set of
> testcases that can be contributed to libc-test. Do you have ideas for
> coverage? Some that come to mind:
> 
Added some more ideas.

> - Absolute argument starting with /, //, and ///
- Absolute argument equal to one of /, //, and ///
> - Absolute symlink target starting with /, //, and ///
- Absolute symlink target equal to one of /, //, and ///, with the link 
separated from the following component with /, //
> - Final / after symlink-to-dir, dir, symlink-to-nondir, nondir
- Intermediate / after symlink-to-nondir, nondir
> - Final / in link contents after [the above]
- Multiple / after ., .., normal component
> - Initial .. in argument, cwd root or non-root
> - Initial .. in symlink target, symlink in root or non-root
> - Initial ...
> - .. following symlink-to-dir, dir, symlink-to-nondir, nondir
- . following symlink-to-dir, dir, symlink-to-nondir, nondir
> - More .. than path depth
> - Null argument
> - Empty string argument
- Argument consisting of a single ., ..
> - Empty string link contents (testable only with seccomp hack)
> - Argument valid abs path exact length PATH_MAX-1
> - Argument valid rel path exact length PATH_MAX-1 to short abs path
- Argument with PATH_MAX length (ENAMETOOLONG)
- A relative symlink in the argument such that the length of the result 
is PATH_MAX-1 (valid path), PATH_MAX (ENAMETOOLONG)
- An absolute symlink in the argument similar to the above
- A relative argument with the current directory similar to the above
- An argument consisting of a single (relative, absolute) symlink with 
the target having length PATH_MAX-1
- An argument ending with a relative symlink with the target having 
length PATH_MAX-1 (ENAMETOOLONG)
- An argument ending with an absolute symlink with the target having 
length PATH_MAX-1 (valid path)

Hm, the last one doesn't work now. Since p is the position of NUL 
instead of the size of stack, "if (k==p) goto toolong;" forbids symlinks 
with the length of the target == PATH_MAX-1.
> 
> Some of these require namespace gymnastics to set up without running
> the tests as root.
> 
Alexey

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.