Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp2286835pja; Thu, 26 Mar 2020 12:40:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvQT9gH5cTLtHFtNFGqQLtZ5E8iEu28oNOpZurxfpkhsnq9MdV6BY2D3rViZPv8SPJP1Ejy X-Received: by 2002:a05:6830:1051:: with SMTP id b17mr7920110otp.157.1585251625175; Thu, 26 Mar 2020 12:40:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585251625; cv=none; d=google.com; s=arc-20160816; b=o2tD3yYYkEfU1M3ni1myuDkSqN71Ih5Qnqw6FZ+fqqNB4e7CURoI717EDVRQV04tM9 pjstAFS8pQxO++f8P1tJXioslFfWoQ4L6YpXenKWjLd21+P/DqAe68+NUTJ4usg2HxdZ zRi243rNIaC2qGqRgtOVrn0AFGjRmCzH96jtAbmbZBP31fcfzfqtCwzPEYMJczQFrI+x iZ5B6lz7R1MsROoPrixkX4MVQzqUi45AGUYqsNofZ0ysYfcOsiWwdXO+g8+7uwKObBWW O1fVkFDXmQ1uMUk6HHPywx3qM8e3d4dbjVV2FP0pvpGWv+07OLvDMAlHsJ1NeqXGuFRf eX0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=krcVqiMkQPdhe4hMOEoqIQl0MN9jc0hPZ4AdMO9emGc=; b=OEvc/K8ywWIOqXOoGjO4vvsfXJsp9U0VEMqDqa/nFwXq8OgzB2Gc7I6l0Lub7MstNY SF5bxpMQjT0w+m3NLsJpntBTWWNYw8w2gpgHGWXcMbYGQTygPcz91VZvP3hU/CESc115 Fh9dKJOoj8Tt/7pOXBjhUPjwgIBUYYS8BLq0D3j6UkNUID+Ngtzo17pfetmnRGoZO+eY VQsUSzLF3wR8A+Nb/aRgUcn+U7XJOMPvt+a9hcdOqZd3SG2BIMdC6kpB+nHeCI7pJKmZ 0+eePEEc/3EiSHBR97+hD7HcjFRj96Wn/5i3bmudUSMe72jooSPdTRAxR5VQCZ7v0Ta0 cMYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ae4waGDS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si1432080oop.3.2020.03.26.12.40.05; Thu, 26 Mar 2020 12:40:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ae4waGDS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbgCZTjZ (ORCPT + 99 others); Thu, 26 Mar 2020 15:39:25 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54103 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbgCZTjZ (ORCPT ); Thu, 26 Mar 2020 15:39:25 -0400 Received: by mail-wm1-f66.google.com with SMTP id b12so8019395wmj.3 for ; Thu, 26 Mar 2020 12:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=krcVqiMkQPdhe4hMOEoqIQl0MN9jc0hPZ4AdMO9emGc=; b=ae4waGDSfrW9e13opPTyj3EkP01ZIr9H99lNvLUCbfhdmjAkVIUtf8myeSBASMioQ6 5sCM+aSj8GGGtOOkAKA2sF1svVbQ++wWd19/SurEr9i3eRmKckpaJhNNdJcmhr+X+2S/ 4ey4IIauUMub88gCWUR3ECmD1rDjjStPObuGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=krcVqiMkQPdhe4hMOEoqIQl0MN9jc0hPZ4AdMO9emGc=; b=Lj/1CLkbrMc+pWjDq+pdd+51JB3rCGDBeCJ6WcbllF1iQKXXRQN5s11woP+JpAGey6 wDJsRPG0Hoz6G6AEJcdfFd+Tw2kRmUa1rnUHkpr4I6x+l4ta2obqt4qb5DyiS5ZjjiFp Dhfe0csExvmZSqq0nPC8PgPKbVpKk36X+hL1WcvDdDVeS3Sel/j2Mor1AOzH9PMlZpHh rn7Z0AE5RxcaGFR8h7j6ruBV22DXI6+V4/t9KB9ny33T274sxhJE4FN/o5zM3TonbHfe jCrkkPCVDYZWywGW34sFFN7l0aui8paTjOWApXktt788Uq69tTuBty2jXMB5mlBHb3Go RWzA== X-Gm-Message-State: ANhLgQ2/JmCr28EClr08aXXuiGG/e5CiIMfpy1V8RxJYVZ27HstJpKZn Z2kjtkNDHiiSkBa5dZv6s42bL/LDzrI= X-Received: by 2002:a1c:5604:: with SMTP id k4mr1483516wmb.57.1585251564109; Thu, 26 Mar 2020 12:39:24 -0700 (PDT) Received: from chromium.org (77-56-209-237.dclient.hispeed.ch. [77.56.209.237]) by smtp.gmail.com with ESMTPSA id w7sm4886527wrr.60.2020.03.26.12.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 12:39:23 -0700 (PDT) From: KP Singh X-Google-Original-From: KP Singh Date: Thu, 26 Mar 2020 20:39:21 +0100 To: Andrii Nakryiko Cc: open list , bpf , linux-security-module@vger.kernel.org, Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , James Morris , Kees Cook , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman Subject: Re: [PATCH bpf-next v7 4/8] bpf: lsm: Implement attach, detach and execution Message-ID: <20200326193921.GA15273@chromium.org> References: <20200326142823.26277-1-kpsingh@chromium.org> <20200326142823.26277-5-kpsingh@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26-M?r 12:12, Andrii Nakryiko wrote: > On Thu, Mar 26, 2020 at 7:29 AM KP Singh wrote: > > > > From: KP Singh > > > > JITed BPF programs are dynamically attached to the LSM hooks > > using BPF trampolines. The trampoline prologue generates code to handle > > conversion of the signature of the hook to the appropriate BPF context. > > > > The allocated trampoline programs are attached to the nop functions > > initialized as LSM hooks. > > > > BPF_PROG_TYPE_LSM programs must have a GPL compatible license and > > and need CAP_SYS_ADMIN (required for loading eBPF programs). > > > > Upon attachment: > > > > * A BPF fexit trampoline is used for LSM hooks with a void return type. > > * A BPF fmod_ret trampoline is used for LSM hooks which return an > > int. The attached programs can override the return value of the > > bpf LSM hook to indicate a MAC Policy decision. > > > > Signed-off-by: KP Singh > > Reviewed-by: Brendan Jackman > > Reviewed-by: Florent Revest > > --- > > Acked-by: Andrii Nakryiko > > > > include/linux/bpf_lsm.h | 11 ++++++++ > > kernel/bpf/bpf_lsm.c | 28 ++++++++++++++++++++ > > kernel/bpf/btf.c | 9 ++++++- > > kernel/bpf/syscall.c | 57 ++++++++++++++++++++++++++++------------- > > kernel/bpf/trampoline.c | 17 +++++++++--- > > kernel/bpf/verifier.c | 19 +++++++++++--- > > 6 files changed, 114 insertions(+), 27 deletions(-) > > > > [...] > > > @@ -2479,6 +2496,10 @@ static int bpf_raw_tracepoint_open(const union bpf_attr *attr) > > } > > buf[sizeof(buf) - 1] = 0; > > tp_name = buf; > > + break; > > + default: > > + err = -EINVAL; > > + goto out_put_prog; > > } > > is indentation off here or it's my email client? You're mail client is fine :) It's me. - KP > > [...]