public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sysctl
@ 2006-10-18 18:23 Albert Cahalan
  2006-10-18 18:27 ` sysctl David KOENIG
  2006-10-18 18:31 ` sysctl Linus Torvalds
  0 siblings, 2 replies; 24+ messages in thread
From: Albert Cahalan @ 2006-10-18 18:23 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Linus Torvalds, ebiederm

In the wireless-extensions thread, Linus writes:

> In general, the answer to "when can we break user space" is very simple.
>
> Never.
>
> It's just not acceptable. We maintain old interfaces for years (and in
> some cases, well over a decade by now), simply because the pain from not
> doing so is horrendous, and it makes debugging impossible. You get into
> situations where users need to upgrade to tools that don't work with older
> kernels, and can thus not downgrade, etc etc.

I guess the sysctl question has been answered then,
especially since random normal apps use sysctl.

If it needs a maintainer, put me down.

I think the main problem was fixed long ago,
by assigning fixed numbers to the enum values.
Practically no other kernel code uses an enum
for an ABI, and I think we can see why.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 18:23 sysctl Albert Cahalan
@ 2006-10-18 18:27 ` David KOENIG
  2006-10-18 18:31 ` sysctl Linus Torvalds
  1 sibling, 0 replies; 24+ messages in thread
From: David KOENIG @ 2006-10-18 18:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Albert Cahalan

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Albert Cahalan wrote:
> In the wireless-extensions thread, Linus writes:
> 
>> In general, the answer to "when can we break user space" is very simple.
>>
>> Never.
>>
>> It's just not acceptable. We maintain old interfaces for years (and in
>> some cases, well over a decade by now), simply because the pain from not
>> doing so is horrendous, and it makes debugging impossible. You get into
>> situations where users need to upgrade to tools that don't work with
>> older
>> kernels, and can thus not downgrade, etc etc.
> 
> I guess the sysctl question has been answered then,
> especially since random normal apps use sysctl.
> 
> If it needs a maintainer, put me down.
> 
> I think the main problem was fixed long ago,
> by assigning fixed numbers to the enum values.
> Practically no other kernel code uses an enum
> for an ABI, and I think we can see why.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
How about rewriting sysctl so that it refers to the real way (with /proc)?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFNnIQmhCgVPlWJY8RAiTCAKDUtO4L7XqWo7+vC2vlhltdcb/L3ACfXSeM
Ii48VQu3334MkrGc23StPSA=
=pcCo
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 18:23 sysctl Albert Cahalan
  2006-10-18 18:27 ` sysctl David KOENIG
@ 2006-10-18 18:31 ` Linus Torvalds
  2006-10-18 18:52   ` sysctl Cal Peake
  1 sibling, 1 reply; 24+ messages in thread
From: Linus Torvalds @ 2006-10-18 18:31 UTC (permalink / raw)
  To: Albert Cahalan; +Cc: linux-kernel, Andrew Morton, ebiederm



On Wed, 18 Oct 2006, Albert Cahalan wrote:
> 
> I guess the sysctl question has been answered then,
> especially since random normal apps use sysctl.

I have yet to find a _single_ app that really uses sysctl, actually. Can 
you name one?

There's apparently some library functions that has used it in the past, 
and I've seen a few effects of that:

	warning: process `wish' used the removed sysctl system call

but the users all had fallback positions, so I don't think anything 
actually broke.

(The situation may be different with older libraries, which is why it's 
still an option to compile in sysctl. None of the machines I had access 
to cared at all, though).

		Linus

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 18:31 ` sysctl Linus Torvalds
@ 2006-10-18 18:52   ` Cal Peake
  2006-10-18 19:12     ` sysctl Olaf Hering
  2006-10-18 19:44     ` sysctl Andrew Morton
  0 siblings, 2 replies; 24+ messages in thread
From: Cal Peake @ 2006-10-18 18:52 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Albert Cahalan, linux-kernel, Andrew Morton, ebiederm

On Wed, 18 Oct 2006, Linus Torvalds wrote:

> There's apparently some library functions that has used it in the past, 
> and I've seen a few effects of that:
> 
> 	warning: process `wish' used the removed sysctl system call
> 
> but the users all had fallback positions, so I don't think anything 
> actually broke.

Agreed, nothing seems to have broken by removing it but the warnings sure 
are ugly. Is there any reason to have them? If a program relies on sysctl 
and the call fails the program should properly handle the error. That 
should be all the warning that's needed (i.e. report the broken program 
and get it fixed).

> (The situation may be different with older libraries, which is why it's 
> still an option to compile in sysctl. None of the machines I had access 
> to cared at all, though).

So leave it as is for now, default to off with option to compile in if 
EMBEDDED and then remove it completely in a few months?

  - C.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 18:52   ` sysctl Cal Peake
@ 2006-10-18 19:12     ` Olaf Hering
  2006-10-18 19:44     ` sysctl Andrew Morton
  1 sibling, 0 replies; 24+ messages in thread
From: Olaf Hering @ 2006-10-18 19:12 UTC (permalink / raw)
  To: Cal Peake
  Cc: Linus Torvalds, Albert Cahalan, linux-kernel, Andrew Morton,
	ebiederm

On Wed, Oct 18, Cal Peake wrote:

> On Wed, 18 Oct 2006, Linus Torvalds wrote:
> 
> > There's apparently some library functions that has used it in the past, 
> > and I've seen a few effects of that:
> > 
> > 	warning: process `wish' used the removed sysctl system call
> > 
> > but the users all had fallback positions, so I don't think anything 
> > actually broke.
> 
> Agreed, nothing seems to have broken by removing it but the warnings sure 
> are ugly. Is there any reason to have them? If a program relies on sysctl 
> and the call fails the program should properly handle the error. That 
> should be all the warning that's needed (i.e. report the broken program 
> and get it fixed).

You will not see the warning for your failing app anyway due to the max
tries == 5 limit. With SLES10 the boot scripts trigger it already.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 18:52   ` sysctl Cal Peake
  2006-10-18 19:12     ` sysctl Olaf Hering
@ 2006-10-18 19:44     ` Andrew Morton
  2006-10-18 21:06       ` sysctl Cal Peake
  2006-10-19  4:41       ` [RFC] [PATCH] Improve the remove sysctl warnings Eric W. Biederman
  1 sibling, 2 replies; 24+ messages in thread
From: Andrew Morton @ 2006-10-18 19:44 UTC (permalink / raw)
  To: Cal Peake; +Cc: Linus Torvalds, Albert Cahalan, linux-kernel, ebiederm

On Wed, 18 Oct 2006 14:52:21 -0400 (EDT)
Cal Peake <cp@absolutedigital.net> wrote:

> On Wed, 18 Oct 2006, Linus Torvalds wrote:
> 
> > There's apparently some library functions that has used it in the past, 
> > and I've seen a few effects of that:
> > 
> > 	warning: process `wish' used the removed sysctl system call
> > 
> > but the users all had fallback positions, so I don't think anything 
> > actually broke.
> 
> Agreed, nothing seems to have broken by removing it but the warnings sure 
> are ugly. Is there any reason to have them? If a program relies on sysctl 
> and the call fails the program should properly handle the error. That 
> should be all the warning that's needed (i.e. report the broken program 
> and get it fixed).

We should have added the sysctl numbers to that warning.

Lots of things do sysctl(KERN_VERSION), including FC5's date(1).  Andi's
proposal to put some hard-wired KERN_VERSION emulator in there sounds
reasonable to me, depending upon how many other things we'll need to
emulate (which we don't know yet).

> > (The situation may be different with older libraries, which is why it's 
> > still an option to compile in sysctl. None of the machines I had access 
> > to cared at all, though).
> 
> So leave it as is for now, default to off with option to compile in if 
> EMBEDDED and then remove it completely in a few months?

It should always be an objective to remove code if we can feasibly find a
way to do so.  For us to give up now and to leave all that goop in there
forever would be sad.

A patch which enhances that printk would be appreciated...

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: sysctl
  2006-10-18 19:44     ` sysctl Andrew Morton
@ 2006-10-18 21:06       ` Cal Peake
  2006-10-19  4:41       ` [RFC] [PATCH] Improve the remove sysctl warnings Eric W. Biederman
  1 sibling, 0 replies; 24+ messages in thread
From: Cal Peake @ 2006-10-18 21:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, Albert Cahalan, linux-kernel, ebiederm

On Wed, 18 Oct 2006, Andrew Morton wrote:

> We should have added the sysctl numbers to that warning.
> 
> Lots of things do sysctl(KERN_VERSION), including FC5's date(1).  Andi's
> proposal to put some hard-wired KERN_VERSION emulator in there sounds
> reasonable to me, depending upon how many other things we'll need to
> emulate (which we don't know yet).
> 
> A patch which enhances that printk would be appreciated...

I'll take a stab at doing that this evening if nobody beats me to it.

  - C.

-- 
"There is nothing wrong with your television set. Do not attempt
    to adjust the picture. We are controlling transmission."
                    -- The Outer Limits


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [RFC] [PATCH] Improve the remove sysctl warnings.
  2006-10-18 19:44     ` sysctl Andrew Morton
  2006-10-18 21:06       ` sysctl Cal Peake
@ 2006-10-19  4:41       ` Eric W. Biederman
  2006-10-19 16:25         ` Cal Peake
  1 sibling, 1 reply; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-19  4:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Cal Peake, Linus Torvalds, Albert Cahalan, linux-kernel, ebiederm


Andrew how does this look?

Don't warn about libpthread's access to kernel.version.
When it receives -ENOSYS it will read /proc/sys/kernel/version.

If anything else shows up print the sysctl number string.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 kernel/sysctl.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8020fb2..19124ee 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2676,13 +2676,33 @@ #else /* CONFIG_SYSCTL_SYSCALL */
 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
 {
 	static int msg_count;
+	struct __sysctl_args tmp;
+	int name[CTL_MAXNAME];
+	int i;
+
+	/* Read in the sysctl name for better debug message logging */
+	if (copy_from_user(&tmp, args, sizeof(tmp)))
+		return -EFAULT;
+	if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
+		return -ENOTDIR;
+	for (i = 0; i < tmp.nlen; i++)
+		if (get_user(name[i], tmp.name + i))
+			return -EFAULT;
 
+	/* Ignore accesses to kernel.version */
+	if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
+		goto out;
+	
 	if (msg_count < 5) {
 		msg_count++;
 		printk(KERN_INFO
 			"warning: process `%s' used the removed sysctl "
-			"system call\n", current->comm);
+			"system call with ", current->comm);
+		for (i = 0; i < tmp.nlen; i++)
+			printk("%d.", name[i]);
+		printk("\n");
 	}
+out:
 	return -ENOSYS;
 }
 
-- 
1.4.2.rc3.g7e18e-dirty


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [RFC] [PATCH] Improve the remove sysctl warnings.
  2006-10-19  4:41       ` [RFC] [PATCH] Improve the remove sysctl warnings Eric W. Biederman
@ 2006-10-19 16:25         ` Cal Peake
  2006-10-19 19:50           ` Alexey Dobriyan
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
  0 siblings, 2 replies; 24+ messages in thread
From: Cal Peake @ 2006-10-19 16:25 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Andrew Morton, Linus Torvalds, Albert Cahalan, linux-kernel

On Wed, 18 Oct 2006, Eric W. Biederman wrote:

>  	if (msg_count < 5) {
>  		msg_count++;
>  		printk(KERN_INFO
>  			"warning: process `%s' used the removed sysctl "
> -			"system call\n", current->comm);
> +			"system call with ", current->comm);
> +		for (i = 0; i < tmp.nlen; i++)
> +			printk("%d.", name[i]);
> +		printk("\n");
>  	}

We should prolly kill the counter now. Other than that it works for me. 
Thanks Eric!

  - C.

-- 
"There is nothing wrong with your television set. Do not attempt
    to adjust the picture. We are controlling transmission."
                    -- The Outer Limits


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC] [PATCH] Improve the remove sysctl warnings.
  2006-10-19 16:25         ` Cal Peake
@ 2006-10-19 19:50           ` Alexey Dobriyan
  2006-10-19 19:55             ` Cal Peake
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
  1 sibling, 1 reply; 24+ messages in thread
From: Alexey Dobriyan @ 2006-10-19 19:50 UTC (permalink / raw)
  To: Cal Peake
  Cc: Eric W. Biederman, Andrew Morton, Linus Torvalds, Albert Cahalan,
	linux-kernel

On Thu, Oct 19, 2006 at 12:25:20PM -0400, Cal Peake wrote:
> On Wed, 18 Oct 2006, Eric W. Biederman wrote:
>
> >  	if (msg_count < 5) {
> >  		msg_count++;
> >  		printk(KERN_INFO
> >  			"warning: process `%s' used the removed sysctl "
> > -			"system call\n", current->comm);
> > +			"system call with ", current->comm);
> > +		for (i = 0; i < tmp.nlen; i++)
> > +			printk("%d.", name[i]);
> > +		printk("\n");
> >  	}
>
> We should prolly kill the counter now.

sysctl(2) callable by everyone including local lusers willing to fill logs.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC] [PATCH] Improve the remove sysctl warnings.
  2006-10-19 19:50           ` Alexey Dobriyan
@ 2006-10-19 19:55             ` Cal Peake
  0 siblings, 0 replies; 24+ messages in thread
From: Cal Peake @ 2006-10-19 19:55 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: Eric W. Biederman, Andrew Morton, Linus Torvalds, Albert Cahalan,
	linux-kernel

On Thu, 19 Oct 2006, Alexey Dobriyan wrote:

> On Thu, Oct 19, 2006 at 12:25:20PM -0400, Cal Peake wrote:
> > On Wed, 18 Oct 2006, Eric W. Biederman wrote:
> >
> > >  	if (msg_count < 5) {
> > >  		msg_count++;
> > >  		printk(KERN_INFO
> > >  			"warning: process `%s' used the removed sysctl "
> > > -			"system call\n", current->comm);
> > > +			"system call with ", current->comm);
> > > +		for (i = 0; i < tmp.nlen; i++)
> > > +			printk("%d.", name[i]);
> > > +		printk("\n");
> > >  	}
> >
> > We should prolly kill the counter now.
> 
> sysctl(2) callable by everyone including local lusers willing to fill logs.

Users don't even need to write a program to do this, see logger(1). If we 
keep the counter then after 5 calls we lose potential debugging info.

  - C.

-- 
"There is nothing wrong with your television set. Do not attempt
    to adjust the picture. We are controlling transmission."
                    -- The Outer Limits


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [CFT] Grep to find users of sys_sysctl.
  2006-10-19 16:25         ` Cal Peake
  2006-10-19 19:50           ` Alexey Dobriyan
