linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Multiple MODALIAS= in uevent file confuses userspace
@ 2021-01-08 16:25 Kai-Heng Feng
  2021-01-18  7:26 ` Kai-Heng Feng
  0 siblings, 1 reply; 12+ messages in thread
From: Kai-Heng Feng @ 2021-01-08 16:25 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, lennart, ACPI Devel Maling List, LKML

Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
"compatible" is present") creates two modaliases for certain ACPI
devices. However userspace (systemd-udevd in this case) assumes uevent
file doesn't have duplicated keys, so two "MODALIAS=" breaks the
assumption.

Based on the assumption, systemd-udevd internally uses hashmap to
store each line of uevent file, so the second modalias always replaces
the first modalias.

My attempt [1] is to add a new key, "MODALIAS1" for the second
modalias. This brings up the question of whether each key in uevent
file is unique. If it's no unique, this may break may userspace.

[1] https://github.com/systemd/systemd/pull/18163

Kai-Heng

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-08 16:25 Multiple MODALIAS= in uevent file confuses userspace Kai-Heng Feng
@ 2021-01-18  7:26 ` Kai-Heng Feng
  2021-01-18 13:50   ` Rafael J. Wysocki
  0 siblings, 1 reply; 12+ messages in thread
From: Kai-Heng Feng @ 2021-01-18  7:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, lennart, ACPI Devel Maling List, LKML

On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> "compatible" is present") creates two modaliases for certain ACPI
> devices. However userspace (systemd-udevd in this case) assumes uevent
> file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> assumption.
>
> Based on the assumption, systemd-udevd internally uses hashmap to
> store each line of uevent file, so the second modalias always replaces
> the first modalias.
>
> My attempt [1] is to add a new key, "MODALIAS1" for the second
> modalias. This brings up the question of whether each key in uevent
> file is unique. If it's no unique, this may break may userspace.

Does anyone know if there's any user of the second modalias?
If there's no user of the second one, can we change it to OF_MODALIAS
or COMPAT_MODALIAS?

Kai-Heng

>
> [1] https://github.com/systemd/systemd/pull/18163
>
> Kai-Heng

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18  7:26 ` Kai-Heng Feng
@ 2021-01-18 13:50   ` Rafael J. Wysocki
  2021-01-18 14:12     ` Mika Westerberg
  0 siblings, 1 reply; 12+ messages in thread
From: Rafael J. Wysocki @ 2021-01-18 13:50 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, lennart,
	ACPI Devel Maling List, LKML, Mika Westerberg, Andy Shevchenko

CC Mika and Andy.

On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > "compatible" is present") creates two modaliases for certain ACPI
> > devices. However userspace (systemd-udevd in this case) assumes uevent
> > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > assumption.
> >
> > Based on the assumption, systemd-udevd internally uses hashmap to
> > store each line of uevent file, so the second modalias always replaces
> > the first modalias.
> >
> > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > modalias. This brings up the question of whether each key in uevent
> > file is unique. If it's no unique, this may break may userspace.
>
> Does anyone know if there's any user of the second modalias?
> If there's no user of the second one, can we change it to OF_MODALIAS
> or COMPAT_MODALIAS?
>
> Kai-Heng
>
> >
> > [1] https://github.com/systemd/systemd/pull/18163
> >
> > Kai-Heng

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 13:50   ` Rafael J. Wysocki
@ 2021-01-18 14:12     ` Mika Westerberg
  2021-01-18 14:26       ` Greg Kroah-Hartman
  2021-01-18 14:51       ` Andy Shevchenko
  0 siblings, 2 replies; 12+ messages in thread
From: Mika Westerberg @ 2021-01-18 14:12 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Kai-Heng Feng, Greg Kroah-Hartman, lennart,
	ACPI Devel Maling List, LKML, Andy Shevchenko

Hi,

On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> CC Mika and Andy.
> 
> On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> > >
> > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > "compatible" is present") creates two modaliases for certain ACPI
> > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > assumption.
> > >
> > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > store each line of uevent file, so the second modalias always replaces
> > > the first modalias.
> > >
> > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > modalias. This brings up the question of whether each key in uevent
> > > file is unique. If it's no unique, this may break may userspace.
> >
> > Does anyone know if there's any user of the second modalias?
> > If there's no user of the second one, can we change it to OF_MODALIAS
> > or COMPAT_MODALIAS?

