linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* libkmod mishandles parameters re-quoted by grub2
@ 2021-01-25  8:49 Jiri Slaby
  2021-01-28  4:05 ` Lucas De Marchi
  2021-02-12  9:42 ` Lucas De Marchi
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2021-01-25  8:49 UTC (permalink / raw)
  To: linux-modules

Hi,

when one passes to the kernel a module parameter from grub2 such as:
   parport.dyndbg="file drivers/parport/ieee1284_ops.c +mpf"
the kernel receives:
   "parport.dyndbg=file drivers/parport/ieee1284_ops.c +mpf"
as grub2 handles quotes this way. It may be a bug in grub2, it was even 
tried to be fixed, but there is no all-cases-working fix yet:
   https://bugzilla.suse.com/show_bug.cgi?id=1181111#c10

The kernel parses the parameter correctly, though:
   parse_one: doing dyndbg params: parport.dyndbg='file 
drivers/parport/ieee1284_ops.c +mpf'

But libkmod doesn't. When parport is modprobe-d, this parameter is not 
passed to it.

kmod_config_parse_kcmdline ignores the parameter as:
   if (is_quoted) {
     /* don't consider a module until closing quotes */

I am not sure how to fix this, can someone look into it and make the 
parser similar to kernel's?

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libkmod mishandles parameters re-quoted by grub2
  2021-01-25  8:49 libkmod mishandles parameters re-quoted by grub2 Jiri Slaby
@ 2021-01-28  4:05 ` Lucas De Marchi
  2021-02-12  9:42 ` Lucas De Marchi
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2021-01-28  4:05 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: linux-modules

On Mon, Jan 25, 2021 at 10:06 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> Hi,
>
> when one passes to the kernel a module parameter from grub2 such as:
>    parport.dyndbg="file drivers/parport/ieee1284_ops.c +mpf"
> the kernel receives:
>    "parport.dyndbg=file drivers/parport/ieee1284_ops.c +mpf"
> as grub2 handles quotes this way. It may be a bug in grub2, it was even
> tried to be fixed, but there is no all-cases-working fix yet:
>    https://bugzilla.suse.com/show_bug.cgi?id=1181111#c10
>
> The kernel parses the parameter correctly, though:
>    parse_one: doing dyndbg params: parport.dyndbg='file
> drivers/parport/ieee1284_ops.c +mpf'
>
> But libkmod doesn't. When parport is modprobe-d, this parameter is not
> passed to it.

yeah... if kernel parses the parameter correctly, we should accept it too.

>
> kmod_config_parse_kcmdline ignores the parameter as:
>    if (is_quoted) {
>      /* don't consider a module until closing quotes */
>
> I am not sure how to fix this, can someone look into it and make the
> parser similar to kernel's?

I will take a look soon.

thanks
Lucas De Marchi

>
> thanks,
> --
> js
> suse labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libkmod mishandles parameters re-quoted by grub2
  2021-01-25  8:49 libkmod mishandles parameters re-quoted by grub2 Jiri Slaby
  2021-01-28  4:05 ` Lucas De Marchi
@ 2021-02-12  9:42 ` Lucas De Marchi
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2021-02-12  9:42 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: linux-modules

On Mon, Jan 25, 2021 at 09:49:13AM +0100, Jiri Slaby wrote:
>Hi,
>
>when one passes to the kernel a module parameter from grub2 such as:
>  parport.dyndbg="file drivers/parport/ieee1284_ops.c +mpf"
>the kernel receives:
>  "parport.dyndbg=file drivers/parport/ieee1284_ops.c +mpf"
>as grub2 handles quotes this way. It may be a bug in grub2, it was 
>even tried to be fixed, but there is no all-cases-working fix yet:
>  https://bugzilla.suse.com/show_bug.cgi?id=1181111#c10
>
>The kernel parses the parameter correctly, though:
>  parse_one: doing dyndbg params: parport.dyndbg='file 
>drivers/parport/ieee1284_ops.c +mpf'
>
>But libkmod doesn't. When parport is modprobe-d, this parameter is not 
>passed to it.
>
>kmod_config_parse_kcmdline ignores the parameter as:
>  if (is_quoted) {
>    /* don't consider a module until closing quotes */
>
>I am not sure how to fix this, can someone look into it and make the 
>parser similar to kernel's?

We have to ignore ill-formed kernel cmdline and that makes it harder.

I threw out the current implementation and rewrote it into a state
machine. It passes the tests, but it's unfortunate we have to do this,
particularly because we have to re-quote it the "right way" to pass back
to kernel, unmangling it.

I will share the patch shortly.

Lucas De Marchi
>
>thanks,
>-- 
>js
>suse labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-12  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25  8:49 libkmod mishandles parameters re-quoted by grub2 Jiri Slaby
2021-01-28  4:05 ` Lucas De Marchi
2021-02-12  9:42 ` Lucas De Marchi

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox