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>] [day] [month] [year] [list]
Date:	Sat, 12 Dec 2015 18:41:28 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Raghu Vatsavayi <rvatsavayi@...iumnetworks.com>
Cc:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: [cavium] weirdness in cnnic_alloc_aligned_dma()

IMO
                ptr =
                    (void *)__get_free_pages(GFP_KERNEL,
                                             get_order(size));
                if ((unsigned long)ptr & 0x07) {
                        free_pages((unsigned long)ptr, get_order(size));
                        ptr = NULL;
                        /* Increment the size required if the first
                         * attempt failed.
                         */
                        if (!retries)
                                size += 7;
                }

in drivers/net/ethernet/cavium/liquidio/octeon_main.h:cnnic_alloc_aligned_dma()
takes defensive programming a bit too far - "if the page returned by
__get_free_pages() is not 64bit-aligned" is not going to trigger until
we start to support an architecture with page size lower than 8 bytes,
which is... unlikely.

Either this code takes paranoia to a truly impressive level, or something
else had been intended.  I tried to guess what that something might've
been, but it's hard to do without seeing the history prior to the
moment when it went into mainline.  The bit in the end is particularly
interesting:
        if ((unsigned long)ptr & 0x07)
                ptr = (void *)(((unsigned long)ptr + 7) & ~(7UL));
That - after having rejected such misaligned pointers.

Something's fishy in that code...
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