Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1164491

Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid, comm accessors

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Alexei Starovoitov <ast@plumgrid.com>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid, comm accessors
Date Sat, 13 Jun 2015 02:20:02 +0200
Message-ID <pAHl0-4SF-9@gated-at.bofh.it> (permalink)
References <pAEZP-1e5-11@gated-at.bofh.it> <pAEZP-1e5-9@gated-at.bofh.it> <pAFjb-1QJ-9@gated-at.bofh.it> <pAFVU-2AR-15@gated-at.bofh.it> <pAG5A-2Mo-3@gated-at.bofh.it> <pAGyB-3E6-11@gated-at.bofh.it> <pAGyC-3E6-15@gated-at.bofh.it> <pAGIi-3SR-9@gated-at.bofh.it> <pAGRZ-44S-47@gated-at.bofh.it> <pAH1E-4gk-19@gated-at.bofh.it> <pAHbj-4H5-21@gated-at.bofh.it>
X-Original-To Andy Lutomirski <luto@amacapital.net>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=6PL2vlrjv/Z32LNUcWkmNgEuiBZfV4c16ucfXt5jGzY=; b=SVjMzCrGWxPjgxRGMiNwQCpbJDkokkEuIbj4hjsOBohdNBrRH9bmEbLe0tY86qYMA/ POh9RV7UkMyhMboSzr+vllvCq91mSve0gT3LHkuYhy+Envz/NuuAs0fo3Ijp08O2WV4j y4G46E2X7hrhcMDByQv0f6rMKI8bddf2W/9CZyMuI5ZJzdbG5TPjzRZRtBhCqC+PVwu7 DWlbixUruyi98TmAir96/zynwGrk1J+i3FzIr78vTW7sSbjLWnKGq7JnsVdpJpuIa0rN TqzoqKG9j37heLt3NRISSkXQ6AwlbAxBT2DwWKXb9cx9/+2mODinmnV5wgrf08WVaES0 FpOg==
X-Gm-Message-State ALoCoQkz203xzdQq0ADartzdk+qcOCyVGeHti1wzobUL9xb5nV3LyogDqutu3qMpcQpTvF07fgEy
X-Received by 10.66.102.103 with SMTP id fn7mr27329602pab.85.1434154560789; Fri, 12 Jun 2015 17:16:00 -0700 (PDT)
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 59
Organization linux.* mail to news gateway
X-Original-Cc "David S. Miller" <davem@davemloft.net>, Ingo Molnar <mingo@kernel.org>, Steven Rostedt <rostedt@goodmis.org>, Wang Nan <wangnan0@huawei.com>, Li Zefan <lizefan@huawei.com>, Daniel Wagner <daniel.wagner@bmw-carit.de>, Daniel Borkmann <daniel@iogearbox.net>, Linux API <linux-api@vger.kernel.org>, Network Development <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
X-Original-Date Fri, 12 Jun 2015 17:15:59 -0700
X-Original-Message-ID <557B763F.7000003@plumgrid.com>
X-Original-References <1434145226-17892-1-git-send-email-ast@plumgrid.com> <1434145226-17892-2-git-send-email-ast@plumgrid.com> <CALCETrUidQ9ig-xZrAFX8_==aVbDNKU-GfeYNMsT6uHugqSydg@mail.gmail.com> <557B60DB.5030200@plumgrid.com> <CALCETrVCAZkoM2TsrxgeT7d+kWjLrcRt76wiPav1Fk7wz0z-3g@mail.gmail.com> <557B6A00.7000600@plumgrid.com> <CALCETrVnhCoD9=nzDpB6UvmXyGz4Th_m1fstJDyRUKzfsSaKHw@mail.gmail.com> <557B6D74.2070305@plumgrid.com> <CALCETrU0OKoWKgxzUyi9A88Pm1VDfiCmgwbNycZoGbiHa6PzWA@mail.gmail.com> <557B718B.80604@plumgrid.com> <CALCETrWYHkBtVr5D0zdrXswoH2gSXsxhtD23w6J7EP=HEwPt8A@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1164491

Show key headers only | View raw


On 6/12/15 5:03 PM, Andy Lutomirski wrote:
> On Fri, Jun 12, 2015 at 4:55 PM, Alexei Starovoitov <ast@plumgrid.com> wrote:
>> On 6/12/15 4:47 PM, Andy Lutomirski wrote:
>>>
>>> On Fri, Jun 12, 2015 at 4:38 PM, Alexei Starovoitov <ast@plumgrid.com>
>>> wrote:
>>>>
>>>> On 6/12/15 4:25 PM, Andy Lutomirski wrote:
>>>>>
>>>>>
>>>>> It's a dangerous tool.  Also, shouldn't the returned uid match the
>>>>> namespace of the task that installed the probe, not the task that's
>>>>> being probed?
>>>>
>>>>
>>>>
>>>> so leaking info to unprivileged apps is the concern?
>>>> The whole thing is for root only as you know.
>>>> The non-root is still far away. Today root needs to see the whole
>>>> kernel. That was the goal from the beginning.
>>>>
>>>
>>> This is more of a correctness issue than a security issue.  ISTM using
>>> current_user_ns() in a kprobe is asking for trouble.  It certainly
>>> allows any unprivilege user to show any uid it wants to the probe,
>>> which is probably not what the installer of the probe expects.
>>
>>
>> probe doesn't expect anything. it doesn't make any decisions.
>> bpf is read only. it's _visibility_ into the kernel.
>> It's not used for security.
>> When we start connecting eBPF to seccomp I would agree that uid
>> handling needs to be done carefully, but we're not there yet.
>> I don't want to kill _visibility_ because in some distant future
>> bpf becomes a decision making tool in security area and
>> get_current_uid() will return numbers that shouldn't be blindly
>> used to reject/accept a user requesting something. That's far away.
>>
>
> All that is true, but the code that *installed* the bpf probe might
> get might confused when it logs that uid 0 did such-and-such when
> really some unprivileged userns root did it.

so what specifically you proposing?
Use from_kuid(&init_user_ns,...) instead?

> Also, as you start calling more and more non-trivial functions from
> bpf, you might need to start preventing bpf probe installations in
> those functions.

yes. may be. I don't want to blacklist stuff yet, unless it
causes crashes. Recursive check is already there. Probably
something else will be needed.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid,  gid, comm accessors Alexei Starovoitov <ast@plumgrid.com> - 2015-06-13 01:30 +0200
  Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid,  comm accessors Andy Lutomirski <luto@amacapital.net> - 2015-06-13 01:30 +0200
    Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid,  gid, comm accessors Alexei Starovoitov <ast@plumgrid.com> - 2015-06-13 01:40 +0200
      Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid,  comm accessors Andy Lutomirski <luto@amacapital.net> - 2015-06-13 01:50 +0200
        Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid,  gid, comm accessors Alexei Starovoitov <ast@plumgrid.com> - 2015-06-13 02:00 +0200
          Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid,  comm accessors Andy Lutomirski <luto@amacapital.net> - 2015-06-13 02:10 +0200
            Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid,  gid, comm accessors Alexei Starovoitov <ast@plumgrid.com> - 2015-06-13 02:20 +0200
              Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid,  gid, comm accessors Alexei Starovoitov <ast@plumgrid.com> - 2015-06-13 02:30 +0200
              Re: [PATCH net-next 1/3] bpf: introduce current->pid, tgid, uid, gid,  comm accessors Andy Lutomirski <luto@amacapital.net> - 2015-06-13 02:30 +0200

csiph-web