OSDN Git Service

android-x86/system-core.git
2 years agoMerge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86 cm-14.1-x86
Chih-Wei Huang [Thu, 8 Jul 2021 13:52:27 +0000 (21:52 +0800)]
Merge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86

Conflicts:
init/init.cpp

2 years agoinit: don't set serialno via kernel cmdline nougat-x86
Chih-Wei Huang [Thu, 8 Jul 2021 13:44:36 +0000 (21:44 +0800)]
init: don't set serialno via kernel cmdline

On an x86 device the product serial number is set in the DMI table.
We don't set it via kernel cmdline. It will be set later in init.sh.

3 years agoMerge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86
Chih-Wei Huang [Sun, 14 Feb 2021 13:48:25 +0000 (21:48 +0800)]
Merge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86

3 years agoFileMap::create: remove duplicate addition.
Elliott Hughes [Mon, 17 Aug 2020 19:37:25 +0000 (12:37 -0700)]
FileMap::create: remove duplicate addition.

The previous change was intended to detect the overflow, but
accidentally retained the existing addition, so we'd abort before
getting to the explicit check.

Also reformat slightly to better match the current code in qt-dev and
beyond, to reduce merge conflicts.

Bug: 156997193
Test: treehugger
Change-Id: I73a3a4e75f0aad00888e8f2b49a07b7e8b4eda05
Merged-In: I73a3a4e75f0aad00888e8f2b49a07b7e8b4eda05
(cherry picked from commit 54794ac613d50bf4072174476f60527e2b0b4cdf)

3 years agoFail explicitly on length overflow.
Christopher Ferris [Tue, 26 May 2020 17:33:18 +0000 (10:33 -0700)]
Fail explicitly on length overflow.

Instead of aborting when FileMap::create detects an overflow, detect the
overflow directly and fail the call.

Bug: 156997193

Test: Ran unit tests, including new unit test that aborted before.
Change-Id: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
Merged-In: Ie49975b8949fd12bbde14346ec9bbb774ef88a51
(cherry picked from commit 68604b9c29b5bd11e2e2dbb848d6b364bf627d21)
(cherry picked from commit 4d14303653247da3922242796ab6d63123fbd004)

3 years agolibutils: check vsnprintf error
Steven Moreland [Tue, 28 Jul 2020 21:41:54 +0000 (21:41 +0000)]
libutils: check vsnprintf error

For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
(cherry picked from commit ee22384c54d42149491c8b9dbcda0d8c5e88eddc)

3 years agoString16::remove - avoid overflow
Steven Moreland [Thu, 28 May 2020 00:29:08 +0000 (00:29 +0000)]
String16::remove - avoid overflow

Bug: 156999009
Test: libutils_test (cases added)
Change-Id: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
Merged-In: Iad46d95d9848928ba81000090b2fe9aec1e5eaac
(cherry picked from commit f251c1c581f2d1b9940e60e756315c5e15443990)
(cherry picked from commit 9a9c8910e9296c9dc8d79c37f589895f5a2a836c)
(cherry picked from commit 4048e49956a2dfd49af3adf0f78881bf15f3550f)

4 years agoMerge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86
Chih-Wei Huang [Wed, 20 May 2020 14:05:35 +0000 (22:05 +0800)]
Merge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86

4 years agoMerge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86
Chih-Wei Huang [Wed, 20 May 2020 14:03:42 +0000 (22:03 +0800)]
Merge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86

Conflicts:
init/service.cpp

4 years agoFlattenableUtils::align memsets
Steven Moreland [Tue, 8 Oct 2019 00:31:17 +0000 (17:31 -0700)]
FlattenableUtils::align memsets

Bug: 141890807
Test: boot, check data is zero'd

[basilgello: Back-ported to 14.1:
 libutils/include/utils/Flattenable.h -> include/utils/Flattenable.h]

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
Change-Id: I45aaeac369f4c5cf3eb44f61c233e00f870a5c79
(cherry picked from commit bf824f8fa50d9f7390057278fefb58e83323a644)
(cherry picked from commit e62a9d7669ac85844d4424474f5c88c096f7160b)

4 years agoinit: set default selinux mode to permissive android-x86-7.1-r4 android-x86-7.1-r5
Chih-Wei Huang [Sat, 23 Nov 2019 02:48:43 +0000 (10:48 +0800)]
init: set default selinux mode to permissive

To support selinux enforcing mode, we still have a long way to go.
Let's set the default mode to permissive.

4 years agoinit: don't skip starting a service with no domain if permissive
William Bellavance [Tue, 30 Aug 2016 12:04:38 +0000 (08:04 -0400)]
init: don't skip starting a service with no domain if permissive

Requires external/libselinux change as well

Change-Id: I3f2887930e15d09014c2594141ba4acbbc8d6d9d

4 years agoMerge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86
Chih-Wei Huang [Tue, 22 Oct 2019 07:14:00 +0000 (15:14 +0800)]
Merge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86

4 years agoMerge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86
Chih-Wei Huang [Tue, 22 Oct 2019 07:09:59 +0000 (15:09 +0800)]
Merge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86

4 years agoMerge tag 'android-7.1.2_r39' into nougat-x86 android-x86-7.1-r3
Chih-Wei Huang [Wed, 16 Oct 2019 14:35:22 +0000 (22:35 +0800)]
Merge tag 'android-7.1.2_r39' into nougat-x86

Android 7.1.2 Release 39 (5787804)

4 years agoFix a memory leak in gatekeeper.
Janis Danisevskis [Wed, 5 Jun 2019 23:42:12 +0000 (16:42 -0700)]
Fix a memory leak in gatekeeper.

In violation to the documentation of GateKeeper::GetAuthTokenKey and
GateKeeper::GetPasswordKey, the implementations in SoftGateKeeper
allocate and return buffers and relinquish ownership causing a memory
leak, because the caller expects the implementation to retain ownership.