The only users I'm aware are udev and the busybox equivalent (udev,
mdev) but I'm not sure if they use the second second modalias at all so
OF_MODALIAS for the DT compatible string sounds like a good way to solve
this.

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:12     ` Mika Westerberg
@ 2021-01-18 14:26       ` Greg Kroah-Hartman
  2021-01-18 14:48         ` Andy Shevchenko
  2021-01-18 14:52         ` Mika Westerberg
  2021-01-18 14:51       ` Andy Shevchenko
  1 sibling, 2 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-18 14:26 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML, Andy Shevchenko

On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> Hi,
> 
> On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > CC Mika and Andy.
> > 
> > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> > >
> > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > <kai.heng.feng@canonical.com> wrote:
> > > >
> > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > assumption.
> > > >
> > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > store each line of uevent file, so the second modalias always replaces
> > > > the first modalias.
> > > >
> > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > modalias. This brings up the question of whether each key in uevent
> > > > file is unique. If it's no unique, this may break may userspace.
> > >
> > > Does anyone know if there's any user of the second modalias?
> > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > or COMPAT_MODALIAS?
> 
> The only users I'm aware are udev and the busybox equivalent (udev,
> mdev) but I'm not sure if they use the second second modalias at all so
> OF_MODALIAS for the DT compatible string sounds like a good way to solve
> this.

As udev seems to "break" with this (which is where we got the original
report from), I don't think you need to worry about that user :)

Does anyone use mdev anymore, and in any ACPI-supported systems?

thanks,

greg k-h

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:26       ` Greg Kroah-Hartman
@ 2021-01-18 14:48         ` Andy Shevchenko
  2021-01-18 14:58           ` Greg Kroah-Hartman
  2021-01-18 14:52         ` Mika Westerberg
  1 sibling, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-01-18 14:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mika Westerberg, Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > <kai.heng.feng@canonical.com> wrote:
> > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > <kai.heng.feng@canonical.com> wrote:
> > > > >
> > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > assumption.
> > > > >
> > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > store each line of uevent file, so the second modalias always replaces
> > > > > the first modalias.
> > > > >
> > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > modalias. This brings up the question of whether each key in uevent
> > > > > file is unique. If it's no unique, this may break may userspace.
> > > >
> > > > Does anyone know if there's any user of the second modalias?
> > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > or COMPAT_MODALIAS?
> > 
> > The only users I'm aware are udev and the busybox equivalent (udev,
> > mdev) but I'm not sure if they use the second second modalias at all so
> > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > this.
> 
> As udev seems to "break" with this (which is where we got the original
> report from), I don't think you need to worry about that user :)

> Does anyone use mdev anymore, and in any ACPI-supported systems?

Yes, regularly.


-- 
With Best Regards,
Andy Shevchenko



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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:12     ` Mika Westerberg
  2021-01-18 14:26       ` Greg Kroah-Hartman
@ 2021-01-18 14:51       ` Andy Shevchenko
  1 sibling, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2021-01-18 14:51 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Rafael J. Wysocki, Kai-Heng Feng, Greg Kroah-Hartman, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > <kai.heng.feng@canonical.com> wrote:
> > > >
> > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > assumption.
> > > >
> > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > store each line of uevent file, so the second modalias always replaces
> > > > the first modalias.
> > > >
> > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > modalias. This brings up the question of whether each key in uevent
> > > > file is unique. If it's no unique, this may break may userspace.
> > >
> > > Does anyone know if there's any user of the second modalias?
> > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > or COMPAT_MODALIAS?
> 
> The only users I'm aware are udev and the busybox equivalent (udev,
> mdev) but I'm not sure if they use the second second modalias at all so
> OF_MODALIAS for the DT compatible string sounds like a good way to solve
> this.

I agree with Mika here.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:26       ` Greg Kroah-Hartman
  2021-01-18 14:48         ` Andy Shevchenko
