Merge tag 'asm-generic-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Sep 2021 22:13:02 +0000 (15:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Sep 2021 22:13:02 +0000 (15:13 -0700)
Pull asm-generic updates from Arnd Bergmann:
 "The main content for 5.15 is a series that cleans up the handling of
  strncpy_from_user() and strnlen_user(), removing a lot of slightly
  incorrect versions of these in favor of the lib/strn*.c helpers that
  implement these correctly and more efficiently.

  The only architectures that retain a private version now are mips,
  ia64, um and parisc. I had offered to convert those at all, but Thomas
  Bogendoerfer wanted to keep the mips version for the moment until he
  had a chance to do regression testing.

  The branch also contains two patches for bitops and for ffs()"

* tag 'asm-generic-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  bitops/non-atomic: make @nr unsigned to avoid any DIV
  asm-generic: ffs: Drop bogus reference to ffz location
  asm-generic: reverse GENERIC_{STRNCPY_FROM,STRNLEN}_USER symbols
  asm-generic: remove extra strn{cpy_from,len}_user declarations
  asm-generic: uaccess: remove inline strncpy_from_user/strnlen_user
  s390: use generic strncpy/strnlen from_user
  microblaze: use generic strncpy/strnlen from_user
  csky: use generic strncpy/strnlen from_user
  arc: use generic strncpy/strnlen from_user
  hexagon: use generic strncpy/strnlen from_user
  h8300: remove stale strncpy_from_user
  asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user

15 files changed:
1  2 
arch/alpha/Kconfig
arch/arm/Kconfig
arch/arm64/Kconfig
arch/ia64/Kconfig
arch/m68k/Kconfig
arch/mips/Kconfig
arch/parisc/Kconfig
arch/powerpc/Kconfig
arch/riscv/Kconfig
arch/sh/Kconfig
arch/sparc/Kconfig
arch/x86/Kconfig
arch/xtensa/Kconfig
include/asm-generic/bitops/non-atomic.h
lib/Kconfig

diff --combined arch/alpha/Kconfig
@@@ -14,6 -14,7 +14,6 @@@ config ALPH
        select PCI_SYSCALL if PCI
        select HAVE_AOUT
        select HAVE_ASM_MODVERSIONS
 -      select HAVE_IDE
        select HAVE_PCSPKR_PLATFORM
        select HAVE_PERF_EVENTS
        select NEED_DMA_MAP_STATE
@@@ -28,8 -29,6 +28,6 @@@
        select AUDIT_ARCH
        select GENERIC_CPU_VULNERABILITIES
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_MOD_ARCH_SPECIFIC
        select MODULES_USE_ELF_RELA
@@@ -531,7 -530,7 +529,7 @@@ config SM
          will run faster if you say N here.
  
          See also the SMP-HOWTO available at
 -        <http://www.tldp.org/docs.html#howto>.
 +        <https://www.tldp.org/docs.html#howto>.
  
          If you don't know what to do here, say N.
  
diff --combined arch/arm/Kconfig
@@@ -63,8 -63,6 +63,6 @@@ config AR
        select GENERIC_PCI_IOMAP
        select GENERIC_SCHED_CLOCK
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select HANDLE_DOMAIN_IRQ
        select HARDIRQS_SW_RESEND
        select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT
@@@ -95,6 -93,7 +93,6 @@@
        select HAVE_FUNCTION_TRACER if !XIP_KERNEL
        select HAVE_GCC_PLUGINS
        select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 -      select HAVE_IDE if PCI || ISA || PCMCIA
        select HAVE_IRQ_TIME_ACCOUNTING
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_LZ4
@@@ -360,6 -359,7 +358,6 @@@ config ARCH_FOOTBRIDG
        bool "FootBridge"
        select CPU_SA110
        select FOOTBRIDGE
 -      select HAVE_IDE
        select NEED_MACH_IO_H if !MMU
        select NEED_MACH_MEMORY_H
        help
@@@ -428,6 -428,7 +426,6 @@@ config ARCH_PX
        select GENERIC_IRQ_MULTI_HANDLER
        select GPIO_PXA
        select GPIOLIB
 -      select HAVE_IDE
        select IRQ_DOMAIN
        select PLAT_PXA
        select SPARSE_IRQ
@@@ -443,6 -444,7 +441,6 @@@ config ARCH_RP
        select ARM_HAS_SG_CHAIN
        select CPU_SA110
        select FIQ
 -      select HAVE_IDE
        select HAVE_PATA_PLATFORM
        select ISA_DMA_API
        select LEGACY_TIMER_TICK
