Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201001201108.GR17637@brightrain.aerifal.cx>
Date: Thu, 1 Oct 2020 16:11:08 -0400
From: Rich Felker <dalias@...ifal.cx>
To: Petr Vorel <petr.vorel@...il.com>
Cc: linux-kernel@...r.kernel.org, musl@...ts.openwall.com,
	linux-api@...r.kernel.org, libc-alpha@...rceware.org,
	Peter Korsgaard <peter@...sgaard.com>,
	Florian Weimer <fweimer@...hat.com>,
	Baruch Siach <baruch@...s.co.il>,
	"David S . Miller" <davem@...emloft.net>,
	Michal Kubecek <mkubecek@...e.cz>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH 1/1] uapi: Don't include <linux/sysinfo.h> in
 <linux/kernel.h>

On Thu, Oct 01, 2020 at 09:52:31PM +0200, Petr Vorel wrote:
> + update code where needed (include <linux/sysinfo.h> in code which
> included <linux/kernel.h> only to get struct sysinfo or SI_LOAD_SHIFT).
> 
> The reason is to avoid indirect <linux/sysinfo.h> include when using
> some network headers: <linux/netlink.h> or others [1] ->
> <linux/kernel.h> -> <linux/sysinfo.h>.
> 
> This indirect include causes redefinition of struct sysinfo when
> included both <sys/sysinfo.h> and some of network headers:
> 
> In file included from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:5,
>                  from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:5,
>                  from ../include/tst_netlink.h:14,
>                  from tst_crypto.c:13:
> x86_64-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:8:8: error: redefinition of ‘struct sysinfo’
>  struct sysinfo {
>         ^~~~~~~
> In file included from ../include/tst_safe_macros.h:15,
>                  from ../include/tst_test.h:93,
>                  from tst_crypto.c:11:
> x86_64-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
> 
> [1] or <linux/sysctl.h>, <linux/ethtool.h>, <linux/mroute6.h>, <linux/ethtool.h>
> 
> Suggested-by: Rich Felker <dalias@...ifal.cx>
> Signed-off-by: Petr Vorel <petr.vorel@...il.com>
> ---
> Hi,
> 
> this looks to be long standing problem: python-psutil [2], iproute2 [3],
> even for glibc in the past [4] and it tried to be solved before [5].
> 
> This will require glibc fix after:

You can't do this; it breaks the existing contract with glibc. New
kernel headers can't force a glibc upgrade. You just have to get rid
of use of <linux/kernel.h> elsewhere in the uapi headers. It was a
mistake that <linux/sysinfo.h> was ever separated out of
<linux/kernel.h> since it didn't (and couldn't) fix the contract that
<linux/kernel.h> exposes struct sysinfo (and that it's misnamed). But
it's no big deal. This can all be fixed without any breakage anywhere
just by not using it.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.