@ 2021-01-18 14:52         ` Mika Westerberg
  1 sibling, 0 replies; 12+ messages in thread
From: Mika Westerberg @ 2021-01-18 14:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML, Andy Shevchenko

On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > Hi,
> > 
> > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > CC Mika and Andy.
> > > 
> > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > <kai.heng.feng@canonical.com> wrote:
> > > >
> > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > <kai.heng.feng@canonical.com> wrote:
> > > > >
> > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > assumption.
> > > > >
> > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > store each line of uevent file, so the second modalias always replaces
> > > > > the first modalias.
> > > > >
> > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > modalias. This brings up the question of whether each key in uevent
> > > > > file is unique. If it's no unique, this may break may userspace.
> > > >
> > > > Does anyone know if there's any user of the second modalias?
> > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > or COMPAT_MODALIAS?
> > 
> > The only users I'm aware are udev and the busybox equivalent (udev,
> > mdev) but I'm not sure if they use the second second modalias at all so
> > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > this.
> 
> As udev seems to "break" with this (which is where we got the original
> report from), I don't think you need to worry about that user :)

Ah right - it is the same udev used in busybox too :)

> Does anyone use mdev anymore, and in any ACPI-supported systems?

My guess is that some "embedded" distros such as Yocto and Buildroot
(Gentoo perhaps) may still use it, and at least Yocto is being used in
ACPI enabled systems.

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:48         ` Andy Shevchenko
@ 2021-01-18 14:58           ` Greg Kroah-Hartman
  2021-01-18 15:27             ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-18 14:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 04:48:53PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> > On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > > <kai.heng.feng@canonical.com> wrote:
> > > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > >
> > > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > > assumption.
> > > > > >
> > > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > > store each line of uevent file, so the second modalias always replaces
> > > > > > the first modalias.
> > > > > >
> > > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > > modalias. This brings up the question of whether each key in uevent
> > > > > > file is unique. If it's no unique, this may break may userspace.
> > > > >
> > > > > Does anyone know if there's any user of the second modalias?
> > > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > > or COMPAT_MODALIAS?
> > > 
> > > The only users I'm aware are udev and the busybox equivalent (udev,
> > > mdev) but I'm not sure if they use the second second modalias at all so
> > > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > > this.
> > 
> > As udev seems to "break" with this (which is where we got the original
> > report from), I don't think you need to worry about that user :)
> 
> > Does anyone use mdev anymore, and in any ACPI-supported systems?
> 
> Yes, regularly.

Ok, and how badly does it break when MODALIAS is multiple lines like
this?  Or can it handle it?

thanks,

greg k-h

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 14:58           ` Greg Kroah-Hartman
@ 2021-01-18 15:27             ` Andy Shevchenko
  2021-01-18 16:40               ` Greg Kroah-Hartman
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-01-18 15:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mika Westerberg, Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 03:58:18PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 18, 2021 at 04:48:53PM +0200, Andy Shevchenko wrote:
> > On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> > > On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > > > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > >
> > > > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > > > assumption.
> > > > > > >
> > > > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > > > store each line of uevent file, so the second modalias always replaces
> > > > > > > the first modalias.
> > > > > > >
> > > > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > > > modalias. This brings up the question of whether each key in uevent
> > > > > > > file is unique. If it's no unique, this may break may userspace.
> > > > > >
> > > > > > Does anyone know if there's any user of the second modalias?
> > > > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > > > or COMPAT_MODALIAS?
> > > > 
> > > > The only users I'm aware are udev and the busybox equivalent (udev,
> > > > mdev) but I'm not sure if they use the second second modalias at all so
> > > > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > > > this.
> > > 
> > > As udev seems to "break" with this (which is where we got the original
> > > report from), I don't think you need to worry about that user :)
> > 
> > > Does anyone use mdev anymore, and in any ACPI-supported systems?
> > 
> > Yes, regularly.
> 
> Ok, and how badly does it break when MODALIAS is multiple lines like
> this?  Or can it handle it?

Since the mentioned change landed into v4.1 I never had a problem with my
setup. From my point of view it doesn't affect anyhow mdev setup.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 15:27             ` Andy Shevchenko
@ 2021-01-18 16:40               ` Greg Kroah-Hartman
  2021-01-18 16:46                 ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2021-01-18 16:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 05:27:44PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 18, 2021 at 03:58:18PM +0100, Greg Kroah-Hartman wrote:
> > On Mon, Jan 18, 2021 at 04:48:53PM +0200, Andy Shevchenko wrote:
> > > On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> > > > On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > > > > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > > > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > > >
> > > > > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > > > > assumption.
> > > > > > > >
> > > > > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > > > > store each line of uevent file, so the second modalias always replaces
> > > > > > > > the first modalias.
> > > > > > > >
> > > > > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > > > > modalias. This brings up the question of whether each key in uevent
> > > > > > > > file is unique. If it's no unique, this may break may userspace.
> > > > > > >
> > > > > > > Does anyone know if there's any user of the second modalias?
> > > > > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > > > > or COMPAT_MODALIAS?
> > > > > 
> > > > > The only users I'm aware are udev and the busybox equivalent (udev,
> > > > > mdev) but I'm not sure if they use the second second modalias at all so
> > > > > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > > > > this.
> > > > 
> > > > As udev seems to "break" with this (which is where we got the original
> > > > report from), I don't think you need to worry about that user :)
> > > 
> > > > Does anyone use mdev anymore, and in any ACPI-supported systems?
> > > 
> > > Yes, regularly.
> > 
> > Ok, and how badly does it break when MODALIAS is multiple lines like
> > this?  Or can it handle it?
> 
> Since the mentioned change landed into v4.1 I never had a problem with my
> setup. From my point of view it doesn't affect anyhow mdev setup.

Do you actually have a device with multiple entries and try to do a rule
based on it?  That's how this was triggered in udev, "normal" operations
work just fine.

thanks,

greg k-h

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

* Re: Multiple MODALIAS= in uevent file confuses userspace
  2021-01-18 16:40               ` Greg Kroah-Hartman
