All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink
@ 2019-08-01 17:55 Jason Wessel
  2019-08-01 18:03 ` Seebs
  2019-08-01 19:55 ` Jason Wessel
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Wessel @ 2019-08-01 17:55 UTC (permalink / raw)
  To: openembedded-core

While working with ostree disk generation in conjunction with wic, I
found a problem with pseudo where it tried to resolve a symlink when
it shouldn't, based on openat() flags.  I narrowed down the problem to
a simple c program to reproduce the issue:

int main()
{
    /* Tested with: gcc -Wall -o app app.c ; echo "no pseudo" ; ./app ; echo "pseudo"; pseudo ./app */
    system("rm -rf tdir tlink");
    system("mkdir tdir");
    system("ln -s tdir tlink");
    DIR *dir = opendir(".");
    int dfd = dirfd(dir);

    int target_dfd = openat (dfd, "tlink", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
    if (target_dfd == -1) {
        printf("This is right\n");
    } else {
        printf("This is broken\n");
    }
    return 0;
}

Many thanks to Peter Seebach for fixing the problem in the pseudo code
to use the same logic which was already there for the
AT_SYMLINK_NOFOLLOW.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/recipes-devtools/pseudo/pseudo_git.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 51db84c4d4..3350c3fabd 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -8,7 +8,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo \
            file://toomanyfiles.patch \
            "
 
-SRCREV = "3fa7c853e0bcd6fe23f7524c2a3c9e3af90901c3"
+SRCREV = "097ca3e245200c4a4333964af59a106c42ff3bca"
 S = "${WORKDIR}/git"
 PV = "1.9.0+git${SRCPV}"
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink
  2019-08-01 17:55 [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink Jason Wessel
@ 2019-08-01 18:03 ` Seebs
  2019-08-01 19:55 ` Jason Wessel
  1 sibling, 0 replies; 3+ messages in thread
From: Seebs @ 2019-08-01 18:03 UTC (permalink / raw)
  To: openembedded-core

On Thu, 1 Aug 2019 10:55:45 -0700
Jason Wessel <jason.wessel@windriver.com> wrote:

> Many thanks to Peter Seebach for fixing the problem in the pseudo code
> to use the same logic which was already there for the
> AT_SYMLINK_NOFOLLOW.

Special credit goes to Past Seebs, who thoughtfully made the parser
for wrapfuncs flexible enough that `flags=flags|O_NOFOLLOW` would work.

-s


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink
  2019-08-01 17:55 [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink Jason Wessel
  2019-08-01 18:03 ` Seebs
@ 2019-08-01 19:55 ` Jason Wessel
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wessel @ 2019-08-01 19:55 UTC (permalink / raw)
  To: openembedded-core

Looks like the checksum license changed between the prior commit and now.  So I'll send a v2, because we don't want to break the master branch of oe-core.

Cheers,
Jason.

On 8/1/19 12:55 PM, Jason Wessel wrote:
> While working with ostree disk generation in conjunction with wic, I
> found a problem with pseudo where it tried to resolve a symlink when
> it shouldn't, based on openat() flags.  I narrowed down the problem to
> a simple c program to reproduce the issue:
>
> int main()
> {
>      /* Tested with: gcc -Wall -o app app.c ; echo "no pseudo" ; ./app ; echo "pseudo"; pseudo ./app */
>      system("rm -rf tdir tlink");
>      system("mkdir tdir");
>      system("ln -s tdir tlink");
>      DIR *dir = opendir(".");
>      int dfd = dirfd(dir);
>
>      int target_dfd = openat (dfd, "tlink", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
>      if (target_dfd == -1) {
>          printf("This is right\n");
>      } else {
>          printf("This is broken\n");
>      }
>      return 0;
> }
>
> Many thanks to Peter Seebach for fixing the problem in the pseudo code
> to use the same logic which was already there for the
> AT_SYMLINK_NOFOLLOW.
>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
>   meta/recipes-devtools/pseudo/pseudo_git.bb | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> index 51db84c4d4..3350c3fabd 100644
> --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> @@ -8,7 +8,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo \
>              file://toomanyfiles.patch \
>              "
>   
> -SRCREV = "3fa7c853e0bcd6fe23f7524c2a3c9e3af90901c3"
> +SRCREV = "097ca3e245200c4a4333964af59a106c42ff3bca"
>   S = "${WORKDIR}/git"
>   PV = "1.9.0+git${SRCPV}"
>   




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-01 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-01 17:55 [PATCH] pseudo: Upgrade to latest to fix openat() with a directory symlink Jason Wessel
2019-08-01 18:03 ` Seebs
2019-08-01 19:55 ` Jason Wessel

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.