Re: [systemd-devel] generators, private /tmp

2024-11-27 Thread Lennart Poettering
On Mi, 27.11.24 02:18, James Muir (jamesmui) ([email protected]) wrote:

> > > Thanks for your reply.
> > >
> > > Is my second statement also correct?
> > >
> > > i.e. is there no way to prevent mounting a private /tmp when executing 
> > > generators using something like an environment variable or config setting?
> >
> > There is none.
>
> I am considering preparing a patch that makes it configurable via system.conf.
>
> e.g., "GeneratorsUsePrivateTmp=yes"
>
> Would a contribution like that be welcome?

Uh, what's the usecase?

If you add a new config knob you need a very good reason too, we are
not fans of of random config knobs with no clear usecase behind them.

Hence, why would this be desirable?

note that generators run in an extremely early context already, where
the real /tmp/ is not available yet, and read-only. hence, it's almost
certainly *wrong* to allow applications to see the real-one: they
should not expect they can write there, and its a terrible place to
read information from (since it's an unmanaged shared namespace).

Hence, you probably will have a very tough time convincing me that
such a knob is desirable, but let's hear it?

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] generators, private /tmp

2024-11-26 Thread James Muir (jamesmui)
> > > > Hi everyone,
> > > >
> > > > The system manager (as of v253) executes generators in a sandbox with a 
> > > > fresh tmpfs mount on /tmp:
> > > >
> > > >   
> > > > https://github.com/systemd/systemd/blob/a526b9ddfc03a290f20a65c0a73792e73029f1b8/src/core/manager.c#L4274
> > > >
> > > > Looking at the code, it appears that there is no way to disable that 
> > > > using, say, an environment variable or a config file setting.
> > > >
> > > > Is that correct?
> > >
> > > Yes.
> > >
> > > Generators run during earliest boot, where /tmp/ is quite likely not
> > > mounted yet, hence generators do not have access to the system's /tmp/
> > > and get a transient one.
> > >
> >
> > Thanks for your reply.
> >
> > Is my second statement also correct?
> >
> > i.e. is there no way to prevent mounting a private /tmp when executing 
> > generators using something like an environment variable or config setting?
>
> There is none.

I am considering preparing a patch that makes it configurable via system.conf.

e.g., "GeneratorsUsePrivateTmp=yes"

Would a contribution like that be welcome?

-James M



Re: [systemd-devel] generators, private /tmp

2024-11-20 Thread Lennart Poettering
On Mi, 20.11.24 21:42, James Muir (jamesmui) ([email protected]) wrote:

> > > Hi everyone,
> > >
> > > The system manager (as of v253) executes generators in a sandbox with a 
> > > fresh tmpfs mount on /tmp:
> > >
> > >   
> > > https://github.com/systemd/systemd/blob/a526b9ddfc03a290f20a65c0a73792e73029f1b8/src/core/manager.c#L4274
> > >
> > > Looking at the code, it appears that there is no way to disable that 
> > > using, say, an environment variable or a config file setting.
> > >
> > > Is that correct?
> >
> > Yes.
> >
> > Generators run during earliest boot, where /tmp/ is quite likely not
> > mounted yet, hence generators do not have access to the system's /tmp/
> > and get a transient one.
> >
>
> Thanks for your reply.
>
> Is my second statement also correct?
 >
> i.e. is there no way to prevent mounting a private /tmp when executing 
> generators using something like an environment variable or config setting?

There is none.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] generators, private /tmp

2024-11-20 Thread James Muir (jamesmui)
> > Hi everyone,
> >
> > The system manager (as of v253) executes generators in a sandbox with a 
> > fresh tmpfs mount on /tmp:
> >
> >   
> > https://github.com/systemd/systemd/blob/a526b9ddfc03a290f20a65c0a73792e73029f1b8/src/core/manager.c#L4274
> >
> > Looking at the code, it appears that there is no way to disable that using, 
> > say, an environment variable or a config file setting.
> >
> > Is that correct?
>
> Yes.
>
> Generators run during earliest boot, where /tmp/ is quite likely not
> mounted yet, hence generators do not have access to the system's /tmp/
> and get a transient one.
>

Thanks for your reply.

Is my second statement also correct?

i.e. is there no way to prevent mounting a private /tmp when executing 
generators using something like an environment variable or config setting?

I see the condition !MANAGER_IS_TEST_RUN(m) guards the flag FORK_PRIVATE_TMP 
but that seems to be just for testing.

-James M



Re: [systemd-devel] generators, private /tmp

2024-11-19 Thread Lennart Poettering
On Di, 19.11.24 20:58, James Muir (jamesmui) ([email protected]) wrote:

> Hi everyone,
>
> The system manager (as of v253) executes generators in a sandbox with a fresh 
> tmpfs mount on /tmp:
>
>   
> https://github.com/systemd/systemd/blob/a526b9ddfc03a290f20a65c0a73792e73029f1b8/src/core/manager.c#L4274
>
> Looking at the code, it appears that there is no way to disable that using, 
> say, an environment variable or a config file setting.
>
> Is that correct?

Yes.

Generators run during earliest boot, where /tmp/ is quite likely not
mounted yet, hence generators do not have access to the system's /tmp/
and get a transient one.

Lennart

--
Lennart Poettering, Berlin


[systemd-devel] generators, private /tmp

2024-11-19 Thread James Muir (jamesmui)
Hi everyone,

The system manager (as of v253) executes generators in a sandbox with a fresh 
tmpfs mount on /tmp:

  
https://github.com/systemd/systemd/blob/a526b9ddfc03a290f20a65c0a73792e73029f1b8/src/core/manager.c#L4274

Looking at the code, it appears that there is no way to disable that using, 
say, an environment variable or a config file setting.

Is that correct?

Thanks,

-James M