Revert of Revert of Disable yama on 3.2 kernels with 32bit userland and 64bit...

Revert of Revert of Disable yama on 3.2 kernels with 32bit userland and 64bit kernel. (https://codereview.chromium.org/374933002/)

Reason for revert:
[Sheriff] This was fixed already in 281762.

Original issue's description:
> Revert of Disable yama on 3.2 kernels with 32bit userland and 64bit kernel. (https://codereview.chromium.org/371113003/)
> 
> Reason for revert:
> Broke clang builders:
> https://build.chromium.org/p/chromium.linux/builders/Linux%20Clang%20(dbg)/builds/61819/steps/compile/logs/stdio
> 
> Original issue's description:
> > Disable two yama tests on 3.2 kernels with 32bit userland and 64bit kernel.
> > 
> > Disabling yama restrictions is broken there.
> > 
> > BUG=391916
> > R=jorgelo@chromium.org
> > 
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=281666
> > 
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=281757
> 
> TBR=jorgelo@chromium.org,keescook@chromium.org,thakis@chromium.org
> NOTREECHECKS=true
> NOTRY=true
> BUG=391916
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=281763

TBR=jorgelo@chromium.org,keescook@chromium.org,thakis@chromium.org,eseidel@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=391916

Review URL: https://codereview.chromium.org/374943002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281764 0039d316-1c4b-4281-b951-d872f2087c98
parent f51fbca5
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "sandbox/linux/services/scoped_process.h" #include "sandbox/linux/services/scoped_process.h"
#include "sandbox/linux/services/yama.h" #include "sandbox/linux/services/yama.h"
#include "sandbox/linux/tests/unit_tests.h" #include "sandbox/linux/tests/unit_tests.h"
...@@ -21,6 +23,21 @@ namespace sandbox { ...@@ -21,6 +23,21 @@ namespace sandbox {
namespace { namespace {
bool HasLinux32Bug() {
#if defined(__i386__)
// On 3.2 kernels, yama doesn't work for 32-bit binaries on 64-bit kernels.
// 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) { bool CanPtrace(pid_t pid) {
int ret; int ret;
ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL); ret = ptrace(PTRACE_ATTACH, pid, NULL, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment