linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modprobe.d: load from /usr/lib.
@ 2021-01-12 16:02 Michal Suchanek
  2021-01-12 20:56 ` Lucas De Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Suchanek @ 2021-01-12 16:02 UTC (permalink / raw)
  To: linux-modules
  Cc: Michal Suchanek, Marcus Rückert, Takashi Iwai,
	Dominique Leuenberger

There is an ongoing effort to limit use of files outside of /usr (or
$prefix on general). Currently all modprobe.d paths are hardcoded to
outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.

Cc: Marcus Rückert <mrueckert@suse.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 Makefile.am        | 1 +
 libkmod/libkmod.c  | 1 +
 man/modprobe.d.xml | 1 +
 3 files changed, 3 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index b29e943a4d29..702a665f0334 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \
 	-include $(top_builddir)/config.h \
 	-I$(top_srcdir) \
 	-DSYSCONFDIR=\""$(sysconfdir)"\" \
+	-DPREFIX=\""$(prefix)"\" \
 	${zlib_CFLAGS}
 
 AM_CFLAGS = $(OUR_CFLAGS)
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 43423d63a889..9399c6c902f8 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -65,6 +65,7 @@ static const char *default_config_paths[] = {
 	SYSCONFDIR "/modprobe.d",
 	"/run/modprobe.d",
 	"/lib/modprobe.d",
+	PREFIX "/lib/modprobe.d",
 	NULL
 };
 
diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
index 211af8488abb..ae5a83986a52 100644
--- a/man/modprobe.d.xml
+++ b/man/modprobe.d.xml
@@ -40,6 +40,7 @@
   </refnamediv>
 
   <refsynopsisdiv>
+    <para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
     <para><filename>/lib/modprobe.d/*.conf</filename></para>
     <para><filename>/etc/modprobe.d/*.conf</filename></para>
     <para><filename>/run/modprobe.d/*.conf</filename></para>
-- 
2.26.2


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

* Re: [PATCH] modprobe.d: load from /usr/lib.
  2021-01-12 16:02 [PATCH] modprobe.d: load from /usr/lib Michal Suchanek
@ 2021-01-12 20:56 ` Lucas De Marchi
  2021-01-12 22:22   ` Dmitry V. Levin
  2021-05-30  9:39   ` Michal Suchánek
  0 siblings, 2 replies; 6+ messages in thread
From: Lucas De Marchi @ 2021-01-12 20:56 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: linux-modules, Marcus Rückert, Takashi Iwai, Dominique Leuenberger

On Tue, Jan 12, 2021 at 8:06 AM Michal Suchanek <msuchanek@suse.de> wrote:
>
> There is an ongoing effort to limit use of files outside of /usr (or
> $prefix on general). Currently all modprobe.d paths are hardcoded to
> outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.

/lib came from module-init-tools and we kept it for compatibility. It
became a non-issue when distros
decided to just merge them and do a symlink /lib -> /usr/lib following
https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/

what distros didn't do that?

I also fear the solution you want here is not so simple since now the
configs will be added twice
if there is the symlink.  And if we just drop /lib and start using
/usr/lib we break compatibility.

Lucas De Marchi