Bug: 129768470
Bug: 134557251
Test: gatekeeper-unit-tests
Change-Id: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
Merged-In: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
(cherry picked from commit 6a9c4e7968e73393110b169b33fb636531fe7fc2)

4 years agoFix a memory leak in gatekeeper.
Janis Danisevskis [Wed, 5 Jun 2019 23:42:12 +0000 (16:42 -0700)]
Fix a memory leak in gatekeeper.

In violation to the documentation of GateKeeper::GetAuthTokenKey and
GateKeeper::GetPasswordKey, the implementations in SoftGateKeeper
allocate and return buffers and relinquish ownership causing a memory
leak, because the caller expects the implementation to retain ownership.

Bug: 129768470
Bug: 134557251
Test: gatekeeper-unit-tests
Change-Id: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
Merged-In: I0af9539d3dcd47dfd1e7d80cdee700ea0c2d6d0f
(cherry picked from commit 6a9c4e7968e73393110b169b33fb636531fe7fc2)

5 years agoMake adb use a custom prop for adb root
Luca Stefani [Sat, 24 Nov 2018 10:54:59 +0000 (11:54 +0100)]
Make adb use a custom prop for adb root

Change-Id: Ie2b8c5e9d75371da43305f003607869370bbd1a4

5 years agoinit: add install_keyring for TWRP FBE decrypt
Ethan Yonker [Sat, 10 Jun 2017 12:43:46 +0000 (07:43 -0500)]
init: add install_keyring for TWRP FBE decrypt

Change-Id: Id7652763ec79bb8679aeb85793f1a748e0d67ff9

5 years agoinit.rc: Lock down access to /proc/net/fib_trie
Nick Kralevich [Fri, 25 Aug 2017 19:55:52 +0000 (12:55 -0700)]
init.rc: Lock down access to /proc/net/fib_trie

Make /proc/net/fib_trie only readable to root.

Bug: 31269937
Test: Device boots, file has appropriate permissions.
Change-Id: I0d01ce5c043d576344a6732b0b9ff93d62fcaa34
CVE-2017-13165

5 years agoinit.rc: move load_system_props to beginning of 'on fs'
Mark Salyzyn [Tue, 18 Apr 2017 15:13:06 +0000 (08:13 -0700)]
init.rc: move load_system_props to beginning of 'on fs'

ro.logd.kernel, ro.config.low_ram, ro.logd.timestamp and ro.debuggable
need to be retrieved prior to logd start in order for the service to
behave in a configured manner.  Other essential services are also
dependent on these system properties as well, so it just makes sense
to pick them all up first in 'on fs'.

Test: smoke test
Bug: 37425809
Change-Id: I33ad185f397ee527ed3c84cc2bcb40ff8ca785b5

5 years agoinit.rc: set initial cpuset to all cores
Wei Wang [Fri, 14 Apr 2017 01:27:35 +0000 (18:27 -0700)]
init.rc: set initial cpuset to all cores

Starting zygote early requires cpuset to be initialized to all cores for
foreground cpuset. Change to expolit all cores by default at boot and
let device manufacturers override to proper values in device specific
init script.

Bug: 36576280
Test: marlin boot fast and checked cpuset during early boot
Change-Id: I2c1ce0630e58a7b04d1a453c6740d3f0bce9de9f

6 years agoString16: remove integer overflows
Steven Moreland [Thu, 1 Mar 2018 19:03:04 +0000 (11:03 -0800)]
String16: remove integer overflows

Bug: 73826242
Test: manual
Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
(cherry picked from commit 0e5fbea01c228050739abe8d6cd13d7fdfacf6ef)
CVE-2017-13323

6 years agoString16: remove integer overflows
Steven Moreland [Thu, 1 Mar 2018 19:03:04 +0000 (11:03 -0800)]
String16: remove integer overflows

Bug: 73826242
Test: manual
Change-Id: I32e13d61b944c1a527cf2d95473552d246e322be
Merged-In: I32e13d61b944c1a527cf2d95473552d246e322be
(cherry picked from commit d0648d8dc61fe9ac39d2cd150a332b385a334bdc)

6 years agoMerge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86
Chih-Wei Huang [Tue, 13 Feb 2018 03:39:42 +0000 (11:39 +0800)]
Merge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86

Conflicts:
init/init.cpp

6 years agoMerge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86
Chih-Wei Huang [Tue, 13 Feb 2018 03:33:04 +0000 (11:33 +0800)]
Merge remote-tracking branch 'lineage/cm-14.1' into cm-14.1-x86

6 years agolibnetutil: Check dhcp respose packet length
tintin [Fri, 13 Oct 2017 18:11:48 +0000 (11:11 -0700)]
libnetutil: Check dhcp respose packet length

Bug: 67474440
Test: Manual

Change-Id: I84b533f0101a56ec01e64c7591f3c7e82f513b2e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
(cherry picked from commit 61f25d4a3657e79659963d12005afa8c30883015)

6 years agoMerge tag 'android-7.1.2_r36' into nougat-x86 android-x86-7.1-r1 android-x86-7.1-r2
Chih-Wei Huang [Thu, 4 Jan 2018 08:45:08 +0000 (16:45 +0800)]
Merge tag 'android-7.1.2_r36' into nougat-x86

Android 7.1.2 Release 36 (N2G48H)

6 years agozip_archive: reject files that don't start with an LFH signature.
Narayan Kamath [Wed, 9 Aug 2017 17:32:09 +0000 (18:32 +0100)]
zip_archive: reject files that don't start with an LFH signature.

Bug: 64211847
Test: zip_archive_test

Merged-In: Ib89f0def696206ff427be27764c158fab88e4b5d
Merged-In: I275e7c4da05ceeb20401b560c72294f29ef63642
Change-Id: I38705f4e9688326a140aa59a1333b0878ed39c14
(cherry picked from commit 2740bb09e3cee99032a86a1700cb0a6f14f3a51f)

6 years agoinit: handle ctrl-alt-del event
Chih-Wei Huang [Mon, 20 Nov 2017 08:50:20 +0000 (16:50 +0800)]
init: handle ctrl-alt-del event

