All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] Unify asm/unaligned.h around struct helper
@ 2021-05-14 10:00 ` Arnd Bergmann
  0 siblings, 0 replies; 98+ messages in thread
From: Arnd Bergmann @ 2021-05-14 10:00 UTC (permalink / raw)
  To: linux-arch
  Cc: Linus Torvalds, Vineet Gupta, Arnd Bergmann, Amitkumar Karwar,
	Benjamin Herrenschmidt, Borislav Petkov, Eric Dumazet,
	Florian Fainelli, Ganapathi Bhat, Geert Uytterhoeven,
	H. Peter Anvin, Ingo Molnar, Jakub Kicinski, James Morris,
	Jens Axboe, John Johansen, Jonas Bonn, Kalle Valo,
	Michael Ellerman, Paul Mackerras, Rich Felker,
	Richard Russon (FlatCap),
	Russell King, Serge E. Hallyn, Sharvari Harisangam,
	Stafford Horne, Stefan Kristiansson, Thomas Gleixner,
	Vladimir Oltean, Xinming Hu, Yoshinori Sato, x86, linux-kernel,
	linux-arm-kernel, linux-m68k, linux-crypto, openrisc,
	linuxppc-dev, linux-sh, sparclinux, linux-ntfs-dev, linux-block,
	linux-wireless, netdev, linux-security-module

From: Arnd Bergmann <arnd@arndb.de>

The get_unaligned()/put_unaligned() helpers are traditionally architecture
specific, with the two main variants being the "access-ok.h" version
that assumes unaligned pointer accesses always work on a particular
architecture, and the "le-struct.h" version that casts the data to a
byte aligned type before dereferencing, for architectures that cannot
always do unaligned accesses in hardware.

Based on the discussion linked below, it appears that the access-ok
version is not realiable on any architecture, but the struct version
probably has no downsides. This series changes the code to use the
same implementation on all architectures, addressing the few exceptions
separately.

I've included this version in the asm-generic tree for 5.14 already,
addressing the few issues that were pointed out in the RFC. If there
are any remaining problems, I hope those can be addressed as follow-up
patches.

        Arnd

Link: https://lore.kernel.org/lkml/75d07691-1e4f-741f-9852-38c0b4f520bc@synopsys.com/
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100363
Link: https://lore.kernel.org/lkml/20210507220813.365382-14-arnd@kernel.org/
Link: git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git unaligned-rework-v2


Arnd Bergmann (13):
  asm-generic: use asm-generic/unaligned.h for most architectures
  openrisc: always use unaligned-struct header
  sh: remove unaligned access for sh4a
  m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  powerpc: use linux/unaligned/le_struct.h on LE power7
  asm-generic: unaligned: remove byteshift helpers
  asm-generic: unaligned always use struct helpers
  partitions: msdos: fix one-byte get_unaligned()
  apparmor: use get_unaligned() only for multi-byte words
  mwifiex: re-fix for unaligned accesses
  netpoll: avoid put_unaligned() on single character
  asm-generic: uaccess: 1-byte access is always aligned
  asm-generic: simplify asm/unaligned.h

 arch/alpha/include/asm/unaligned.h          |  12 --
 arch/arm/include/asm/unaligned.h            |  27 ---
 arch/ia64/include/asm/unaligned.h           |  12 --
 arch/m68k/Kconfig                           |   1 +
 arch/m68k/include/asm/unaligned.h           |  26 ---
 arch/microblaze/include/asm/unaligned.h     |  27 ---
 arch/mips/crypto/crc32-mips.c               |   2 +-
 arch/openrisc/include/asm/unaligned.h       |  47 -----
 arch/parisc/include/asm/unaligned.h         |   6 +-
 arch/powerpc/include/asm/unaligned.h        |  22 ---
 arch/sh/include/asm/unaligned-sh4a.h        | 199 --------------------
 arch/sh/include/asm/unaligned.h             |  13 --
 arch/sparc/include/asm/unaligned.h          |  11 --
 arch/x86/include/asm/unaligned.h            |  15 --
 arch/xtensa/include/asm/unaligned.h         |  29 ---
 block/partitions/ldm.h                      |   2 +-
 block/partitions/msdos.c                    |   2 +-
 drivers/net/wireless/marvell/mwifiex/pcie.c |  10 +-
 include/asm-generic/uaccess.h               |   4 +-
 include/asm-generic/unaligned.h             | 141 +++++++++++---
 include/linux/unaligned/access_ok.h         |  68 -------
 include/linux/unaligned/be_byteshift.h      |  71 -------
 include/linux/unaligned/be_memmove.h        |  37 ----
 include/linux/unaligned/be_struct.h         |  37 ----
 include/linux/unaligned/generic.h           | 115 -----------
 include/linux/unaligned/le_byteshift.h      |  71 -------
 include/linux/unaligned/le_memmove.h        |  37 ----
 include/linux/unaligned/le_struct.h         |  37 ----
 include/linux/unaligned/memmove.h           |  46 -----
 net/core/netpoll.c                          |   4 +-
 security/apparmor/policy_unpack.c           |   2 +-
 31 files changed, 131 insertions(+), 1002 deletions(-)
 delete mode 100644 arch/alpha/include/asm/unaligned.h
 delete mode 100644 arch/arm/include/asm/unaligned.h
 delete mode 100644 arch/ia64/include/asm/unaligned.h
 delete mode 100644 arch/m68k/include/asm/unaligned.h
 delete mode 100644 arch/microblaze/include/asm/unaligned.h
 delete mode 100644 arch/openrisc/include/asm/unaligned.h
 delete mode 100644 arch/powerpc/include/asm/unaligned.h
 delete mode 100644 arch/sh/include/asm/unaligned-sh4a.h
 delete mode 100644 arch/sh/include/asm/unaligned.h
 delete mode 100644 arch/sparc/include/asm/unaligned.h
 delete mode 100644 arch/x86/include/asm/unaligned.h
 delete mode 100644 arch/xtensa/include/asm/unaligned.h
 delete mode 100644 include/linux/unaligned/access_ok.h
 delete mode 100644 include/linux/unaligned/be_byteshift.h
 delete mode 100644 include/linux/unaligned/be_memmove.h
 delete mode 100644 include/linux/unaligned/be_struct.h
 delete mode 100644 include/linux/unaligned/generic.h
 delete mode 100644 include/linux/unaligned/le_byteshift.h
 delete mode 100644 include/linux/unaligned/le_memmove.h
 delete mode 100644 include/linux/unaligned/le_struct.h
 delete mode 100644 include/linux/unaligned/memmove.h

-- 
2.29.2

Cc: Amitkumar Karwar <amitkarwar@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ganapathi Bhat <ganapathi017@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: James Morris <jmorris@namei.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rich Felker <dalias@libc.org>
Cc: "Richard Russon (FlatCap)" <ldm@flatcap.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Sharvari Harisangam <sharvari.harisangam@nxp.com>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Xinming Hu <huxinming820@gmail.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-crypto@vger.kernel.org
Cc: openrisc@lists.librecores.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-ntfs-dev@lists.sourceforge.net
Cc: linux-block@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-security-module@vger.kernel.org



^ permalink raw reply	[flat|nested] 98+ messages in thread

end of thread, other threads:[~2021-12-17 13:54 UTC | newest]

Thread overview: 98+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 10:00 [PATCH v2 00/13] Unify asm/unaligned.h around struct helper Arnd Bergmann
2021-05-14 10:00 ` [OpenRISC] " Arnd Bergmann
2021-05-14 10:00 ` Arnd Bergmann
2021-05-14 10:00 ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 01/13] asm-generic: use asm-generic/unaligned.h for most architectures Arnd Bergmann
2021-05-14 10:00   ` Arnd Bergmann
2021-05-14 10:00   ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 02/13] openrisc: always use unaligned-struct header Arnd Bergmann
2021-05-14 10:00   ` [OpenRISC] " Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 03/13] sh: remove unaligned access for sh4a Arnd Bergmann
2021-05-14 10:34   ` John Paul Adrian Glaubitz
2021-05-14 12:22     ` Arnd Bergmann
2021-05-15 15:36       ` John Paul Adrian Glaubitz
2021-05-15 20:10         ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 04/13] m68k: select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 05/13] powerpc: use linux/unaligned/le_struct.h on LE power7 Arnd Bergmann
2021-05-14 10:00   ` Arnd Bergmann
2021-05-14 11:48   ` Segher Boessenkool
2021-05-14 11:48     ` Segher Boessenkool
2021-05-14 13:02     ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 06/13] asm-generic: unaligned: remove byteshift helpers Arnd Bergmann
2021-05-14 10:00   ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 07/13] asm-generic: unaligned always use struct helpers Arnd Bergmann
2021-05-14 10:00   ` Arnd Bergmann
2021-05-17 21:53   ` Eric Biggers
2021-05-17 21:53     ` Eric Biggers
2021-05-18  7:25     ` Arnd Bergmann
2021-05-18  7:25       ` Arnd Bergmann
2021-05-18 14:56       ` Linus Torvalds
2021-05-18 14:56         ` Linus Torvalds
2021-05-18 15:41         ` Arnd Bergmann
2021-05-18 15:41           ` Arnd Bergmann
2021-05-18 16:12           ` Linus Torvalds
2021-05-18 16:12             ` Linus Torvalds
2021-05-18 18:09             ` Jason A. Donenfeld
2021-05-18 18:09               ` Jason A. Donenfeld
2021-05-18 20:51             ` Arnd Bergmann
2021-05-18 20:51               ` Arnd Bergmann
2021-05-18 21:31               ` Eric Biggers
2021-05-18 21:31                 ` Eric Biggers
2021-05-18 21:14         ` David Laight
2021-05-18 21:14           ` David Laight
2021-05-14 10:00 ` [PATCH v2 08/13] partitions: msdos: fix one-byte get_unaligned() Arnd Bergmann
2021-05-17 10:28   ` Christoph Hellwig
2021-05-17 10:44     ` Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 09/13] apparmor: use get_unaligned() only for multi-byte words Arnd Bergmann
2021-05-14 10:00 ` [PATCH v2 10/13] mwifiex: re-fix for unaligned accesses Arnd Bergmann
2021-05-15  6:22   ` Kalle Valo
2021-05-15  9:01     ` Arnd Bergmann
2021-05-15 18:23       ` Kalle Valo
2021-05-14 10:00 ` [PATCH v2 11/13] netpoll: avoid put_unaligned() on single character Arnd Bergmann
2021-05-14 10:01 ` [PATCH v2 12/13] asm-generic: uaccess: 1-byte access is always aligned Arnd Bergmann
2021-05-15 18:41   ` Randy Dunlap
2021-05-15 20:16     ` Arnd Bergmann
2021-05-14 10:01 ` [PATCH v2 13/13] asm-generic: simplify asm/unaligned.h Arnd Bergmann
2021-05-14 10:35   ` David Laight
2021-05-14 17:32 ` [PATCH v2 00/13] Unify asm/unaligned.h around struct helper Linus Torvalds
2021-05-14 17:32   ` [OpenRISC] " Linus Torvalds
2021-05-14 17:32   ` Linus Torvalds
2021-05-14 17:32   ` Linus Torvalds
2021-05-14 18:51   ` Vineet Gupta
2021-05-14 18:51     ` [OpenRISC] " Vineet Gupta
2021-05-14 18:51     ` Vineet Gupta
2021-05-14 18:51     ` Vineet Gupta
2021-05-14 19:22     ` Linus Torvalds
2021-05-14 19:22       ` [OpenRISC] " Linus Torvalds
2021-05-14 19:22       ` Linus Torvalds
2021-05-14 19:22       ` Linus Torvalds
2021-05-14 19:45       ` Vineet Gupta
2021-05-14 19:45         ` [OpenRISC] " Vineet Gupta
2021-05-14 19:45         ` Vineet Gupta
2021-05-14 19:45         ` Vineet Gupta
2021-05-14 20:19         ` Linus Torvalds
2021-05-14 20:19           ` [OpenRISC] " Linus Torvalds
2021-05-14 20:19           ` Linus Torvalds
2021-05-14 20:19           ` Linus Torvalds
2021-05-14 19:31   ` Arnd Bergmann
2021-05-14 19:31     ` [OpenRISC] " Arnd Bergmann
2021-05-14 19:31     ` Arnd Bergmann
2021-05-14 19:31     ` Arnd Bergmann
2021-12-16 17:29 ` Ard Biesheuvel
2021-12-16 17:29   ` [OpenRISC] " Ard Biesheuvel
2021-12-16 17:29   ` Ard Biesheuvel
2021-12-16 17:42   ` Linus Torvalds
2021-12-16 17:42     ` [OpenRISC] " Linus Torvalds
2021-12-16 17:42     ` Linus Torvalds
2021-12-16 17:49   ` David Laight
2021-12-16 17:49     ` [OpenRISC] " David Laight
2021-12-16 17:49     ` David Laight
2021-12-16 18:56   ` Segher Boessenkool
2021-12-16 18:56     ` [OpenRISC] " Segher Boessenkool
2021-12-16 18:56     ` Segher Boessenkool
2021-12-17 12:34     ` David Laight
2021-12-17 12:34       ` [OpenRISC] " David Laight
2021-12-17 12:34       ` David Laight
2021-12-17 13:35       ` Segher Boessenkool
2021-12-17 13:35         ` [OpenRISC] " Segher Boessenkool
2021-12-17 13:35         ` Segher Boessenkool

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.