Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4605756ybf; Wed, 4 Mar 2020 07:12:01 -0800 (PST) X-Google-Smtp-Source: ADFU+vu7X7JRaBCYbHTOFpcDMf3LCPpT5nl0ElWow2bfmaI15i+1SJ6zHgzwjkNWwDKs0xaEu/J6 X-Received: by 2002:a05:6808:3a1:: with SMTP id n1mr2001771oie.89.1583334721291; Wed, 04 Mar 2020 07:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583334721; cv=none; d=google.com; s=arc-20160816; b=vyALgf1ZxBc4nudiiMX+2wNy0lbVZFbhpaeq2LXl5wmakBYOVTJltnmnwH9ihMV9R6 jPftKT3j7bYlhr4HU5FiJs789aMA39724sNsRtxs5yUTgOXLa4YgQD0wVQksVQrsiwTt oA2NLPZBE6gYcTxQNgP17ibEV10A0RlZyJ4h1UfeAlRynSZV+mw/A96sa4fQIF7Y/S3L xoUZuJZplvmnwCx/ivk+OlaNYmxoX3DSoUXwrdHYOtyrrwr9te01ewIfXvNocpvvua/+ V6YGLDUA8yEFkip8JCch16Ujy5kGfMjKHE0x3FTeemzigBxISmuVESLGCMHCD5sIC96d Fsrw== 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=yT7XeoSwUdQk121SDMf3G5g+/PJMGsICwgeNmRY4RQs=; b=M4qEHuRiMUjM76kmPFi4oEfKmcfkFby96NBknkjQi75IZyml8aWK+6kOjJAIkSLt2I I3uyVZ/nQ7JkoeCBzn4qdcI+7uEtoC7xyxz4g6df2DyrBrIXCBt/+roqVoUZLbeMztej V0BOONTw41xCYsFfgkn0ynp34LeNKEcl1uQyb74yw2ZBSVHozKXVUcmluxhuLZkWIEgm xuB9sOdFfD4/vER9AX459RiNUypzHB+n/Tw5TqbbiJxT3kOudiKDtFuCssBkWZ2MGCuB PJ+wQtz6lbeglzEgZOvZjInqaojQ8XcWjYoe/9sQdDBhvXXmzBEXO8vJEfhkJRt3X8Si OKlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AwWGHCjd; 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 v92si1330820otb.160.2020.03.04.07.11.24; Wed, 04 Mar 2020 07:12:01 -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=AwWGHCjd; 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 S1728278AbgCDPLL (ORCPT + 99 others); Wed, 4 Mar 2020 10:11:11 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46346 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbgCDPLL (ORCPT ); Wed, 4 Mar 2020 10:11:11 -0500 Received: by mail-wr1-f67.google.com with SMTP id j7so2800774wrp.13 for ; Wed, 04 Mar 2020 07:11:10 -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:content-transfer-encoding:in-reply-to :user-agent; bh=yT7XeoSwUdQk121SDMf3G5g+/PJMGsICwgeNmRY4RQs=; b=AwWGHCjdbOoLCZNfTjqCPibGkm2uREaDzZapM7b/n3n7Nwkrs1hqcGWlxuLlrw2muO 1j29uSfwHFQVcOeMU9krUtHsG7P+kDz5jRFL8cWEYsyVC2DqWybq30o9KuKutALdHKfz LlPQoJFSTux9e0xsm51R7QkJlMMo5Zd6C6708= 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=yT7XeoSwUdQk121SDMf3G5g+/PJMGsICwgeNmRY4RQs=; b=ap4ULkWDCWmrK0px39vgoAavdp4B7MKuH6qKZh4nZ44FEjHrM1XCOS8qxZzvV0cbBU JoWE/d6uwY1MArEslyAYH36X8Af0+frpBjPuxgA/1By4qTveWDeYerJj88itYtgSof81 UmoE2UlROQ9kE2VvJttuWWzEwYMYlZnCzBM52t8DgUr7nNf/nIPswUy5SqEhk8SK5c+Q xFfyYAt7+aW4UprKnEavwLN1AY56xtuwP2hOhscZJBCmV8o6MMZVYVw5qjcLi7YwF+2f euHLUYrZUu95kvQYhkX6ls9DCSI69xDJm9Q4W4NqfprDlDG4qaBdOE5LmlavxwlbuUO0 01Jg== X-Gm-Message-State: ANhLgQ2xhzFEyQxGZfMehy611wpPDg1ji/QQ6bhiSBCtOw9lm5yGMczz RpvhVeIQhCR+2HzSxxqPRVuO4Q== X-Received: by 2002:a5d:6986:: with SMTP id g6mr4555742wru.421.1583334669504; Wed, 04 Mar 2020 07:11:09 -0800 (PST) Received: from chromium.org ([2a00:79e1:abc:308:8ca0:6f80:af01:b24]) by smtp.gmail.com with ESMTPSA id v8sm4971969wma.28.2020.03.04.07.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 07:11:08 -0800 (PST) From: KP Singh X-Google-Original-From: KP Singh Date: Wed, 4 Mar 2020 16:11:07 +0100 To: Andrii Nakryiko Cc: linux-security-module@vger.kernel.org, open list , bpf , Alexei Starovoitov , Daniel Borkmann , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman Subject: Re: [PATCH bpf-next v2 1/7] bpf: Refactor trampoline update code Message-ID: <20200304151107.GA9984@chromium.org> References: <20200304015528.29661-1-kpsingh@chromium.org> <20200304015528.29661-2-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 03-M?r 20:49, Andrii Nakryiko wrote: > On Tue, Mar 3, 2020 at 5:56 PM KP Singh wrote: > > > > From: KP Singh > > > > As we need to introduce a third type of attachment for trampolines, the > > flattened signature of arch_prepare_bpf_trampoline gets even more > > complicated. > > > > Refactor the prog and count argument to arch_prepare_bpf_trampoline to > > use bpf_tramp_progs to simplify the addition and accounting for new > > attachment types. > > > > Signed-off-by: KP Singh > > --- > > See note about const-ification of trampoline and naming suggestion, > but looks good overall: > > Acked-by: Andrii Nakryiko > > > +static struct bpf_tramp_progs * > > +bpf_trampoline_update_progs(struct bpf_trampoline *tr, int *total) > > reading the code again, seems like bpf_trampoline_update_progs is > really more like bpf_trampoline_get_progs, no? It doesn't modify > trampoline itself, so might as well mark tr as const pointer. Makes sense. I will send a v3 with these some minor fixes by EOD ZRH. - KP > > > > +{ > > + struct bpf_tramp_progs *tprogs; > > + struct bpf_prog **progs; > > + struct bpf_prog_aux *aux; > > + int kind; > > + > > [...]