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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1215533175.9610.51.camel@johannes.berg>
Date:	Tue, 08 Jul 2008 18:06:15 +0200
From:	Johannes Berg <johannes@...solutions.net>
To:	Rusty Russell <rusty@...tcorp.com.au>
Cc:	Christoph Hellwig <hch@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-wireless <linux-wireless@...r.kernel.org>,
	Linux Kernel list <linux-kernel@...r.kernel.org>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Tomas Winkler <tomasw@...il.com>
Subject: Re: [PATCH] CONFIG_KMOD needs to be default y

On Tue, 2008-07-08 at 23:03 +1000, Rusty Russell wrote:

> > What about just killing the config option entirely?  It' basically
> > guarding a ~50 lines function + a sysctl variable.  I think having
> > modules but not CONFIG_KMOD is entirely unreasonable.
> 
> I agree with Christoph here.

Yeah, like I said, I wasn't sure why it's there anyway.

> But as a patch series please: it's spread pretty wide.  eg. first make it a 
> non-prompting CONFIG option, then remove the users, then finally kill it.

Sure.

> Some existing request_module users might be able to use 
> try_then_request_module, too...

try_then_request_module seems buggy though. Or at least, doing something
unexpected. Here's the macro, for reference:

#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x)))

I think it should be
#define try_then_request_module(x, mod...) \
	((x) ?: ({request_module(mod); (x)}))

the difference being that it returns the result of the second "x" when
the first "x" fails. A potential user would be
net/bridge/netfilter/ebtables.c:

        ret = find_inlist_lock_noload(head, name, error, mutex);
        if (!ret) {
                request_module("%s%s", prefix, name);
                ret = find_inlist_lock_noload(head, name, error, mutex);
        }

which could then be written as

ret = try_then_request_module(
	find_inlist_lock_noload(head, name, error, mutex),
	"%s%s", prefix, name);

Also, in the case of MODULES=n, I think it should just be

static inline void printf_check(char *name, ...) __attribute__((format(printf, 1, 2))) {};
#define try_then_request_module(x, mod...) \
	({ printf_check(mod); (x) })

so (x) is only evaluated once.

A different variation you could make a case for is to not re-evaluate x
if request_module fails, which would then automatically collapse the
MODULES=n case:

#define try_then_request_module(x, mod...) \
	({ typeof(x) __ret = (x); __ret ?: \
		(request_module(mod) ? __r : (x)); })

johannes

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