@ 2006-10-20  7:05           ` Eric W. Biederman
  2006-10-20  7:35             ` Andrew Morton
                               ` (3 more replies)
  1 sibling, 4 replies; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-20  7:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Linus Torvalds, Albert Cahalan, Cal Peake


Anyone who is interested in knowing if they have an application on
their system that actually uses sys_sysctl please run the following grep.

find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 

The -perm /111 is an optimization to only look at executable files,
and may be omitted if you are patient.

Currently I don't expect anyone to find a match anywhere except in libpthreads,
if you find any others please let me know.

Eric

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
@ 2006-10-20  7:35             ` Andrew Morton
  2006-10-20 12:54               ` Eric W. Biederman
  2006-10-20  7:52             ` Russell King
                               ` (2 subsequent siblings)
  3 siblings, 1 reply; 24+ messages in thread
From: Andrew Morton @ 2006-10-20  7:35 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: linux-kernel, Linus Torvalds, Albert Cahalan, Cal Peake

On Fri, 20 Oct 2006 01:05:18 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> 
> Anyone who is interested in knowing if they have an application on
> their system that actually uses sys_sysctl please run the following grep.
> 
> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 
> 
> The -perm /111 is an optimization to only look at executable files,
> and may be omitted if you are patient.
> 
> Currently I don't expect anyone to find a match anywhere except in libpthreads,
> if you find any others please let me know.
> 

http://www.google.com/codesearch

there are a few hits...

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
  2006-10-20  7:35             ` Andrew Morton
@ 2006-10-20  7:52             ` Russell King
  2006-10-20 14:38               ` Eric W. Biederman
  2006-10-20  8:02             ` Jakub Jelinek
  2006-10-20 17:54             ` Marco Roeland
  3 siblings, 1 reply; 24+ messages in thread
From: Russell King @ 2006-10-20  7:52 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Albert Cahalan,
	Cal Peake

On Fri, Oct 20, 2006 at 01:05:18AM -0600, Eric W. Biederman wrote:
> Anyone who is interested in knowing if they have an application on
> their system that actually uses sys_sysctl please run the following grep.
> 
> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 
> 
> The -perm /111 is an optimization to only look at executable files,
> and may be omitted if you are patient.
> 
> Currently I don't expect anyone to find a match anywhere except in libpthreads,
> if you find any others please let me know.

glibc on ARM _requires_ sys_sysctl for userspace ioperm, inb, outb etc
emulation.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
  2006-10-20  7:35             ` Andrew Morton
  2006-10-20  7:52             ` Russell King
@ 2006-10-20  8:02             ` Jakub Jelinek
  2006-10-20 13:41               ` Eric W. Biederman
  2006-10-20 17:54             ` Marco Roeland
  3 siblings, 1 reply; 24+ messages in thread
From: Jakub Jelinek @ 2006-10-20  8:02 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Albert Cahalan,
	Cal Peake

On Fri, Oct 20, 2006 at 01:05:18AM -0600, Eric W. Biederman wrote:
> 
> Anyone who is interested in knowing if they have an application on
> their system that actually uses sys_sysctl please run the following grep.
> 
> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 

This assumes the binaries and/or libraries are not stripped, and they
usually are stripped.  So, it is better to run something like:
find / -type f -perm /111 | while read f; do readelf -Ws $f 2>/dev/null | fgrep -q sysctl@GLIBC && echo $f; done

	Jakub

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:35             ` Andrew Morton
@ 2006-10-20 12:54               ` Eric W. Biederman
  2006-10-20 16:39                 ` Andrew Morton
  0 siblings, 1 reply; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-20 12:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Linus Torvalds, Albert Cahalan, Cal Peake

Andrew Morton <akpm@osdl.org> writes:

> On Fri, 20 Oct 2006 01:05:18 -0600
> ebiederm@xmission.com (Eric W. Biederman) wrote:
>
>> 
>> Anyone who is interested in knowing if they have an application on
>> their system that actually uses sys_sysctl please run the following grep.
>> 
>> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 
>> 
>> The -perm /111 is an optimization to only look at executable files,
>> and may be omitted if you are patient.
>> 
>> Currently I don't expect anyone to find a match anywhere except in
> libpthreads,
>> if you find any others please let me know.
>> 
>
> http://www.google.com/codesearch
>
> there are a few hits...

What were you using for search criteria?

A challenge is to weed out code that runs on BSDs where people do use sysctl.

Eric

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  8:02             ` Jakub Jelinek
@ 2006-10-20 13:41               ` Eric W. Biederman
  0 siblings, 0 replies; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-20 13:41 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Albert Cahalan,
	Cal Peake

Jakub Jelinek <jakub@redhat.com> writes:

> On Fri, Oct 20, 2006 at 01:05:18AM -0600, Eric W. Biederman wrote:
>> 
>> Anyone who is interested in knowing if they have an application on
>> their system that actually uses sys_sysctl please run the following grep.
>> 
>> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 
>
> This assumes the binaries and/or libraries are not stripped, and they
> usually are stripped.  So, it is better to run something like:
> find / -type f -perm /111 | while read f; do readelf -Ws $f 2>/dev/null | fgrep
> -q sysctl@GLIBC && echo $f; done

