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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 9CDA3C282DD for ; Wed, 8 Jan 2020 18:22:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D8F120692 for ; Wed, 8 Jan 2020 18:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729090AbgAHSWd (ORCPT ); Wed, 8 Jan 2020 13:22:33 -0500 Received: from namei.org ([65.99.196.166]:56096 "EHLO namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbgAHSWd (ORCPT ); Wed, 8 Jan 2020 13:22:33 -0500 Received: from localhost (localhost [127.0.0.1]) by namei.org (8.14.4/8.14.4) with ESMTP id 008ILnMB026782; Wed, 8 Jan 2020 18:21:49 GMT Date: Thu, 9 Jan 2020 05:21:49 +1100 (AEDT) From: James Morris To: KP Singh cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Kees Cook , Thomas Garnier , Michael Halcrow , Paul Turner , Brendan Gregg , Jann Horn , Matthew Garrett , Christian Brauner , =?ISO-8859-15?Q?Micka=EBl_Sala=FCn?= , Florent Revest , Brendan Jackman , Martin KaFai Lau , Song Liu , Yonghong Song , "Serge E. Hallyn" , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Nicolas Ferre , Stanislav Fomichev , Quentin Monnet , Andrey Ignatov , Joe Stringer Subject: Re: [PATCH bpf-next v1 10/13] bpf: lsm: Handle attachment of the same program In-Reply-To: <20191220154208.15895-11-kpsingh@chromium.org> Message-ID: References: <20191220154208.15895-1-kpsingh@chromium.org> <20191220154208.15895-11-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: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, 20 Dec 2019, KP Singh wrote: > From: KP Singh > > Allow userspace to attach a newer version of a program without having > duplicates of the same program. > > If BPF_F_ALLOW_OVERRIDE is passed, the attachment logic compares the > name of the new program to the names of existing attached programs. The > names are only compared till a "__" (or '\0', if there is no "__"). If > a successful match is found, the existing program is replaced with the > newer attachment. > > ./loader Attaches "env_dumper__v1" followed by "env_dumper__v2" > to the bprm_check_security hook.. > > ./loader > ./loader > > Before: > > cat /sys/kernel/security/bpf/process_execution > env_dumper__v1 > env_dumper__v2 > > After: > > cat /sys/kernel/security/bpf/process_execution > env_dumper__v2 > > Signed-off-by: KP Singh Reviewed-by: James Morris -- James Morris