lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 22 Jul 2007 14:04:36 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:	adobriyan@...il.com
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] parse_table() earlier check.


Alexey Dobriyan wrote:
> On Fri, Jul 20, 2007 at 12:37:45PM +0900, Tetsuo Handa wrote:
> > --- linux-2.6.22-orig/kernel/sysctl.c
> > +++ linux-2.6.22/kernel/sysctl.c
> > @@ -1190,9 +1190,9 @@
> >  		return -ENOTDIR;
> >  	if (get_user(n, name))
> >  		return -EFAULT;
> > +	if (!n)
> > +		return -ENOTDIR;
> >  	for ( ; table->ctl_name || table->procname; table++) {
> > -		if (!table->ctl_name)
> > -			continue;
> >  		if (n == table->ctl_name) {
> >  			int error;
> >  			if (table->child) {
> 
> I don't like this. For one, it destroy some symmetry in sysctl table
> walking code, where sysctl(2) code checks for valid ->ctl_name, and proc
> code checks for valid ->procname and both have same for loop. For two,
> nobody uses sysctl(2), sysctl aren't big, so this optimization is
> unneeded.

Excuse me, but I didn't understand what you are worrying.
I'm saying that:
  If n == 0, the condition "if (n == table->ctl_name)" is always false
  because of previous "if (!table->ctl_name) continue;" statement
  regardless of the result whether ->ctl_name and/or ->procname are valid or not.
  Thus, they always return -ENOTDIR if n == 0.
Why this optimization destroys something?
Should "if (!table->ctl_name)" be
 	for ( ; table->ctl_name || table->procname; table++) {
-		if (!table->ctl_name)
+		if (!table->procname)
 			continue;
 		if (n == table->ctl_name) {
 			int error;
 			if (table->child) {
or something?

Regards.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