<feed xmlns='http://www.w3.org/2005/Atom'>
<title>replicant/core/init/devices.cpp, branch master</title>
<subtitle>Patches not merged yet, used for building and testing them
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/'/>
<entry>
<title>Adds /dev/block/by-name/&lt;partition&gt; symlinks</title>
<updated>2018-05-19T01:31:35+00:00</updated>
<author>
<name>Bowgo Tsai</name>
<email>bowgotsai@google.com</email>
</author>
<published>2018-05-16T10:33:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=5ee7dae840eaebdd1aec47632e2a32e1ba7dd90a'/>
<id>5ee7dae840eaebdd1aec47632e2a32e1ba7dd90a</id>
<content type='text'>
During uevent processing, some "by-name" symlinks will be created.
    /dev/block/&lt;type&gt;/&lt;device&gt;/by-name/&lt;partition&gt;

&lt;type&gt; can be: platform, pci or vbd.
&lt;device&gt; might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc.
&lt;partition&gt; might be: system, vendor, system_a, system_b, etc.

e.g., on a non-A/B device:
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

On a A/B device:
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_b
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b

However, those symlinks are "device-specific".

This change adds the "generic" symlinks in ueventd, in addition to
the existing symlinks, when the possible "boot devices" are specified
in device tree. e.g.,

    &amp;firmware_android {
	compatible = "android,firmware";
	boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci";
    }

The following symlinks will then be created on the aforementioned non-A/B
and A/B devices, respectively.

    /dev/block/by-name/system
    /dev/block/by-name/vendor

    /dev/block/by-name/system_a
    /dev/block/by-name/system_b
    /dev/block/by-name/vendor_a
    /dev/block/by-name/vendor_b

Note that both &lt;type&gt; and &lt;device&gt; are skipped in the newly create symlinks.
It assumes there is no more than one devices with the same &lt;partition&gt;,
which is the assumption of current first stage mount flow.

Finally, when 'boot_devices' in DT is absent, it fallbacks to extract
'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc',
'soc.0/f9824900.sdhci' for a fstab with the following content:

   /dev/block/platform/soc/1da4000.ufshc/by-name/system
   /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

Bug: 78613232
Test: adb shell ls /dev/block/by-name
Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
Merged-In: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
(cherry picked from commit 8eec38f4e463d8cd980562ec49432c17972cc5cb)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During uevent processing, some "by-name" symlinks will be created.
    /dev/block/&lt;type&gt;/&lt;device&gt;/by-name/&lt;partition&gt;

&lt;type&gt; can be: platform, pci or vbd.
&lt;device&gt; might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc.
&lt;partition&gt; might be: system, vendor, system_a, system_b, etc.

e.g., on a non-A/B device:
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

On a A/B device:
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_b
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b

However, those symlinks are "device-specific".

This change adds the "generic" symlinks in ueventd, in addition to
the existing symlinks, when the possible "boot devices" are specified
in device tree. e.g.,

    &amp;firmware_android {
	compatible = "android,firmware";
	boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci";
    }

The following symlinks will then be created on the aforementioned non-A/B
and A/B devices, respectively.

    /dev/block/by-name/system
    /dev/block/by-name/vendor

    /dev/block/by-name/system_a
    /dev/block/by-name/system_b
    /dev/block/by-name/vendor_a
    /dev/block/by-name/vendor_b

Note that both &lt;type&gt; and &lt;device&gt; are skipped in the newly create symlinks.
It assumes there is no more than one devices with the same &lt;partition&gt;,
which is the assumption of current first stage mount flow.

Finally, when 'boot_devices' in DT is absent, it fallbacks to extract
'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc',
'soc.0/f9824900.sdhci' for a fstab with the following content:

   /dev/block/platform/soc/1da4000.ufshc/by-name/system
   /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

