mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[BEEEP] Use tracing in process_isolation (#16762)
This commit is contained in:
@@ -2,6 +2,7 @@ use anyhow::Result;
|
||||
#[cfg(target_env = "gnu")]
|
||||
use libc::c_uint;
|
||||
use libc::{self, c_int};
|
||||
use tracing::info;
|
||||
|
||||
// RLIMIT_CORE is the maximum size of a core dump file. Setting both to 0 disables core dumps, on crashes
|
||||
// https://github.com/torvalds/linux/blob/1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0/include/uapi/asm-generic/resource.h#L20
|
||||
@@ -20,7 +21,7 @@ pub fn disable_coredumps() -> Result<()> {
|
||||
rlim_cur: 0,
|
||||
rlim_max: 0,
|
||||
};
|
||||
println!("[Process Isolation] Disabling core dumps via setrlimit");
|
||||
info!("Disabling core dumps via setrlimit.");
|
||||
|
||||
if unsafe { libc::setrlimit(RLIMIT_CORE, &rlimit) } != 0 {
|
||||
let e = std::io::Error::last_os_error();
|
||||
@@ -48,9 +49,9 @@ pub fn is_core_dumping_disabled() -> Result<bool> {
|
||||
|
||||
pub fn isolate_process() -> Result<()> {
|
||||
let pid = std::process::id();
|
||||
println!(
|
||||
"[Process Isolation] Disabling ptrace and memory access for main ({}) via PR_SET_DUMPABLE",
|
||||
pid
|
||||
info!(
|
||||
pid,
|
||||
"Disabling ptrace and memory access for main via PR_SET_DUMPABLE."
|
||||
);
|
||||
|
||||
if unsafe { libc::prctl(PR_SET_DUMPABLE, 0) } != 0 {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use anyhow::{bail, Result};
|
||||
use tracing::info;
|
||||
|
||||
pub fn disable_coredumps() -> Result<()> {
|
||||
bail!("Not implemented on Mac")
|
||||
@@ -10,10 +11,7 @@ pub fn is_core_dumping_disabled() -> Result<bool> {
|
||||
|
||||
pub fn isolate_process() -> Result<()> {
|
||||
let pid: u32 = std::process::id();
|
||||
println!(
|
||||
"[Process Isolation] Disabling ptrace on main process ({}) via PT_DENY_ATTACH",
|
||||
pid
|
||||
);
|
||||
info!(pid, "Disabling ptrace on main process via PT_DENY_ATTACH.");
|
||||
|
||||
secmem_proc::harden_process().map_err(|e| {
|
||||
anyhow::anyhow!(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use anyhow::{bail, Result};
|
||||
use tracing::info;
|
||||
|
||||
pub fn disable_coredumps() -> Result<()> {
|
||||
bail!("Not implemented on Windows")
|
||||
@@ -10,10 +11,7 @@ pub fn is_core_dumping_disabled() -> Result<bool> {
|
||||
|
||||
pub fn isolate_process() -> Result<()> {
|
||||
let pid: u32 = std::process::id();
|
||||
println!(
|
||||
"[Process Isolation] Isolating main process via DACL {}",
|
||||
pid
|
||||
);
|
||||
info!(pid, "Isolating main process via DACL.");
|
||||
|
||||
secmem_proc::harden_process().map_err(|e| {
|
||||
anyhow::anyhow!(
|
||||
|
||||
Reference in New Issue
Block a user