@ 2021-01-18 16:46                 ` Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2021-01-18 16:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mika Westerberg, Rafael J. Wysocki, Kai-Heng Feng, lennart,
	ACPI Devel Maling List, LKML

On Mon, Jan 18, 2021 at 05:40:36PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Jan 18, 2021 at 05:27:44PM +0200, Andy Shevchenko wrote:
> > On Mon, Jan 18, 2021 at 03:58:18PM +0100, Greg Kroah-Hartman wrote:
> > > On Mon, Jan 18, 2021 at 04:48:53PM +0200, Andy Shevchenko wrote:
> > > > On Mon, Jan 18, 2021 at 03:26:28PM +0100, Greg Kroah-Hartman wrote:
> > > > > On Mon, Jan 18, 2021 at 04:12:38PM +0200, Mika Westerberg wrote:
> > > > > > On Mon, Jan 18, 2021 at 02:50:33PM +0100, Rafael J. Wysocki wrote:
> > > > > > > On Mon, Jan 18, 2021 at 8:27 AM Kai-Heng Feng
> > > > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > > > On Sat, Jan 9, 2021 at 12:25 AM Kai-Heng Feng
> > > > > > > > <kai.heng.feng@canonical.com> wrote:
> > > > > > > > >
> > > > > > > > > Commit 8765c5ba19490 ("ACPI / scan: Rework modalias creation when
> > > > > > > > > "compatible" is present") creates two modaliases for certain ACPI
> > > > > > > > > devices. However userspace (systemd-udevd in this case) assumes uevent
> > > > > > > > > file doesn't have duplicated keys, so two "MODALIAS=" breaks the
> > > > > > > > > assumption.
> > > > > > > > >
> > > > > > > > > Based on the assumption, systemd-udevd internally uses hashmap to
> > > > > > > > > store each line of uevent file, so the second modalias always replaces
> > > > > > > > > the first modalias.
> > > > > > > > >
> > > > > > > > > My attempt [1] is to add a new key, "MODALIAS1" for the second
> > > > > > > > > modalias. This brings up the question of whether each key in uevent
> > > > > > > > > file is unique. If it's no unique, this may break may userspace.
> > > > > > > >
> > > > > > > > Does anyone know if there's any user of the second modalias?
> > > > > > > > If there's no user of the second one, can we change it to OF_MODALIAS
> > > > > > > > or COMPAT_MODALIAS?
> > > > > > 
> > > > > > The only users I'm aware are udev and the busybox equivalent (udev,
> > > > > > mdev) but I'm not sure if they use the second second modalias at all so
> > > > > > OF_MODALIAS for the DT compatible string sounds like a good way to solve
> > > > > > this.
> > > > > 
> > > > > As udev seems to "break" with this (which is where we got the original
> > > > > report from), I don't think you need to worry about that user :)
> > > > 
> > > > > Does anyone use mdev anymore, and in any ACPI-supported systems?
> > > > 
> > > > Yes, regularly.
> > > 
> > > Ok, and how badly does it break when MODALIAS is multiple lines like
> > > this?  Or can it handle it?
> > 
> > Since the mentioned change landed into v4.1 I never had a problem with my
> > setup. From my point of view it doesn't affect anyhow mdev setup.
> 
> Do you actually have a device with multiple entries and try to do a rule
> based on it?

I doubt I have any use case for that. It may explain why only now the problem
was observed.

> That's how this was triggered in udev, "normal" operations
> work just fine.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-01-18 16:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 16:25 Multiple MODALIAS= in uevent file confuses userspace Kai-Heng Feng
2021-01-18  7:26 ` Kai-Heng Feng
2021-01-18 13:50   ` Rafael J. Wysocki
2021-01-18 14:12     ` Mika Westerberg
2021-01-18 14:26       ` Greg Kroah-Hartman
2021-01-18 14:48         ` Andy Shevchenko
2021-01-18 14:58           ` Greg Kroah-Hartman
2021-01-18 15:27             ` Andy Shevchenko
2021-01-18 16:40               ` Greg Kroah-Hartman
2021-01-18 16:46                 ` Andy Shevchenko
2021-01-18 14:52         ` Mika Westerberg
2021-01-18 14:51       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).