* Re: [patch] seccomp.2: Note that memory area is read-only [not found] <5522A66F.9060606@gmail.com> @ 2015-04-18 11:17 ` Michael Kerrisk (man-pages) 2015-04-18 23:37 ` Kees Cook 1 sibling, 0 replies; 4+ messages in thread From: Michael Kerrisk (man-pages) @ 2015-04-18 11:17 UTC (permalink / raw) To: CC: Kees Cook; +Cc: Michael Kerrisk, linux-man, lkml Hi Kees, Ping! Cheers, Michael On 6 April 2015 at 17:29, Michael Kerrisk (man-pages) <mtk.manpages@gmail.com> wrote: > Hi Kees, > > I recently was asked about the point below, and had to go check the code > to be sure, since the man page said nothing. It would be good to have > a confirmation: the seccomp_data buffer supplied to a seccomp BPF program > is read-only, right? (That is, one can't write to the buffer in order to > change the arguments that a system call actually receives.) > > A small man page patch below. > > Cheers, > > Michael > > --- a/man2/seccomp.2 > +++ b/man2/seccomp.2 > @@ -232,15 +232,15 @@ struct sock_filter { /* Filter block */ > }; > .fi > .in > > When executing the instructions, the BPF program operates on the > system call information made available (i.e., use the > .BR BPF_ABS > -addressing mode) as a buffer of the following form: > +addressing mode) as a (read-only) buffer of the following form: > > .in +4n > .nf > struct seccomp_data { > int nr; /* System call number */ > __u32 arch; /* AUDIT_ARCH_* value > (see <linux/audit.h>) */ > > > -- > Michael Kerrisk > Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ > Linux/UNIX System Programming Training: http://man7.org/training/ -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] seccomp.2: Note that memory area is read-only [not found] <5522A66F.9060606@gmail.com> 2015-04-18 11:17 ` [patch] seccomp.2: Note that memory area is read-only Michael Kerrisk (man-pages) @ 2015-04-18 23:37 ` Kees Cook 2015-04-19 0:29 ` Alexei Starovoitov 2015-04-19 7:32 ` Michael Kerrisk (man-pages) 1 sibling, 2 replies; 4+ messages in thread From: Kees Cook @ 2015-04-18 23:37 UTC (permalink / raw) To: Michael Kerrisk (man-pages); +Cc: linux-man, lkml On Mon, Apr 6, 2015 at 8:29 AM, Michael Kerrisk (man-pages) <mtk.manpages@gmail.com> wrote: > Hi Kees, > > I recently was asked about the point below, and had to go check the code > to be sure, since the man page said nothing. It would be good to have > a confirmation: the seccomp_data buffer supplied to a seccomp BPF program > is read-only, right? (That is, one can't write to the buffer in order to > change the arguments that a system call actually receives.) That's correct. If BPF even allows changing the data, it's not copied back to the syscall when it runs. Anything wanting to do things like that would need to use ptrace to catch the call an directly modify the registers before continuing with the call. > > A small man page patch below. Looks good, thanks! -Kees > > Cheers, > > Michael > > --- a/man2/seccomp.2 > +++ b/man2/seccomp.2 > @@ -232,15 +232,15 @@ struct sock_filter { /* Filter block */ > }; > .fi > .in > > When executing the instructions, the BPF program operates on the > system call information made available (i.e., use the > .BR BPF_ABS > -addressing mode) as a buffer of the following form: > +addressing mode) as a (read-only) buffer of the following form: > > .in +4n > .nf > struct seccomp_data { > int nr; /* System call number */ > __u32 arch; /* AUDIT_ARCH_* value > (see <linux/audit.h>) */ > > > -- > Michael Kerrisk > Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ > Linux/UNIX System Programming Training: http://man7.org/training/ -- Kees Cook Chrome OS Security ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] seccomp.2: Note that memory area is read-only 2015-04-18 23:37 ` Kees Cook @ 2015-04-19 0:29 ` Alexei Starovoitov 2015-04-19 7:32 ` Michael Kerrisk (man-pages) 1 sibling, 0 replies; 4+ messages in thread From: Alexei Starovoitov @ 2015-04-19 0:29 UTC (permalink / raw) To: Kees Cook; +Cc: Michael Kerrisk (man-pages), linux-man, lkml On Sat, Apr 18, 2015 at 04:37:35PM -0700, Kees Cook wrote: > On Mon, Apr 6, 2015 at 8:29 AM, Michael Kerrisk (man-pages) > <mtk.manpages@gmail.com> wrote: > > Hi Kees, > > > > I recently was asked about the point below, and had to go check the code > > to be sure, since the man page said nothing. It would be good to have > > a confirmation: the seccomp_data buffer supplied to a seccomp BPF program > > is read-only, right? (That is, one can't write to the buffer in order to > > change the arguments that a system call actually receives.) > > That's correct. If BPF even allows changing the data, it's not copied > back to the syscall when it runs. Anything wanting to do things like > that would need to use ptrace to catch the call an directly modify the > registers before continuing with the call. Today BPF programs can only read from seccomp_data buffer. I think it would be an interesting feature to allow overwrite of syscall arguments by the program on the fly... sometime in the future. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] seccomp.2: Note that memory area is read-only 2015-04-18 23:37 ` Kees Cook 2015-04-19 0:29 ` Alexei Starovoitov @ 2015-04-19 7:32 ` Michael Kerrisk (man-pages) 1 sibling, 0 replies; 4+ messages in thread From: Michael Kerrisk (man-pages) @ 2015-04-19 7:32 UTC (permalink / raw) To: Kees Cook; +Cc: linux-man, lkml, Pierre Chifflier On 19 April 2015 at 01:37, Kees Cook <keescook@chromium.org> wrote: > On Mon, Apr 6, 2015 at 8:29 AM, Michael Kerrisk (man-pages) > <mtk.manpages@gmail.com> wrote: >> Hi Kees, >> >> I recently was asked about the point below, and had to go check the code >> to be sure, since the man page said nothing. It would be good to have >> a confirmation: the seccomp_data buffer supplied to a seccomp BPF program >> is read-only, right? (That is, one can't write to the buffer in order to >> change the arguments that a system call actually receives.) > > That's correct. If BPF even allows changing the data, it's not copied > back to the syscall when it runs. Anything wanting to do things like > that would need to use ptrace to catch the call an directly modify the > registers before continuing with the call. > >> >> A small man page patch below. > > Looks good, thanks! Thanks, Kees! Cheers, Michael >> --- a/man2/seccomp.2 >> +++ b/man2/seccomp.2 >> @@ -232,15 +232,15 @@ struct sock_filter { /* Filter block */ >> }; >> .fi >> .in >> >> When executing the instructions, the BPF program operates on the >> system call information made available (i.e., use the >> .BR BPF_ABS >> -addressing mode) as a buffer of the following form: >> +addressing mode) as a (read-only) buffer of the following form: >> >> .in +4n >> .nf >> struct seccomp_data { >> int nr; /* System call number */ >> __u32 arch; /* AUDIT_ARCH_* value >> (see <linux/audit.h>) */ >> >> >> -- >> Michael Kerrisk >> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ >> Linux/UNIX System Programming Training: http://man7.org/training/ > > > > -- > Kees Cook > Chrome OS Security -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-04-19 7:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <5522A66F.9060606@gmail.com>
2015-04-18 11:17 ` [patch] seccomp.2: Note that memory area is read-only Michael Kerrisk (man-pages)
2015-04-18 23:37 ` Kees Cook
2015-04-19 0:29 ` Alexei Starovoitov
2015-04-19 7:32 ` Michael Kerrisk (man-pages)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome