blob: 0248c61a25e64c4767260b7cec01a5553e9be30a [file] [log] [blame]
Alan Stokes1294f942023-08-21 14:34:12 +01001// 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.
18pub const ROOT_UID: u32 = 0;
19
Alan Stokes679ddf32023-09-01 11:14:48 +010020// 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 Stokes1294f942023-08-21 14:34:12 +010031/// Group ID shared by all payload users.
Alan Stokes27f3ef02023-09-29 15:09:35 +010032pub const MICRODROID_PAYLOAD_GID: u32 = if cfg!(multi_tenant) { 6000 } else { 0 };
Alan Stokes1294f942023-08-21 14:34:12 +010033
34/// User ID for the initial payload user.
Alan Stokes27f3ef02023-09-29 15:09:35 +010035pub const MICRODROID_PAYLOAD_UID: u32 = if cfg!(multi_tenant) { 6000 } else { 0 };