All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-api@vger.kernel.org, qemu-devel@nongnu.org,
	Peter Maydell <peter.maydell@linaro.org>,
	Andy Lutomirski <luto@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] ext4: Give 32bit personalities 32bit hashes
Date: Tue, 17 Mar 2020 12:52:04 +0100	[thread overview]
Message-ID: <87lfnzdwrf.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20200317113153.7945-1-linus.walleij@linaro.org> (Linus Walleij's message of "Tue, 17 Mar 2020 12:31:53 +0100")

* Linus Walleij:

> It was brought to my attention that this bug from 2018 was
> still unresolved: 32 bit emulators like QEMU were given
> 64 bit hashes when running 32 bit emulation on 64 bit systems.
>
> The personality(2) system call supports to let processes
> indicate that they are 32 bit Linux to the kernel. This
> was suggested by Teo in the original thread, so I just wired
> it up and it solves the problem.
>
> Programs that need the 32 bit hash only need to issue the
> personality(PER_LINUX32) call and things start working.
>
> I made a test program like this:
>
>   #include <dirent.h>
>   #include <errno.h>
>   #include <stdio.h>
>   #include <string.h>
>   #include <sys/types.h>
>   #include <sys/personality.h>
>
>   int main(int argc, char** argv) {
>     DIR* dir;
>     personality(PER_LINUX32);
>     dir = opendir("/boot");
>     printf("dir=%p\n", dir);
>     printf("readdir(dir)=%p\n", readdir(dir));
>     printf("errno=%d: %s\n", errno, strerror(errno));
>     return 0;
>   }
>
> This was compiled with an ARM32 toolchain from Bootlin using
> glibc 2.28 and thus suffering from the bug.

Just be sure: Is it possible to move the PER_LINUX32 setting into QEMU?
(I see why not.)

However, this does not solve the issue with network file systems and
other scenarios.  I still think need to add a workaround to the glibc
implementation.

WARNING: multiple messages have this Message-ID (diff)
From: Florian Weimer <fw@deneb.enyo.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Theodore Ts'o <tytso@mit.edu>,
	linux-api@vger.kernel.org, qemu-devel@nongnu.org,
	stable@vger.kernel.org, Andreas Dilger <adilger.kernel@dilger.ca>,
	Andy Lutomirski <luto@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Give 32bit personalities 32bit hashes
Date: Tue, 17 Mar 2020 12:52:04 +0100	[thread overview]
Message-ID: <87lfnzdwrf.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20200317113153.7945-1-linus.walleij@linaro.org> (Linus Walleij's message of "Tue, 17 Mar 2020 12:31:53 +0100")

* Linus Walleij:

> It was brought to my attention that this bug from 2018 was
> still unresolved: 32 bit emulators like QEMU were given
> 64 bit hashes when running 32 bit emulation on 64 bit systems.
>
> The personality(2) system call supports to let processes
> indicate that they are 32 bit Linux to the kernel. This
> was suggested by Teo in the original thread, so I just wired
> it up and it solves the problem.
>
> Programs that need the 32 bit hash only need to issue the
> personality(PER_LINUX32) call and things start working.
>
> I made a test program like this:
>
>   #include <dirent.h>
>   #include <errno.h>
>   #include <stdio.h>
>   #include <string.h>
>   #include <sys/types.h>
>   #include <sys/personality.h>
>
>   int main(int argc, char** argv) {
>     DIR* dir;
>     personality(PER_LINUX32);
>     dir = opendir("/boot");
>     printf("dir=%p\n", dir);
>     printf("readdir(dir)=%p\n", readdir(dir));
>     printf("errno=%d: %s\n", errno, strerror(errno));
>     return 0;
>   }
>
> This was compiled with an ARM32 toolchain from Bootlin using
> glibc 2.28 and thus suffering from the bug.

Just be sure: Is it possible to move the PER_LINUX32 setting into QEMU?
(I see why not.)

However, this does not solve the issue with network file systems and
other scenarios.  I still think need to add a workaround to the glibc
implementation.


  reply	other threads:[~2020-03-17 11:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 11:31 [PATCH] ext4: Give 32bit personalities 32bit hashes Linus Walleij
2020-03-17 11:31 ` Linus Walleij
2020-03-17 11:52 ` Florian Weimer [this message]
2020-03-17 11:52   ` Florian Weimer
2020-03-17 12:38   ` Linus Walleij
2020-03-17 12:38     ` Linus Walleij
2020-03-17 11:58 ` Peter Maydell
2020-03-17 11:58   ` Peter Maydell
2020-03-19 15:13   ` Linus Walleij
2020-03-19 15:13     ` Linus Walleij
2020-03-19 15:25     ` Peter Maydell
2020-03-19 15:25       ` Peter Maydell
2020-03-19 22:23       ` Linus Walleij
2020-03-19 22:23         ` Linus Walleij
2020-03-24  2:34         ` Theodore Y. Ts'o
2020-03-24  2:34           ` Theodore Y. Ts'o
2020-03-24  9:29           ` Peter Maydell
2020-03-24  9:29             ` Peter Maydell
2020-03-24 18:47             ` Theodore Y. Ts'o
2020-03-24 18:47               ` Theodore Y. Ts'o
2020-03-24 21:17               ` Linus Walleij
2020-03-24 21:17                 ` Linus Walleij
2020-03-17 22:28 ` Andreas Dilger
2020-03-17 22:28   ` Andreas Dilger
2020-03-19 15:18   ` Linus Walleij
2020-03-19 15:18     ` Linus Walleij
2020-03-17 22:30 ` Sasha Levin

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=87lfnzdwrf.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.