Merge "Remove usage of base/logging.h in libfs_avb" into main
diff --git a/debuggerd/libdebuggerd/tombstone_proto.cpp b/debuggerd/libdebuggerd/tombstone_proto.cpp
index b6fc4e2..ed4fd53 100644
--- a/debuggerd/libdebuggerd/tombstone_proto.cpp
+++ b/debuggerd/libdebuggerd/tombstone_proto.cpp
@@ -356,6 +356,9 @@
     auto map_info = maps->Find(fault_addr);
     if (map_info != nullptr && map_info->flags() == PROT_EXEC) {
       cause = "execute-only (no-read) memory access error; likely due to data in .text.";
+    } else if (fault_addr == target_thread.registers->pc() &&
+               map_info != nullptr && (map_info->flags() & PROT_EXEC) == 0) {
+      cause = "trying to execute non-executable memory.";
     } else {
       cause = get_stack_overflow_cause(fault_addr, target_thread.registers->sp(), maps);
     }
diff --git a/fs_mgr/libsnapshot/scratch_super.cpp b/fs_mgr/libsnapshot/scratch_super.cpp
index 805abf3..93c4bbd 100644
--- a/fs_mgr/libsnapshot/scratch_super.cpp
+++ b/fs_mgr/libsnapshot/scratch_super.cpp
@@ -98,7 +98,6 @@
     }
     const auto& opener = info->GetPartitionOpener();
     std::string slot_suffix = info->GetSlotSuffix();
-    int slot = SlotNumberForSlotSuffix(slot_suffix);
     // Walk both the slots and clean up metadata related to scratch space from
     // both the slots.
     for (auto slot : slots) {
diff --git a/fs_mgr/libsnapshot/snapshot_stats.cpp b/fs_mgr/libsnapshot/snapshot_stats.cpp
index 9b6eb2c..8e9d9c5 100644
--- a/fs_mgr/libsnapshot/snapshot_stats.cpp
+++ b/fs_mgr/libsnapshot/snapshot_stats.cpp
@@ -25,7 +25,7 @@
 
 SnapshotMergeStats* SnapshotMergeStats::GetInstance(SnapshotManager& parent) {
     static SnapshotMergeStats g_instance(parent.GetMergeStateFilePath());
-    CHECK(g_instance.path_ == parent.GetMergeStateFilePath());
+    CHECK_EQ(g_instance.path_, parent.GetMergeStateFilePath());
     return &g_instance;
 }
 
diff --git a/init/README.md b/init/README.md
index 1e15765..de57208 100644
--- a/init/README.md
+++ b/init/README.md
@@ -745,6 +745,9 @@
   fstab.${ro.hardware} or fstab.${ro.hardware.platform} will be scanned for
   under /odm/etc, /vendor/etc, or / at runtime, in that order.
 
+`swapoff <path>`
+> Stops swapping to the file or block device specified by path.
+
 `symlink <target> <path>`
 > Create a symbolic link at _path_ with the value _target_
 
@@ -788,7 +791,6 @@
   If the file does not exist, it will be created. If it does exist,
   it will be truncated. Properties are expanded within _content_.
 
-
 Imports
 -------
 `import <path>`
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 3f3bec6..c4af5b5 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -36,6 +36,7 @@
 #include <sys/resource.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
+#include <sys/swap.h>
 #include <sys/syscall.h>
 #include <sys/system_properties.h>
 #include <sys/time.h>
@@ -1270,6 +1271,13 @@
     return {};
 }
 
+static Result<void> do_swapoff(const BuiltinArguments& args) {
+    if (!swapoff(args[1].c_str())) {
+        return ErrnoError() << "swapoff() failed";
+    }
+    return {};
+}
+
 // Builtin-function-map start
 const BuiltinFunctionMap& GetBuiltinFunctionMap() {
     constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max();
@@ -1325,6 +1333,7 @@
         {"start",                   {1,     1,    {false,  do_start}}},
         {"stop",                    {1,     1,    {false,  do_stop}}},
         {"swapon_all",              {0,     1,    {false,  do_swapon_all}}},
+        {"swapoff",                 {1,     1,    {false,  do_swapoff}}},
         {"enter_default_mount_ns",  {0,     0,    {false,  do_enter_default_mount_ns}}},
         {"symlink",                 {2,     2,    {true,   do_symlink}}},
         {"sysclktz",                {1,     1,    {false,  do_sysclktz}}},
diff --git a/libcutils/include/private/android_filesystem_config.h b/libcutils/include/private/android_filesystem_config.h
index eeb0394..b0bddf5 100644
--- a/libcutils/include/private/android_filesystem_config.h
+++ b/libcutils/include/private/android_filesystem_config.h
@@ -143,7 +143,8 @@
 #define AID_PRNG_SEEDER 1092         /* PRNG seeder daemon */
 #define AID_UPROBESTATS 1093         /* uid for uprobestats */
 #define AID_CROS_EC 1094             /* uid for accessing ChromeOS EC (cros_ec) */
-/* Changes to this file must be made in AOSP, *not* in internal branches. */
+// Additions to this file must be made in AOSP, *not* in internal branches.
+// You will also need to update expect_ids() in bionic/tests/grp_pwd_test.cpp.
 
 #define AID_SHELL 2000 /* adb and debug shell user */
 #define AID_CACHE 2001 /* cache access */
@@ -158,7 +159,7 @@
 #define AID_OEM_RESERVED_START 2900
 #define AID_OEM_RESERVED_END 2999
 
-/* The 3000 series are intended for use as supplemental group id's only.
+/* The 3000 series are intended for use as supplemental group ids only.
  * They indicate special Android capabilities that the kernel is aware of. */
 #define AID_NET_BT_ADMIN 3001 /* bluetooth: create any socket */
 #define AID_NET_BT 3002       /* bluetooth: create sco, rfcomm or l2cap sockets */
@@ -172,6 +173,8 @@
 #define AID_UHID 3011         /* Allow read/write to /dev/uhid node */
 #define AID_READTRACEFS 3012  /* Allow tracefs read */
 #define AID_VIRTUALMACHINE 3013 /* Allows VMs to tune for performance*/
+// Additions to this file must be made in AOSP, *not* in internal branches.
+// You will also need to update expect_ids() in bionic/tests/grp_pwd_test.cpp.
 
 /* The range 5000-5999 is also reserved for vendor partition. */
 #define AID_OEM_RESERVED_2_START 5000
diff --git a/rootdir/Android.bp b/rootdir/Android.bp
index 5f0a2c3..44acbba 100644
--- a/rootdir/Android.bp
+++ b/rootdir/Android.bp
@@ -50,10 +50,15 @@
     recovery_available: true,
 }
 
+filegroup {
+    name: "system_linker_config_json_file",
+    srcs: ["etc/linker.config.json"],
+}
+
 // TODO(b/147210213) Generate list of libraries during build and fill in at build time
 linker_config {
     name: "system_linker_config",
-    src: "etc/linker.config.json",
+    src: ":system_linker_config_json_file",
     installable: false,
 }
 
diff --git a/rootdir/Android.mk b/rootdir/create_root_structure.mk
similarity index 98%
rename from rootdir/Android.mk
rename to rootdir/create_root_structure.mk
index ac9ca85..1daf239 100644
--- a/rootdir/Android.mk
+++ b/rootdir/create_root_structure.mk
@@ -1,7 +1,5 @@
 LOCAL_PATH:= $(call my-dir)
 
-$(eval $(call declare-1p-copy-files,system/core/rootdir,))
-
 #######################################
 ifneq ($(filter address,$(SANITIZE_TARGET)),)
 ASAN_EXTRACT_FILES :=