Re: sparc32: Init process fails to load with generic kmap atomic

From: Thomas Gleixner
Date: Tue Dec 22 2020 - 18:53:28 EST


On Tue, Dec 22 2020 at 18:58, Andreas Larsson wrote:
> From as far as I have gotten into hunting down the problem, I get a
> failure from load_elf_binary here:
>
> /* First of all, some simple consistency checks */
> if (memcmp(elf_ex->e_ident, ELFMAG, SELFMAG) != 0)
> goto out;
>
> at least seemingly due to the kaddr from copy_page_to_iter in
> lib/iov_iter.c
>
> if (i->type & (ITER_BVEC|ITER_KVEC)) {
> void *kaddr = kmap_atomic(page);
> size_t wanted = copy_to_iter(kaddr + offset, bytes, i);
>
> where kaddr points to memory with all zeroes (from an earlier bzero) in
> this context:

The kaddr might be misleading you here. If the code flow is:

kaddr1 = kmap_atomic(page1);
...
kunmap_atomic(kaddr1);

kaddr2 = kmap_atomic(page2);

Then kaddr1 == kaddr2, but first it maps page1 and then page2, but that
was the same in the original code.

> I will have to continue to dig deeper into this in January. If anyone
> has any ideas how this could stem from this kmap patch, I am all ears.

I can't spot it either. I'll send you a debug patch after the holidays.

Thanks,

tglx