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

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

Issue 371113003: Disable yama on 3.2 kernels with 32bit userland and 64bit kernel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/yama_unittests.cc
diff --git a/sandbox/linux/services/yama_unittests.cc b/sandbox/linux/services/yama_unittests.cc
index 17ef4b40de5a046286296eab9fafb8302e6ac2cb..b765f41b7b172e7cca9c469204d8f5613b5e7c8e 100644
--- a/sandbox/linux/services/yama_unittests.cc
+++ b/sandbox/linux/services/yama_unittests.cc
@@ -21,6 +21,21 @@ namespace sandbox {
namespace {
+bool HasLinux32Bug() {
+#if defined(__i386__)
+ // On 3.2 kernels, yama doesn't work for 32bit binaries on 64bit kernels.
Jorge Lucangeli Obes 2014/07/08 04:57:14 Yama, 32-bit, 64-bit
Nico 2014/07/08 05:00:47 I had fixed the 32bit/64bit thing (see patch set 3
+ // This is fixed in 3.4.
+ bool is_kernel_64bit =
+ base::SysInfo::OperatingSystemArchitecture() == "x86_64";
+ bool is_linux = base::SysInfo::OperatingSystemName() == "Linux";
+ bool is_3_dot_2 = StartsWithASCII(
+ base::SysInfo::OperatingSystemVersion(), "3.2", /*case_sensitive=*/false);
+ if (is_kernel_64bit && is_linux && is_3_dot_2)
+ return true;
+#endif // defined(__i386__)
+ return false;
+}
+
bool CanPtrace(pid_t pid) {
int ret;
ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL);
@@ -112,6 +127,9 @@ void SetYamaRestrictions(bool enable_restriction) {
}
TEST(Yama, RestrictPtraceWorks) {
+ if (HasLinux32Bug())
+ return;
+
ScopedProcess process1(base::Bind(&SetYamaRestrictions, true));
ASSERT_TRUE(process1.WaitForClosureToRun());
@@ -134,7 +152,7 @@ TEST(Yama, RestrictPtraceWorks) {
void DoNothing() {}
SANDBOX_TEST(Yama, RestrictPtraceIsDefault) {
- if (!Yama::IsPresent())
+ if (!Yama::IsPresent() || HasLinux32Bug())
return;
CHECK(Yama::DisableYamaRestrictions());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698