lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiwOC+AJoOBYUotSsOfch80D-5k3Uioox2znozeAYnQYQ@mail.gmail.com>
Date: Wed, 27 Mar 2024 13:26:42 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Greg KH <gregkh@...uxfoundation.org>, Chris Leech <cleech@...hat.com>, 
	Nilesh Javali <njavali@...vell.com>, Christoph Hellwig <hch@....de>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] Char/Misc driver changes for 6.9-rc1

On Wed, 27 Mar 2024 at 09:56, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> I also *suspect* that using 'physaddr_t' is in itself pointless,
> because I *think* the physical addresses are always page-aligned
> anyway, and it would be better if the uio_mem thing just contained the
> pfn instead. Which could just be 'unsigned long pfn'.

Oddly, the uio code seems to be written to allow unaligned page buffers,

        actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK)
                        + idev->info->mem[mi].size + PAGE_SIZE -1) >>
PAGE_SHIFT;

but none of the mmap routines than actually allow such a mapping, and
they all have alignment checks.

Which sounds wonderful, until you find code like this duplicated in
various uio drivers:

                uiomem->memtype = UIO_MEM_PHYS;
                uiomem->addr = r->start & PAGE_MASK;
                uiomem->offs = r->start & ~PAGE_MASK;
                uiomem->size = (uiomem->offs + resource_size(r)
                                + PAGE_SIZE - 1) & PAGE_MASK;

IOW, it explicitly aligns the resources to pages, so now mmap works
again. Oh the horror.

But yes, that physical part of 'addr' should be a pfn. Sadly, all of
this code is such a mess that it's a horrible job to try to fix it all
up.

So we may be stuck with the horrendous confusion that is the current
uio_mem thing.

                 Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