Bug 14809 - glibc's sysctl.h uses incorrect <linux/kernel.h> header guard macro starting with kernel-3.7.x
Summary: glibc's sysctl.h uses incorrect <linux/kernel.h> header guard macro starting ...
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: Andreas Jaeger
URL:
Keywords: glibc_2.15, glibc_2.16
Depends on:
Blocks:
 
Reported: 2012-11-05 20:30 UTC by kkeithle
Modified: 2014-06-14 11:13 UTC (History)
3 users (show)

See Also:
Host: Fedora rawhide
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kkeithle 2012-11-05 20:30:00 UTC
./sysdeps/unix/sysv/linux/sys/sysctl.h contains:

/* Prevent more kernel headers than necessary to be included.  */
#ifndef _LINUX_KERNEL_H
# define _LINUX_KERNEL_H        1
# define __undef_LINUX_KERNEL_H
#endif
#ifndef _LINUX_TYPES_H
# define _LINUX_TYPES_H         1
# define __undef_LINUX_TYPES_H
#endif
#ifndef _LINUX_LIST_H
# define _LINUX_LIST_H          1
# define __undef_LINUX_LIST_H
#endif
#ifndef __LINUX_COMPILER_H
# define __LINUX_COMPILER_H     1
# define __user
# define __undef__LINUX_COMPILER_H
#endif

But starting with kernel 3.7, the feature test macros are _UAPI_LINUX_KERNEL_H and _UAPI_LINUX_TYPES_H (and no file uses *_LIST_H or *_COMPILER_H AFAICT)

As such the above doesn't work and third party apps that include the (in)correct mix of header files don't compile due to conflicting types, e.g. include both <stdint.h> and <sys/sysctl.h> in one source file.
Comment 1 kkeithle 2012-11-06 14:25:21 UTC
s/feature test/header guard/
Comment 2 Andreas Jaeger 2012-11-07 08:48:08 UTC
Thanks for the bug report, patch posted at:
http://sourceware.org/ml/libc-alpha/2012-11/msg00239.html
Comment 3 Andreas Jaeger 2012-11-07 20:43:42 UTC
Fixed for head, will submit later for glibc 2.16/2.15 (after approval by Carlos)
Comment 4 Carlos O'Donell 2012-11-13 00:14:52 UTC
OK for 2.16/2.15.

Slightly off-topic: I didn't know we had to manually maintain those header guards to prevent other headers from being included when we include the kernel version. Do we really need to maintain this? Is this simply an optimization to reduce the amount of cpp work that is done for this header?
Comment 5 Andreas Jaeger 2012-11-13 08:06:11 UTC
Carlos, see the original comment: We get types declared twice.

I'm pushing this now to 2.16 and 2.15 branches.
Comment 6 Andreas Schwab 2012-11-27 14:17:23 UTC
The kernel has been fixed, so this is no longer needed.  No released kernel will have this issue.
Comment 7 Andreas Schwab 2012-11-28 15:43:40 UTC
The patch has been reverted since it was a kernel bug.