[RESTRICT AUTOMERGE] fcntl_F_SETFD test: allow both Android 14 and 2024Q1 behavior. am: 7922ce0d0d

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2898796

Change-Id: Id9eea3e40c29773a89479bc1101f674225396fff
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index 845ff27..212aafc 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -49,34 +49,21 @@
 #include "private/ScopedFd.h"
 
 static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
-static const char property_service_for_system_socket[] =
-    "/dev/socket/" PROP_SERVICE_FOR_SYSTEM_NAME;
 static const char* kServiceVersionPropertyName = "ro.property_service.version";
 
 class PropertyServiceConnection {
  public:
-  PropertyServiceConnection(const char* name) : last_error_(0) {
+  PropertyServiceConnection() : last_error_(0) {
     socket_.reset(::socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0));
     if (socket_.get() == -1) {
       last_error_ = errno;
       return;
     }
 
-    // If we're trying to set "sys.powerctl" from a privileged process, use the special
-    // socket. Because this socket is only accessible to privileged processes, it can't
-    // be DoSed directly by malicious apps. (The shell user should be able to reboot,
-    // though, so we don't just always use the special socket for "sys.powerctl".)
-    // See b/262237198 for context
-    const char* socket = property_service_socket;
-    if (strcmp(name, "sys.powerctl") == 0 &&
-        access(property_service_for_system_socket, W_OK) == 0) {
-      socket = property_service_for_system_socket;
-    }
-
-    const size_t namelen = strlen(socket);
+    const size_t namelen = strlen(property_service_socket);
     sockaddr_un addr;
     memset(&addr, 0, sizeof(addr));
-    strlcpy(addr.sun_path, socket, sizeof(addr.sun_path));
+    strlcpy(addr.sun_path, property_service_socket, sizeof(addr.sun_path));
     addr.sun_family = AF_LOCAL;
     socklen_t alen = namelen + offsetof(sockaddr_un, sun_path) + 1;
 
@@ -189,7 +176,7 @@
 };
 
 static int send_prop_msg(const prop_msg* msg) {
-  PropertyServiceConnection connection(msg->name);
+  PropertyServiceConnection connection;
   if (!connection.IsValid()) {
     return connection.GetLastError();
   }
@@ -282,7 +269,7 @@
     // New protocol only allows long values for ro. properties only.
     if (strlen(value) >= PROP_VALUE_MAX && strncmp(key, "ro.", 3) != 0) return -1;
     // Use proper protocol
-    PropertyServiceConnection connection(key);
+    PropertyServiceConnection connection;
     if (!connection.IsValid()) {
       errno = connection.GetLastError();
       async_safe_format_log(
diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index c7a30eb..744a45b 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -41,7 +41,6 @@
 __BEGIN_DECLS
 
 #define PROP_SERVICE_NAME "property_service"
-#define PROP_SERVICE_FOR_SYSTEM_NAME "property_service_for_system"
 #define PROP_FILENAME "/dev/__properties__"
 
 #define PROP_MSG_SETPROP 1
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index f0ad937..5f802aa 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -168,6 +168,8 @@
 }
 
 TEST(time, mktime_EOVERFLOW) {
+  setenv("TZ", "UTC", 1);
+
   struct tm t;
   memset(&t, 0, sizeof(tm));
 
diff --git a/tests/uchar_test.cpp b/tests/uchar_test.cpp
index 4dc6314..703f558 100644
--- a/tests/uchar_test.cpp
+++ b/tests/uchar_test.cpp
@@ -112,7 +112,7 @@
   ASSERT_EQ(0U, mbrtoc16(nullptr, nullptr, 0, nullptr));
 }
 
-TEST(uchar, mbrtoc16_zero_len) {
+TEST(uchar, DISABLED_mbrtoc16_zero_len) {
   char16_t out;
 
   out = L'x';
@@ -125,7 +125,7 @@
   ASSERT_EQ(L'h', out);
 }
 
-TEST(uchar, mbrtoc16) {
+TEST(uchar, DISABLED_mbrtoc16) {
   char16_t out;
 
   ASSERT_STREQ("C.UTF-8", setlocale(LC_CTYPE, "C.UTF-8"));
@@ -196,7 +196,7 @@
   ASSERT_EQ(EILSEQ, errno);
 }
 
-TEST(uchar, mbrtoc16_incomplete) {
+TEST(uchar, DISABLED_mbrtoc16_incomplete) {
   mbstate_t ps;
   memset(&ps, 0, sizeof(ps));
 
@@ -271,7 +271,7 @@
   ASSERT_EQ(EILSEQ, errno);
 }
 
-TEST(uchar, mbrtoc32) {
+TEST(uchar, DISABLED_mbrtoc32) {
   char32_t out[8];
 
   out[0] = L'x';
diff --git a/tests/wchar_test.cpp b/tests/wchar_test.cpp
index 8716810..07eef1b 100644
--- a/tests/wchar_test.cpp
+++ b/tests/wchar_test.cpp
@@ -34,7 +34,7 @@
   EXPECT_EQ(4U, sizeof(wint_t));
 }
 
-TEST(wchar, mbrlen) {
+TEST(wchar, DISABLED_mbrlen) {
   char bytes[] = { 'h', 'e', 'l', 'l', 'o', '\0' };
   EXPECT_EQ(0U, mbrlen(&bytes[0], 0, nullptr));
   EXPECT_EQ(1U, mbrlen(&bytes[0], 1, nullptr));
@@ -252,7 +252,7 @@
   ASSERT_TRUE(wcsstr(L"romrom", L"rom") != nullptr);
 }
 
-TEST(wchar, mbtowc) {
+TEST(wchar, DISABLED_mbtowc) {
   wchar_t out[8];
 
   out[0] = 'x';
@@ -271,7 +271,7 @@
   ASSERT_EQ(0, mbtowc(nullptr, nullptr, 0));
 }
 
-TEST(wchar, mbrtowc) {
+TEST(wchar, DISABLED_mbrtowc) {
   wchar_t out[8];
 
   out[0] = 'x';