Daniel Thompson a818777d42 libbb: Enable support for !CONFIG_MULTIUSER
Linux recently gained a new config option, CONFIG_MULTIUSER, that makes
support for non-root users optional. This results in a number of syscalls
being disabled: setuid, setregid, setgid, setreuid, setresuid, getresuid,
setresgid, getresgid, setgroups, getgroups, setfsuid, setfsgid, capget,
capset.

Currently a number of busybox applets, including login, struggle to run
when CONFIG_MULTIUSER is disabled. Even the root user is unable to login:
  login: can't set groups: Functi

This patch adds code to make change_identity() a nop on single user
systems. It works by recognising the signature errno value (ENOSYS, due
to the system calls being disabled) and, to avoid security risks, only
deploys when the current uid and target uid is the same.

After the patch is applied any attempt to switch to a non-root user will
fail. Thus a badly configured userspace (for example, one that tries to
start a daemon as a non-root user when the kernel cannot support this)
will report errors as one would expect.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-12 23:59:57 +02:00
..
2014-11-26 14:04:51 +01:00
2011-02-03 00:05:48 +01:00
2013-02-26 00:36:53 +01:00
2012-10-03 09:42:21 +02:00
2011-08-10 00:51:29 +02:00
2011-09-08 10:59:26 +02:00
2014-12-22 19:37:05 +01:00
2011-05-16 12:21:31 +02:00
2011-02-10 10:01:49 +01:00
2011-03-12 02:19:50 +01:00
2011-02-12 01:56:25 +01:00
2011-08-28 05:31:49 +02:00
2015-04-02 23:03:46 +02:00
2011-10-28 16:15:00 +02:00
2011-10-24 04:06:18 +02:00
2014-05-02 07:18:55 +02:00
2015-03-22 17:56:38 +01:00

Please see the LICENSE file for copyright information (GPLv2)

libbb is BusyBox's utility library.  All of this stuff used to be stuffed into
a single file named utility.c.  When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time).  If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.

	Erik Andersen
	<andersen@codepoet.org>