lkml.org 
[lkml]   [2016]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectCONFIG_* in UAPI headers
Hello.

It was noticed during addition of support for the new arch_prctl code constants
to strace that these new constants (ARCH_MAP_VDSO_X32, ARCH_MAP_VDSO_32 and
ARCH_MAP_VDSO_64) are guarded with the CONFIG_CHECKPOINT_RESTORE ifdef.
However, from what I can see (by looking at headers in and around
/usr/include/linux in Debian and Red Hat distributions), kernel configuration
definitions are not exported as a part of the UAPI headers, so these definitions
would be unusable unless user application explicitly defines
CONFIG_CHECKPOINT_RESTORE macro, regardless of kernel support.

Further inspection of UAPI headers revealed that there are several other
examples of such CONFIG_*-guarded definitions, namely:
* include/uapi/asm-generic/fcntl.h — ifndef CONFIG_64BIT (however glibc
headers have own magic regarding fcntl constants)
* include/uapi/asm-generic/mman-common.h —
ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
* include/uapi/asm-generic/unistd.h — ifdef CONFIG_MMU
* include/uapi/linux/atmdev.h — ifdef CONFIG_COMPAT
* include/uapi/linux/elfcore.h — ifdef CONFIG_BINFMT_ELF_FDPIC
* include/uapi/linux/eventpoll.h — ifdef CONFIG_PM_SLEEP
* include/uapi/linux/fb.h — ifdef CONFIG_FB_BACKLIGHT
* include/uapi/linux/flat.h — ifdef CONFIG_BINFMT_SHARED_FLAT
* include/uapi/linux/hw_breakpoint.h — ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
* include/uapi/linux/pktcdvd.h — if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
* arch/arc/include/uapi/asm/swab.h — ifdef CONFIG_ARC_HAS_SWAPE
* arch/arm/include/uapi/asm/ptrace.h — ifdef CONFIG_CPU_ENDIAN_BE8
* arch/hexagon/include/uapi/asm/ptrace.h — if CONFIG_HEXAGON_ARCH_VERSION >= 4
* arch/hexagon/include/uapi/asm/user.h — if CONFIG_HEXAGON_ARCH_VERSION < 4
* arch/m68k/include/uapi/asm/ptrace.h — ifdef CONFIG_COLDFIRE
* arch/nios2/include/uapi/asm/swab.h — ifdef CONFIG_NIOS2_CI_SWAB_SUPPORT
* arch/x86/include/uapi/asm/auxvec.h — if defined(CONFIG_IA32_EMULATION) ||
!defined(CONFIG_X86_64)
* arch/x86/include/uapi/asm/mman.h —
ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS (another piece of the new code
added in 4.9)
* arch/xtensa/include/uapi/asm/mman.h — ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED

Maybe most of these are false positives, but by looking at them it isn't clear
how user space should use definitions and code under under these checks, so
maybe it should be moved out from UAPI or at least fitted with comments
regarding necessity of these guards useful only in kernel space?

--
Eugene Syromyatnikov
mailto:evgsyr@gmail.com
xmpp:esyr@jabber.{ru|org}

\
 
 \ /
  Last update: 2016-12-02 05:39    [W:0.023 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site