>
> Cc: Marcus Rückert <mrueckert@suse.com>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Dominique Leuenberger <dimstar@opensuse.org>
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  Makefile.am        | 1 +
>  libkmod/libkmod.c  | 1 +
>  man/modprobe.d.xml | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index b29e943a4d29..702a665f0334 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -19,6 +19,7 @@ AM_CPPFLAGS = \
>         -include $(top_builddir)/config.h \
>         -I$(top_srcdir) \
>         -DSYSCONFDIR=\""$(sysconfdir)"\" \
> +       -DPREFIX=\""$(prefix)"\" \
>         ${zlib_CFLAGS}
>
>  AM_CFLAGS = $(OUR_CFLAGS)
> diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
> index 43423d63a889..9399c6c902f8 100644
> --- a/libkmod/libkmod.c
> +++ b/libkmod/libkmod.c
> @@ -65,6 +65,7 @@ static const char *default_config_paths[] = {
>         SYSCONFDIR "/modprobe.d",
>         "/run/modprobe.d",
>         "/lib/modprobe.d",
> +       PREFIX "/lib/modprobe.d",
>         NULL
>  };
>
> diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
> index 211af8488abb..ae5a83986a52 100644
> --- a/man/modprobe.d.xml
> +++ b/man/modprobe.d.xml
> @@ -40,6 +40,7 @@
>    </refnamediv>
>
>    <refsynopsisdiv>
> +    <para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
>      <para><filename>/lib/modprobe.d/*.conf</filename></para>
>      <para><filename>/etc/modprobe.d/*.conf</filename></para>
>      <para><filename>/run/modprobe.d/*.conf</filename></para>
> --
> 2.26.2
>

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

* Re: [PATCH] modprobe.d: load from /usr/lib.
  2021-01-12 20:56 ` Lucas De Marchi
@ 2021-01-12 22:22   ` Dmitry V. Levin
  2021-01-13 14:08     ` Lucas De Marchi
  2021-05-30  9:39   ` Michal Suchánek
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry V. Levin @ 2021-01-12 22:22 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Michal Suchanek, linux-modules, Marcus Rückert,
	Takashi Iwai, Dominique Leuenberger

On Tue, Jan 12, 2021 at 12:56:05PM -0800, Lucas De Marchi wrote:
> On Tue, Jan 12, 2021 at 8:06 AM Michal Suchanek <msuchanek@suse.de> wrote:
> >
> > There is an ongoing effort to limit use of files outside of /usr (or
> > $prefix on general). Currently all modprobe.d paths are hardcoded to
> > outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.
> 
> /lib came from module-init-tools and we kept it for compatibility. It
> became a non-issue when distros
> decided to just merge them and do a symlink /lib -> /usr/lib following
> https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
> 
> what distros didn't do that?

FWiW, we decided not to do TheUsrMerge at all.


-- 
ldv

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

* Re: [PATCH] modprobe.d: load from /usr/lib.
  2021-01-12 22:22   ` Dmitry V. Levin
@ 2021-01-13 14:08     ` Lucas De Marchi
  2021-01-14  9:54       ` Michal Suchánek
  0 siblings, 1 reply; 6+ messages in thread
From: Lucas De Marchi @ 2021-01-13 14:08 UTC (permalink / raw)
  To: Dmitry V. Levin
  Cc: Michal Suchanek, linux-modules, Marcus Rückert,
	Takashi Iwai, Dominique Leuenberger

On Tue, Jan 12, 2021 at 2:22 PM Dmitry V. Levin <ldv@altlinux.org> wrote:
>
> On Tue, Jan 12, 2021 at 12:56:05PM -0800, Lucas De Marchi wrote:
> > On Tue, Jan 12, 2021 at 8:06 AM Michal Suchanek <msuchanek@suse.de> wrote:
> > >
> > > There is an ongoing effort to limit use of files outside of /usr (or
> > > $prefix on general). Currently all modprobe.d paths are hardcoded to
> > > outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.
> >
> > /lib came from module-init-tools and we kept it for compatibility. It
> > became a non-issue when distros
> > decided to just merge them and do a symlink /lib -> /usr/lib following
> > https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
> >
> > what distros didn't do that?
>
> FWiW, we decided not to do TheUsrMerge at all.

It looks like we will need to put this behind a compilation option
then: --enable-split-usr.
Then we only add the additional dir if split-usr is being used.

If it's not used, we may actually change the path and corresponding
docs to move it to /usr,
but that is another separate change.

thanks
Lucas De Marchi

>
>
> --
> ldv

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

* Re: [PATCH] modprobe.d: load from /usr/lib.
  2021-01-13 14:08     ` Lucas De Marchi
@ 2021-01-14  9:54       ` Michal Suchánek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Suchánek @ 2021-01-14  9:54 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Dmitry V. Levin, linux-modules, Marcus Rückert,
	Takashi Iwai, Dominique Leuenberger

Hello,

On Wed, Jan 13, 2021 at 06:08:41AM -0800, Lucas De Marchi wrote:
> On Tue, Jan 12, 2021 at 2:22 PM Dmitry V. Levin <ldv@altlinux.org> wrote:
> >
> > On Tue, Jan 12, 2021 at 12:56:05PM -0800, Lucas De Marchi wrote:
> > > On Tue, Jan 12, 2021 at 8:06 AM Michal Suchanek <msuchanek@suse.de> wrote:
> > > >
> > > > There is an ongoing effort to limit use of files outside of /usr (or
> > > > $prefix on general). Currently all modprobe.d paths are hardcoded to
> > > > outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.
> > >
> > > /lib came from module-init-tools and we kept it for compatibility. It
> > > became a non-issue when distros
> > > decided to just merge them and do a symlink /lib -> /usr/lib following
> > > https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
> > >
> > > what distros didn't do that?
> >
> > FWiW, we decided not to do TheUsrMerge at all.
> 
> It looks like we will need to put this behind a compilation option
> then: --enable-split-usr.
> Then we only add the additional dir if split-usr is being used.
We could also stat the directories and skip the current one if it's the
same as the last one.
> 
> If it's not used, we may actually change the path and corresponding
> docs to move it to /usr,
> but that is another separate change.
Yes, the man page uses hardcoded paths rather than the actual paths.
There is no support for expanding configure variables in it at the
moment.

Thanks

Michal

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

* Re: [PATCH] modprobe.d: load from /usr/lib.
  2021-01-12 20:56 ` Lucas De Marchi
  2021-01-12 22:22   ` Dmitry V. Levin
@ 2021-05-30  9:39   ` Michal Suchánek
  1 sibling, 0 replies; 6+ messages in thread
From: Michal Suchánek @ 2021-05-30  9:39 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: linux-modules, Marcus Rückert, Takashi Iwai,
	Dominique Leuenberger, Jan Engelhardt

On Tue, Jan 12, 2021 at 12:56:05PM -0800, Lucas De Marchi wrote:
> On Tue, Jan 12, 2021 at 8:06 AM Michal Suchanek <msuchanek@suse.de> wrote:
> >
> > There is an ongoing effort to limit use of files outside of /usr (or
> > $prefix on general). Currently all modprobe.d paths are hardcoded to
> > outside of $prefix. Teach kmod to load modprobe.d from $prefix/lib.
> 
> /lib came from module-init-tools and we kept it for compatibility. It
> became a non-issue when distros
> decided to just merge them and do a symlink /lib -> /usr/lib following
> https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
> 
> what distros didn't do that?
> 
> I also fear the solution you want here is not so simple since now the
> configs will be added twice
> if there is the symlink.  And if we just drop /lib and start using
> /usr/lib we break compatibility.

Ins't there already a mechanism in place that loads only one file with
the same name (so that files in /etc can override files in /lib)?

Then even if the same directory is seached twice because of symlinks it
has no effect, right?

Also there is depmod.d which is documented as /lib but is actually
searched in /usr/lib.

Thanks

Michal
> 
> Lucas De Marchi
> 
> >
> > Cc: Marcus Rückert <mrueckert@suse.com>
> > Cc: Takashi Iwai <tiwai@suse.com>
> > Cc: Dominique Leuenberger <dimstar@opensuse.org>
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> >  Makefile.am        | 1 +
> >  libkmod/libkmod.c  | 1 +
> >  man/modprobe.d.xml | 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index b29e943a4d29..702a665f0334 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -19,6 +19,7 @@ AM_CPPFLAGS = \
> >         -include $(top_builddir)/config.h \
> >         -I$(top_srcdir) \
> >         -DSYSCONFDIR=\""$(sysconfdir)"\" \
> > +       -DPREFIX=\""$(prefix)"\" \
> >         ${zlib_CFLAGS}
> >
> >  AM_CFLAGS = $(OUR_CFLAGS)
> > diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
> > index 43423d63a889..9399c6c902f8 100644
> > --- a/libkmod/libkmod.c
> > +++ b/libkmod/libkmod.c
> > @@ -65,6 +65,7 @@ static const char *default_config_paths[] = {
> >         SYSCONFDIR "/modprobe.d",
> >         "/run/modprobe.d",
> >         "/lib/modprobe.d",
> > +       PREFIX "/lib/modprobe.d",
> >         NULL
> >  };
> >
> > diff --git a/man/modprobe.d.xml b/man/modprobe.d.xml
> > index 211af8488abb..ae5a83986a52 100644
> > --- a/man/modprobe.d.xml
> > +++ b/man/modprobe.d.xml
> > @@ -40,6 +40,7 @@
> >    </refnamediv>
> >
> >    <refsynopsisdiv>
> > +    <para><filename>/usr/lib/modprobe.d/*.conf</filename></para>
> >      <para><filename>/lib/modprobe.d/*.conf</filename></para>
> >      <para><filename>/etc/modprobe.d/*.conf</filename></para>
> >      <para><filename>/run/modprobe.d/*.conf</filename></para>
> > --
> > 2.26.2
> >

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

end of thread, other threads:[~2021-05-30  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 16:02 [PATCH] modprobe.d: load from /usr/lib Michal Suchanek
2021-01-12 20:56 ` Lucas De Marchi
2021-01-12 22:22   ` Dmitry V. Levin
2021-01-13 14:08     ` Lucas De Marchi
2021-01-14  9:54       ` Michal Suchánek
2021-05-30  9:39   ` Michal Suchánek

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