@@@ -465,6 -467,7 +463,6 @@@ config ARCH_SA110
        select CPU_SA1100
        select GENERIC_IRQ_MULTI_HANDLER
        select GPIOLIB
 -      select HAVE_IDE
        select IRQ_DOMAIN
        select ISA
        select NEED_MACH_MEMORY_H
@@@ -500,6 -503,7 +498,6 @@@ config ARCH_OMAP
        select GENERIC_IRQ_CHIP
        select GENERIC_IRQ_MULTI_HANDLER
        select GPIOLIB
 -      select HAVE_IDE
        select HAVE_LEGACY_CLK
        select IRQ_DOMAIN
        select NEED_MACH_IO_H if PCCARD
diff --combined arch/arm64/Kconfig
@@@ -130,8 -130,6 +130,6 @@@ config ARM6
        select GENERIC_PTDUMP
        select GENERIC_SCHED_CLOCK
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select GENERIC_TIME_VSYSCALL
        select GENERIC_GETTIMEOFDAY
        select GENERIC_VDSO_TIME_NS
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_MMAP_RND_BITS
        select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
 +      select HAVE_ARCH_PFN_VALID
        select HAVE_ARCH_PREL32_RELOCATIONS
        select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
        select HAVE_ARCH_SECCOMP_FILTER
@@@ -1801,11 -1798,11 +1799,11 @@@ config RANDOMIZE_BAS
          If unsure, say N.
  
  config RANDOMIZE_MODULE_REGION_FULL
 -      bool "Randomize the module region over a 4 GB range"
 +      bool "Randomize the module region over a 2 GB range"
        depends on RANDOMIZE_BASE
        default y
        help
 -        Randomizes the location of the module region inside a 4 GB window
 +        Randomizes the location of the module region inside a 2 GB window
          covering the core kernel. This way, it is less likely for modules
          to leak information about the location of core kernel data structures
          but it does imply that function calls between modules and the core
  
          When this option is not set, the module region will be randomized over
          a limited range that contains the [_stext, _etext] interval of the
 -        core kernel, so branch relocations are always in range.
 +        core kernel, so branch relocations are almost always in range unless
 +        ARM64_MODULE_PLTS is enabled and the region is exhausted. In this
 +        particular case of region exhaustion, modules might be able to fall
 +        back to a larger 2GB area.
  
  config CC_HAVE_STACKPROTECTOR_SYSREG
        def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
diff --combined arch/ia64/Kconfig
@@@ -9,6 -9,8 +9,8 @@@ menu "Processor type and features
  config IA64
        bool
        select ARCH_HAS_DMA_MARK_CLEAN
+       select ARCH_HAS_STRNCPY_FROM_USER
+       select ARCH_HAS_STRNLEN_USER
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select ARCH_MIGHT_HAVE_PC_SERIO
        select ACPI
@@@ -25,6 -27,7 +27,6 @@@
        select HAVE_ASM_MODVERSIONS
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_EXIT_THREAD
 -      select HAVE_IDE
        select HAVE_KPROBES
        select HAVE_KRETPROBES
        select HAVE_FTRACE_MCOUNT_RECORD
diff --combined arch/m68k/Kconfig
@@@ -16,13 -16,12 +16,11 @@@ config M68
        select GENERIC_CPU_DEVICES
        select GENERIC_IOMAP
        select GENERIC_IRQ_SHOW
-       select GENERIC_STRNCPY_FROM_USER if MMU
-       select GENERIC_STRNLEN_USER if MMU
        select HAVE_AOUT if MMU
        select HAVE_ASM_MODVERSIONS
        select HAVE_DEBUG_BUGVERBOSE
        select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_HAS_NO_UNALIGNED
        select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
 -      select HAVE_IDE
        select HAVE_MOD_ARCH_SPECIFIC
        select HAVE_UID16
        select MMU_GATHER_NO_RANGE if MMU
diff --combined arch/mips/Kconfig
@@@ -9,6 -9,8 +9,8 @@@ config MIP
        select ARCH_HAS_KCOV
        select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
        select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
+       select ARCH_HAS_STRNCPY_FROM_USER
+       select ARCH_HAS_STRNLEN_USER
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAS_GCOV_PROFILE_ALL
@@@ -71,6 -73,7 +73,6 @@@
        select HAVE_FUNCTION_TRACER
        select HAVE_GCC_PLUGINS
        select HAVE_GENERIC_VDSO
 -      select HAVE_IDE
        select HAVE_IOREMAP_PROT
        select HAVE_IRQ_EXIT_ON_IRQ_STACK
        select HAVE_IRQ_TIME_ACCOUNTING
