Skip to contentSkip to conversation

+ allow-proc-configgz-to-be-built-as-a-module.patch added to -mm tree

DISCUSSION Randy.Dunlap 7 participants 12 messages Sep 15, 2006 – Oct 2, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 7 lines · On Fri, 15 Sep 2006 14:58:06 -0700 [email protected] wrote:

The patch titled

allow /proc/config.gz to be built as a module

has been added to the -mm tree. Its filename is

Quoted 8 lines

allow-proc-configgz-to-be-built-as-a-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this

------------------------------------------------------
Subject: allow /proc/config.gz to be built as a module
From: Ross Biro <[email protected]>

When/where was this patch submitted? I seem to have missed it (or it was so long ago that I forgot about it).

Quoted 2 lines

The driver for /proc/config.gz consumes rather a lot of memory and it is in fact possible to build it as a module.

Can you try to quantify "rather a lot of memory"?

Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

Quoted 24 lines

But OTOH the potential memory savings are decent, and it'd be fairly dumb to build your configs.o with a different .config.

---

 init/Kconfig |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN init/Kconfig~allow-proc-configgz-to-be-built-as-a-module init/Kconfig

init/Kconfig renamed from init/Kconfig~allow-proc-configgz-to-be-built-as-a-module +1 -1
@@ -241,7 +241,7 @@ config AUDITSYSCALL
 	  ensure that INOTIFY is configured.
 
 config IKCONFIG
-	bool "Kernel .config support"
+	tristate "Kernel .config support"
 	---help---
 	  This option enables the complete Linux kernel ".config" file
 	  contents to be saved in the kernel. It provides documentation
Quoted 1 line

_

---
~Randy

#2 lore raw
Quoted 6 lines · Randy.Dunlap
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

It's not worth the risk for distributions or if you are tyring to support people building their own kernels. But if you are in an environment where you have enough control that you are not worried the kernel and the module being built at separate times or with different configs, then it's a nice compromise between convenience and memory use.

Ross

#3 lore raw
Quoted 8 lines · On Fri, 15 Sep 2006 19:04:30 -0400 rossb wrote:
Quoted 6 lines · Randy.Dunlap
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

Quoted 6 lines

It's not worth the risk for distributions or if you are tyring to support people building their own kernels. But if you are in an environment where you have enough control that you are not worried the kernel and the module being built at separate times or with different configs, then it's a nice compromise between convenience and memory use.

One can have any number of private kernel patches, too. Or put another way: Just because it can be done doesn't mean that it should be done.

And I'm still interested in the other questions that were not answered.

---
~Randy

#4 lore raw
In reply to Randy.Dunlap
Quoted 14 lines · On Fri, 15 Sep 2006 15:47:52 -0700 "Randy.Dunlap" <[email protected]> wrote:
Quoted 12 lines · On Fri, 15 Sep 2006 14:58:06 -0700 [email protected] wrote:

The patch titled

allow /proc/config.gz to be built as a module

has been added to the -mm tree. Its filename is

allow-proc-configgz-to-be-built-as-a-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this

Quoted 6 lines
Quoted 3 lines

------------------------------------------------------
Subject: allow /proc/config.gz to be built as a module
From: Ross Biro <[email protected]>

When/where was this patch submitted? I seem to have missed it (or it was so long ago that I forgot about it).

Ross wrote it today and I stole it.

Quoted 4 lines
Quoted 2 lines

The driver for /proc/config.gz consumes rather a lot of memory and it is in fact possible to build it as a module.

Can you try to quantify "rather a lot of memory"?

I confused it with /proc/kallsyms. No, /proc/config.gz doesn't use much memory.

Quoted 6 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

I'd want to be hearing from distro people on that - I'd expect that the .config which is used to build configs.ko would not differ from that which is used to build vmlinux.

Plus it's configurable.

Am not particularly fussed either way, really. It would be better if treading on /proc/config.gz were to cause a modprobe of the driver for it, but procfs doesn't work that way.

#5 lore raw
Quoted 45 lines · On Fri, 15 Sep 2006 16:41:35 -0700 Andrew Morton wrote:
Quoted 14 lines · On Fri, 15 Sep 2006 15:47:52 -0700 "Randy.Dunlap" <[email protected]> wrote:
Quoted 12 lines · On Fri, 15 Sep 2006 14:58:06 -0700 [email protected] wrote:

The patch titled

