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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200910212341.06025.rusty@rustcorp.com.au>
Date:	Wed, 21 Oct 2009 23:41:03 +1030
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Takashi Iwai <tiwai@...e.de>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Problems with string (charp) module parameters

On Tue, 13 Oct 2009 09:07:46 pm Takashi Iwai wrote:
> While I tried to add some debug option to a driver, I found that a module
> parameter taking a string (charp) gives Oops when set via sysfs:

Hi Takashi,

   Always nice to receive a good analysis like this: thanks!

> * Each struct kernel_param instance is defined as const, and is put
>   into __param section, which is read-only.
>   I guess this causes the page fault above.  And...

Ah yes, that's bad, but we could fix that.

> * The above NULL check is invalid.  It should be
> 		if (!*(char **)kp->arg)
> 			return -ENOMEM
>   This is easy, however...

Good spotting.

> * The handling of parameter array is pretty buggy now.
>   kp->perm and kp->flags aren't properly initialized in
>   param_array().  Thus, you might call kfree() with invalid pointers,
>   or pass a wrong type for bool.

Yes, an array of charp isn't going to work.  Erk, I switched one bug for
another :(

> So, the situation looks messy right now, not only about the section
> issue.  If we allow kmalloc of each parameter array element, the flag
> must be associated to each element, not a global one to the array.
> 
> Thoughts?

Yes, that's hard.  There's only one place which currently has a writable
array parameter: drivers/usb/atm/ueagle-atm.c, and it's root only.

OK, for 2.6.32, we remove the const.  In the longer term, I'm reworking how
this is done entirely.

Thanks!
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