By setting /proc/sys/kernel/ctrl-alt-del to 1, kernel will trap
ctrl-alt-del event and send a SIGINT signal to init.

Start the ctrl-alt-del service on receiving the signal.

6 years agoFix integer overflow in utf{16,32}_to_utf8_length
Adam Vartanian [Mon, 14 Aug 2017 14:51:29 +0000 (15:51 +0100)]
Fix integer overflow in utf{16,32}_to_utf8_length

Without an explicit check, the return value can wrap around and return
a value that is far too small to hold the data from the resulting
conversion.

No CTS test is provided because it would need to allocate at least
SSIZE_MAX / 2 bytes of UTF-16 data, which is unreasonable on 64-bit
devices.

Bug: 37723026
Test: run cts -p android.security
Change-Id: I56ba5e31657633b7f33685dd8839d4b3b998e586
(cherry picked from commit 47efc676c849e3abf32001d66e2d6eb887e83c48)

6 years agolibnetutil: Check dhcp respose packet length
tintin [Fri, 13 Oct 2017 18:11:48 +0000 (11:11 -0700)]
libnetutil: Check dhcp respose packet length

Bug: 67474440
Test: Manual

Change-Id: I84b533f0101a56ec01e64c7591f3c7e82f513b2e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
(cherry picked from commit 61f25d4a3657e79659963d12005afa8c30883015)