Thanks the better grep helps.

Eric

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:52             ` Russell King
@ 2006-10-20 14:38               ` Eric W. Biederman
  2006-10-20 15:18                 ` Albert Cahalan
  2006-10-20 15:46                 ` Bill Nottingham
  0 siblings, 2 replies; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-20 14:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Linus Torvalds, Albert Cahalan, Cal Peake,
	Andi Kleen, Alan Cox

Jakub Jelinek <jakub@redhat.com> writes:

> This assumes the binaries and/or libraries are not stripped, and they
> usually are stripped.  So, it is better to run something like:
> find / -type f -perm /111 | while read f; do readelf -Ws $f 2>/dev/null | fgrep
> -q sysctl@GLIBC && echo $f; done

Russell King <rmk+lkml@arm.linux.org.uk> writes:
> glibc on ARM _requires_ sys_sysctl for userspace ioperm, inb, outb etc
> emulation.


It looks like we have a small but interesting set of sysctl users.

The list of files below is a composite from a number of systems I have
access to, and the reply I have gotten so far.  I'm still hoping to hear
from other people so I can add some other users of sysctl to my list.

I'm still investigating to see how all of these pieces are using
sysctl, and how much they care:
- radvd seems to be an upstanding user.
- libsensors seems to be using sysctls so we have no responsibility to
  maintain the ABI there.
- libpthread uses sysctl but it doesn't much care.
- module_upgrade seems to be setting the printk verbosity?

The nvidia-installer sounds like a scary piece of code.

I'm puzzled why the majority of the users seem to be concentrated
in system configuration software and installers. 

These 


Compiling the results I have so far (Some of these are from older distros):
/sbin/kmodule
/sbin/sndconfig
/usr/X11R6/bin/Xconfigurator
/usr/bin/tiny-nvidia-installer
/usr/bin/nvidia-installer
/usr/sbin/glidelink
/usr/sbin/kudzu
/usr/sbin/module_upgrade
/usr/sbin/mouseconfig
/usr/sbin/radvd
/usr/sbin/updfstab

/usr/lib/libsensors.so.1.2.1
/usr/lib/libsensors.so.3.1.0
/usr/lib/libsensors.so.3.0.9
/usr/lib64/libsensors.so.2.0.0
/usr/lib64/libsensors.so.3.0.9

/usr/lib/python1.5/site-packages/_kudzumodule.so
/usr/lib/python2.2/site-packages/_kudzumodule.so
/usr/lib/python2.3/site-packages/_kudzumodule.so
/usr/lib64/python2.4/site-packages/_kudzumodule.so

/lib/i686/libpthread-0.10.so
/lib/i686/libpthread.so.0
/lib/i686/nosegneg/libpthread-2.4.so
/lib/libpthread-0.10.so
/lib/libpthread-0.9.so
/lib/libpthread.so.0
/lib/tls/libpthread-2.3.3.so
/lib/tls/libpthread-2.3.5.so
/lib/tls/libpthread-2.3.6.so
/lib/tls/libpthread.so.0
/lib/libpthread-2.4.so
/lib64/libpthread.so.0
/lib64/tls/libpthread.so.0
/lib64/libpthread-2.4.so
/usr/i386-glibc22-linux/lib/libpthread-0.9.so
/usr/i386-glibc22-linux/lib/libpthread.so.0


Eric

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20 14:38               ` Eric W. Biederman
@ 2006-10-20 15:18                 ` Albert Cahalan
  2006-10-21 10:53                   ` Eric W. Biederman
  2006-10-20 15:46                 ` Bill Nottingham
  1 sibling, 1 reply; 24+ messages in thread
From: Albert Cahalan @ 2006-10-20 15:18 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Cal Peake,
	Andi Kleen, Alan Cox

On 10/20/06, Eric W. Biederman <ebiederm@xmission.com> wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
>
> > This assumes the binaries and/or libraries are not stripped, and they
> > usually are stripped.  So, it is better to run something like:
> > find / -type f -perm /111 | while read f; do readelf -Ws $f 2>/dev/null | fgrep
> > -q sysctl@GLIBC && echo $f; done
>
> Russell King <rmk+lkml@arm.linux.org.uk> writes:
> > glibc on ARM _requires_ sys_sysctl for userspace ioperm, inb, outb etc
> > emulation.
>
>
> It looks like we have a small but interesting set of sysctl users.
>
> The list of files below is a composite from a number of systems I have
> access to, and the reply I have gotten so far.  I'm still hoping to hear
> from other people so I can add some other users of sysctl to my list.

So does Linux now only support GLIBC apps? That's what your
grep seems to imply. At least one of the free Pascal compilers
does not use GLIBC. You won't find a GLIBC sysctl symbol in
any of the alternate C libraries (there are many) or even in libc5.

