summaryrefslogtreecommitdiffstats
path: root/init/devices.c
Commit message (Collapse)AuthorAgeFilesLines
* Init: Remove unused variablesAndreas Gampe2014-11-241-9/+5
| | | | | | | | For build-system CFLAGS clean-up, fix unused variables. Use a #define instead of static variable in a header file. Change-Id: Id47bf38e51644b61a9f3ac1893a16553695f1aac
* Fix segfault in get_character_device_symlinks()Tomasz Kondel2014-11-131-1/+1
| | | | | | A segmentation fault will occur when strchr function returns NULL. Change-Id: I76076acfff16056179bf24dff5df9f81d9a45125
* am cf2b944d: am 5a1d5a8c: Merge "ueventd: call _exit for safety"Kenny Root2014-08-251-1/+3
|\ | | | | | | | | * commit 'cf2b944df6d744d279a434ec280f9bd8cef03a5b': ueventd: call _exit for safety
| * ueventd: call _exit for safetyKenny Root2014-08-251-1/+3
| | | | | | | | | | | | | | | | | | Make sure to call _exit instead of exit to avoid triggering exit handlers that may have existed in the parent process. Print out a log message when forking to process firmware events fails. Change-Id: I2436bdf85d9a8ea26b718e62023f1dac89864667
* | am 7367ecbc: am 06023134: am 8022ce1e: Merge "ueventd fixup_sys_perms: fixup ↵Nick Kralevich2014-07-071-13/+15
|\ \ | |/ | | | | | | | | | | SELinux labels unconditionally" * commit '7367ecbc4839e3a608ab9b7742c659b58065209f': ueventd fixup_sys_perms: fixup SELinux labels unconditionally
| * ueventd fixup_sys_perms: fixup SELinux labels unconditionallyNick Kralevich2014-07-071-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the fixup code in fixup_sys_perms() scans through all entries in uevent*.rc. If it finds a match, then it performs a fixup. If there's no match in that file, no fixup is performed. SELinux file labels are independently stored in /file_contexts, with no relationship to the files in /ueventd.rc. Even when no entries exist in ueventd.rc, we still want to fixup the SELinux file label in /sys when a uevent message occurs. Change-Id: I0ccb5395ec0be9282095b844a5022e8c0d8903ac
* | am b18d44e4: am ab7e5752: am 09117c70: Merge "ueventd: allow matching ↵Colin Cross2014-07-021-13/+38
|\ \ | |/ | | | | | | | | | | symlink names when setting permissions" * commit 'b18d44e458501f6b5b99349acc68d3d4e90e9d62': ueventd: allow matching symlink names when setting permissions
| * ueventd: allow matching symlink names when setting permissionsColin Cross2014-07-021-13/+38
| | | | | | | | Change-Id: I5f6cc2a25f1236fbe2c7193b65363b7883b9ba2e
* | ueventd: UEVENT_MSG_LEN changed to 2048 from 1048 in compliance with theRuchi Kandoi2014-06-231-1/+1
|/ | | | | | BUFFER_LEN in the kobject_uevent in kernel. Change-Id: Ib98626f20a7c26e7718bbe4d5ec4513a1ae5d9b7
* init/ueventd: adds wildcard matching for ueventd rulesDaniel Leung2014-06-201-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs nodes can change from devices to devices for a particular class of peripheral. Some of them even change after suspend/resume, e.g. rfkill for USB bluetooth adapters. This patch adds to the way how ueventd rules with wildcard are handled. In addition to matching the prefix with a trailing wildcard, now rules can have wildcard anywhere in the rule. The wildcard matching is implemented using fnmatch(), where its matching is simliar to shell pathname expansion. It suits this particular usage model well. To avoid abuse, the number of slashes has to match between path name and the rule. For example, instead of creating a rule to match: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/bluetooth/hci0/rfkill* , this would suffice: /sys/devices/pci0000:00/0000:00:1d.0/*/*/*/*/bluetooth/hci0/rfkill* The prefix matching behavior is retained, such that those rules do not have to pay for processing penalty with fnmatch(). Change-Id: I3ae6a39c838f6d12801cb71958e481b016f731f5 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
* Extend ueventd to use the label-by-symlink support in libselinux.Stephen Smalley2014-06-161-3/+4
| | | | | | | | | | | | | | When ueventd creates a device node, it may also create one or more symlinks to the device node. These symlinks may be the only stable name for the device, e.g. if the partition is dynamically assigned. A corresponding change with the same Change-Id to external/libselinux introduces selabel_lookup_best_match() to support looking up the "best match" for a device node based on its real path (key) and any links to it (aliases). This change updates ueventd to use this new interface to find the best match for the device node when creating it. Change-Id: Id6c2597eee2b6723a5089dcf7c450f8d0a4128f4 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* ueventd: support by-name symlinks for PCI block devicesAndrew Boie2014-05-131-6/+44
| | | | | | | | | | | | | | | | | To ensure that well-crafted removable media can't spoof the internal partitions, for platform devices the controller id is inside the generated path. We now do the same for PCI devices. The generated path has two levels; the PCI domain/bus, and then the peripheral ID. This lets us get by-name symlinks for PCI media, such as the SATA controllers on PC-like hardware. The symlinks will be created under /dev/block/pci/. For example: /dev/block/pci/pci0000:00/0000:00:1f.2/by-name/ Change-Id: Icee3e86bef5569c2bbd94c26bc00d49028345e3b Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* ueventd: Ueventd changes the permission of sysfs files for max/minRuchi Kandoi2014-05-011-1/+1
| | | | | | | | | | | | cpufreq The owner and permissions for the sysfs file /sys/devices/system/cpu*/cpufreq/scaling_max/min_freq is changed. This would allow the PowerHAL to change the max/min cpufreq even after the associated CPU's are hotplugged out and back in. Change-Id: Ibe0b4aaf3db555ed48e89a7fcd0c5fd3a18cf233 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
* liblog: enable logging to logd.Mark Salyzyn2014-02-281-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | * Modify liblog to send all messages to the new syslog user space daemon. Original-Change-Id: I0ce439738cd921efb2db4c1d6a289a96bdbc8bc2 Original-Change-Id: If4eb0d09409f7e9be3eb4bb7017073dc7e931ab4 Signed-off-by: Nick Kralevich <nnk@google.com> * Add a TARGET_USES_LOGD make flag for BoardConfig.mk to manage whether logd is enabled for use or not. * rename syslog to logd to avert confusion with bionic syslog * Add fake log support back in * prefilter for logging messages from logd * Fill in timestamps at logging source * update abstract log reader * switch from using suffix for id to v3 format * log a message when creating devices that a deprecated interface is being utilized. Signed-off-by: Mark Salyzyn <salyzyn@google.com> (cherry pick from commit 099e2c1f6f706a8600c1cef74cce9066fc315480) Change-Id: I47929a5432977a1d7235267a435cec0a7d6bd440
* Remove an unused #include of <asm/page.h>.Elliott Hughes2014-02-241-1/+0
| | | | Change-Id: I000aead8c82ec11151f69e6ce439dd09b0f0b4f4
* init: add subsystem rules to ueventd.rcGreg Hackmann2013-11-261-29/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default ueventd creates device nodes under /dev based on the ueventd DEVPATH. Several subsystems have special rules which are hardcoded in devices.c. Moving forward these special rules should go in ueventd.rc. Special rules have the syntax: subsystem <s> devname (uevent_devname|uevent_devpath) [dirname <dir>] Devices matching SUBSYSTEM=<s> will be populated under <dir>. dirname is optional and defaults to /dev. If dirname is provided, <dir> must start with "/". If devname is uevent_devname, ueventd will create the device node as <dir>/DEVNAME. DEVNAME may include intermediate subdirectories, which ueventd will automatically create. If devname is uevent_devpath, ueventd will use the legacy behavior of computing DEVPATH_BASE=basepath(DEVPATH), and creating the device node as <dir>/DEVPATH_BASE. The new parsing code is based on init_parser.c, with small tweaks to handle commands which don't fall under a section header. Change-Id: I3bd1b59d7e62dfc9d289cf6ae889e237fb5bd7c5 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* init: handle ueventd path truncation betterGreg Hackmann2013-11-261-2/+16
| | | | | | | | Log an error before discarding problematic events, and add a missing truncation check to the usb subsystem's unique codepath Change-Id: I0d05aa287ffc63b46d1752d2a7409d35dc8caca7 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* Handle policy reloads within ueventd rather than restarting it.Stephen Smalley2013-07-261-0/+11
| | | | | | | | | | | Restarting ueventd upon policy reloads has reportedly created stability problems for some users and could cause events to be lost. Stop restarting ueventd and instead handle policy reloads within ueventd. Also stops restarting installd upon policy reloads. Change-Id: Ic7f310d69a7c420e48fbc974000cf4a5b9ab4a3b Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* am 5954ecb8: Merge "Allow more characters in partition name links"Colin Cross2013-07-221-0/+2
|\ | | | | | | | | * commit '5954ecb87b8c77425d8cc766c0cc798957a07a7d': Allow more characters in partition name links
| * Allow more characters in partition name linksJohan Redestig2013-07-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | We have several partitions with underscores in their names which would not be properly linked in: /dev/block/platform/msm_sdcc.1/by-name/ With this change more characters (_-.) are allowed in partition name links. Also, any other character is replaced with '_' so the resulting link names have the same length as the partition name. Change-Id: I746566c03db98b10326c755692362d2c10e528ae
* | am 76c58893: Free file handle for /firmware/image after useAjay Dudani2013-06-141-0/+1
|\ \ | |/ |/| | | | | * commit '76c5889325c2ada5dda07fd9af20a4a485978538': Free file handle for /firmware/image after use
| * Free file handle for /firmware/image after useAjay Dudani2013-06-131-0/+1
| | | | | | | | Change-Id: Id59e25486b45dffc87a89a961970a6e8128a5237
| * ueventd: allow platform devices to have just a /devices/ prefix - DO NOT MERGEDima Zavin2013-03-111-39/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using device tree, platform devices may not have a /devices/platform/ path prefix, but can be rooted in /devices/. Modify the platform device tracking code to store the device path as well as the name. This way, when we create symlinks, we can correctly skip the base platform device prefix and get to the proper device node path. Change-Id: I939ef8fbcb45c5c803cd9a054e40136a912efc72 Signed-off-by: Dima Zavin <dima@android.com>
* | Update ueventd set the SELinux context on sysfsStephen Smalley2013-04-031-0/+9
| | | | | | | | | | | | | | | | This change enables labeling of dynamically created sysfs nodes with specific SELinux security contexts. Change-Id: If8b8d66120453123c1371ce063b6f20e8b96b6ef Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* | ueventd: allow platform devices to have just a /devices/ prefixDima Zavin2013-03-141-39/+44
|/ | | | | | | | | | | | | | When using device tree, platform devices may not have a /devices/platform/ path prefix, but can be rooted in /devices/. Modify the platform device tracking code to store the device path as well as the name. This way, when we create symlinks, we can correctly skip the base platform device prefix and get to the proper device node path. Change-Id: I939ef8fbcb45c5c803cd9a054e40136a912efc72 Signed-off-by: Dima Zavin <dima@android.com>
* ueventd: Increase uevent buffer sizeAndrew Boie2013-01-041-2/+2
| | | | | | | | | | | | | As it turns out, no, 64K is not enough. A device provisioning tool was generating many uevents as it manipulated the GPT, causing events near the end of the process (including events as a result of the final BLKRRPART ioctl()) to get lost. It's not clear what the best value for this should be, but increasing to 256K fixed the problem in this case. Change-Id: I4883b34e96c89e8a6fa581bc9cd121bb021b5694 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* am 7b88a90d: Merge "Remove HAVE_SELINUX guards"Kenny Root2012-10-171-12/+5
|\ | | | | | | | | * commit '7b88a90da2a27e347fc16c14fa577f4ae1ef07fd': Remove HAVE_SELINUX guards
| * Remove HAVE_SELINUX guardsKenny Root2012-10-161-12/+5
| | | | | | | | Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
* | am ee0d281a: am c95c15b1: Merge "Char device /dev/dri/card0 was not created ↵Jean-Baptiste Queru2012-08-141-0/+3
|\ \ | |/ | | | | | | | | | | during startup." * commit 'ee0d281a3e5fe611bdda23db18fa0e5684ee43ed': Char device /dev/dri/card0 was not created during startup.
| * Merge "Char device /dev/dri/card0 was not created during startup."Jean-Baptiste Queru2012-08-141-0/+3
| |\
| | * Char device /dev/dri/card0 was not created during startup.Lukasz Anaczkowski2012-07-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | This device is required by libdrm for GPUs like IvyBridge. Change-Id: I0ac47056a9cec2100f3e6eaa5591571fe6bbc145 Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com> Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
* | | resolved conflicts for merge of 4dcd52ab to jb-mr1-devKenny Root2012-08-131-6/+5
|\ \ \ | |/ / | | | | | | Change-Id: Ibd0c03a7883a2e31adab18543c016776b7b36866
| * | Add support for reloading policy from /data/system.Stephen Smalley2012-08-091-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support runtime policy management, add support for reloading policy from /data/system. This can be triggered by setting the selinux.loadpolicy property to 1, whether from init.rc after mounting /data or from the system_server (e.g. upon invocation of a new device admin API for provisioning policy). ueventd and installd are restarted upon policy reloads to pick up the new policy configurations relevant to their operation. Change-Id: I97479aecef8cec23b32f60e09cc778cc5520b691 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* | | am faad67fa: am ef3f7fa3: Merge "Set the SELinux security label on new ↵Jean-Baptiste Queru2012-08-081-27/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | directories." * commit 'faad67fac68642ca039fe5c29099acebf546f5ee': Set the SELinux security label on new directories.
| * | Merge "Set the SELinux security label on new directories."Jean-Baptiste Queru2012-08-081-27/+1
| |\ \ | | |/ | |/|
| | * Set the SELinux security label on new directories.Stephen Smalley2012-07-261-27/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Automatically set the SELinux security label on directories created by init.rc. This avoids the need to separately call restorecon on each such directory from the init.rc file. Also restorecon /dev and /dev/socket after initial policy load so that they are labeled correctly before any other dev nodes or sockets are created. Change-Id: If6af6c4887cdead949737cebdd673957e9273ead Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* | | Merge remote-tracking branch 'goog/jb-dev-mako' into jb-mr1-devEd Heyl2012-07-281-11/+19
|\ \ \
| * | | HACK: use /firmware/image as a 3rd choiceIliyan Malchev2012-06-111-11/+19
| |/ / | | | | | | | | | | | | Change-Id: I74af2e2dc872f88b904ead13e300ae32547e70c8 Signed-off-by: Iliyan Malchev <malchev@google.com>
* | | ueventd: fixup /sys permissions on change ueventsColin Cross2012-07-241-1/+1
|/ / | | | | | | | | | | | | Change uevents may be triggered after new files are created on a device in /sys, run the sys permissions fixup when they occur. Change-Id: Iec2725c9f8a032e5124190444edaf189a766b0b2
* | Add handling for DEVNAME for usb devicesWei Zhong2012-03-231-13/+39
|/ | | | | | | | | | When creating device node, user-space handler should honor device node provided by kernel if present. Bug: 6105248 Change-Id: I9ab3810563f29f065c239e15149882db28f08893 Signed-off-by: Wei Zhong <wzhong@google.com>
* Extend init and ueventd for SE Android.Stephen Smalley2012-02-011-12/+70
| | | | | | | | | | | | | | | Add SE Android support for init and ueventd. init: - Load policy at boot. - Set the security context for service daemons and their sockets. - New built-in commands: setcon, setenforce, restorecon, setsebool. - New option for services: seclabel. ueventd: - Set the security context for device directories and nodes. Change-Id: I98ed752cde503c94d99dfa5b5a47e3c33db16aac
* init/cutils: move list utility code to cutils from initDima Zavin2011-09-021-1/+1
| | | | | Change-Id: I357ceee813700297d8343159f22a07659e768d41 Signed-off-by: Dima Zavin <dima@android.com>
* libcutils/init: move uevent socket opening code to libcutilsDima Zavin2011-09-021-28/+2
| | | | | Change-Id: I90adf78c0eb6185505f2bf7b62e96e25ab918345 Signed-off-by: Dima Zavin <dima@android.com>
* rename uevent_checked_recv to uevent_kernel_multicast_recvNick Kralevich2011-05-111-1/+1
| | | | Change-Id: I1839627490080efcbb7269699709064856312f8b
* am b0d0e260: resolved conflicts for merge of 2baeb898 to honeycomb-plus-aospNick Kralevich2011-04-271-29/+5
|\ | | | | | | | | * commit 'b0d0e260bd6118959fa0e2d3c84037b3e0178551': Fold uevent message origin checking from init into libcutils.
| * resolved conflicts for merge of 2baeb898 to honeycomb-plus-aospNick Kralevich2011-04-271-29/+5
| |\ | | | | | | | | | Change-Id: Ib3169b3a36aa13ef413da624355b1737e9b76fd9
| | * Fold uevent message origin checking from init into libcutils.Vernon Tang2011-04-281-29/+5
| | | | | | | | | | | | Change-Id: I7cbc0cb840d1b4962e6c360fdad9a9c0ce20e87b
* | | am de35f274: am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message ↵Nick Kralevich2011-04-271-5/+29
|\ \ \ | |/ / | | | | | | | | | | | | | | | origin checking from init into libcutils."" * commit 'de35f2741c4e32e331a92be99f7c04b92b94beb2': Revert "Fold uevent message origin checking from init into libcutils."
| * | am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message origin checking ↵Nick Kralevich2011-04-271-5/+29
| |\ \ | | |/ | | | | | | | | | | | | | | | from init into libcutils."" * commit '03752be0a437d12e19ac73ebe23385fe6f756e2c': Revert "Fold uevent message origin checking from init into libcutils."
| | * Revert "Fold uevent message origin checking from init into libcutils."Nick Kralevich2011-04-271-5/+29
| | | | | | | | | | | | | | | | | | This reverts commit 8405ec0e7562a370174d9973dd94984c47e49c36. The original change does not compile.