allow /proc/config.gz to be built as a module

has been added to the -mm tree. Its filename is

allow-proc-configgz-to-be-built-as-a-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this

Quoted 6 lines
Quoted 3 lines

------------------------------------------------------
Subject: allow /proc/config.gz to be built as a module
From: Ross Biro <[email protected]>

When/where was this patch submitted? I seem to have missed it (or it was so long ago that I forgot about it).

Ross wrote it today and I stole it.

Quoted 4 lines
Quoted 2 lines

The driver for /proc/config.gz consumes rather a lot of memory and it is in fact possible to build it as a module.

Can you try to quantify "rather a lot of memory"?

I confused it with /proc/kallsyms. No, /proc/config.gz doesn't use much memory.

Quoted 6 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

I'd want to be hearing from distro people on that - I'd expect that the .config which is used to build configs.ko would not differ from that which is used to build vmlinux.

Quoted 5 lines

Plus it's configurable.

Am not particularly fussed either way, really. It would be better if treading on /proc/config.gz were to cause a modprobe of the driver for it, but procfs doesn't work that way.

I'm not terribly fussed either way either. We have just about hit my quota/limit for discussion of this patch. :)

If memory is an issue, one should just build the .config file into the kernel image and use scripts/extract-ikconfig to read it back (IMHO).

---
~Randy

#6 lore raw
In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

I'd want to be hearing from distro people on that - I'd expect that the .config which is used to build configs.ko would not differ from that which is used to build vmlinux.

What's the point though? If you can find configs.ko, you can have install_modules copy config.gz there, no? And you also have it in /boot/config-uname -r. /proc/config.gz has a trust value only because it is linked into the image. Having it as a module gives the exact save level of trustyness that the perfectly well working solution of copying in /boot had before.

In other terms, if you allow configs.ko, you can't trust the contents of /proc/config.gz anymore and /proc/config.gz lost all its interest where it comes to debugging.

OG.

#7 lore raw
In reply to Andrew Morton
Quoted 38 lines · Andrew Morton
Quoted 14 lines · On Fri, 15 Sep 2006 15:47:52 -0700 "Randy.Dunlap" <[email protected]> wrote:
Quoted 12 lines · On Fri, 15 Sep 2006 14:58:06 -0700 [email protected] wrote:

The patch titled

allow /proc/config.gz to be built as a module

has been added to the -mm tree. Its filename is

allow-proc-configgz-to-be-built-as-a-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this

Quoted 6 lines
Quoted 3 lines

------------------------------------------------------
Subject: allow /proc/config.gz to be built as a module
From: Ross Biro <[email protected]>

When/where was this patch submitted? I seem to have missed it (or it was so long ago that I forgot about it).

Ross wrote it today and I stole it.

Quoted 4 lines
Quoted 2 lines

The driver for /proc/config.gz consumes rather a lot of memory and it is in fact possible to build it as a module.

Can you try to quantify "rather a lot of memory"?

I confused it with /proc/kallsyms. No, /proc/config.gz doesn't use much memory.

Quoted 4 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

Quoted 7 lines
Quoted 2 lines

and that's why a module wasn't allowed.
It's not worth the risk IMO.

I'd want to be hearing from distro people on that - I'd expect that the .config which is used to build configs.ko would not differ from that which is used to build vmlinux.
...

If you are concerned about memory usage, and you are anyway building a kernel package for a distribution, the reasonable solution is place the .config in /boot/config-...

That's also what I know from the Debian kernel packages.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#8 lore raw
In reply to Andrew Morton
Quoted 26 lines · On Fri, 15 Sep 2006 16:41:35 -0700 Andrew Morton wrote:
Quoted 14 lines · On Fri, 15 Sep 2006 15:47:52 -0700 "Randy.Dunlap" <[email protected]> wrote:
Quoted 12 lines · On Fri, 15 Sep 2006 14:58:06 -0700 [email protected] wrote:

The patch titled

allow /proc/config.gz to be built as a module

has been added to the -mm tree. Its filename is

allow-proc-configgz-to-be-built-as-a-module.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this

Quoted 6 lines
Quoted 3 lines

------------------------------------------------------
Subject: allow /proc/config.gz to be built as a module
From: Ross Biro <[email protected]>

When/where was this patch submitted? I seem to have missed it (or it was so long ago that I forgot about it).

Ross wrote it today and I stole it.

