Re: [PATCH v2] proc: allow restricting /proc/pid/mem writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 05, 2024 at 02:12:26AM -0800, Kees Cook wrote:
> On Tue, Mar 05, 2024 at 10:58:25AM +0100, Christian Brauner wrote:
> > Since the write handler for /proc/<pid>/mem does raise FOLL_FORCE
> > unconditionally it likely would implicitly. But I'm not familiar enough
> > with FOLL_FORCE to say for sure.
> 
> I should phrase the question better. :) Is the supervisor writing into
> read-only regions of the child process?

Hm... I suspect we don't. Let's take two concrete examples so you can
tell me.

Incus intercepts the sysinfo() syscall. It prepares a struct sysinfo
with cgroup aware values for the supervised process and then does:

unix.Pwrite(siov.memFd, &sysinfo, sizeof(struct sysinfo), seccomp_data.args[0]))

It also intercepts some bpf system calls attaching bpf programs for the
caller. If that fails we update the log buffer for the supervised
process:

union bpf_attr attr = {}, new_attr = {};

// read struct bpf_attr from mem_fd
ret = pread(mem_fd, &attr, attr_len, req->data.args[1]);
if (ret < 0)
        return -errno;

// Do stuff with attr. Stuff fails. Update log buffer for supervised process:
if ((new_attr.log_size) > 0 && (pwrite(mem_fd, new_attr.log_buf, new_attr.log_size, attr.log_buf) != new_attr.log_size))

But I'm not sure if there are other use-cases that would require this.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux