On Thu, Dec 31, 2020 at 2:04 AM Qu Wenruo <[email protected]> wrote:
> On 2020/12/31 上午8:50, Denys Vlasenko wrote:
> > On Thu, Dec 31, 2020 at 1:45 AM Qu Wenruo <[email protected]> wrote:
> >> If kernel is really going to detect compressed module, the decompression
> >> should happen before we check the ELF header, thus the error message
> >> should still be there.
> >
> > I was talking from the userspace perspective: is there a reasonable way
> > to be more careful for userspace? No, unless userspace assumes
> > that finit_module() will *never* be extended to handle .ko.gz modules.
>
> It's the spec, if finit_module() really supports compressed kernel one
> day, it breaks the spec and only then it should be considered as a
> regression (ironically)

If we go down legalese road, the spec does not say "if you supply something
which is not an ELF image, kernel will emit a scary message to the log".

I propose this simple fix:

    if (not_a_good_ELF_image(image_ptr)) {
+       if (!not_GZIP_signature(image_ptr)
+        || !not_BZIP2_signature(image_ptr)
+        || !not_XZ_signature(image_ptr))
            printk(KERN_ERR "Module has invalid ELF header\n");
    }
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to