Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4958200ybf; Wed, 4 Mar 2020 14:17:57 -0800 (PST) X-Google-Smtp-Source: ADFU+vsI5lF+i7YAZ26XkDK6I1a837neduS5HgZkVXskdAehJEBjndTJuYs6YyrvopDlwiDf8LjL X-Received: by 2002:aca:3542:: with SMTP id c63mr3336663oia.135.1583360277073; Wed, 04 Mar 2020 14:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583360277; cv=none; d=google.com; s=arc-20160816; b=eoxwIQ2XRNxheAKmu5uE+Yt85SPVR5jQ2mx8n7bttPiR40WRPOLt2BU2qLzwMsft7j uf3S6hqAqR7Adbho7D0RCONobOoHxlDXbe/IuVeg3qxOy/Vl1g2VEVjwOGV1/cy857/R 03RIqp2yD1P3NqqJtkRqNpWStkzj9tv4oBbIwMJllwXwGwHYcGuUas0PqsodOtp1TYu0 4TfYAEFnibW22HoTXcP2eOiFDsRGxgInvvRuPhtwkx7nAUs4GrGOLLVDM+3EIAIYAJcI UvBAQw0QgQZMOWBkbz6xy2KuHm9sSOdeMQwCWhWU3AOPGVJOR0rd/vVAte3CdX5W+KIX eRpg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SeLK1u6XZQiNjm/hVW01wDa1blPflVVcyrMnhEyc6lQ=; b=RoOE6SqAz+5NdPmB2UHri+K25/o5Ulw8oBAuWOuZ3iiVRqbkDhHD0XMk1JLRtqvjLG WGbYdZxqhRooHnEcBmkKv+lnLgS24MZ80WLKdEUdznRC9jYFV66TknhvS3DbcRXkiwMa GLRbKmhYp66QEr9DKngDmKW3Daz26P9FefrRtbm87aWeZZ3Y44Q86KonSdpAbTW0g0r2 86CH2L+Q9ypSitk4huXKYE+l9bi8iuwaveQjJzWsnFp1yYsyf2oGVUv48QjB2D7TH+i0 b9oZoMn+AhsjgmCafhdY/sQmb3fOCsI/1ExJ3rhw8AGiVsQThXmEgOgT6uRp3V9AHhmF TLww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NMU2vjdl; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si2067905oto.87.2020.03.04.14.17.44; Wed, 04 Mar 2020 14:17:57 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=NMU2vjdl; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388400AbgCDWRf (ORCPT + 99 others); Wed, 4 Mar 2020 17:17:35 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46609 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387931AbgCDWRf (ORCPT ); Wed, 4 Mar 2020 17:17:35 -0500 Received: by mail-pg1-f193.google.com with SMTP id y30so1655683pga.13; Wed, 04 Mar 2020 14:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SeLK1u6XZQiNjm/hVW01wDa1blPflVVcyrMnhEyc6lQ=; b=NMU2vjdlKGiHucUtsyG5rog2PzW9dzSnvDzdLKNICZRP2PNr8ScfWCQFerCD8Ahp2u vcUeFNhQG8fPfXQ0gGiJdVRFNTvcogp34MrK6zryQm4gwiI6JQQpIdQ70ZDrOevveruT BUe+wIukIMUlRudvg0bo9jOQ3aE/yM6Xt5AGi8DirwFPvk4bGYJWgAZuvsYum+0rAKHn 6GnluaBJFp+g3s93SOqNX9+N5XBSJLxrHLxBFvm02VytTQBXtJyyR6sG/XdfxLCZJaZ9 qnywdqfsF0Xw5akcQdU3OnELDza+MQ0cDUe8rlVoEcm/uz//hHG87CAd4sSMiWCxa6F3 2hOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SeLK1u6XZQiNjm/hVW01wDa1blPflVVcyrMnhEyc6lQ=; b=bG6M4Ut0DGtIAS90bJTpz/Q8MVcZiNfptw0jOjs2FTmHIERtv1RcTL8D29YO67gED2 rnZafOBPhPi3Wt2c4EGfDaGeYbOotQZzBIPv5jasu9n+Gjc5vjb/8OxvOYukUNNUgLIz WQWp863ZQEMqzw9o5JVqQjztEuCkXbYNW9CIKqou1ceMHSQaRGc3UharcA6T0BCpwVpj hrg0GqBaw6wVpZ/KAU+61KZMcX98nxjlB3w5q7RD1OWySSc+NqK9aBW7HmwGzERLD/IE 09encumyvcLVEYWELgwq0PwXtEjNNN2vDJ2pEqEcofgh9cVSjp7sMG+Wcttc6S76ObaE ezhg== X-Gm-Message-State: ANhLgQ1GqPhZe8dNnHqU3nC2LcFbw72aGvr3fpSRVu6mx19XNRjPH3z4 qM3ukmgBYHMHgucfYv3H4zTOTTzA X-Received: by 2002:a63:2323:: with SMTP id j35mr4466654pgj.440.1583360253961; Wed, 04 Mar 2020 14:17:33 -0800 (PST) Received: from ast-mbp ([2620:10d:c090:500::4:c694]) by smtp.gmail.com with ESMTPSA id d186sm11160532pfc.8.2020.03.04.14.17.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2020 14:17:33 -0800 (PST) Date: Wed, 4 Mar 2020 14:17:31 -0800 From: Alexei Starovoitov To: KP Singh Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman Subject: Re: [PATCH bpf-next v4 0/7] Introduce BPF_MODIFY_RET tracing progs Message-ID: <20200304221729.d6omw6tltqhbw5xr@ast-mbp> References: <20200304191853.1529-1-kpsingh@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304191853.1529-1-kpsingh@chromium.org> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 08:18:46PM +0100, KP Singh wrote: > > Here is an example of how a fmod_ret program behaves: > > int func_to_be_attached(int a, int b) V> { <--- do_fentry > > do_fmod_ret: > > if (ret != 0) > goto do_fexit; > > original_function: > > > > } <--- do_fexit > > ALLOW_ERROR_INJECTION(func_to_be_attached, ERRNO) > > The fmod_ret program attached to this function can be defined as: > > SEC("fmod_ret/func_to_be_attached") > int BPF_PROG(func_name, int a, int b, int ret) > { > // This will skip the original function logic. > return -1; > } Applied to bpf-next. Thanks. I think it sets up a great base to parallelize further work. 1. I'm rebasing my sleepable BPF patches on top. It's necessary to read enviroment variables without the 'opportunistic copy before hand' hack I saw in your github tree to do bpf_get_env_var() helper. 2. please continue on LSM_HOOK patches to go via security tree. 3. we need a volunteer to generalize bpf_sk_storage to task and inode structs. This work will be super useful for all bpf tracing too. Sleepable progs are useful for tracing as well.