From: "Richard B. Johnson" <root@chaos.analogic.com>
To: DervishD <raul@pleyades.net>
Cc: Matthew Reppert <repp0017@tc.umn.edu>,
Lev Lvovsky <lists1@sonous.com>,
linux-kernel@vger.kernel.org
Subject: Re: older kernels + new glibc?
Date: Tue, 30 Mar 2004 10:15:55 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.53.0403301001090.6371@chaos> (raw)
In-Reply-To: <20040330145013.GD8304@DervishD>
On Tue, 30 Mar 2004, DervishD wrote:
> Hi Matthew :)
>
> * Matthew Reppert <repp0017@tc.umn.edu> dixit:
> > > Mmm, I'm confused. As far as I knew, you *should* use symlinks to
> > > your current (running) kernel includes for /usr/include/asm and
> > > /usr/include/linux. I've been doing this for years (in fact I
> > > compiled my libc back in the 2.2 days IIRC), without problems. Why it
> > > should be avoided and what kind of problems may arise if someone
> > > (like me) has those symlinks?
> > See http://www.kernelnewbies.org/faq/index.php3#headers
>
> Thanks a lot for the information, it's been quite useful :)))
>
> I find the explanation extremely sensible, but the problem I see
> is that some user-space tools that are very coupled with the kernel
> (for example, hdparm) assume that the kernel headers can be accessed
> throuhg a system standard include directory (like /usr/include). What
> I mean is that all these tools just #include <linux/whatever.h>,
> without making assumptions about where are they.
>
If you have any user-mode 'kernel' utilities, you need to be
extremely careful because you can build code that doesn't work.
That's why you should use an 'include' search path on the
compiler command line when you are compiling these. The search
path should point to the kernel headers of the version you
intend to use. The kernel tries to remain compatible, but
when you access internal structures, compatibility may be lost.
> If I've understood correctly, these tools (like hdparm) should
> *not* use current (running) kernel headers, but those that were in
> use when glibc was built, am I right? Which, BTW, is a big problem
> because I don't have the slightest idea about which kernel was in use
> when I built my glibc.
>
Yes. One can usually 'trust' a distribution and use whatever they
shipped.
> But putting under /usr/include/linux and /usr/include/asm the
> headers in use when glibc is built can lead to a problem, too.
> Imagine that at some point in the future, the contents of the asm or
> linux dirs depends on which facilities the kernel has configured
> e.g. no scsi.h if no scsi support is present in the configured
> kernel. That way, you don't have scsi.h under your
> /usr/include/linux, but you may need it if you add an SCSI card with
> your running kernel and want to compile some 'scsiutils' or whatever
> like that.
>
No. User-mode programs must never, never, never, ever include
kernel headers directly. Instead, if they are for kernel utilities,
the include search-path must be explicitly set.
> I confess that this is a very weird scenario, very difficult to
> appear but... Just wondering.
>
> > The correct place, I've read, to get the headers for the current running
> > kernel is /lib/modules/$(uname -r)/build/include
>
This is one of the newer places that's been defined. It's probably
worthless because it's just another sim-link! And, it's a sim-link
to some kernel source that probably doesn't exist anymore. You
need to explicitly define where you want the include-search-path
to include when you compile kernel-specific things. In other words,
when compiling things that interface with the kernel or with
kernel internals, there is no free lunch. You need to know exactly
what you are doing.
> Please correct me if I'm wrong: only external kernel modules
> should use current (running, again) kernel headers, no?
>
Kernel modules must use the headers for the kernel version you
wish to run. That is not necessarily the kernel that is running
now. That's why you need to define the search-path for the
'include' files.
> > Basically, the potential problem as I understand it is binary
> > incompatibility with the currently installed glibc.
>
Yes. You need to keep user-space and kernel space seperate.
> That has never happened to me, but reading Linus' explanation,
> that can bite me in the future (if some interface I use in userspace
> changes in the kernel).
>
Correct.
> Raúl Núñez de Arenas Coronado
>
> --
> Linux Registered User 88736
> http://www.pleyades.net & http://raul.pleyades.net/
>
Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.
next prev parent reply other threads:[~2004-03-30 15:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-29 20:40 Lev Lvovsky
2004-03-29 21:00 ` Arjan van de Ven
2004-03-29 21:09 ` Lev Lvovsky
2004-03-29 21:22 ` Arjan van de Ven
2004-03-29 21:26 ` Lev Lvovsky
2004-03-29 21:28 ` Arjan van de Ven
2004-03-29 21:34 ` Lev Lvovsky
2004-03-29 21:36 ` Arjan van de Ven
2004-03-29 21:45 ` Chris Meadors
2004-03-29 23:03 ` David T Hollis
2004-03-30 15:07 ` Adrian Bunk
2004-03-31 0:54 ` GOTO Masanori
2004-03-29 21:17 ` Richard B. Johnson
2004-03-29 21:36 ` Lev Lvovsky
2004-03-29 21:50 ` Richard B. Johnson
2004-03-29 21:55 ` Lev Lvovsky
2004-03-29 22:10 ` Richard B. Johnson
2004-03-29 22:55 ` Lev Lvovsky
2004-03-30 12:19 ` Richard B. Johnson
2004-03-29 22:27 ` DervishD
2004-03-29 23:55 ` Matthew Reppert
2004-03-30 0:09 ` Lev Lvovsky
2004-03-30 14:50 ` DervishD
2004-03-30 15:15 ` Richard B. Johnson [this message]
2004-03-30 17:10 ` DervishD
2004-03-30 12:16 ` Richard B. Johnson
2004-03-30 15:20 ` DervishD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.53.0403301001090.6371@chaos \
--to=root@chaos.analogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lists1@sonous.com \
--cc=raul@pleyades.net \
--cc=repp0017@tc.umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®