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: <93870187-086a-4536-9c7e-992f3bd7ecf7@app.fastmail.com>
Date: Mon, 03 Feb 2025 11:49:28 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Julian Vetter" <julian@...er-limits.org>,
 "James E . J . Bottomley" <James.Bottomley@...senpartnership.com>,
 "Helge Deller" <deller@....de>
Cc: linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] parisc: Remove memcpy_fromio

On Mon, Feb 3, 2025, at 11:21, Julian Vetter wrote:
> On 1/31/25 08:28, Arnd Bergmann wrote:
>> Those functions have been unchanged since before the git
>> history and there are some comments that I don't find helpful.
>> One thing they do is to deal with unaligned memory buffers,
>> which the generic ones don't, but that could be easily added
>> using get_unaligned/put_unaligned, expecting the compiler
>> to optimize the memory side of the transfer.
>
> I'm not sure what you suggest. Do you mean adding 
> get_unaligned/put_unaligned in the generic include/asm-generic/io.h 
> functions, or just adding get_unaligned/put_unaligned to the body of the 
> parisc specific functions? Instead of all the "switch... case 0x2..." code?

I meant adding put_unaligned/get_unaligned like this:

--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -422,7 +422,8 @@ static inline void readsw(const volatile void __iomem *addr, void *buffer,
 
                do {
                        u16 x = __raw_readw(addr);
-                       *buf++ = x;
+                       put_unaligned(x, buf);
+                       buf++;
                } while (--count);
        }
 }

This has no effect on architectures that can handle unaligned
load/store on memory, and should behave the same way as the
parisc code otherwise. On powerpc and possibly others, there
needs to be a barrier (eieio() on powerpc) inside of the loop,
according to Segher's earlier comments.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