Bug: 78613232
Test: adb shell ls /dev/block/by-name
Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
Merged-In: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
(cherry picked from commit 8eec38f4e463d8cd980562ec49432c17972cc5cb)
</pre>
</div>
</content>
</entry>
<entry>
<title>Removing block device by-num symlinks</title>
<updated>2018-05-19T01:28:42+00:00</updated>
<author>
<name>Bowgo Tsai</name>
<email>bowgotsai@google.com</email>
</author>
<published>2018-05-17T08:19:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=ff17cc31e5aa49fc8cce1693f813d150a7343ab5'/>
<id>ff17cc31e5aa49fc8cce1693f813d150a7343ab5</id>
<content type='text'>
The uevent.partition_num easily collides between partitions, for
example:

  Both /dev/block/sda3 and /dev/block/sdd3 will generate the same symlink:
    /dev/block/platform/soc/1da4000.ufshc/by-num/p3

This change remove those by-num symlinks as there seems no effective
user of it.

Bug: 78613232
Test: m init_tests &amp;&amp; \
      adb push $OUT/data/nativetest64/init_tests/init_tests /data/. &amp;&amp; \
      adb shell /data/init_tests

Change-Id: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de
Merged-In: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de
(cherry picked from commit 95591bd00e653826f25bfa705c3f50545f6b06a3)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The uevent.partition_num easily collides between partitions, for
example:

  Both /dev/block/sda3 and /dev/block/sdd3 will generate the same symlink:
    /dev/block/platform/soc/1da4000.ufshc/by-num/p3

This change remove those by-num symlinks as there seems no effective
user of it.

Bug: 78613232
Test: m init_tests &amp;&amp; \
      adb push $OUT/data/nativetest64/init_tests/init_tests /data/. &amp;&amp; \
      adb shell /data/init_tests

Change-Id: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de
Merged-In: I8dfa8dc1a2f9fc9296aa30f33e905bf158b501de
(cherry picked from commit 95591bd00e653826f25bfa705c3f50545f6b06a3)
</pre>
</div>
</content>
</entry>
<entry>
<title>Add std::string StartsWith*/EndsWith* overloads.</title>
<updated>2017-12-20T17:42:22+00:00</updated>
<author>
<name>Elliott Hughes</name>
<email>enh@google.com</email>
</author>
<published>2017-12-20T17:41:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=579e682628805dd9c3f8c96765c0beb3f56f1494'/>
<id>579e682628805dd9c3f8c96765c0beb3f56f1494</id>
<content type='text'>
We should have done this from the beginning. Thanks to Windows, we're not
going to be able to switch libbase over to std::string_view any time soon.

Bug: N/A
Test: ran tests
Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We should have done this from the beginning. Thanks to Windows, we're not
going to be able to switch libbase over to std::string_view any time soon.

Bug: N/A
Test: ran tests
Change-Id: Iff2f56986e39de53f3ac484415378af17dacf26b
</pre>
</div>
</content>
</entry>
<entry>
<title>ueventd: fix subsystem list logic issues</title>
<updated>2017-08-18T17:39:48+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-08-17T16:38:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=9c8d6dd7de6e436542d40ae1cd635ce13b89162f'/>
<id>9c8d6dd7de6e436542d40ae1cd635ce13b89162f</id>
<content type='text'>
1) Check subsystems list before doing usb subsystem logic.  This allows
   developers to handle usb* subsystems in ueventd.rc files.
2) Fix a bug where each subsystem_ instance is not reinitialized, but
   rather only the name_ member was set.

Test: boot bullhead
Test: check that multiple uevent_devname subsystems work when
      specified in ueventd.rc
Change-Id: Ifcac04763afcaf72a3b14ef5f3a6cb89981b51a1
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1) Check subsystems list before doing usb subsystem logic.  This allows
   developers to handle usb* subsystems in ueventd.rc files.
2) Fix a bug where each subsystem_ instance is not reinitialized, but
   rather only the name_ member was set.

Test: boot bullhead
Test: check that multiple uevent_devname subsystems work when
      specified in ueventd.rc
