Re: [PATCH 4/4] read string sections such as .modinfo with load_strings()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/18/09, Andreas Robinson <andr345@xxxxxxxxx> wrote:
> On Mon, 2009-05-18 at 22:18 +0100, Alan Jenkins wrote:
>> On 5/18/09, Andreas Robinson <andr345@xxxxxxxxx> wrote:
>> > Would it be terribly ugly to have next_string() check that a terminator
>> > exists at the end of the section and if it doesn't, insert one and then
>> > write a warning message to the log?
>>
>> Yeah, terribly ugly :-).  That would require mapping the file as copy
>> on write (private).  But I _think_ we should be able to run on NOMMU,
>> where that is not supported.
>>
>> I would prefer that the program refuse to handle the module if it is
>> discovered to be corrupt.  I don't think we should try and work around
>> such corruption.
>
> 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?

+               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 :-).

Thanks again for working on this
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

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux