OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 } | 483 } |
484 | 484 |
485 if (setuid_sandbox->IsInNewPIDNamespace() && !has_started_new_init) { | 485 if (setuid_sandbox->IsInNewPIDNamespace() && !has_started_new_init) { |
486 LOG(ERROR) << "The SUID sandbox created a new PID namespace but Zygote " | 486 LOG(ERROR) << "The SUID sandbox created a new PID namespace but Zygote " |
487 "is not the init process. Please, make sure the SUID " | 487 "is not the init process. Please, make sure the SUID " |
488 "binary is up to date."; | 488 "binary is up to date."; |
489 } | 489 } |
490 | 490 |
491 int sandbox_flags = linux_sandbox->GetStatus(); | 491 int sandbox_flags = linux_sandbox->GetStatus(); |
492 | 492 |
493 #if defined(USE_NSS) | |
ddorwin
2012/10/20 00:45:32
If we take this patch, should we remove http://cod
jln (very slow on Chromium)
2012/10/20 01:14:09
This comment is misleading on Linux. On Linux the
| |
494 // Do some extra NSS initialization. We don't want to do this pre-sandbox | |
495 // because it's not well defined what venues of attacks it could create. | |
496 // | |
497 // In addition to the benfit of doing this initialization only once, (it | |
498 // will be inherited), this is a good warm-up before we enable our next layer | |
499 // of sandbox, e.g. seccomp-bpf. | |
500 | |
501 // We will soon fork, but we haven't loaded any security module. | |
502 crypto::DisableNSSForkCheck(); | |
Ryan Sleevi
2012/10/19 23:50:10
Is modifying the |env| like this permitted at this
jln (very slow on Chromium)
2012/10/20 00:51:30
I didn't now that the env was affected, but I don'
| |
503 // Without this line on Linux, HMAC::Init will instantiate a singleton that | |
504 // in turn attempts to open a file. | |
Ryan Sleevi
2012/10/19 23:50:10
drop the comment on 503-504. It doesn't matter wha
jln (very slow on Chromium)
2012/10/20 00:51:30
Done.
| |
505 // The sandbox will prevent that anyway, but if it didn't, this would also | |
506 // leak descriptors to private files. | |
Ryan Sleevi
2012/10/19 23:50:10
What files are being opened? What descriptors are
jln (very slow on Chromium)
2012/10/20 00:51:30
I modified it to make it more generic. What we don
| |
507 crypto::ForceNSSNoDBInit(); | |
508 // Initialize NSS, every child process will benefit from it. | |
509 crypto::EnsureNSSInit(); | |
Ryan Sleevi
2012/10/19 23:50:10
s/benefit/suffer/ :)
It's not clear to me what ho
jln (very slow on Chromium)
2012/10/20 00:51:30
When this function is called, NSS will make some s
| |
510 #endif | |
511 | |
493 Zygote zygote(sandbox_flags, forkdelegate); | 512 Zygote zygote(sandbox_flags, forkdelegate); |
494 // This function call can return multiple times, once per fork(). | 513 // This function call can return multiple times, once per fork(). |
495 return zygote.ProcessRequests(); | 514 return zygote.ProcessRequests(); |
496 } | 515 } |
497 | 516 |
498 } // namespace content | 517 } // namespace content |
OLD | NEW |