Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp144457ybb; Fri, 27 Mar 2020 18:09:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvsmubMXiePXFlf9RMiSvUXr4/OHOGWkuEF9mGEH5tBzld6wIdJeMzAbfU2mb5IBTRAJuOs X-Received: by 2002:aca:acc2:: with SMTP id v185mr1212107oie.27.1585357769824; Fri, 27 Mar 2020 18:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585357769; cv=none; d=google.com; s=arc-20160816; b=ycfynjkp3S0NoTGnGT2upn9qC4fXGM0lrNSD0MNSiUQP8GJHoXxLecJZZuD7rzySSj 2eANKbz9v/D2ed00u4/5P0EauTX4YL38wB3KVuAbjElJhMYOHVpVishPtAJBh9I1YD5P 8hLJYA8qEgRBb+LE9SuGIpxrkAU7mbSYQv2x5a0YHu6J00LK0UVMTSMBccmdLKwpK+0Y x4U29k7bIH1pV0mZhfhnT7LnnvyKoEcJjP44hzQc8Dt7b7mdG8KSYXG6g2Szb7V8zhIj JQF2U5B/YKhKs8rkq1nGMgrpsQ3660Xy7VyL870zOy+Apr9kdZEkueCnx0WFqOvnuiwE +1/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=x/FN/zZIe9AMAMd7DUJuAEPHiOR6iMtlUG+HjqZbSdA=; b=DdiI28mo+n8lc0QnOtplVPex0EUx0PPfBZ0XeN61gdGiz7I0Kd/zK8kw63nmBaJsua shoFtpq/lGrtvCB39PLrPXnl1IFbr9S4n5is2vPLnU8PV8Nmp8VavnxW0fQBDWclDdfo Ea55X6aYMQOX6iiVXriAmFsZ0CsPrgqwO/+4BAZTeaE0Pu0Dm2tG49Cm3AFw8/kNsZ43 ncN3DFIwo69JOx9uVbrkZiYf3A5mwfah8JRPfL+1CW4qTva4w+iwsATjeP6VOh/Fr2wf ddf8cPznC8UA7OTdsFJCfVkvPdGDJ612LQu7Jb6feglmLuQJvD1cFR9qM8Bfb4DvQ+rW t/bA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q197si3028339oic.262.2020.03.27.18.09.16; Fri, 27 Mar 2020 18:09:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726422AbgC1BIx (ORCPT + 99 others); Fri, 27 Mar 2020 21:08:53 -0400 Received: from namei.org ([65.99.196.166]:44080 "EHLO namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbgC1BIx (ORCPT ); Fri, 27 Mar 2020 21:08:53 -0400 Received: from localhost (localhost [127.0.0.1]) by namei.org (8.14.4/8.14.4) with ESMTP id 02S18Fsm015427; Sat, 28 Mar 2020 01:08:15 GMT Date: Sat, 28 Mar 2020 12:08:15 +1100 (AEDT) From: James Morris To: KP Singh cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Andrii Nakryiko , Brendan Jackman , Florent Revest , Alexei Starovoitov , Daniel Borkmann , Kees Cook , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman Subject: Re: [PATCH bpf-next v8 4/8] bpf: lsm: Implement attach, detach and execution In-Reply-To: <20200327192854.31150-5-kpsingh@chromium.org> Message-ID: References: <20200327192854.31150-1-kpsingh@chromium.org> <20200327192854.31150-5-kpsingh@chromium.org> User-Agent: Alpine 2.21 (LRH 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 Mar 2020, 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 > Acked-by: Andrii Nakryiko > Reviewed-by: Brendan Jackman > Reviewed-by: Florent Revest Acked-by: James Morris -- James Morris