No description
Find a file
Nick Kralevich bc60954fae builtins.c: Don't require file open() for chmod/chown
42a9349dc4 modified init's
builtin chmod, chown, and mkdir calls to avoid following
symlinks. This addressed a number of attacks we were seeing
at the time where poorly written init scripts were following
attacker supplied symlinks resulting in rooting vulnerabilities.

To avoid race conditions, the previous implementation only ran
fchown / fchmod on file descriptors opened with open(O_NOFOLLOW).
Unfortunately, unlike the normal "chown" or "chmod" calls, this
requires read or write access to the underlying file. This
isn't ideal, as opening some files may have side effects, or
init may not have permission to open certain files (such as when
SELinux is enabled).

Instead of using open(O_NOFOLLOW) + fchown(), use lchown() instead.
As before, the target of the symlink won't be modified by chown.
This also supports setting the ownership of symlinks.

Instead of using open(O_NOFOLLOW) + fchmod(), use
fchmodat(AT_SYMLINK_NOFOLLOW) instead. As before, the target of the
symlink won't be modified by chmod.

This change will continue to ensure that chown/chmod/mkdir doesn't
follow symlinks, without requiring init to open every file in
read-only or read-write mode.

This change depends on bionic commit I1eba0cdb2c509d9193ceecf28f13118188a3cfa7

Addresses the following mako/occam SELinux denial:

  audit(1422770408.951:6): avc:  denied  { write } for  pid=1 comm="init" name="smd7" dev="tmpfs" ino=7207 scontext=u:r:init:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file

Change-Id: I14fde956784d65c44e7aa91dd7eea9a004df3081
2015-02-02 13:45:21 -08:00
adb Merge "Verify token length before adb signs it" 2015-01-28 14:32:52 +00:00
adf Add missing includes. 2015-01-29 21:31:23 -08:00
cpio cpio: Turn on -Werror 2014-05-23 09:48:09 -07:00
debuggerd Remove the pt_regs_mips_t structure. 2015-01-26 13:52:35 -08:00
fastboot kill libunz 2014-12-09 22:24:07 -08:00
fs_mgr Make encryption configurable 2015-01-28 11:41:53 -08:00
gpttool gpttool: turn on -Werror 2014-05-05 10:30:04 -07:00
healthd Remove obsolete BUILD_TINY_ANDROID check from healthd makefile 2015-01-24 04:26:16 +00:00
include Kill HAVE_PTHREADS. 2015-01-27 14:23:22 -08:00
init builtins.c: Don't require file open() for chmod/chown 2015-02-02 13:45:21 -08:00
libbacktrace Cleanup libbacktrace Android.mk 2014-12-12 04:40:06 +00:00
libcutils Kill HAVE_PTHREADS. 2015-01-27 14:23:22 -08:00
libdiskconfig am eb075e28: am c8179498: am 2f62edf7: Merge "libdiskconfig: Turn on -Werror" 2014-05-21 21:19:27 +00:00
libion Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
liblog Kill HAVE_PTHREADS. 2015-01-27 14:23:22 -08:00
libmemtrack Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libmincrypt Disable clang optimization that has segmentation fault. 2014-12-17 14:59:53 -08:00
libnativebridge am c6dead70: Merge "maybe fix mac build" 2014-11-02 14:25:08 +00:00
libnetutils Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libpixelflinger Remove obsolete BUILD_TINY_ANDROID. 2015-01-24 22:39:10 -08:00
libprocessgroup Fix missing #includes in system/core. 2014-12-29 12:24:25 -08:00
libsparse Cleanup libsparse Android.mk 2014-12-12 04:19:27 +00:00
libsuspend Libsuspend: Remove unused variable 2014-11-24 18:53:44 -08:00
libsync Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libsysutils Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
libusbhost libusbhost: Fix IOCTL call during usb_request_cancel 2014-08-07 14:58:31 -07:00
libutils Kill HAVE_PTHREADS. 2015-01-27 14:23:22 -08:00
libziparchive Merge "Reject zip archives whose entry names are not valid UTF-8." 2014-12-08 13:08:34 +00:00
libzipfile Clean up libzipfile Android.mk 2014-12-05 15:59:03 +00:00
lmkd Lmkd: Fix unused variables 2014-11-24 20:32:42 -08:00
logcat logcat: use liblog to determine -b all list 2014-12-05 20:14:30 +00:00
logd Add missing <malloc.h> and <string.h> includes. 2015-01-28 11:37:57 -08:00
logwrapper Fix "ptsname is not thread-safe; use ptsname_r instead" build break. 2014-07-29 11:08:57 -07:00
mkbootimg mkbootimg: turn on -Werror 2014-05-05 10:30:04 -07:00
netcfg Remove obsolete BUILD_TINY_ANDROID. 2015-01-24 22:39:10 -08:00
reboot reboot: Turn on -Werror 2014-05-21 12:58:38 -07:00
rootdir ensure /data/tombstones exists on all Android devices 2015-01-30 17:38:06 -08:00
run-as run-as: build 1161573 failure 2014-05-08 21:18:23 +00:00
sdcard sdcard : inode numbers must be fully representable as uint32_t. 2015-01-15 11:58:53 +00:00
toolbox Add ps --ppid. 2015-01-29 17:20:47 -08:00
.gitignore Don't compile abort_socket.c for host targets. It is only intended to run on Linux targets. 2009-05-26 13:23:23 -07:00
Android.mk Remove the simulator target from all makefiles. 2011-07-11 22:12:32 -07:00
CleanSpec.mk Extend to receive NFLOG packets. 2015-01-15 12:50:59 -08:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2013-07-30 13:56:49 -07:00
NOTICE Fix omission in NOTICE file. 2013-07-30 13:56:55 -07:00