All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: Ross Burton <ross@burtonini.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH][pseudo] client: strip trailing slashes when opening an ignored path
Date: Fri, 09 Apr 2021 14:29:13 +0100	[thread overview]
Message-ID: <14155d492f56b0a462173ac631bef7944b14194b.camel@linuxfoundation.org> (raw)
In-Reply-To: <20210408162509.4016524-1-ross.burton@arm.com>

On Thu, 2021-04-08 at 17:25 +0100, Ross Burton wrote:
> The pseudo client path map stores paths that have been sanitised, but
> in the ignored-path (PSEUDO_IGNORE_PATHS) codepath for open() calls this
> sanitising wasn't performed so it is possible for paths that end with a
> trailing slash to be entered.
> 
> This then subsequently interacts badly with path manipulation, resulting
> in the situation where doing:
> 
>   fd = open("/some/path/")
>   parent_fd = openat(fd, "../)
> 
> results in parent_fd actually pointing at /some/path still.
> 
> Solve this by ensuring that any trailing slashes are removed from the
> path when adding to the map in the ignore short-circuit.
> 
> Also add a test case for this to ensure that it doesn't regress in the
> future.
> 
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
>  Makefile.in         |  1 +
>  pseudo_client.c     | 11 ++++++++-
>  test/test-openat.c  | 55 +++++++++++++++++++++++++++++++++++++++++++++
>  test/test-openat.sh |  7 ++++++
>  4 files changed, 73 insertions(+), 1 deletion(-)
>  create mode 100644 test/test-openat.c
>  create mode 100755 test/test-openat.sh

Merged to the oe-core branch, thanks. Bonus kudos for a new test! :)

Cheers,

Richard


      reply	other threads:[~2021-04-09 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 16:25 [PATCH][pseudo] client: strip trailing slashes when opening an ignored path Ross Burton
2021-04-09 13:29 ` Richard Purdie [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=14155d492f56b0a462173ac631bef7944b14194b.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross@burtonini.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 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.