All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Sargun Dhillon <sargun@sargun.me>, linux-kernel@vger.kernel.org
Cc: alexei.starovoitov@gmail.com,
	linux-security-module@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC 4/4] bpf: Restrict Checmate bpf programs to current kernel ABI
Date: Thu, 04 Aug 2016 11:54:45 +0200	[thread overview]
Message-ID: <57A310E5.7030000@iogearbox.net> (raw)
In-Reply-To: <57A31070.8090602@iogearbox.net>

On 08/04/2016 11:52 AM, Daniel Borkmann wrote:
> On 08/04/2016 09:12 AM, Sargun Dhillon wrote:
>> I think it makes sense to restrict Checmate to loading programs that have been
>> compiled with the current kernel ABI. We can further stabilize the ABI, and
>> perhaps lift this restriction later.
>>
>> Signed-off-by: Sargun Dhillon <sargun@sargun.me>
>> ---
>>   kernel/bpf/syscall.c         | 2 +-
>>   samples/bpf/checmate1_kern.c | 3 ++-
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index 228f962..2a37b4d 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -741,7 +741,7 @@ static int bpf_prog_load(union bpf_attr *attr)
>>       if (attr->insn_cnt >= BPF_MAXINSNS)
>>           return -EINVAL;
>>
>> -    if (type == BPF_PROG_TYPE_KPROBE &&
>> +    if ((type & (BPF_PROG_TYPE_KPROBE | BPF_PROG_TYPE_CHECMATE)) &&
>>           attr->kern_version != LINUX_VERSION_CODE)
>
> Btw, this check is correct, program types are not masks.

Sorry, I meant to write *not* correct, which was hopefully inferable from
the rest.

> BPF_PROG_TYPE_KPROBE (== 2) and BPF_PROG_TYPE_CHECMATE (== 7) will now
> require every type to have a version code ...
>
>>           return -EINVAL;
>>

      reply	other threads:[~2016-08-04 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  7:12 [RFC 4/4] bpf: Restrict Checmate bpf programs to current kernel ABI Sargun Dhillon
2016-08-04  9:52 ` Daniel Borkmann
2016-08-04  9:54   ` Daniel Borkmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57A310E5.7030000@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sargun@sargun.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.