Skip to content

Commit 956a031

Browse files
committed
Merge branch 'fix-split-tun-clear'
2 parents 819de86 + f364383 commit 956a031

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Line wrap the file at 100 chars. Th
4040
- Fix a bug with Shadowsocks-based API access methods where some ciphers were configurable by
4141
Mullvad VPN clients while not being supported by the system service.
4242

43+
#### Linux
44+
- Fix 'mullvad split-tunnel clear' getting stuck.
45+
4346
### Security
4447
- Remove ability for renderer process to execute arbitrary binaries. This is a defence-in-depth
4548
measure to ensure that the renderer process does not have any capabilities beyond that of a

talpid-cgroup/src/v1.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct CGroup1 {
2424
/// Absolute path of the cgroup, e.g. `/sys/fs/cgroup/net_cls/foobar`
2525
path: PathBuf,
2626

27-
/// `cgroup.procs` is used to add and list PIDs in the cgroup2.
27+
/// `cgroup.procs` is used to add and list PIDs in the cgroup.
2828
procs: File,
2929
}
3030

@@ -89,7 +89,7 @@ impl CGroup1 {
8989
Self::open(child_path)
9090
}
9191

92-
/// Try to clone the cgroup2 handle.
92+
/// Try to clone the cgroup handle.
9393
///
9494
/// This is fallible because cloning file descriptors can fail.
9595
pub fn try_clone(&self) -> Result<Self, super::Error> {
@@ -102,7 +102,7 @@ impl CGroup1 {
102102
})
103103
}
104104

105-
/// Assign a process to this cgroup2.
105+
/// Assign a process to this cgroup.
106106
pub fn add_pid(&self, pid: Pid) -> Result<(), super::Error> {
107107
// Format the PID as a string
108108
let mut pid_buf = [0u8; 16];
@@ -111,12 +111,12 @@ impl CGroup1 {
111111

112112
// Write PID to `cgroup.procs`.
113113
nix::unistd::write(&self.procs, pid_str.to_bytes())
114-
.with_context(|| anyhow!("Failed to add process {pid} to cgroup2"))?;
114+
.with_context(|| anyhow!("Failed to add process {pid} to cgroup"))?;
115115

116116
Ok(())
117117
}
118118

119-
/// List all PIDs in this cgroup2.
119+
/// List all PIDs in this cgroup.
120120
pub fn list_pids(&mut self) -> Result<Vec<pid_t>, super::Error> {
121121
let mut file = &self.procs;
122122
let mut pids = String::new();

talpid-core/src/split_tunnel/linux/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,9 @@ impl Inner {
218218

219219
/// Removes all PIDs from the Cgroup.
220220
fn clear(&mut self) -> Result<(), Error> {
221-
let mut pids = self.list()?;
222-
while !pids.is_empty() {
223-
for pid in pids {
224-
let pid = Pid::from_raw(pid);
225-
self.remove(pid)?;
226-
}
227-
pids = self.list()?;
221+
for pid in self.list()? {
222+
let pid = Pid::from_raw(pid);
223+
self.remove(pid)?;
228224
}
229225
Ok(())
230226
}

0 commit comments

Comments
 (0)