Bug 230687 - rmuser kill_procs kills processes in jails
Summary: rmuser kill_procs kills processes in jails
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-17 08:24 UTC by ikanobori
Modified: 2018-08-17 08:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ikanobori 2018-08-17 08:24:25 UTC
The usr.sbin/adduser/rmuser.sh script which ends up in /usr/sbin/rmuser when ran from a host system such as `rmuser user` will kill all processes owned by `user` in its kill_procs routine by identifying processes with `ps -U $USER`.

This includes jailed processes which is not something to be expected (or is it?).

I could submit a patch which would remove processes which have a J flag hidden behind an argument such as --no-jail / -F but don't know if this is desirable.

It doesn't seem there are much better options here as we can't get the current JID as far as I'm aware. If that were possible we could add the -J $JID flag to ps.
Comment 1 ikanobori 2018-08-17 08:25:42 UTC
Reproduction:

- create user user1 on host system
- create jail1 with user1
- run process in jail1 as user1
- rmuser user1 on host system
- process running in jail1 gets killed

Expected:

- jailed processes are not the same user as the host system and should not be killed