Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5932914ybf; Thu, 5 Mar 2020 09:44:10 -0800 (PST) X-Google-Smtp-Source: ADFU+vuraSRHJosps6S6PJlyw4MjF/c74F+/0J26WlJ76w49Wq657b4y4LQpx4icp35hSJXgvDNr X-Received: by 2002:a9d:5d09:: with SMTP id b9mr7507551oti.207.1583430250001; Thu, 05 Mar 2020 09:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583430249; cv=none; d=google.com; s=arc-20160816; b=RjAMOChaUuIKkzyUj49rHob1tmQkNCe71hAaWHAodVfqGiXzwNm8IPJwd415iugZc/ vwWn7sIgQ31RJt3CGYlqld645FU/n/41L877b1YQCguMj3MQi9mC1QfHavjmQTNjyVR+ S1+6c0i6PWyDGKTWynTKiNtaOsQLhUA+ff1OKF6bcihS2fzQo3pTvtqLAZk/HPutEn6S XwvhCVlXN4K1U1ZqVdJrmOeaDpHHgBoCexGDtJPIuAcNG98cx0ATv4qCVjZp5E10f72D yKl0Kk/IP4DXjMVtRQ3rDfx+wMZMftld94Bsq+dFSHr7p576wenJNxSR0UQ1ZCWzTwIB 5zsQ== 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:date:from:dkim-signature; bh=bHAy6+6uVDKeAvvnXhbkpLjB9BJYv+SeoKQESBQgb5A=; b=uIzCPZiRh9S1jgDVK2cdpJEffpXaBzJg8YJvJkiRgZY7kFR24BkGv9668byhwF/2H2 AQSDkaJHjiocX1mw28shY7PA4A7p6MIWiYbGYBsas1QAntbo2tblavQo4gmF1Xv77PuX +R2lJL/lM03XCDnw9NFRU3o3nPcOhLfvsynR6Hcvc+9ztRlRoY/cBAz094mzJDm9f5Hz hl3SHUbwhTjHvy4sqp5Z0Eig2Q0U3uEkyNegewti/u2rwPw/xes9bZcfor2ecsI0iZkl Mga8B6tmZjT0FJNPiPfZGXpI4b/Pws7RYil2lz3c+BThVlKu3PAA2Zoo7WCZhGlym6PX awSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=B7ByMAXR; 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 a23si3865310otl.228.2020.03.05.09.43.57; Thu, 05 Mar 2020 09:44:09 -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=@chromium.org header.s=google header.b=B7ByMAXR; 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 S1726007AbgCERng (ORCPT + 99 others); Thu, 5 Mar 2020 12:43:36 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43641 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgCERng (ORCPT ); Thu, 5 Mar 2020 12:43:36 -0500 Received: by mail-wr1-f67.google.com with SMTP id v9so1473191wrf.10 for ; Thu, 05 Mar 2020 09:43:35 -0800 (PST) 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:in-reply-to:user-agent; bh=bHAy6+6uVDKeAvvnXhbkpLjB9BJYv+SeoKQESBQgb5A=; b=B7ByMAXR5naWc1+YE2RUrPsLSK32XIdadhkGFNwpvWzfffhIEjyiJWifTv9SKmv2bO n6BsQ128MM+4tDd6R+anpfCUKI51CQNcGsIvj3p8zlFWuNrhBJ1v8KHRYadbIalTqT3o pSjWXL9ZcF3jRR+fpXN7Kbt9KAIy/VkoiKneU= 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:in-reply-to:user-agent; bh=bHAy6+6uVDKeAvvnXhbkpLjB9BJYv+SeoKQESBQgb5A=; b=s1q3aJ33I1JDQ9ufRYqhcP+P/RAxtagJvnCKB8gyNnvCLIwF7M91ARVafV3tIDDPb5 bUJwRRB20kpV/mm3010mr2Xbl6tXr50k/wrvX53geiIJOWumS0WVm6EvUHpR39R/CrqD K6XYSUveJAufSJOItlKxBBFEuFeM5qS+mkvOzVLWKl/ksIDyh4vODBaBhY9G2xy5s5IX EkK2FTesNmyeGlBsaPTpVLBUyLB1tGpu+HfmoYRC5Ackhno7ZUf4D4zOEWCiGX7JykFQ pd1c0EZXmdhNNQ55RocnwkzLl01K1uNzLkzA5070hPvs7U9gP0OZ5KOe+AstVYyItwkR /e4Q== X-Gm-Message-State: ANhLgQ1SS4grZYi9sZ2ZKZny7vYfiRT9PimUwC/Zvcv5N1JVgjc/JEcP 6tQ7JIH9aRu9VHe9Guyghbqlwg== X-Received: by 2002:adf:f20f:: with SMTP id p15mr44839wro.219.1583430214477; Thu, 05 Mar 2020 09:43:34 -0800 (PST) Received: from google.com ([2a00:79e0:42:204:8a21:ba0c:bb42:75ec]) by smtp.gmail.com with ESMTPSA id k66sm7470957wmf.0.2020.03.05.09.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 09:43:33 -0800 (PST) From: KP Singh X-Google-Original-From: KP Singh Date: Thu, 5 Mar 2020 18:43:32 +0100 To: Alexei Starovoitov Cc: KP Singh , 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: <20200305174332.GA167686@google.com> References: <20200304191853.1529-1-kpsingh@chromium.org> <20200304221729.d6omw6tltqhbw5xr@ast-mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304221729.d6omw6tltqhbw5xr@ast-mbp> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-Mar 14:17, Alexei Starovoitov wrote: > 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. Thanks. > > I think it sets up a great base to parallelize further work. Totally Agreed! > > 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 :) Sleepable BPF would indeed make it much simpler. > 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 is quite important, especially for some of the examples we had brought up. I can take a look at the generalization of bpf_sk_storage. Thanks! - KP > This work will be super useful for all bpf tracing too. > Sleepable progs are useful for tracing as well.