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: <20090807094404.GA10603@flint.arm.linux.org.uk>
Date:	Fri, 7 Aug 2009 10:44:04 +0100
From:	Russell King <rmk+lkml@....linux.org.uk>
To:	Adrian Hunter <adrian.hunter@...ia.com>
Cc:	JiSheng Zhang <jszhang3@...il.com>,
	"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"dwmw2@...radead.org" <dwmw2@...radead.org>,
	"Bityutskiy Artem (Nokia-D/Helsinki)" <Artem.Bityutskiy@...ia.com>
Subject: Re: [UBI UBIFS] replace vmalloc with kmalloc

On Fri, Aug 07, 2009 at 12:20:03PM +0300, Adrian Hunter wrote:
> vmalloc allows large (> 128KiB) buffers, but kmalloc doesn't.
> So we presently have no choice but to use vmalloc.
>
> I do not know what hardware you have or exactly what driver you
> are using, but we have UBIFS on OneNAND using DMA.
> See drivers/mtd/onenand/omap2.c

Hmm.  Looking at that code, it's unsafe:

        if (buf >= high_memory) {
                struct page *p1;

                if (((size_t)buf & PAGE_MASK) !=
                    ((size_t)(buf + count - 1) & PAGE_MASK))
                        goto out_copy;
                p1 = vmalloc_to_page(buf);
                if (!p1)
                        goto out_copy;
                buf = page_address(p1) + ((size_t)buf & ~PAGE_MASK);
        }
...
        dma_dst = dma_map_single(&c->pdev->dev, buf, count, DMA_FROM_DEVICE);

If you consider a VIVT cache, and with vmalloc'd pages you're passing
a *different* virtual address to the DMA functions, it's not going to
touch the cachelines associated with the vmalloc mapping.

The above *may* work for VIPT caches provided both the vmalloc and
kernel direct mappings are of the same colour.  If not, this really
isn't going to be reliable for the same reason.

Basically, what's going in there is *totally* unsafe.  I hope you
don't place important data on this NAND device.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