Re: RFC: seccomp-bpf support

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: RFC: seccomp-bpf support
Дата
Msg-id
28344.1567019959@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support David Fetter <david@fetter.org>
Re: RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Tom Lane <tgl@sss.pgh.pa.us>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Tom Lane <tgl@sss.pgh.pa.us>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Tom Lane <tgl@sss.pgh.pa.us>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Alvaro Herrera <alvherre@2ndquadrant.com>
Re: RFC: seccomp-bpf support Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support Tom Lane <tgl@sss.pgh.pa.us>
Re: RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: RFC: seccomp-bpf support Robert Haas <robertmhaas@gmail.com>
Re: RFC: seccomp-bpf support Tomas Vondra <tomas.vondra@2ndquadrant.com>
Re: RFC: seccomp-bpf support Robert Haas <robertmhaas@gmail.com>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Thomas Munro <thomas.munro@gmail.com>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: RFC: seccomp-bpf support Tom Lane <tgl@sss.pgh.pa.us>
Re: RFC: seccomp-bpf support Joshua Brindle <joshua.brindle@crunchydata.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Re: RFC: seccomp-bpf support Joe Conway <mail@joeconway.com>
Re: RFC: seccomp-bpf support Andres Freund <andres@anarazel.de>
Andres Freund  writes:
> On 2019-08-28 14:47:04 -0400, Joshua Brindle wrote:
>> A prime example is madvise() which was a catastrophic failure that 1)
>> isn't preventable by any LSM including SELinux, 2) isn't used by PG
>> and is therefore a good candidate for a kill list, and 3) a clear win
>> in the dont-let-PG-be-a-vector-for-kernel-compromise arena.

> IIRC it's used by glibc as part of its malloc implementation (also
> threading etc) - but not necessarily hit during the most common
> paths. That's *precisely* my problem with this approach.

I think Andres is right here.  There are madvise calls in glibc:

glibc-2.28/malloc/malloc.c:                    __madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);
glibc-2.28/malloc/arena.c:    __madvise ((char *) h + new_size, diff, MADV_DONTNEED);

It appears that the first is only reachable from __malloc_trim which
we don't use, but the second is reachable from free().  However,
strace'ing says that it's never called during our standard regression
tests, confirming Andres' thought that it's in seldom-reached paths.
(I did not go through the free() logic in any detail, but it looks
like it is only reached when dealing with quite-large allocations,
which'd make sense.)

So this makes a perfect example for Peter's point that testing is
going to be a very fallible way of finding the set of syscalls that
need to be allowed.  Even if we had 100.00% code coverage of PG
proper, we would not necessarily find calls like this.

			regards, tom lane


В списке pgsql-hackers по дате отправления
От: Tomas Vondra
Дата:
От: Andres Freund
Дата:
Сообщение: Re: RFC: seccomp-bpf support
FAQ