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] [day] [month] [year] [list]
Date:	Tue, 14 Jul 2015 08:37:18 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Horacio Mijail Anton Quiles <hmijail@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	David Howells <dhowells@...hat.com>,
	Vivek Goyal <vgoyal@...hat.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Jiri Kosina <trivial@...nel.org>, Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v5] hexdump: fix for non-aligned buffers

On Tue, Jul 14, 2015 at 12:23 AM, Horacio Mijail Anton Quiles
<hmijail@...il.com> wrote:
> An hexdump with a buf not aligned to the groupsize causes
> non-naturally-aligned memory accesses. This was causing a kernel panic
> on the processor BlackFin BF527, when such an unaligned buffer was fed
> by the function ubifs_scanned_corruption in fs/ubifs/scan.c .
>
> To fix this, change accesses to the contents of the buffer so they go
> through get_unaligned(). This change should be harmless to unaligned-
> access-capable architectures, and any performance hit should be anyway
> dwarfed by the snprintf() processing time.
>
> Signed-off-by: Horacio Mijail Antón Quiles <hmijail@...il.com>

Acked-by: Geert Uytterhoeven <geert@...ux-m68k.org>

> --- a/lib/hexdump.c
> +++ b/lib/hexdump.c
> @@ -11,6 +11,7 @@

> @@ -139,7 +140,8 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
>                 for (j = 0; j < ngroups; j++) {
>                         ret = snprintf(linebuf + lx, linebuflen - lx,
>                                        "%s%16.16llx", j ? " " : "",
> -                                      (unsigned long long)*(ptr8 + j));
> +                                      (unsigned long long)
> +                                              get_unaligned(ptr8 + j));

I think the cast to "unsigned long long" dates back to the days u64 was
"unsigned long" on some 64-bit architectures.

As u64 is now "unsigned long long", it can be removed. Would you mind sending
a follow-up patch to just do that?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
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