Running your grep on developer machines is highly biased
against legacy business apps.

Despite the desires of some fanatics, Linux does support an ABI
which is used by closed-source apps. Sometimes people even
lose their source code, perhaps via corporate reorganization.
I don't expect you plan to help anybody whose business depends
on some crufty old software...?

We have lots worse cruft if you want to go on a cleaning rampage.
We have old syscalls that can't handle modern data types.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20 14:38               ` Eric W. Biederman
  2006-10-20 15:18                 ` Albert Cahalan
@ 2006-10-20 15:46                 ` Bill Nottingham
  1 sibling, 0 replies; 24+ messages in thread
From: Bill Nottingham @ 2006-10-20 15:46 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Albert Cahalan,
	Cal Peake, Andi Kleen, Alan Cox

Eric W. Biederman (ebiederm@xmission.com) said: 
> - module_upgrade seems to be setting the printk verbosity?

Reading the current verbosity; setting it is done with sys_syslog.
Could be ported to read it out of /proc/sys/kernel/printk; that's
just more lines of code. (All this code is dying anyway, so... eh,
whatever.)

Bill

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20 12:54               ` Eric W. Biederman
@ 2006-10-20 16:39                 ` Andrew Morton
  2006-10-21 10:23                   ` Eric W. Biederman
  0 siblings, 1 reply; 24+ messages in thread
From: Andrew Morton @ 2006-10-20 16:39 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: linux-kernel, Linus Torvalds, Albert Cahalan, Cal Peake

On Fri, 20 Oct 2006 06:54:43 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> > On Fri, 20 Oct 2006 01:05:18 -0600
> > ebiederm@xmission.com (Eric W. Biederman) wrote:
> >
> >> 
> >> Anyone who is interested in knowing if they have an application on
> >> their system that actually uses sys_sysctl please run the following grep.
> >> 
> >> find / -type f  -perm /111 -exec fgrep 'sysctl@@GLIBC' '{}' ';' 
> >> 
> >> The -perm /111 is an optimization to only look at executable files,
> >> and may be omitted if you are patient.
> >> 
> >> Currently I don't expect anyone to find a match anywhere except in
> > libpthreads,
> >> if you find any others please let me know.
> >> 
> >
> > http://www.google.com/codesearch
> >
> > there are a few hits...
> 
> What were you using for search criteria?
> 
> A challenge is to weed out code that runs on BSDs where people do use sysctl.

I just used "sysctl" and clicked a lot.

>From a quick scan:

http://www.google.com/codesearch?q=+sysctl+linux+-glibc+show:ezM3VpAIwOY:VqU4ELp0K4A:GC7QFUptQys&sa=N&cd=51&ct=rc&cs_p=http://www.xorp.org/releases/0.2/xorp-0.2.tar.gz&cs_f=xorp-0.2/ospfd/linux/system.C#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:dPzMrf8geLs:EbNoGzoYDAc:I-_8YloL1fY&sa=N&cd=11&ct=rc&cs_p=http://www.openwall.com/scanlogd/lib/libnet-1.1.3-RC-01.tar.gz&cs_f=libnet/src/libnet_link_bpf.c#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:QQ2BcrelppE:zZeMmMrGko0:BFmHNHvdqyA&sa=N&cd=17&ct=rc&cs_p=http://www.cpan.org/authors/id/B/BR/BRYCE/Test-Parser-1.4.tar.gz&cs_f=Test-Parser-1.4/lib/Test/Parser/Sysctl.pm#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:yqt7gBTAktI:350f8_WXUz8:J6r1Ge4gTiw&sa=N&cd=23&ct=rc&cs_p=http://darwinsource.opendarwin.org/tarballs/apsl/top-9.tar.gz&cs_f=top-9/libtop.c#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:-9-E1kR2zW0:HD_LhbY9gNM:Wt7DONTBSR4&sa=N&cd=65&ct=rc&cs_p=http://sparemint.atariforge.net/sparemint/mint/kernel/1.15.12/freemint-1.15.12-src.tar.gz&cs_f=freemint-1.15.12/tools/sysctl/sysctl.c#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:A8hxeTvi8Lc:rlNCNnWdQuo:lUO9tYzCStY&sa=N&cd=102&ct=rc&cs_p=http://www.opensource.apple.com/darwinsource/tarballs/other/OpenLDAP-69.0.2.tar.gz&cs_f=OpenLDAP-69.0.2/OpenLDAP/libraries/liblutil/uuid.c#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:8eVH0Ss2hrY:Yg_zU6fz4U8:akq5ZzLPf34&sa=N&cd=107&ct=rc&cs_p=ftp://ftp.stacken.kth.se/pub/arla/arla-0.42.tar.gz&cs_f=arla-0.42/lib/roken/getdtablesize.c#a0

http://www.google.com/codesearch?q=+sysctl+-glibc+show:NXzHfAnEMjg:ZIWovlf1IWU:WZdEzr-Zs0o&sa=N&cd=112&ct=rc&cs_p=http://gentoo.osuosl.org/distfiles/bind-9.3.2-P1.tar.gz&cs_f=bind-9.3.2-P1/lib/isc/unix/ifiter_sysctl.c#a0

Quite a lot of networking-related utilities.  Including bind and openldap.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
                               ` (2 preceding siblings ...)
  2006-10-20  8:02             ` Jakub Jelinek
@ 2006-10-20 17:54             ` Marco Roeland
  3 siblings, 0 replies; 24+ messages in thread