Change-Id: Ifcac04763afcaf72a3b14ef5f3a6cb89981b51a1
</pre>
</div>
</content>
</entry>
<entry>
<title>init: split security functions out of init.cpp</title>
<updated>2017-08-14T16:40:01+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-08-10T19:22:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=0c8d6d27304d1d6e5f8f0a3feb1f60872ac278f2'/>
<id>0c8d6d27304d1d6e5f8f0a3feb1f60872ac278f2</id>
<content type='text'>
This change splits out the selinux initialization and supporting
functionality into selinux.cpp and splits the security related
initialization of the rng, etc to security.cpp.  It also provides
additional documentation for SEPolicy loading as this has been
requested by some teams.

It additionally cleans up sehandle and sehandle_prop.  The former is
static within selinux.cpp and new wrapper functions are created around
selabel_lookup*() to better serve the users.  The latter is moved to
property_service.cpp as it is isolated to that file for its usage.

Test: boot bullhead
Merged-In: Idc95d493cebc681fbe686b5160502f36af149f60
Change-Id: Idc95d493cebc681fbe686b5160502f36af149f60
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change splits out the selinux initialization and supporting
functionality into selinux.cpp and splits the security related
initialization of the rng, etc to security.cpp.  It also provides
additional documentation for SEPolicy loading as this has been
requested by some teams.

It additionally cleans up sehandle and sehandle_prop.  The former is
static within selinux.cpp and new wrapper functions are created around
selabel_lookup*() to better serve the users.  The latter is moved to
property_service.cpp as it is isolated to that file for its usage.

Test: boot bullhead
Merged-In: Idc95d493cebc681fbe686b5160502f36af149f60
Change-Id: Idc95d493cebc681fbe686b5160502f36af149f60
</pre>
</div>
</content>
</entry>
<entry>
<title>ueventd: remove character device symlinks (/dev/usb/*)</title>
<updated>2017-06-26T20:58:57+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-06-23T19:43:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=b4dd881ffd2c2b50b5ffd323264b3c0bfd7bffe7'/>
<id>b4dd881ffd2c2b50b5ffd323264b3c0bfd7bffe7</id>
<content type='text'>
While refactoring ueventd, I was looking for code the character device
symlinks (/dev/usb/*) that ueventd creates, such that I could test it
on a real device.  I found none in our tree, and history showing Xoom,
which was last supported years ago, was the last user.  If this code
is in fact obsolete, let's remove it.

Test: boot bullhead
Test: init unit tests

Change-Id: I601f7165eb06d36b31b6dcf69ee9e0a449d81a96
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While refactoring ueventd, I was looking for code the character device
symlinks (/dev/usb/*) that ueventd creates, such that I could test it
on a real device.  I found none in our tree, and history showing Xoom,
which was last supported years ago, was the last user.  If this code
is in fact obsolete, let's remove it.

Test: boot bullhead
Test: init unit tests

Change-Id: I601f7165eb06d36b31b6dcf69ee9e0a449d81a96
</pre>
</div>
</content>
</entry>
<entry>
<title>init: create android::init:: namespace</title>
<updated>2017-06-23T20:21:20+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-06-22T19:53:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=81f5d3ebef2c3789737bf718fc2a2cdd7b9e8b33'/>
<id>81f5d3ebef2c3789737bf718fc2a2cdd7b9e8b33</id>
<content type='text'>
With some small fixups along the way

Test: Boot bullhead
Test: init unit tests
Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With some small fixups along the way

Test: Boot bullhead
Test: init unit tests
Change-Id: I7beaa473cfa9397f845f810557d1631b4a462d6a
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Revert "ueventd: remove PlatformDeviceList""</title>
<updated>2017-06-21T22:04:57+00:00</updated>
<author>
<name>Sandeep Patil</name>
<email>sspatil@google.com</email>
</author>
<published>2017-06-21T19:46:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=cd2ba0d184c3fa9bbf0881a5d1fb3d3e205da1f9'/>
<id>cd2ba0d184c3fa9bbf0881a5d1fb3d3e205da1f9</id>
<content type='text'>
This reverts commit 516ff99711bbb533c4ca3970882ef376df6b044d.

Bug: 62864413
Bug: 62864413

Change-Id: Ie3980cd536c2c83adace063f0950128f68561105
Signed-off-by: Sandeep Patil &lt;sspatil@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 516ff99711bbb533c4ca3970882ef376df6b044d.

Bug: 62864413
Bug: 62864413

Change-Id: Ie3980cd536c2c83adace063f0950128f68561105
Signed-off-by: Sandeep Patil &lt;sspatil@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "ueventd: remove PlatformDeviceList"</title>
<updated>2017-06-21T18:42:07+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-06-21T18:40:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=516ff99711bbb533c4ca3970882ef376df6b044d'/>
<id>516ff99711bbb533c4ca3970882ef376df6b044d</id>
<content type='text'>
Bug: 62864413

This reverts commit c94ce7b130979317d9523ba0d175f0ad369fb1c4.

Change-Id: I014360251e5cda89c87adfec46d8b1e5000f3a9c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bug: 62864413

This reverts commit c94ce7b130979317d9523ba0d175f0ad369fb1c4.

Change-Id: I014360251e5cda89c87adfec46d8b1e5000f3a9c
</pre>
</div>
</content>
</entry>
<entry>
<title>ueventd: remove PlatformDeviceList</title>
<updated>2017-06-20T21:21:14+00:00</updated>
<author>
<name>Tom Cherry</name>
<email>tomcherry@google.com</email>
</author>
<published>2017-06-16T23:48:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/contrib/GNUtoo/replicant/core/commit/?id=c94ce7b130979317d9523ba0d175f0ad369fb1c4'/>
<id>c94ce7b130979317d9523ba0d175f0ad369fb1c4</id>
<content type='text'>
In order to create symlinks for USB and block devices, the path for
their parent platform device must be known.

Previously, ueventd would save each platform device that it encounters
to a list and query this list when creating the symlinks.  That,
however, is racy because the uevent socket does not differentiate
uevents from RegenerateUevents() and uevents sent by the kernel when
probing a device first the first time.  The below scenario is the
faulty  case:

1) Kernel probes parent platform device for a block device
2) ueventd calls RegenerateUevents() and starts processing uevents
3) Kernel probes block device and sends its uevents
4) ueventd picks up the block device uevent during its uevent processing,
   without yet regenerating the platform device uevent, causing improper
   symlinks to be created.

This change stops storing the platform devices in a list, and instead
traverses up the directory structure for each USB or block device
until it reaches a platform device, defined as one whose subsystem is
the platform bus.  This fixes the race and simplifies the ueventd
code.

Bug: 62436493
Bug: 62681642
Test: Boot bullhead
Test: Boot sailfish
Test: Init unit tests
Test: Boot hikey + hotplug/unplug sdcard
Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to create symlinks for USB and block devices, the path for
their parent platform device must be known.

Previously, ueventd would save each platform device that it encounters
to a list and query this list when creating the symlinks.  That,
however, is racy because the uevent socket does not differentiate
uevents from RegenerateUevents() and uevents sent by the kernel when
probing a device first the first time.  The below scenario is the
faulty  case:

1) Kernel probes parent platform device for a block device
2) ueventd calls RegenerateUevents() and starts processing uevents
3) Kernel probes block device and sends its uevents
4) ueventd picks up the block device uevent during its uevent processing,
   without yet regenerating the platform device uevent, causing improper
   symlinks to be created.

This change stops storing the platform devices in a list, and instead
traverses up the directory structure for each USB or block device
until it reaches a platform device, defined as one whose subsystem is
the platform bus.  This fixes the race and simplifies the ueventd
code.

Bug: 62436493
Bug: 62681642
Test: Boot bullhead
Test: Boot sailfish
Test: Init unit tests
Test: Boot hikey + hotplug/unplug sdcard
Change-Id: I21636355d8e434f30e0cba568598a6cf139e67f9
</pre>
</div>
</content>
</entry>
</feed>
