From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82839C433E1 for ; Thu, 14 May 2020 08:02:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D6592065D for ; Thu, 14 May 2020 08:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726073AbgENICE (ORCPT ); Thu, 14 May 2020 04:02:04 -0400 Received: from www62.your-server.de ([213.133.104.62]:33606 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725935AbgENICD (ORCPT ); Thu, 14 May 2020 04:02:03 -0400 Received: from sslproxy03.your-server.de ([88.198.220.132]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jZ8ob-0000Bn-Hu; Thu, 14 May 2020 10:02:01 +0200 Received: from [178.196.57.75] (helo=pc-9.home) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jZ8ob-000QuX-9S; Thu, 14 May 2020 10:02:01 +0200 Subject: Re: [bpf-next PATCH 2/3] bpf: sk_msg helpers for probe_* and *current_task* To: John Fastabend , ast@kernel.org Cc: lmb@cloudflare.com, bpf@vger.kernel.org, jakub@cloudflare.com, netdev@vger.kernel.org References: <158939776371.17281.8506900883049313932.stgit@john-Precision-5820-Tower> <158939787911.17281.887645911866087465.stgit@john-Precision-5820-Tower> From: Daniel Borkmann Message-ID: <384e5835-a241-bc5d-9f3c-729aac4866f3@iogearbox.net> Date: Thu, 14 May 2020 10:02:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <158939787911.17281.887645911866087465.stgit@john-Precision-5820-Tower> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.2/25811/Wed May 13 14:11:53 2020) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 5/13/20 9:24 PM, John Fastabend wrote: > Often it is useful when applying policy to know something about the > task. If the administrator has CAP_SYS_ADMIN rights then they can > use kprobe + sk_msg and link the two programs together to accomplish > this. However, this is a bit clunky and also means we have to call > sk_msg program and kprobe program when we could just use a single > program and avoid passing metadata through sk_msg/skb, socket, etc. > > To accomplish this add probe_* helpers to sk_msg programs guarded > by a CAP_SYS_ADMIN check. New supported helpers are the following, > > BPF_FUNC_get_current_task > BPF_FUNC_current_task_under_cgroup > BPF_FUNC_probe_read_user > BPF_FUNC_probe_read_kernel > BPF_FUNC_probe_read > BPF_FUNC_probe_read_user_str > BPF_FUNC_probe_read_kernel_str > BPF_FUNC_probe_read_str Given the current discussion in the other thread with Linus et al, please don't add more users for BPF_FUNC_probe_read and BPF_FUNC_probe_read_str as I'm cooking up a patch to disable them on non-x86, and cleanups from Christoph would make them less efficient than the *_user/_kernel{,_str}() versions anyway, so lets only add the latter. Thanks, Daniel