Skip to contentSkip to conversation

add umask parameter to procfs

PATCH Bodo Eggert 3 participants 3 messages Feb 18, 2005 – Feb 19, 2005 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 7 lines · Herbert Poetzl
Quoted 6 lines · Andrew Morton
Quoted 4 lines · Rene Scharfe

Add proc.umask kernel parameter. It can be used to restrict permissions on the numerical directories in the root of a proc filesystem, i.e. the directories containing process specific information.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

E.g. add proc.umask=077 to your kernel command line and all users except root can only see their own process details (like command line parameters) with ps or top. It can be useful to add a bit of privacy to multi-user servers.

The feature seems fairly obscure, although very simple. Is anyone actually likely to use this?

I'm using a openwall-patched kernel on some of my boxes with a similar feature. I did not yet test this patch, but I like it. It's cheap, and it fixes a potential security leak.

Quoted 3 lines

what about parents (and especially the init process) some tools like pstree (or ps in certain cases) depend on their visibility/accessability ...

pstree will break if /proc/1 isn't readable, unless you specify a readable starting pid. Since this is not the default case, this is IMO ok. (It should be easy to rewrite it to trace the ppid-chains like "ps auxf" already does correctly, or rather implement it in ps where it belongs).

None of my other tools seemed to stop working in an unintended way, but I don't usurally spend my time watching processes.

Sample output of "ps auxf" on a openwall-patched system:

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
7eggert  22504  5.0  3.5  2800 1608 pts/4    S    04:14   0:00 -bash
7eggert  22522  0.0  1.7  2856  792 pts/4    R    04:14   0:00  \_ ps auxf
7eggert  22483  2.3  3.4  2800 1588 pts/2    S    04:14   0:00 -bash
Quoted 2 lines

what if you want to change it afterwards (when tools did break)?

Change the kernel command line back and reboot (or reload the module).

#3 lore raw
Quoted 13 lines · Bodo Eggert
Quoted 11 lines · Herbert Poetzl
Quoted 10 lines · Andrew Morton
Quoted 8 lines · Rene Scharfe

Add proc.umask kernel parameter. It can be used to restrict permissions on the numerical directories in the root of a proc filesystem, i.e. the directories containing process specific information.

E.g. add proc.umask=077 to your kernel command line and all users except root can only see their own process details (like command line parameters) with ps or top. It can be useful to add a bit of privacy to multi-user servers.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

The feature seems fairly obscure, although very simple. Is anyone actually likely to use this?

I'm using a openwall-patched kernel on some of my boxes with a similar feature. I did not yet test this patch, but I like it. It's cheap, and it fixes a potential security leak.

don't get me wrong, I'm all for something like this, as a matter of fact we are using something more specialized for linux-vserver to hide processes between contexts ...

Quoted 8 lines
Quoted 3 lines

what about parents (and especially the init process) some tools like pstree (or ps in certain cases) depend on their visibility/accessability ...

pstree will break if /proc/1 isn't readable, unless you specify a readable starting pid. Since this is not the default case, this is IMO ok. (It should be easy to rewrite it to trace the ppid-chains like "ps auxf" already does correctly, or rather implement it in ps where it belongs).

hmm, so what about debugger and similar not able to find the parent process or something like that?

I'd say this needs some more investigation what tools and applications will break once it is enabled ...

Quoted 9 lines

None of my other tools seemed to stop working in an unintended way, but I don't usurally spend my time watching processes.

Sample output of "ps auxf" on a openwall-patched system:

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
7eggert  22504  5.0  3.5  2800 1608 pts/4    S    04:14   0:00 -bash
7eggert  22522  0.0  1.7  2856  792 pts/4    R    04:14   0:00  \_ ps auxf
7eggert  22483  2.3  3.4  2800 1588 pts/2    S    04:14   0:00 -bash
Quoted 4 lines
Quoted 2 lines

what if you want to change it afterwards (when tools did break)?

Change the kernel command line back and reboot (or reload the module).

hmm, reload the procfs module? not very likely ;)

best,
Herbert

#4 lore raw
Quoted 2 lines · Herbert Poetzl

hmm, so what about debugger and similar not able to find the parent process or something like that?

You can walk the parentage chain up until you reach your login shell. So you can look up info about the parent of every one of your processes except for your login shell and any zombies.

Quoted 2 lines

I'd say this needs some more investigation what tools and applications will break once it is enabled ...

Sure, that can't be bad. I didn't really do anything so far that warrants being called testing (compiles, runs, doesn't crash on boot -- send patch! ;).

But I also didn't invent this feature: it has been in OpenWall and grsecurity for a long time now, so a form of restricted /proc has received at least *some* testing.

Rene