Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 2021 12:11:33 +0200
From:      Michael Gmelin <freebsd@grem.de>
To:        James Gritton <jamie@freebsd.org>
Cc:        jail@freebsd.org, Michael Gmelin <freebsd@grem.de>
Subject:   Re: POSIX shared memory and dying jails
Message-ID:  <20210802121133.4456fb99@bsd64.grem.de>
In-Reply-To: <8d9eb169d7b0072cd6f7ff00f5757842@freebsd.org>
References:  <20210625164100.73c71055@bsd64.grem.de> <03809b2655a40134dd802386afa6be7d@freebsd.org> <20210625185859.40fead46@bsd64.grem.de> <8d9eb169d7b0072cd6f7ff00f5757842@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help


On Fri, 25 Jun 2021 20:18:39 -0700
James Gritton <jamie@freebsd.org> wrote:

> On 2021-06-25 09:58, Michael Gmelin wrote:
> > Another problem caused by the lack of jail ownership is that access
> > semantics are a bit strange. E.g., a jail based on / can easily list
> > (and remove) all memory allocations in the system, while for other 
> > jails
> > it depends. They can stat their own allocations like in:
> > 
> >     # posixshmcontrol stat /xyz
> >     output as expected...
> > 
> > But not list them:
> > 
> >     # posixshmcontrol ls
> >     posixshmcontrol: cannot get kern.ipc.posix_shm_list length:
> >     Operation not permitted
> > 
> > Probably related to matching the path of the allocation, I didn't
> > look into the code.  
> 
> That's just a case of the sysctl not being marked as jail-safe.
> Looking at the code, it's clear that it needs to be altered when
> called from within a jail, but preventing it is definitely not the
> right thing.
> 
> > but having something automatic in the OS would be nice. Or being
> > able to run `posixshmcontrol -j shmtest ls`. Seems like this would
> > be quite some effort though to get it right - also in terms of who
> > can access what - right now, it's simply based on the path, which
> > also gives
> > a lot of flexibility.  
> 
> Since access to the shared memory segments themselves is only on file
> permissions and pathnames, just making a "posixshmcontrol -j" also
> rely on pathnames actually makes sense.
> 
> Put this into a bug report, and I'll take a closer look.  Probably two
> different bugs for different issues (listing and automatic removal).
> 

Hi Jamie,

I *finally* found the time to write the bug reports:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257554
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257555
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257556

I took the liberty to assign them to you.

Best,
Michael

-- 
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210802121133.4456fb99>