Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: sandbox/linux/services/credentials_unittest.cc

Issue 1310773006: Update sandbox/linux from upstream (Closed) Base URL: ssh://ssh.github.com/domokit/mojo.git@master
Patch Set: Update to 3909ebfa69566f7374a6900e63cd4d3c73a35378 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/services/credentials.cc ('k') | sandbox/linux/services/namespace_sandbox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/credentials_unittest.cc
diff --git a/sandbox/linux/services/credentials_unittest.cc b/sandbox/linux/services/credentials_unittest.cc
index 6b93c86c3ecbc2104282b50da80e32f3d9ad06d3..39fd6a7e6def2fcca19b62766c688f2ae7e0d50e 100644
--- a/sandbox/linux/services/credentials_unittest.cc
+++ b/sandbox/linux/services/credentials_unittest.cc
@@ -6,6 +6,8 @@
#include <errno.h>
#include <fcntl.h>
+#include <pthread.h>
+#include <signal.h>
#include <stdio.h>
#include <sys/capability.h>
#include <sys/stat.h>
@@ -237,6 +239,31 @@ SANDBOX_TEST(Credentials, SetCapabilitiesMatchesLibCap2) {
CHECK_EQ(0, cap_compare(expected_cap.get(), actual_cap.get()));
}
+volatile sig_atomic_t signal_handler_called;
+void SignalHandler(int sig) {
+ signal_handler_called = 1;
+}
+
+// Disabled on ASAN because of crbug.com/451603.
+SANDBOX_TEST(Credentials, DISABLE_ON_ASAN(DropFileSystemAccessPreservesTLS)) {
+ // Probably missing kernel support.
+ if (!Credentials::MoveToNewUserNS()) return;
+ CHECK(Credentials::DropFileSystemAccess(ProcUtil::OpenProc().get()));
+
+ // In glibc, pthread_getattr_np makes an assertion about the cached PID/TID in
+ // TLS.
+ pthread_attr_t attr;
+ EXPECT_EQ(0, pthread_getattr_np(pthread_self(), &attr));
+
+ // raise also uses the cached TID in glibc.
+ struct sigaction action = {};
+ action.sa_handler = &SignalHandler;
+ PCHECK(sigaction(SIGUSR1, &action, nullptr) == 0);
+
+ PCHECK(raise(SIGUSR1) == 0);
+ CHECK_EQ(1, signal_handler_called);
+}
+
} // namespace.
} // namespace sandbox.
« no previous file with comments | « sandbox/linux/services/credentials.cc ('k') | sandbox/linux/services/namespace_sandbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698