Quoted 14 lines
Quoted 4 lines
Quoted 2 lines

The driver for /proc/config.gz consumes rather a lot of memory and it is in fact possible to build it as a module.

Can you try to quantify "rather a lot of memory"?

I confused it with /proc/kallsyms. No, /proc/config.gz doesn't use much memory.

Quoted 6 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

*************************************************

Quoted 1 line

I'd want to be hearing from distro people on that - I'd expect that the

*************************************************

Quoted 2 lines

.config which is used to build configs.ko would not differ from that which is used to build vmlinux.

Can any of the distro people chime in here? Andrew merged this patch to mainline today. Several people had disagreed with merging it, but now Andrew says we need more discussion (if or) in order to revert it.

Quoted 5 lines

Plus it's configurable.

Am not particularly fussed either way, really. It would be better if treading on /proc/config.gz were to cause a modprobe of the driver for it, but procfs doesn't work that way.

---
~Randy

#9 lore raw
Quoted 4 lines · Randy Dunlap

Can any of the distro people chime in here? Andrew merged this patch to mainline today. Several people had disagreed with merging it, but now Andrew says we need more discussion (if or) in order to revert it.

Everyone who wants this to be =m can do so.
The rest will likely leave it =y.

#10 lore raw
In reply to Randy.Dunlap
Quoted 6 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

Hi,

I agree with Randy here; this does not make sense. Either you're ok with a small risk that the config doesn't match the kernel (and you use /boot/config-<version> as put there by make install and by all distributions) or you want a 100.00% guarantee and use /proc/config.gz. Making the later unreliable (even if that is a CHOICE a user of it cannot find this out, in the config.gz he sees the CONFIG option for this may say =y even if the actual config has it as module!. So users of this are now in the cold).

One hack we could do is make an md5sum or similar of the config and stick that somewhere which is built in and always available (proc or sysfs or something like that); that can be used to validate any config basically to be "correct matching". In fact we could even make it (optionally) part of the VERMAGIC to avoid any kind of mismatch at all.

Greetings,
Arjan van de Ven

#11 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 6 lines
Quoted 3 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config which was used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

The problem is, the patch is basically s/bool/tristate/ so you can't really count on /proc/config.gz anyway. It's a lot like security through obscurity.

Quoted 5 lines

One hack we could do is make an md5sum or similar of the config and stick that somewhere which is built in and always available (proc or sysfs or something like that); that can be used to validate any config basically to be "correct matching". In fact we could even make it (optionally) part of the VERMAGIC to avoid any kind of mismatch at all.

Not a bad idea, but I think you want to be able to edit your config before compiling modules. In particular, you might want to turn something from off to module.

How about we embed the md5sum of the config in the kernel, make it available via /proc or /sysfs and then have /proc/config.gz return an error in the event the md5sum doesn't match?

Ross

#12 lore raw
Quoted 19 lines · rossb
Quoted 7 lines · Arjan van de Ven
Quoted 2 lines
Quoted 2 lines

In some ways this is a bit risky, because the .config which is used for compiling kernel/configs.c isn't necessarily the same as the .config

which was

Quoted 4 lines
Quoted 1 line

used to build vmlinux.

and that's why a module wasn't allowed.
It's not worth the risk IMO.

The problem is, the patch is basically s/bool/tristate/ so you can't really count on /proc/config.gz anyway. It's a lot like security through obscurity.

Quoted 5 lines

One hack we could do is make an md5sum or similar of the config and stick that somewhere which is built in and always available (proc or sysfs or something like that); that can be used to validate any config basically to be "correct matching". In fact we could even make it (optionally) part of the VERMAGIC to avoid any kind of mismatch at all.

Quoted 7 lines

Not a bad idea, but I think you want to be able to edit your config before compiling modules. In particular, you might want to turn something from off to module.

How about we embed the md5sum of the config in the kernel, make it available via /proc or /sysfs and then have /proc/config.gz return an error in the event the md5sum doesn't match?

IMHO this all sounds like overdesigning something that is only a quick hack that is sometimes handy:

If you don't want to waste kernel memory, set CONFIG_IKCONFIG=n.

If you are building a kernel for a distribution kernel, set CONFIG_IKCONFIG=n and place the .config in /boot/config-* (or a similar place).

We don't need a sophisticated well-defined semantics for the case when the .config changes due to additional modules selected or other special cases.

Quoted 1 line

Ross

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed