Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755404AbcLBEjT (ORCPT ); Thu, 1 Dec 2016 23:39:19 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33743 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751936AbcLBEjR (ORCPT ); Thu, 1 Dec 2016 23:39:17 -0500 Date: Fri, 2 Dec 2016 07:39:10 +0300 From: Eugene Syromyatnikov To: linux-kernel@vger.kernel.org Subject: CONFIG_* in UAPI headers Message-ID: <20161202043910.GA26755@obsidian> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2582 Lines: 47 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}