Alan Stokes | 1294f94 | 2023-08-21 14:34:12 +0100 | [diff] [blame] | 1 | // Copyright 2023 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | //! User and group IDs within Microdroid |
| 16 | |
| 17 | /// Always the user ID of Root. |
| 18 | pub const ROOT_UID: u32 = 0; |
| 19 | |
Alan Stokes | 679ddf3 | 2023-09-01 11:14:48 +0100 | [diff] [blame] | 20 | // Android reserves UID/GIDs 6000-6499 for use by the system partition - |
| 21 | // see AID_SYSTEM_RESERVED_START. |
| 22 | // Within Microdroid we own the system partition, so they are free for our |
| 23 | // use. The Microdroid system image includes /system/ext/passwd and |
| 24 | // /system/ext/group files that allocate names to the IDs that we are |
| 25 | // using, so that tools like `ps` handle them correctly - see build targets |
| 26 | // microdroid_etc_passwd and microdroid_etc_group. |
| 27 | // (Our UIDs are entirely separate from Android's, but we use the same |
| 28 | // Bionic, and it uses the Android definitions - so using a reserved range |
| 29 | // helps avoid confusion.) |
| 30 | |
Alan Stokes | 1294f94 | 2023-08-21 14:34:12 +0100 | [diff] [blame] | 31 | /// Group ID shared by all payload users. |
| 32 | pub const MICRODROID_PAYLOAD_GID: u32 = if cfg!(payload_not_root) { 6000 } else { 0 }; |
| 33 | |
| 34 | /// User ID for the initial payload user. |
| 35 | pub const MICRODROID_PAYLOAD_UID: u32 = if cfg!(payload_not_root) { 6000 } else { 0 }; |