summaryrefslogtreecommitdiffstats
path: root/init/ueventd.c
Commit message (Collapse)AuthorAgeFilesLines
* Redirect libselinux logging to dmesg for ueventd.Stephen Smalley2014-06-241-0/+5
| | | | | | | | | | | | | | | | We already do this for init, but had failed to do it for ueventd and could not capture any logging from libselinux calls made by ueventd. Truly enabling non-error logging also requires uncommenting a line in Android.mk: LOCAL_CFLAGS += -DLOG_UEVENTS=1 which enables other logging and sets the default log level to INFO, or otherwise changing the klog level in the ueventd code (is not settable by init.rc loglevel). Change-Id: I00e6f9d6271f2a21d9078c96368816d74d6d2850 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* init/ueventd: adds wildcard matching for ueventd rulesDaniel Leung2014-06-201-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ueventd: fix klog debug typoAlex Ray2014-03-191-2/+2
| | | | Change-Id: Ib0acece15145cc0e868452ede8f3acbab419b965
* ueventd: easier debug loggingAlex Ray2014-03-071-0/+6
| | | | | | | Move ueventd debug flag into the Android.mk. Boost klog level if event logging enabled. Change-Id: Iae48edbc43c487092c2424023576af29c76ff401
* ueventd: fix a busy loop while reading ueventsAmir Goldstein2013-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Under certain conditions, poll() may raise the POLLERR flag along with POLLIN, in which case the check for (ufd.revents == POLLIN) results in an endless busy loop. The following fix was applied to hardware/libhardware_legacy/uevent/uevent.c to fix a similar bug: commit 3aabb260ceef10377c31c9e45fb239247f5cfeba Author: Mathias Agopian <mathias@google.com> Date: Mon Oct 1 14:53:18 2012 -0700 fix a typo in uevent_next_eventi Bug: 7114973 Change-Id: I15a4c714b59aeb1d02db00517d70b5f0e5ab22c2 Applying the same fix for two more poll loops in init and ueventd. Change-Id: I50693f6d3c904992ac4b8a9a14a83c7106e6b9e0
* init: fix return value for android uid/gid checkVeeren Mandalia2012-08-031-1/+1
| | | | | | | | | Now get_android_id function returns -EINVAL if the uid/gid is not in the list of android ids. This will allow ueventd to catch invalid ids and report the error. Change-Id: I943b04dd64d518891623e1ee2d561b8061af4863 Signed-off-by: Veeren Mandalia <v.mandalia@sta.samsung.com>
* init: Change umask of forked processes to 077Nick Kralevich2012-04-021-5/+12
| | | | | | | | | | | | | | | | | | | | | | Modify init to set the umask to 077 when forking processes. This helps protect against inadvertant information disclosure in init's child processes. ueventd: Keep umask at 000. uevent needs to be able to create device nodes with exactly the permissions it indicates. Testing: 1) Do an "ls -lR /data /dev" on the device before and after the umask change and diff the output. Verified by hand that the permission change wouldn't cause any problems. 2) Verify that package installation works, and the permissions are as expected, when installing a program from market and "adb install". Bug: 3272072 Change-Id: Ie4f7f06c0ee9da8d9b6fce25d71d8991a9bce406
* Pick up on androidboot.hardware kernel cmd optionVladimir Chtchetkine2011-09-281-0/+19
| | | | | | | x86 emulator passes hardware name through the androidboot.hardware kernel cmd option, and ueventd must pick up on it to locate proper ueventd.rc file for that hardware. Change-Id: Id61c5b67fe6275a15c7aa62556e0b89eda7968f8
* init/cutils: move kernel logging interface to libcutils from initDima Zavin2011-09-021-1/+1
| | | | | Change-Id: Ia0f91b1fcd6cae69d76bf3dd841340958db938a8 Signed-off-by: Dima Zavin <dima@android.com>
* defer firmware load until after filesystems are mountedBrian Swetland2011-03-251-0/+9
| | | | | | | | | In some situations a driver could try to request firmware before /system is mounted. Previously we'd fail the request. Now we will retry the read-from-filesystem every 100ms until we find the firmware or we've finished the "fs" and "post-fs" stages of init. Change-Id: Ie32402f7d41c818bf20f3297286ed5f99705b72c
* init: support owner/permission setting for sysfs attributes of devicesBrian Swetland2010-10-261-2/+11
| | | | | | | | | This should be much nicer than peppering init.rc with chown/chmod directives. Also, remove some dead code and obsolete comments. Change-Id: I10895f10a9cf2f1226c8d12976cd3db3743da9ec
* init: Add ueventd.rc parsing to ueventdColin Cross2010-04-211-0/+91
| | | | Change-Id: Iea53050d6c10e8cabf563e5d80e84eaf78873695
* init: Move uevent handling to an external ueventd processColin Cross2010-04-211-0/+47
Change-Id: Iea6c56013062ade633a1754f7bcf8cf09b3dedc1