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: <bf7dfadfc8a94e3f810a8ba238f77543@AcuMS.aculab.com>
Date:   Sat, 25 Nov 2023 15:37:39 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Clément Léger' <cleger@...osinc.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Christoph Hellwig <hch@...radead.org>,
        Ben Dooks <ben.dooks@...ethink.co.uk>,
        kernel test robot <lkp@...el.com>
Subject: RE: [PATCH v2] riscv: fix incorrect use of __user pointer

...
> @@ -491,7 +486,7 @@ int handle_misaligned_load(struct pt_regs *regs)
> 
>  	val.data_u64 = 0;
>  	for (i = 0; i < len; i++) {
> -		if (load_u8(regs, (void *)(addr + i), &val.data_bytes[i]))
> +		if (load_u8(regs, addr + i, &val.data_bytes[i]))
>  			return -1;
>  	}

I'd really have thought that you'd want to pull the kernel/user
check way outside the loop?
In any case, for a misaligned read why not just read (addr & ~7)[0]
and (if needed) (addr & ~7)[1] and then ahift and or together?

clang will do it for misaligned structure members with known
misalignment, but it is almost certainly also better for reads
with unknown misalignment.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