2003-09-04 18:31:50

by Stephen Hemminger

[permalink] [raw]
Subject: [PATCH] ikconfig - resolve rebuild permissions

If ikconfig is enabled then the following annoying permission
problem happens.
$ make
$ su
# make install
$ make

make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
CHK include/asm-i386/asm_offsets.h
CHK include/linux/compile.h
CC kernel/configs.o
mv: overwrite `kernel/configs.o', overriding mode 0644?

This patch fixes it by removing the configs.o file when
needed.

It applies against 2.6.0-test4 but is also needed even with the
ikconfig patch already in -mm5

diff -Nru a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile Thu Sep 4 10:33:49 2003
+++ b/kernel/Makefile Thu Sep 4 10:33:49 2003
@@ -36,5 +36,6 @@

$(obj)/ikconfig.h: scripts/mkconfigs .config Makefile FORCE
$(call if_changed,ikconfig)
+ @rm -f $(obj)/configs.o

$(obj)/configs.o: $(obj)/ikconfig.h


2003-09-04 19:14:01

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] ikconfig - resolve rebuild permissions

On Thu, Sep 04, 2003 at 11:31:33AM -0700, Stephen Hemminger wrote:
> This patch fixes it by removing the configs.o file when
> needed.

A better approach would be to remove the need for compile.h from
configs.c. See attached patch for the makefile change.
It just took the relevant part from mk_compile and
used it in the Makefile.
Example only - I expect Randy to integrate it properly.

But what you see is also a more fundamental problem.
Should we allow the kernel to be build by two distinct users -
in this case a normal user and root.

We could check for this early, and stop. But it would require
too many changes in the top-level Makefile for my taste.

Sam

===== kernel/Makefile 1.33 vs edited =====
--- 1.33/kernel/Makefile Mon Sep 1 01:13:58 2003
+++ edited/kernel/Makefile Thu Sep 4 21:05:29 2003
@@ -19,6 +19,7 @@
obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_IKCONFIG) += configs.o
+CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"

ifneq ($(CONFIG_IA64),y)
# According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is

2003-09-05 01:09:51

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] ikconfig - resolve rebuild permissions

> On Thu, Sep 04, 2003 at 11:31:33AM -0700, Stephen Hemminger wrote:
>> This patch fixes it by removing the configs.o file when
>> needed.
>
> A better approach would be to remove the need for compile.h from
> configs.c. See attached patch for the makefile change.
> It just took the relevant part from mk_compile and
> used it in the Makefile.
> Example only - I expect Randy to integrate it properly.

configs.o also wants UTS_RELEASE from compile.h, and
I really dislike generating the same data in multiple places,
so I prefer to continue to use compile.h.
I'll see about other options or using Steve's patch.

Thanks,
~Randy


> ===== kernel/Makefile 1.33 vs edited =====
> --- 1.33/kernel/Makefile Mon Sep 1 01:13:58 2003
> +++ edited/kernel/Makefile Thu Sep 4 21:05:29 2003
> @@ -19,6 +19,7 @@
> obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
> obj-$(CONFIG_COMPAT) += compat.o
> obj-$(CONFIG_IKCONFIG) += configs.o
> +CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"
>
> ifneq ($(CONFIG_IA64),y)
> # According to Alan Modra <[email protected]>, the
> -fno-omit-frame-pointer is
> -



2003-09-05 01:22:57

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] ikconfig - resolve rebuild permissions

>> On Thu, Sep 04, 2003 at 11:31:33AM -0700, Stephen Hemminger wrote:
>>> This patch fixes it by removing the configs.o file when
>>> needed.
>>
>> A better approach would be to remove the need for compile.h from
>> configs.c. See attached patch for the makefile change.
>> It just took the relevant part from mk_compile and
>> used it in the Makefile.
>> Example only - I expect Randy to integrate it properly.
>
> configs.o also wants UTS_RELEASE from compile.h, and

UTS_RELEASE is not from compile.h....
so Sam's patch looks reasonable, working on it now.

> I really dislike generating the same data in multiple places,
> so I prefer to continue to use compile.h.
> I'll see about other options or using Steve's patch.

~Randy



2003-09-05 01:50:31

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] ikconfig - resolve rebuild permissions

On Thu, 4 Sep 2003 21:13:53 +0200 Sam Ravnborg <[email protected]> wrote:

| On Thu, Sep 04, 2003 at 11:31:33AM -0700, Stephen Hemminger wrote:
| > This patch fixes it by removing the configs.o file when
| > needed.
|
| A better approach would be to remove the need for compile.h from
| configs.c. See attached patch for the makefile change.
| It just took the relevant part from mk_compile and
| used it in the Makefile.
| Example only - I expect Randy to integrate it properly.

Steve, can you test this? I don't have/see the problem.
Anyway, configs.c no longer uses compile.h with this patch,
so hopefully this will fix it.

Thanks for the patch, Sam.

This patch is against 2.6.0-test4-current of 2003-09-04 evening PST.

--
~Randy


patch_name: no_compile_h.patch
patch_version: 2003-09-04.18:36:25
author: Randy.Dunlap <[email protected]>
description: don't use compile.h in kernel/configs.c
product: Linux
product_versions: 260-904
diffstat: =
kernel/Makefile | 1 +
kernel/configs.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-

diff -Naur ./kernel/Makefile~compile ./kernel/Makefile
--- ./kernel/Makefile~compile 2003-09-04 16:34:58.000000000 -0700
+++ ./kernel/Makefile 2003-09-04 18:23:07.000000000 -0700
@@ -20,6 +20,7 @@
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_IKCONFIG) += configs.o
obj-$(CONFIG_IKCONFIG_PROC) += configs.o
+CFLAGS_configs.o = -DLINUX_COMPILER="$(shell $(CC) -v 2>&1 | tail -n 1)"

ifneq ($(CONFIG_IA64),y)
# According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
diff -Naur ./kernel/configs.c~compile ./kernel/configs.c
--- ./kernel/configs.c~compile 2003-09-04 16:34:58.000000000 -0700
+++ ./kernel/configs.c 2003-09-04 18:30:40.000000000 -0700
@@ -28,8 +28,8 @@
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/stringify.h>
#include <linux/init.h>
-#include <linux/compile.h>
#include <linux/version.h>
#include <asm/uaccess.h>

@@ -81,7 +81,7 @@
{
seq_printf(seq,
"Kernel: %s\nCompiler: %s\nVersion_in_Makefile: %s\n",
- ikconfig_build_info, LINUX_COMPILER, UTS_RELEASE);
+ ikconfig_build_info, __stringify(LINUX_COMPILER), UTS_RELEASE);
return 0;
}