On 5/21/09, Andreas Robinson <andr345@xxxxxxxxx> wrote: > On Thu, 2009-05-21 at 13:01 +0100, Alan Jenkins wrote: >> On 5/18/09, Andreas Robinson <andr345@xxxxxxxxx> wrote: >> > The easy way is if next_string() checks the terminator, prints a warning >> > if it's missing, and returns NULL, i.e finds no strings at all. >> > >> > OTOH, the program wouldn't exactly refuse anything in this case, just >> > misbehave. I will write up a patch that actually makes it stop and >> > complain. >> >> The version you've posted now implements "just misbehave". Did you >> change your mind? > > Yes kind of. I realized we wouldn't want load_strings() to be fatal in > modinfo and depmod when they are processing several modules. > > OTOH, it is possible to have it both ways ... I'll add an errfn_t > parameter or something and let it be decided at the callsite whether an > error in load_strings() is fatal or not. > >> + if (*(strings + size - 1) != '\0') { >> + error("Ignoring malformed section %s in %s ", >> + " - the last string terminator is >> missing.\n", >> + secname, module->pathname); >> + return NULL; >> + } >> >> From my point of view, the easiest way is to make the error message a >> fatal() one. I would prefer not to "be lenient in what you accept" >> when loading code into the kernel :-). > > You mean like Linus? ;-) > fatal("This module is TOTAL CRAP. There is a string without a terminator > in it and that IS NOT VALID."); heh I don't mind what modinfo does; more lenient behaviour may be useful for debugging. depmod I disagree with though. As a minimum, if the old depmod could crash on a module then I want the new one to exit with an error code. That should let e.g. RPM scripts pick it up in a similar way as before. I don't think you're doing that at the moment. I guess the scenario where it matters is a non-expert user installing extra modules. If you're simply following instructions, you may not know how to uninstall invalid modules. If the error is FATAL, you'll still have a working system, but you won't be able add new modules in future. Maybe I've lurked on too many forums, but I admit this sounds like a realistic scenario :-). If depmod can return an error code as well, then I'll be happy with a non-fatal ERROR. Thanks Alan -- To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html