diff --combined arch/parisc/Kconfig
@@@ -3,6 -3,7 +3,6 @@@ config PARIS
        def_bool y
        select ARCH_32BIT_OFF_T if !64BIT
        select ARCH_MIGHT_HAVE_PC_PARPORT
 -      select HAVE_IDE
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_SYSCALL_TRACEPOINTS
@@@ -10,6 -11,7 +10,7 @@@
        select ARCH_HAS_ELF_RANDOMIZE
        select ARCH_HAS_STRICT_KERNEL_RWX
        select ARCH_HAS_UBSAN_SANITIZE_ALL
+       select ARCH_HAS_STRNLEN_USER
        select ARCH_NO_SG_CHAIN
        select ARCH_SUPPORTS_HUGETLBFS if PA20
        select ARCH_SUPPORTS_MEMORY_FAILURE
@@@ -33,7 -35,6 +34,6 @@@
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_CPU_DEVICES
-       select GENERIC_STRNCPY_FROM_USER
        select GENERIC_LIB_DEVMEM_IS_ALLOWED
        select SYSCTL_ARCH_UNALIGN_ALLOW
        select SYSCTL_EXCEPTION_TRACE
diff --combined arch/powerpc/Kconfig
@@@ -183,8 -183,6 +183,6 @@@ config PP
        select GENERIC_IRQ_SHOW_LEVEL
        select GENERIC_PCI_IOMAP                if PCI
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select GENERIC_TIME_VSYSCALL
        select GENERIC_VDSO_TIME_NS
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_HARDLOCKUP_DETECTOR_ARCH    if PPC_BOOK3S_64 && SMP
        select HAVE_HARDLOCKUP_DETECTOR_PERF    if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH
        select HAVE_HW_BREAKPOINT               if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
 -      select HAVE_IDE
        select HAVE_IOREMAP_PROT
        select HAVE_IRQ_EXIT_ON_IRQ_STACK
        select HAVE_IRQ_TIME_ACCOUNTING
diff --combined arch/riscv/Kconfig
@@@ -56,8 -56,6 +56,6 @@@ config RISC
        select GENERIC_PTDUMP if MMU
        select GENERIC_SCHED_CLOCK
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER if MMU
-       select GENERIC_STRNLEN_USER if MMU
        select GENERIC_TIME_VSYSCALL if MMU && 64BIT
        select HANDLE_DOMAIN_IRQ
        select HAVE_ARCH_AUDITSYSCALL
@@@ -492,16 -490,10 +490,16 @@@ config CC_HAVE_STACKPROTECTOR_TL
  
  config STACKPROTECTOR_PER_TASK
        def_bool y
 +      depends on !GCC_PLUGIN_RANDSTRUCT
        depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_TLS
  
 +config PHYS_RAM_BASE_FIXED
 +      bool "Explicitly specified physical RAM address"
 +      default n
 +
  config PHYS_RAM_BASE
        hex "Platform Physical RAM address"
 +      depends on PHYS_RAM_BASE_FIXED
        default "0x80000000"
        help
          This is the physical address of RAM in the system. It has to be
@@@ -514,7 -506,6 +512,7 @@@ config XIP_KERNE
        # This prevents XIP from being enabled by all{yes,mod}config, which
        # fail to build since XIP doesn't support large kernels.
        depends on !COMPILE_TEST
 +      select PHYS_RAM_BASE_FIXED
        help
          Execute-In-Place allows the kernel to run from non-volatile storage
          directly addressable by the CPU, such as NOR flash. This saves RAM
diff --combined arch/sh/Kconfig
@@@ -22,8 -22,6 +22,6 @@@ config SUPER
        select GENERIC_IRQ_SHOW
        select GENERIC_PCI_IOMAP if PCI
        select GENERIC_SCHED_CLOCK
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select GENERIC_SMP_IDLE_THREAD
        select GUP_GET_PTE_LOW_HIGH if X2TLB
        select HAVE_ARCH_AUDITSYSCALL
@@@ -39,6 -37,7 +37,6 @@@
        select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_HW_BREAKPOINT
 -      select HAVE_IDE if HAS_IOPORT_MAP
        select HAVE_IOREMAP_PROT if MMU && !X2TLB
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_GZIP
diff --combined arch/sparc/Kconfig
@@@ -19,6 -19,7 +19,6 @@@ config SPAR
        select OF
        select OF_PROMTREE
        select HAVE_ASM_MODVERSIONS
 -      select HAVE_IDE
        select HAVE_ARCH_KGDB if !SMP || SPARC64
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_SECCOMP if SPARC64
@@@ -37,8 -38,6 +37,6 @@@
        select HAVE_EBPF_JIT if SPARC64
        select HAVE_DEBUG_BUGVERBOSE
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select MODULES_USE_ELF_RELA
        select PCI_SYSCALL if PCI
        select PCI_MSI_ARCH_FALLBACKS if PCI_MSI
diff --combined arch/x86/Kconfig
@@@ -119,7 -119,6 +119,7 @@@ config X8
        select ARCH_WANT_HUGE_PMD_SHARE
        select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_WANTS_THP_SWAP              if X86_64
 +      select ARCH_HAS_PARANOID_L1D_FLUSH
        select BUILDTIME_TABLE_SORT
        select CLKEVT_I8253
        select CLOCKSOURCE_VALIDATE_LAST_CYCLE
        select GENERIC_PENDING_IRQ              if SMP
        select GENERIC_PTDUMP
        select GENERIC_SMP_IDLE_THREAD
-       select GENERIC_STRNCPY_FROM_USER
-       select GENERIC_STRNLEN_USER
        select GENERIC_TIME_VSYSCALL
        select GENERIC_GETTIMEOFDAY
        select GENERIC_VDSO_TIME_NS
        select HAVE_FUNCTION_TRACER
        select HAVE_GCC_PLUGINS
        select HAVE_HW_BREAKPOINT
 -      select HAVE_IDE
        select HAVE_IOREMAP_PROT
        select HAVE_IRQ_EXIT_ON_IRQ_STACK       if X86_64
        select HAVE_IRQ_TIME_ACCOUNTING
@@@ -2767,6 -2765,32 +2765,6 @@@ config AMD_N
        def_bool y
        depends on CPU_SUP_AMD && PCI
  
 -config X86_SYSFB
 -      bool "Mark VGA/VBE/EFI FB as generic system framebuffer"
 -      help
 -        Firmwares often provide initial graphics framebuffers so the BIOS,
 -        bootloader or kernel can show basic video-output during boot for
 -        user-guidance and debugging. Historically, x86 used the VESA BIOS
 -        Extensions and EFI-framebuffers for this, which are mostly limited
 -        to x86.
 -        This option, if enabled, marks VGA/VBE/EFI framebuffers as generic
 -        framebuffers so the new generic system-framebuffer drivers can be
 -        used on x86. If the framebuffer is not compatible with the generic
 -        modes, it is advertised as fallback platform framebuffer so legacy
 -        drivers like efifb, vesafb and uvesafb can pick it up.
 -        If this option is not selected, all system framebuffers are always
 -        marked as fallback platform framebuffers as usual.
 -
 -        Note: Legacy fbdev drivers, including vesafb, efifb, uvesafb, will
 -        not be able to pick up generic system framebuffers if this option
 -        is selected. You are highly encouraged to enable simplefb as
 -        replacement if you select this option. simplefb can correctly deal
 -        with generic system framebuffers. But you should still keep vesafb
 -        and others enabled as fallback if a system framebuffer is
 -        incompatible with simplefb.
 -
 -        If unsure, say Y.
 -
  endmenu
  
  
diff --combined arch/xtensa/Kconfig
@@@ -7,6 -7,8 +7,8 @@@ config XTENS
        select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
        select ARCH_HAS_DMA_SET_UNCACHED if MMU
+       select ARCH_HAS_STRNCPY_FROM_USER if !KASAN
+       select ARCH_HAS_STRNLEN_USER
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
@@@ -20,7 -22,6 +22,6 @@@
        select GENERIC_IRQ_SHOW
        select GENERIC_PCI_IOMAP
        select GENERIC_SCHED_CLOCK
-       select GENERIC_STRNCPY_FROM_USER if KASAN
        select HAVE_ARCH_AUDITSYSCALL
        select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
        select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL
@@@ -327,6 -328,7 +328,6 @@@ config XTENSA_PLATFORM_IS
  
  config XTENSA_PLATFORM_XT2000
        bool "XT2000"
 -      select HAVE_IDE
        help
          XT2000 is the name of Tensilica's feature-rich emulation platform.
          This hardware is capable of running a full Linux distribution.
@@@ -5,7 -5,7 +5,7 @@@
  #include <asm/types.h>
  
  /**
 - * __set_bit - Set a bit in memory
 + * arch___set_bit - Set a bit in memory
   * @nr: the bit to set
   * @addr: the address to start counting from
   *
   * If it's called on the same region of memory simultaneously, the effect
   * may be that only one operation succeeds.
   */
 -static inline void __set_bit(unsigned int nr, volatile unsigned long *addr)
 +static __always_inline void
- arch___set_bit(int nr, volatile unsigned long *addr)
++arch___set_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  
        *p  |= mask;
  }
 +#define __set_bit arch___set_bit
  
 -static inline void __clear_bit(unsigned int nr, volatile unsigned long *addr)
 +static __always_inline void
- arch___clear_bit(int nr, volatile unsigned long *addr)
++arch___clear_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  
        *p &= ~mask;
  }
 +#define __clear_bit arch___clear_bit
  
  /**
 - * __change_bit - Toggle a bit in memory
 + * arch___change_bit - Toggle a bit in memory
   * @nr: the bit to change
   * @addr: the address to start counting from
   *
   * If it's called on the same region of memory simultaneously, the effect
   * may be that only one operation succeeds.
   */
 -static inline void __change_bit(unsigned int nr, volatile unsigned long *addr)
 +static __always_inline
- void arch___change_bit(int nr, volatile unsigned long *addr)
++void arch___change_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  
        *p ^= mask;
  }
 +#define __change_bit arch___change_bit
  
  /**
 - * __test_and_set_bit - Set a bit and return its old value
 + * arch___test_and_set_bit - Set a bit and return its old value
   * @nr: Bit to set
   * @addr: Address to count from
   *
@@@ -61,8 -55,7 +61,8 @@@
   * If two examples of this operation race, one can appear to succeed
   * but actually fail.  You must protect multiple accesses with a lock.
   */
 -static inline int __test_and_set_bit(unsigned int nr, volatile unsigned long *addr)
 +static __always_inline int
- arch___test_and_set_bit(int nr, volatile unsigned long *addr)
++arch___test_and_set_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
        *p = old | mask;
        return (old & mask) != 0;
  }
 +#define __test_and_set_bit arch___test_and_set_bit
  
  /**
 - * __test_and_clear_bit - Clear a bit and return its old value
 + * arch___test_and_clear_bit - Clear a bit and return its old value
   * @nr: Bit to clear
   * @addr: Address to count from
   *
@@@ -82,8 -74,7 +82,8 @@@
   * If two examples of this operation race, one can appear to succeed
   * but actually fail.  You must protect multiple accesses with a lock.
   */
 -static inline int __test_and_clear_bit(unsigned int nr, volatile unsigned long *addr)
 +static __always_inline int
- arch___test_and_clear_bit(int nr, volatile unsigned long *addr)
++arch___test_and_clear_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
        *p = old & ~mask;
        return (old & mask) != 0;
  }
 +#define __test_and_clear_bit arch___test_and_clear_bit
  
  /* WARNING: non atomic and it can be reordered! */
 -static inline int __test_and_change_bit(unsigned int nr,
 -                                          volatile unsigned long *addr)
 +static __always_inline int
- arch___test_and_change_bit(int nr, volatile unsigned long *addr)
++arch___test_and_change_bit(unsigned int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
        *p = old ^ mask;
        return (old & mask) != 0;
  }
 +#define __test_and_change_bit arch___test_and_change_bit
  
  /**
 - * test_bit - Determine whether a bit is set
 + * arch_test_bit - Determine whether a bit is set
   * @nr: bit number to test
   * @addr: Address to start counting from
   */
 -static inline int test_bit(unsigned int nr, const volatile unsigned long *addr)
 +static __always_inline int
- arch_test_bit(int nr, const volatile unsigned long *addr)
++arch_test_bit(unsigned int nr, const volatile unsigned long *addr)
  {
        return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
  }
 +#define test_bit arch_test_bit
  
  #endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
diff --combined lib/Kconfig
@@@ -50,12 -50,18 +50,18 @@@ config HAVE_ARCH_BITREVERS
          This option enables the use of hardware bit-reversal instructions on
          architectures which support such operations.
  
- config GENERIC_STRNCPY_FROM_USER
+ config ARCH_HAS_STRNCPY_FROM_USER
        bool
  
- config GENERIC_STRNLEN_USER
+ config ARCH_HAS_STRNLEN_USER
        bool
  
+ config GENERIC_STRNCPY_FROM_USER
+       def_bool !ARCH_HAS_STRNCPY_FROM_USER
+ config GENERIC_STRNLEN_USER
+       def_bool !ARCH_HAS_STRNLEN_USER
  config GENERIC_NET_UTILS
        bool
  
@@@ -683,6 -689,9 +689,6 @@@ config PARMA
  config OBJAGG
        tristate "objagg" if COMPILE_TEST
  
 -config STRING_SELFTEST
 -      tristate "Test string functions"
 -
  endmenu
  
  config GENERIC_IOREMAP