# Re: \[PATCH\] ext4: Give 32bit personalities 32bit hashes

- List: linux-api
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-api/2020/03/175459/t

## Re: \[PATCH\] ext4: Give 32bit personalities 32bit hashes

- From: Florian Weimer \<hidden\>
- Date: 2020-03-17 11:53:38 
- Message: https://ratatoskr.run/linux-api/2020/03/175459.md

```text
* 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.
```

## Re: \[PATCH\] ext4: Give 32bit personalities 32bit hashes

- From: Linus Walleij \<hidden\>
- Date: 2020-03-17 12:38:27 
- Message: https://ratatoskr.run/linux-api/2020/03/175461.md

```text
On Tue, Mar 17, 2020 at 12:53 PM Florian Weimer [ref] wrote:

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

I set it in the program explicitly, but what actually happens when
I run it is that the binfmt handler invokes qemu-user so certainly
that program can set the flag, any process can.

Yours,
Linus Walleij
```