6 years agoMerge cherrypicks of [3166006, 3165952, 3164925, 3164926, 3164927, 3164928, 3167313...
android-build-team Robot [Fri, 3 Nov 2017 19:55:51 +0000 (19:55 +0000)]
Merge cherrypicks of [316600631659523164925316492631649273164928316731331673143167315316731631673173167318316731931673203167321316732231663183166319316632031663213166322316632331663243167333316733431673733165112316632531652293165230] into nyc-mr2-release

Change-Id: I1ceb02446b2daf909b269a7e9a2777182546e414

6 years agozip_archive: reject files that don't start with an LFH signature.
Narayan Kamath [Wed, 9 Aug 2017 17:32:09 +0000 (18:32 +0100)]
zip_archive: reject files that don't start with an LFH signature.

Bug: 64211847
Test: zip_archive_test

Merged-In: Ib89f0def696206ff427be27764c158fab88e4b5d
Merged-In: I275e7c4da05ceeb20401b560c72294f29ef63642
Change-Id: I38705f4e9688326a140aa59a1333b0878ed39c14
(cherry picked from commit 2740bb09e3cee99032a86a1700cb0a6f14f3a51f)

6 years agoMerge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86
meijjaa [Wed, 25 Oct 2017 15:43:43 +0000 (17:43 +0200)]
Merge remote-tracking branch 'x86/nougat-x86' into cm-14.1-x86

6 years agozip_archive: reject files that don't start with an LFH signature.
Narayan Kamath [Wed, 9 Aug 2017 17:32:09 +0000 (18:32 +0100)]
zip_archive: reject files that don't start with an LFH signature.

Bug: 64211847
Test: zip_archive_test

Merged-In: Ib89f0def696206ff427be27764c158fab88e4b5d
Merged-In: I275e7c4da05ceeb20401b560c72294f29ef63642
Change-Id: I38705f4e9688326a140aa59a1333b0878ed39c14
(cherry picked from commit 2740bb09e3cee99032a86a1700cb0a6f14f3a51f)

6 years agoUse __ with attribute __noreturn__ to avoid colliding with noreturn.
Elliott Hughes [Tue, 21 Jun 2016 00:21:59 +0000 (17:21 -0700)]
Use __ with attribute __noreturn__ to avoid colliding with noreturn.

Change-Id: I5a73ec69b580b2e70b2c68177078fa56b8353c19

6 years agoMerge cherrypicks of [2973982, 2974657, 2974658, 2973983, 2973984, 2974689, 2974690...
android-build-team Robot [Thu, 28 Sep 2017 17:17:26 +0000 (17:17 +0000)]
Merge cherrypicks of [2973982297465729746582973983297398429746892974690297469129746922974710297471129747132974714297421529742162974217297421829742192974220297472929747302974731297473229747332974734297473529747362974737297473829747392974740297474129747422974749297475029747512974752297475329746472974744297469329746942974648297451329746652974746] into nyc-mr2-release

Change-Id: Ib4bf7d12a0daded9d3a6a9861e82b96b2b657afa

6 years agoFix integer overflow in utf{16,32}_to_utf8_length
Adam Vartanian [Mon, 14 Aug 2017 14:51:29 +0000 (15:51 +0100)]
Fix integer overflow in utf{16,32}_to_utf8_length

Without an explicit check, the return value can wrap around and return
a value that is far too small to hold the data from the resulting
conversion.

No CTS test is provided because it would need to allocate at least
SSIZE_MAX / 2 bytes of UTF-16 data, which is unreasonable on 64-bit
devices.

Bug: 37723026
Test: run cts -p android.security
Change-Id: Ie2606b92b9eab1acfe8ce4663b43b81156a4cad7
Merged-In: I56ba5e31657633b7f33685dd8839d4b3b998e586
(cherry picked from commit f0a43dede921178b3048d40c330a8b664e94cca3)

6 years agoFix integer overflow in utf{16,32}_to_utf8_length
Adam Vartanian [Mon, 14 Aug 2017 14:51:29 +0000 (15:51 +0100)]
Fix integer overflow in utf{16,32}_to_utf8_length

Without an explicit check, the return value can wrap around and return
a value that is far too small to hold the data from the resulting
conversion.

No CTS test is provided because it would need to allocate at least
SSIZE_MAX / 2 bytes of UTF-16 data, which is unreasonable on 64-bit
devices.

Bug: 37723026
Test: run cts -p android.security
Change-Id: Ie2606b92b9eab1acfe8ce4663b43b81156a4cad7
Merged-In: I56ba5e31657633b7f33685dd8839d4b3b998e586
(cherry picked from commit f0a43dede921178b3048d40c330a8b664e94cca3)

6 years agoMake sdcardfs the default
Daniel Rosenberg [Mon, 20 Mar 2017 20:09:06 +0000 (13:09 -0700)]
Make sdcardfs the default

This will cause devices to default to sdcardfs if the kernel
supports it.

Test: Booted a wiped device, ensured sdcardfs was enabled
Change-Id: Ibce012b841b78d37ade668a38e91dca74a637867

6 years agolibsync: add support to new Sync API
Gustavo Padovan [Sat, 11 Jun 2016 14:11:19 +0000 (11:11 -0300)]
libsync: add support to new Sync API

Change libsync functions in a way that it can run dynamically on both
APIs.

v2: fix whitespace changes and poll return handling

v3: handle error cases on sync_wait()

Test: Sync unit tests still passes.
Change-Id: I743ab92ce39cbfa75dca41dd0a435efa9f2aab66
hange-Id: Ib56f2c6441b41028bc9f66998676790b7713988a

6 years agolibsync: open new location of sw_sync file
Gustavo Padovan [Fri, 10 Jun 2016 19:51:29 +0000 (16:51 -0300)]
libsync: open new location of sw_sync file

sw_sync file for debug was moved to debugfs. Try to open it and if it
fails try to open /dev/sw_sync.

Test: Sync unit tests still passes.
Change-Id: Ie078fbc2eb5294f28b916a9e65b7fcd3a18a8580
hange-Id: I216874964368d939bed2779d98cd89e527a57d45

6 years agolibsync: add new Sync kernel API
Gustavo Padovan [Fri, 10 Jun 2016 19:24:49 +0000 (16:24 -0300)]
libsync: add new Sync kernel API

Add the new API to the internal sync.h file. As there is two different
APIs we will need to discovery dynamically which one to use.

v2: Fix Documentation

Test: Sync unit tests still passes.
Change-Id: I2ab3cd46e48ba5d9c73d54f9583b1a8141566581

6 years agolibsync: move kernel headers for sync ioctls to sync.h
Gustavo Padovan [Fri, 10 Jun 2016 19:09:36 +0000 (16:09 -0300)]
libsync: move kernel headers for sync ioctls to sync.h

This patch moves the legacy API to the internal sync.h header
and add documentation to it.

Test: Sync unit tests still passes.
Change-Id: I9b17eb23af30043b3df5fb9e857affad68ba8521

6 years agoUpdate for kernel headers v4.8.14.
Christopher Ferris [Tue, 13 Dec 2016 01:32:55 +0000 (17:32 -0800)]
Update for kernel headers v4.8.14.

Update sync.c to include the structurs from sw_sync.h. This uapi
header has been deleted.

Test: Built mips/arm/arm64/x86/x86_64. Built and booted angler.
Change-Id: I2495cb17b35f697fb8a2a00f6633ccb53f78293f

6 years agoUpdate for kernel headers v4.7.2.
Christopher Ferris [Wed, 24 Aug 2016 21:49:18 +0000 (14:49 -0700)]
Update for kernel headers v4.7.2.

The new uapi kernel headers added a new SEGV reason code, so
add it to the tombstone code.

Update sync.c to include the needed data structures itself. Someone
else will be fixing this to work on old versus new kernels.

Change-Id: Icb27713ea38a20003c7671a9bca262eebd96099b

6 years agolibsync: add static library for recovery
Greg Hackmann [Fri, 5 Aug 2016 20:47:32 +0000 (13:47 -0700)]
libsync: add static library for recovery

Change-Id: If43188c3b4b16c698c077338ea0ef1dfd16b9c56
Signed-off-by: Greg Hackmann <ghackmann@google.com>
6 years agolibsync: remove unused liblog dependency
Greg Hackmann [Fri, 5 Aug 2016 17:07:28 +0000 (10:07 -0700)]
libsync: remove unused liblog dependency

Change-Id: I69840ece3f13809b2440edbe6cfa412a56aee4aa
Signed-off-by: Greg Hackmann <ghackmann@google.com>
6 years agoCleanup uses of sprintf so we can deprecate it.
George Burgess IV [Wed, 2 Mar 2016 22:02:55 +0000 (14:02 -0800)]
Cleanup uses of sprintf so we can deprecate it.

Also cleans up two instances of open() with useless mode params, and
changes a few uses of snprintf to use sizeof(buffer) instead of
hardcoded buffer sizes.

Change-Id: If11591003d910c995e72ad8f75afd072c255a3c5

6 years agologcat: Add missing newline to read failure
Luca Stefani [Sat, 8 Jul 2017 15:48:00 +0000 (17:48 +0200)]
logcat: Add missing newline to read failure

Change-Id: I468b3bd00f1effa43eb139a3c514ba042ae3dff7

6 years agoinit.rc: setup console-ramoops-0
Mark Salyzyn [Tue, 27 Jun 2017 16:32:32 +0000 (09:32 -0700)]
init.rc: setup console-ramoops-0

On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: Ibe1feb39ef9081b1ab2316510674bf181bdc7b0c

6 years agohealthd: check console-ramoops-0
Mark Salyzyn [Tue, 27 Jun 2017 16:19:09 +0000 (09:19 -0700)]
healthd: check console-ramoops-0

On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: I05be83e40dfc1730ed62b74a146123cdb8573ca6

6 years agofs_mgr: check console-ramoops-0
Mark Salyzyn [Tue, 27 Jun 2017 16:03:37 +0000 (09:03 -0700)]
fs_mgr: check console-ramoops-0

On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: If1422e4df09b68c44f16608b1d191aeb6378c66b

6 years agoinit: Run restorecon_recursive asynchronously
Tom Marshall [Fri, 9 Jun 2017 18:07:34 +0000 (18:07 +0000)]
init: Run restorecon_recursive asynchronously

restorecon_recursive may take a long time if there are a lot of files on
the volume.  This can trigger a watchdog timeout in any process that
tries to set a property while it is running.  Fix this by running
restorecon_recursive in its own process.

See https://jira.lineageos.org/browse/BUGBASH-555

Change-Id: I2ce26ff2b5bfc9a133ea42f4dbac50a3ac289c04

6 years agohealthd: fix include paths
Ayke van Laethem [Sun, 11 Jun 2017 01:44:54 +0000 (03:44 +0200)]
healthd: fix include paths

This makes it possible to set the *_LED_PATH defines from the device's
BoardConfig.mk.

For some reason, these defines were set for healthd.cpp, not for
healthd_mode_charger.cpp, where they are actually used.

I think the issue was introduced with the merging of android-7.1.2_r2 in
commit e40b34d9fc045a22929e459a8b3adc9cb104b2c1.

Change-Id: I507f2cb4cb440f2a6584a59394a623e5ffa16864

6 years agoMerge tag 'android-7.1.2_r17' into nougat-x86
Chih-Wei Huang [Wed, 7 Jun 2017 02:34:34 +0000 (10:34 +0800)]
Merge tag 'android-7.1.2_r17' into nougat-x86

Android 7.1.2 Release 17 (NJH47B)

6 years agolibcutils: fix schedboost after 31f78ddf4ea2ab7963d873cb16db98e976346468
Dan Pasanen [Mon, 5 Jun 2017 23:56:50 +0000 (18:56 -0500)]
libcutils: fix schedboost after 31f78ddf4ea2ab7963d873cb16db98e976346468

* fine, we'll use our own variable. jeez

Change-Id: I7663680767a966d21390c0f3b4d1d54703e7a134

6 years agoMerge tag 'android-7.1.2_r17' into cm-14.1
Dan Pasanen [Mon, 5 Jun 2017 23:29:57 +0000 (18:29 -0500)]
Merge tag 'android-7.1.2_r17' into cm-14.1

Android 7.1.2 Release 17 (NJH47B)

# gpg: Signature made Fri 02 Jun 2017 05:09:10 PM CDT
# gpg:                using DSA key E8AD3F819AB10E78
# gpg: Can't check signature: No public key

7 years agolibsuspend: add powerbtnd thread
Chih-Wei Huang [Sat, 20 May 2017 08:29:06 +0000 (16:29 +0800)]
libsuspend: add powerbtnd thread

Also send wakeup key on resume to ensure the system wakes up normally.

7 years agoMerge cherrypicks of [2278225, 2279882, 2279862, 2278226, 2277057, 2279863, 2278227...
android-build-team Robot [Thu, 18 May 2017 00:55:53 +0000 (00:55 +0000)]
Merge cherrypicks of [2278225227988222798622278226227705722798632278227] into nyc-mr2-pixel-monthly-release

Change-Id: I1ecb022752e056db772b9dc471529bc4ef335d7a

7 years agolibcutils: remove schedgroup fds [DO NOT MERGE]
Wei Wang [Wed, 29 Mar 2017 19:57:51 +0000 (12:57 -0700)]
libcutils: remove schedgroup fds [DO NOT MERGE]

After removing bg_non_interactive cgroup, there is only a ROOT cgroup.
This CL removes the no-op trying to set cgroup.
It also removes the attempt to open non-exist bg_non_interactive cgroup.

Bug: 36649832
Test: marlin boosts and cgroup ROOT task looks normal
Change-Id: Idef1dfdaa71fde63c98c73a3d37f65416aa6f2e2
(cherry picked from commit bcb6419fc9ac4c33aa1429092df4428e8e3836df)

7 years agoinit.rc: remove bg_non_interactive cgroup [ DO NOT MERGE ]
Wei Wang [Mon, 20 Mar 2017 21:21:06 +0000 (14:21 -0700)]
init.rc: remove bg_non_interactive cgroup [ DO NOT MERGE ]

We have seen cases when threads in this cgroup not scheduled for more than
a few seconds in heavy workload situation and causing device freeze.
In Linux, multiple threads placed in ROOT cgroup cause the CPU resource to
be split per thread, rather than per group.
Currently we have many threads in ROOT cgroup, which makes threads in
bg_non_interactive cgroup to have "tiny" CPU resource other than 5%
quota defined.

Bug: 34193533
Test: on marlin
Change-Id: I7721f6196560fbedf6265e8b6db130cec9edefd7
(cherry picked from commit 0638626e0e6c38835d36fa17326aee08235e261a)

7 years agolibcutils: only change cgroup when fd is initialized [ DO NOT MERGE ]
Wei Wang [Mon, 20 Mar 2017 22:13:05 +0000 (15:13 -0700)]
libcutils: only change cgroup when fd is initialized [ DO NOT MERGE ]

This is to avoid failues on setting non-exist cgroup

Bug: 34193533
Test: on marlin
Change-Id: I619dcba332fda9ec421df811745cf10311beddd3
(cherry picked from commit e46aae223626432bde7d4e95818e8394664c6c02)

7 years agorelease-request-513a9883-0d18-4c2f-80ce-cadb234b4e89-for-git_nyc-mr2-pixel-monthly...
android-build-team Robot [Wed, 17 May 2017 22:59:12 +0000 (22:59 +0000)]
release-request-513a9883-0d18-4c2f-80ce-cadb234b4e89-for-git_nyc-mr2-pixel-monthly-release-3938523 snap-temp-L39300000065258774

Change-Id: Iebfce5748223b9efcec5d6693b75df9868ad4acf

7 years agoRevert "Set correct permission for pppd"
Chih-Wei Huang [Fri, 12 May 2017 03:54:47 +0000 (11:54 +0800)]
Revert "Set correct permission for pppd"

It causes mtpd can't run pppd.

This reverts commit 9e89fe3e1816e8e7a5142780bf12302ee64d1b7e.

Reported-By: Xuefer H <xuefer@gmail.com>
7 years agoMerge cherrypicks of [2247380, 2246315, 2247358] into nyc-mr2-pixel-monthly-release
android-build-team Robot [Thu, 11 May 2017 19:13:46 +0000 (19:13 +0000)]
Merge cherrypicks of [224738022463152247358] into nyc-mr2-pixel-monthly-release

Change-Id: I63d2b044988b02601e7050cb3af45e4956338924

7 years agolibcutils: remove schedgroup fds [DO NOT MERGE]
Wei Wang [Wed, 29 Mar 2017 19:57:51 +0000 (12:57 -0700)]
libcutils: remove schedgroup fds [DO NOT MERGE]

Change-Id: Ie2c576dca8097668edd4c4e4fe947e862bd0c6d9

7 years agoRevert "init.rc: set initial cpuset to all cores"
Christopher R. Palmer [Mon, 8 May 2017 15:18:23 +0000 (15:18 +0000)]
Revert "init.rc: set initial cpuset to all cores"

Looks like cpusets doesn't initialize itself very sanely and this
causes all tasks to be placed in the root cgroup during boot, which
isn't what we wanted...

This reverts commit ada295f88cbcf6eff0e417abb753f1457df279c7.

Change-Id: I8d040c3e8e7a1d705c311d40f72754c999b80da7

7 years agoinit.rc: set initial cpuset to all cores
Wei Wang [Fri, 14 Apr 2017 01:27:35 +0000 (18:27 -0700)]
init.rc: set initial cpuset to all cores

Starting zygote early requires cpuset to be initialized to all cores for
foreground cpuset. Change to expolit all cores by default at boot and
let device manufacturers override to proper values in device specific
init script.

Bug: 36576280
Test: marlin boot fast and checked cpuset during early boot
Change-Id: I2c1ce0630e58a7b04d1a453c6740d3f0bce9de9f

7 years agoCamera: Add feature extensions
Susmitha Gummalla [Thu, 25 Jun 2015 05:38:25 +0000 (22:38 -0700)]
Camera: Add feature extensions

This change includes below commits:

    Camera bringup changes system-core
    Change-Id: I1cf98641eca9096bd27645e07ea802646ea1fb96

    system/core: Fix for HAL compilation issues while integrating HAL 1.0
    Change-Id: Iead9c1ade279b64c5cbdf4d2de1a8b695939c52a

    Camera: Add enum to specify the frame type
    Added enum to specify the frame type of either fd/data buffer
    CRs-fixed: 654901
    Change-Id: I1c0b1a2c6a1425cdb6650cdfc20ca65835a1b81f

Change-Id: I654a40661e6e101da2a06986abeceb20639cccd9

7 years agolibsuspend: disable earlysuspend by default
Chih-Wei Huang [Fri, 7 Oct 2016 13:59:28 +0000 (21:59 +0800)]
libsuspend: disable earlysuspend by default

7 years agoueventd: defer modules loading if explicitly listed
Chih-Wei Huang [Tue, 27 Sep 2016 11:14:12 +0000 (19:14 +0800)]
ueventd: defer modules loading if explicitly listed

The patch extends the syntax of /etc/modules.blacklist.
The modules marked as deferred in this file will be loaded
after all other modules are loaded at coldboot stage.

7 years agoinit: set default value of ro.hardware to the target name
Chih-Wei Huang [Fri, 23 Sep 2016 09:59:47 +0000 (17:59 +0800)]
init: set default value of ro.hardware to the target name

People usually forget to set the value of androidboot.hardware to
the target name in kernel cmdline which results in boot failure.

The change tries to reduce such an error in the future. The target
name is hardcoded to the image. This eliminates the necessity of
androidboot.hardware.

7 years agoueventd: auto load modules on uevents
Chih-Wei Huang [Thu, 25 Aug 2016 17:02:30 +0000 (01:02 +0800)]
ueventd: auto load modules on uevents

This is a squashed and refactory patch of the following commits
from marshmallow-x86:

 *  add modprobe-like capability and automatic ueventd loading

    Author: Jianxun Zhang <jianxun.zhang@intel.com>
    Author: Daniel Leung <daniel.leung@intel.com>
    Author: Andrew Boie <andrew.p.boie@intel.com>

    - insmod_by_dep() added to libcutils; loads a module into kernel.
    Modules the target module depends on will be loaded first. Loading
    will be stopped when an error occurs.

    - rmmod_by_dep() added to libcutils; removes a module from kernel.
    It also tries to remove other modules the target module depends
    on until an error occurs.

    - Implement wildcard matching for ueventd rules.
    The PCI and USB addresses for devices can change from devices
    from devices for a particular class of peripheral, for example,
    bluetooth. The ueventd rules created with these addresses are
    then device-specific.

    This changes the way ueventd rules with wildcard are handled.
    Instead of matching just the prefix with a trailing wildcard,
    now these 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.

    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/*/bluetooth/hci0/rfkill*

    - Let ueventd auto-load kernel modules. Implements the functionality
    for ueventd to auto-load kernel modules when uevents are triggered.
    Since /system may not be mounted when uevents are fired,
    a deferred loading mechanism is implemented. Once mapping of
    module and alias is available, these modules are then loaded.
    Modules can also be blacklisted so they will not be loaded
    automatically. One example would be the Wifi driver, as
    Android's has to control its loading and unloading.

    - add 'probemod' builtin command. This command accepts the name of a
    kernel module plus a set of command line arguments. The module will
    be loaded, along with all its dependencies, using the libcutils
    insmod_by_dep() API.

    - Drivers in kernel can request modules by launching a program in
    user space, the program's path by default is "/sbin/modprobe".
    Because Android system has no modprobe and ueventd is the only
    program handling the module aliases so far, This patch provides a
    cheap approach to handle kernel's requests in ueventd executable.

    - Add new builtin init command "coldboot". The main purpose is to
    provide an approach in init.*.rc files to fire uevents for devices
    under the path which is passed as the the argument. This should be
    called after /system is mounted so any queued events that need to
    load a module can be fired.

 *  allow to load modules from standard module path

 *  ueventd: load modules in a forked process

    Loading some modules (e.g., ath3k) will be blocked to wait for
    firmware. The forking is necessary, otherwise ueventd has no
    chance to load the firmware.

 *  init: add modprobe to load kernel requested modules

 *  libcutils: refine probe_module

    Make the code be more elegant and fix the realloc bug.

 *  ueventd: refactory module and firmware loading mechanism

    Currently each module and firmware loading event is forked to
    a child process to handle. It may cause some race conditions.

    Now we fork ueventd into two processes. The parent process handles
    normal uevents including modules loading, while the child process
    only handles firmware loading events. All events are handled
    sequentially.

 *  ueventd: load all modules with the matched alias

    Originally we only load the first module with the matched alias.
    It causes some necessary modules are not loaded.

7 years agoueventd: fix copied string not being freed
Chih-Wei Huang [Thu, 25 Aug 2016 13:10:32 +0000 (21:10 +0800)]
ueventd: fix copied string not being freed

Unlike change Id0a5f711e33363082ba201afda6b26043998cb1c,
parse_subsystem and parse_line_subsystem hold points to memory
of the copied string which can't be freed.

To fix the issue, duplicate the strings to be hold.
Then we can parse the std::string data directly without
copying it.

Change-Id: I4dbf543de6880537b419e6c2344ee6a40ce378f1

7 years agoinit: don't bail out even no SELinux domain defined
Chih-Wei Huang [Thu, 18 Aug 2016 08:05:58 +0000 (16:05 +0800)]
init: don't bail out even no SELinux domain defined

7 years agoinit: enlarge the time to wait coldboot done
Chih-Wei Huang [Sun, 14 Aug 2016 03:23:20 +0000 (11:23 +0800)]
init: enlarge the time to wait coldboot done

We need more time to probe and load all modules.
If 10s is still not enough for you, let me know.

7 years agoinit.rc: symlink /lib to /system/lib
Chih-Wei Huang [Fri, 29 Jul 2016 11:49:58 +0000 (19:49 +0800)]
init.rc: symlink /lib to /system/lib

Currently more linux drivers use request_firmware_nowait() to load
firmwares. It requires the firmwares exist in the standard path.

Create the symlink before ueventd started to ensure firmwares
could be loaded correctly.

7 years agoFix build break on x86_64
Ma Jian [Wed, 6 Jul 2016 10:31:55 +0000 (18:31 +0800)]
Fix build break on x86_64

When TARGET_ARCH=x86_64, the LOCAL_SRC_FILES will be wrongly set to
codegen.cpp.arm,  but the android make will 'smartly' remove the suffix
".arm" and try to compile the codegen.cpp without the libenc dependency.

NO_REF_TASK
Tested: local build

Change-Id: I25df0692886fd8b7c56d467d3b6f674919b09b56

7 years agoSupport use local time for RTC
Ma Jian [Sun, 12 Jun 2016 09:34:25 +0000 (17:34 +0800)]
Support use local time for RTC

When default timezone isn't UTC, there will no persist.sys.timezone
under /data/property/, so init won't get the default timezone for
setting time from rtc.

This change adds a fallback to read the property when the persist file
does not exists.

Notice, the default property of persist.sys.timezone should be set in
/default.prop instead of /system/build.prop

NO_REF_TASK
Tested: set default timezone with Asia/Shanghai, make sure bios time
is correct in local time, reboot to android, the local time should
be correct.

Change-Id: Ifbd20cb3710f833ab65852b4e5d51e38cc7c2d79

7 years agoinit: support usbmisc devices
Roman Petrovski [Fri, 10 Jun 2016 19:50:00 +0000 (03:50 +0800)]
init: support usbmisc devices

The patch allows to create usbmisc device nodes like /dev/cdc-wdm0.

7 years agolibsuspend: add a property sleep.earlysuspend
Chih-Wei Huang [Sun, 5 Jun 2016 10:47:29 +0000 (18:47 +0800)]
libsuspend: add a property sleep.earlysuspend

Set the property to 0 to disable earlysuspend.
The default value is 1.

7 years agolibsuspend: make sleep state configurable and add a fallback
Jaap Jan Meijer [Thu, 2 Jun 2016 15:43:24 +0000 (17:43 +0200)]
libsuspend: make sleep state configurable and add a fallback

This patch allows the user to set the sleep state target from
Android properties for both wakeup_count and earlysuspend methods.
It also includes a fallback state if the default state is not
available and the user didn't set the sleep.state property.

Signed-off-by: Jaap Jan Meijer <jjmeijer88@gmail.com>
7 years agoMount debugfs earlier regardless build variant
Ching Tzung Lin [Mon, 11 Jan 2016 21:00:22 +0000 (13:00 -0800)]
Mount debugfs earlier regardless build variant

ag/835596 can be reverted after this CL is merged.

BUG:26455292
Change-Id: I453b0f1d08d822f8cd2d4d33f1c1b21f0d7f543a

7 years agolibsuspend: enable earlysuspend for android-x86
Chih-Wei Huang [Tue, 6 Oct 2015 19:08:21 +0000 (03:08 +0800)]
libsuspend: enable earlysuspend for android-x86

7 years agoinit: expand variables on mount_all command
Chih-Wei Huang [Mon, 23 Nov 2015 09:57:37 +0000 (17:57 +0800)]
init: expand variables on mount_all command

This allows mount_all to handle fstab.${ro.hardware} instead
of hardcoding the file name.

7 years agoSoftware-accelerated Pixel Flinger
Chih-Wei Huang [Mon, 10 Aug 2015 08:31:28 +0000 (16:31 +0800)]
Software-accelerated Pixel Flinger

The typical graphic workloads on VirtualBox are improved 3X.

Supports both x86 and x86_64.

Similar change by HazouPH <jgrharbers@gmail.com>:
http://review.cyanogenmod.org/#/c/70896/

And by Quanganh pham <quanganh2627@gmail.com>:
http://review.cyanogenmod.org/#/c/97125/

7 years agoinit.rc: fix for "add_tid_to_cgroup failed to write" warnings
Chih-Wei Huang [Fri, 3 Apr 2015 12:36:39 +0000 (20:36 +0800)]
init.rc: fix for "add_tid_to_cgroup failed to write" warnings

I still don't understand why only 0660 works.

7 years agoMerge branch 'android-ia' into nougat-x86
Chih-Wei Huang [Sat, 6 May 2017 14:52:37 +0000 (22:52 +0800)]
Merge branch 'android-ia' into nougat-x86

7 years agoAllow all to execute su
Chih-Wei Huang [Mon, 3 Nov 2014 15:06:02 +0000 (23:06 +0800)]
Allow all to execute su

The Superuser app can control how su is used.

7 years agoinit.rc: let some services run as root
Chih-Wei Huang [Wed, 29 Oct 2014 15:25:57 +0000 (23:25 +0800)]
init.rc: let some services run as root

The surfaceflinger needs root permission to control vt.

Run the console shell as root to make debugging easier.

7 years agolibutils: fix incorrect calculation in utf8_length() method
Chih-Wei Huang [Fri, 8 Aug 2014 10:17:04 +0000 (18:17 +0800)]
libutils: fix incorrect calculation in utf8_length() method

The first character of utf-8 could be larger than 128. If use signed char
variable to hold it, it would be treated as negative. That may result in
some unexpected errors.

For example, without this patch, suppose the code is 0xE88888, then
first_char is 0xE8 and converted to int32_t type (0xFFFFFFE8) and
masked with (~to_ignore_mask). The result utf32 is FFF08208
which is incorrect.

Change-Id: I72b355f380865bc375251eb287fc225fd585a115

7 years agoSet correct permission for pppd
Chih-Wei Huang [Sun, 29 Apr 2012 07:04:55 +0000 (15:04 +0800)]
Set correct permission for pppd

The pppd needs setuid root to setup ppp interface.

7 years agoinit: avoid virtual console be set blanked
Chih-Wei Huang [Sun, 1 Jan 2012 19:16:41 +0000 (03:16 +0800)]
init: avoid virtual console be set blanked

7 years agoinit: change firmware_dirs for Android-x86
Chih-Wei Huang [Tue, 1 Feb 2011 07:47:03 +0000 (15:47 +0800)]
init: change firmware_dirs for Android-x86

7 years agoueventd.rc: remove redundant definitions
Chih-Wei Huang [Sat, 15 Jan 2011 22:44:37 +0000 (06:44 +0800)]
ueventd.rc: remove redundant definitions

Change-Id: Icb4f051abf941052aca9752ca2949386738d94e5

7 years agoUPSTREAM_PENDING newfs_msdos: Handle alignment failure
Irina Patru [Fri, 22 Aug 2014 12:18:49 +0000 (15:18 +0300)]
UPSTREAM_PENDING newfs_msdos: Handle alignment failure

When trying to create a new FAT32 file system using alignment, the resulted
MBR structure is corrupted, because the total sectors reported does not
correspond to the actual available sectors. This is due to the reserved
sectors field which is updated during the alignment.

When fsck_msdos will try to check this file system, it will fail because it
cannot match the reported sectors with the actual available sectors.
Due to the failed check, the file system cannot be mounted by vold.

I/fsck_msdos( 2180): FAT size too small, 242822 entries won't fit into 1897 sectors
I/fsck_msdos( 2180): fsck_msdos terminated by exit(8)
E/Vold    ( 2180): Filesystem check failed (unknown exit code 8)
E/Vold    ( 2180): /dev/block/vold/179:49 failed FS checks (I/O error)
D/Vold    ( 2180): Volume sdcard1 state changing 3 (Checking) -> 1 (Idle-Unmounted)

In order to fix this issue, we will save the initial bpb structure and restore
it if the alignment fails.

Change-Id: I58d5078551c689b28c9070585bb330c45bab9c62
Signed-off-by: Irina Patru <irina.patru@intel.com>
Reviewed-on: https://android.intel.com/256992
Reviewed-by: Dolca, Robert <robert.dolca@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Reviewed-by: Popa, Valentin <valentin.popa@intel.com>
7 years agodevices: Increase the uevent socket buffer size
Samuel Ortiz [Thu, 17 Jul 2014 23:35:29 +0000 (01:35 +0200)]
devices: Increase the uevent socket buffer size

Depending on the timing, hald may start while ueventd is not done yet
with its initial coldboot. As hald also independently starts its own
coldboot, ueventd netlink socket buffer could get filled quickly and
thus ueventd could lose some uevents.
This is fixed by increasing the ueventd netlink socket buffer size.

Change-Id: Ie92f77c14099421740b3984f1cc23f813287b78f
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Reviewed-on: https://android.intel.com/219843
Reviewed-by: Escande, Thierry <thierry.escande@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Reviewed-by: Ortiz, Samuel <samuel.ortiz@intel.com>
Tested-by: Ortiz, Samuel <samuel.ortiz@intel.com>
Tested-by: cactus <cactus@intel.com>
Reviewed-by: Porlan, Patrick <patrick.porlan@intel.com>
Reviewed-by: Bianti, Sebastien <sebastien.bianti@intel.com>
Reviewed-by: Mahalingam, Ganesh <ganesh.mahalingam@intel.com>
Tested-by: Mahalingam, Ganesh <ganesh.mahalingam@intel.com>
7 years agoadb: reserve a wakelock when clients are connected over socket
Andrew Boie [Thu, 12 Jul 2012 22:39:25 +0000 (15:39 -0700)]
adb: reserve a wakelock when clients are connected over socket

USB OTG connections already have a wakelock reserved, but if a network
socket connection is made, the device can unexpectedly suspend
in the middle of a session. The lock is released when the client
disconnects.

Change-Id: Id5ac01699fab9350955c9814042259542fc6a694
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>