From: Marco Roeland @ 2006-10-20 17:54 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Albert Cahalan,
	Cal Peake

On Friday October 20th 2006 at 01:05 uur Eric W. Biederman wrote:

> Currently I don't expect anyone to find a match anywhere except in libpthreads,
> if you find any others please let me know.

/usr/bin/qemu-mipsel
/usr/bin/qemu-i386
/usr/bin/qemu-arm
/usr/bin/qemu-ppc
/usr/bin/qemu-mips
/usr/bin/qemu-armeb
/usr/bin/qemu-sparc

This is on Debian 'sid' x86-64.
-- 
Marco Roeland

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20 16:39                 ` Andrew Morton
@ 2006-10-21 10:23                   ` Eric W. Biederman
  0 siblings, 0 replies; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-21 10:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Linus Torvalds, Albert Cahalan, Cal Peake

Andrew Morton <akpm@osdl.org> writes:

>> What were you using for search criteria?
>> 
>> A challenge is to weed out code that runs on BSDs where people do use sysctl.
>
> I just used "sysctl" and clicked a lot.

Ok, no secrets from hanging out at google :)

>>From a quick scan:
>
> http://www.google.com/codesearch?q=+sysctl+linux+-glibc+show:ezM3VpAIwOY:VqU4ELp0K4A:GC7QFUptQys&sa=N&cd=51&ct=rc&cs_p=http://www.xorp.org/releases/0.2/xorp-0.2.tar.gz&cs_f=xorp-0.2/ospfd/linux/system.C#a0

Definitely linux.

> http://www.google.com/codesearch?q=+sysctl+-glibc+show:dPzMrf8geLs:EbNoGzoYDAc:I-_8YloL1fY&sa=N&cd=11&ct=rc&cs_p=http://www.openwall.com/scanlogd/lib/libnet-1.1.3-RC-01.tar.gz&cs_f=libnet/src/libnet_link_bpf.c#a0

I believe this is a false positive, I can't see how this code compiles on linux.

> http://www.google.com/codesearch?q=+sysctl+-glibc+show:QQ2BcrelppE:zZeMmMrGko0:BFmHNHvdqyA&sa=N&cd=17&ct=rc&cs_p=http://www.cpan.org/authors/id/B/BR/BRYCE/Test-Parser-1.4.tar.gz&cs_f=Test-Parser-1.4/lib/Test/Parser/Sysctl.pm#a0

Pass through infrastructure so to see a real user would need something at a higher level.

> http://www.google.com/codesearch?q=+sysctl+-glibc+show:yqt7gBTAktI:350f8_WXUz8:J6r1Ge4gTiw&sa=N&cd=23&ct=rc&cs_p=http://darwinsource.opendarwin.org/tarballs/apsl/top-9.tar.gz&cs_f=top-9/libtop.c#a0
>
> http://www.google.com/codesearch?q=+sysctl+-glibc+show:-9-E1kR2zW0:HD_LhbY9gNM:Wt7DONTBSR4&sa=N&cd=65&ct=rc&cs_p=http://sparemint.atariforge.net/sparemint/mint/kernel/1.15.12/freemint-1.15.12-src.tar.gz&cs_f=freemint-1.15.12/tools/sysctl/sysctl.c#a0
>
> http://www.google.com/codesearch?q=+sysctl+-glibc+show:A8hxeTvi8Lc:rlNCNnWdQuo:lUO9tYzCStY&sa=N&cd=102&ct=rc&cs_p=http://www.opensource.apple.com/darwinsource/tarballs/other/OpenLDAP-69.0.2.tar.gz&cs_f=OpenLDAP-69.0.2/OpenLDAP/libraries/liblutil/uuid.c#a0

No offense to apple but in I since they are BSDs they have a usable sysctl so
I have been ignoring code from there site as a likely source of false positives.

>
> http://www.google.com/codesearch?q=+sysctl+-glibc+show:8eVH0Ss2hrY:Yg_zU6fz4U8:akq5ZzLPf34&sa=N&cd=107&ct=rc&cs_p=ftp://ftp.stacken.kth.se/pub/arla/arla-0.42.tar.gz&cs_f=arla-0.42/lib/roken/getdtablesize.c#a0
>
> http://www.google.com/codesearch?q=+sysctl+-glibc+show:NXzHfAnEMjg:ZIWovlf1IWU:WZdEzr-Zs0o&sa=N&cd=112&ct=rc&cs_p=http://gentoo.osuosl.org/distfiles/bind-9.3.2-P1.tar.gz&cs_f=bind-9.3.2-P1/lib/isc/unix/ifiter_sysctl.c#a0
>
> Quite a lot of networking-related utilities.  Including bind and openldap.

It is hard to tell on portable application like that.  By looking at the compiled
version bind definitely does not call sysctl.  At least not the copy I have.

This is not meant to argue that the approach is worthless, but rather to show
the pain of weeding out false positives and why I started greping through
the imported symbols of binaries, on linux.  At least there everything
that is found is 100% a user.

Eric


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [CFT] Grep to find users of sys_sysctl.
  2006-10-20 15:18                 ` Albert Cahalan
@ 2006-10-21 10:53                   ` Eric W. Biederman
  0 siblings, 0 replies; 24+ messages in thread
From: Eric W. Biederman @ 2006-10-21 10:53 UTC (permalink / raw)
  To: Albert Cahalan
  Cc: linux-kernel, Andrew Morton, Linus Torvalds, Cal Peake,
	Andi Kleen, Alan Cox

"Albert Cahalan" <acahalan@gmail.com> writes:

> On 10/20/06, Eric W. Biederman <ebiederm@xmission.com> wrote:
>> Jakub Jelinek <jakub@redhat.com> writes:
>>
>> > This assumes the binaries and/or libraries are not stripped, and they
>> > usually are stripped.  So, it is better to run something like:
>> > find / -type f -perm /111 | while read f; do readelf -Ws $f 2>/dev/null |
> fgrep
>> > -q sysctl@GLIBC && echo $f; done
>>
>> Russell King <rmk+lkml@arm.linux.org.uk> writes:
>> > glibc on ARM _requires_ sys_sysctl for userspace ioperm, inb, outb etc
>> > emulation.
>>
>>
>> It looks like we have a small but interesting set of sysctl users.
>>
>> The list of files below is a composite from a number of systems I have
>> access to, and the reply I have gotten so far.  I'm still hoping to hear
>> from other people so I can add some other users of sysctl to my list.
>
> So does Linux now only support GLIBC apps? That's what your
> grep seems to imply. At least one of the free Pascal compilers
> does not use GLIBC. You won't find a GLIBC sysctl symbol in
> any of the alternate C libraries (there are many) or even in libc5.
>
> Running your grep on developer machines is highly biased
> against legacy business apps.

Show me a better way to prove that sysctl is used, and to
find sysctl users.

Somehow we got this idea into our heads that sysctl doesn't
matter, after we got that idea into our heads people have figured
that breaking the ABI was a don't care case.  That has got to stop.
Either by deleting the syscall or by deciding to support it.

I am attempting to take that conjecture and find the truth of it.
At first approximation the conjecture appeared true.  You compile
out sysctl and nothing obviously breaks.

Please feel free to find other means to list binaries, that use
sysctl.  Showing that there is a diversity of users, and showing that
those users use sysctl in a variety of ways is the best way to get
all of the developers to understand that sysctl isn't something
that is unused and doesn't matter.

Arguing about ABIs and user entitlements because of those ABI doesn't
put the case anywhere near as strongly as empirical evidence does.
We support and maintain ABI's because we have users, not because it is
a good in and of itself.  And our ABI currently has a mechanism to
report sysctl value is not support in this kernel, and system call is
not supported in this kernel so unless I reuse the syscall number or
the sysctl entry number I am not breaking the ABI.

I think I have found enough users to show that sysctl has users and
most likely needs to be kept.  But the list I have is currently very
small, and would benefit from a larger list of users if we can find
them.

Eric

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2006-10-21 10:55 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 18:23 sysctl Albert Cahalan
2006-10-18 18:27 ` sysctl David KOENIG
2006-10-18 18:31 ` sysctl Linus Torvalds
2006-10-18 18:52   ` sysctl Cal Peake
2006-10-18 19:12     ` sysctl Olaf Hering
2006-10-18 19:44     ` sysctl Andrew Morton
2006-10-18 21:06       ` sysctl Cal Peake
2006-10-19  4:41       ` [RFC] [PATCH] Improve the remove sysctl warnings Eric W. Biederman
2006-10-19 16:25         ` Cal Peake
2006-10-19 19:50           ` Alexey Dobriyan
2006-10-19 19:55             ` Cal Peake
2006-10-20  7:05           ` [CFT] Grep to find users of sys_sysctl Eric W. Biederman
2006-10-20  7:35             ` Andrew Morton
2006-10-20 12:54               ` Eric W. Biederman
2006-10-20 16:39                 ` Andrew Morton
2006-10-21 10:23                   ` Eric W. Biederman
2006-10-20  7:52             ` Russell King
2006-10-20 14:38               ` Eric W. Biederman
2006-10-20 15:18                 ` Albert Cahalan
2006-10-21 10:53                   ` Eric W. Biederman
2006-10-20 15:46                 ` Bill Nottingham
2006-10-20  8:02             ` Jakub Jelinek
2006-10-20 13:41               ` Eric W. Biederman
2006-10-20 17:54             ` Marco Roeland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox