Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

binfmt_flat: provide an asm-generic/flat.h

This file implements the flat get/put reloc helpers for architectures
that do not need to overload the relocs by simply using get_user/put_user.

Note that many nommu architectures currently use {get,put}_unaligned, which
looks a little bogus and should probably later be switched over to this
version as well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>

authored by

Christoph Hellwig and committed by
Greg Ungerer
7a8998c9 cf9a566c

+6 -28
+1
arch/arm/include/asm/Kbuild
··· 5 5 generic-y += emergency-restart.h 6 6 generic-y += exec.h 7 7 generic-y += extable.h 8 + generic-y += flat.h 8 9 generic-y += irq_regs.h 9 10 generic-y += kdebug.h 10 11 generic-y += local.h
+4 -8
arch/arm/include/asm/flat.h include/asm-generic/flat.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * arch/arm/include/asm/flat.h -- uClinux flat-format executables 4 - */ 5 - 6 - #ifndef __ARM_FLAT_H__ 7 - #define __ARM_FLAT_H__ 2 + #ifndef _ASM_GENERIC_FLAT_H 3 + #define _ASM_GENERIC_FLAT_H 8 4 9 5 #include <linux/uaccess.h> 10 6 11 7 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, 12 - u32 *addr, u32 *persistent) 8 + u32 *addr, u32 *persistent) 13 9 { 14 10 #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 15 11 return copy_from_user(addr, rp, 4) ? -EFAULT : 0; ··· 23 27 #endif 24 28 } 25 29 26 - #endif /* __ARM_FLAT_H__ */ 30 + #endif /* _ASM_GENERIC_FLAT_H */
+1 -20
arch/m68k/include/asm/flat.h
··· 6 6 #ifndef __M68KNOMMU_FLAT_H__ 7 7 #define __M68KNOMMU_FLAT_H__ 8 8 9 - #include <linux/uaccess.h> 10 - 11 - static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, 12 - u32 *addr, u32 *persistent) 13 - { 14 - #ifdef CONFIG_CPU_HAS_NO_UNALIGNED 15 - return copy_from_user(addr, rp, 4) ? -EFAULT : 0; 16 - #else 17 - return get_user(*addr, rp); 18 - #endif 19 - } 20 - 21 - static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel) 22 - { 23 - #ifdef CONFIG_CPU_HAS_NO_UNALIGNED 24 - return copy_to_user(rp, &addr, 4) ? -EFAULT : 0; 25 - #else 26 - return put_user(addr, rp); 27 - #endif 28 - } 9 + #include <asm-generic/flat.h> 29 10 30 11 #define FLAT_PLAT_INIT(regs) \ 31 12 do { \