From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E5E037A for ; Sat, 10 Feb 2024 00:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707523284; cv=none; b=lj2t7+XS/N7VT71mDJm2DqZwoUsLwtw3fvaP2cUFERbPbcysLcb7dYY8S1I5M/+VbNJLxCnTF72sx+lNx7WUEhKqjhFzDyZ+yyEcPuR4R8cwJdOOLKAYLjxL7pnP20WahNHogNjnoZlrnRUd+VQCX6yddKzTMkQodF8iiGIxaxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707523284; c=relaxed/simple; bh=rCfJsAKeXXcZCAjkOXWwNzPHH0iNeMtutMIl0Ma/wGc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=L1R3jpmd9z26hfKjxzmWRVfN5+CnUdgDRLWd+T4jZmFSZFfabLDnnOWFwZBSiAoxHLGVmCiOx3BrD+ZWlVWxLWQJsLgqkU2L9+2KTr7NT7jGqLZutv8gPxw2Xy5+titDoCXoLKte1+Aizc8ODQj2WLWobBvtKPrCwgIt/XtwCQ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sdf.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nC/5y7nX; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--sdf.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nC/5y7nX" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-296f78bdb40so1478151a91.2 for ; Fri, 09 Feb 2024 16:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707523283; x=1708128083; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=c6ofdqHOHjOqeu37knmsIEqYVGa2yCjdBWHlcP9NF/Q=; b=nC/5y7nX6754PKWviq40EEoJ8KQ3RAp6ciXnVF5LUbmsfBfjYlGeNTlV+Fl2VElfiz TSTXtT7to/x8w3LyvSpI6IrPv3zJDpFJHbDs1gaqVQe9Oe8QGYPAJLQcM9TEu70NB0D3 SBErKEyVMpGk+MtiP22z9PpvxZKTD3JzjblflOxY4eiaM6JN8mqh0zZORx9LrKmvXKW9 xWMA9G4x+/bESdmjlUzo5q+a4+UBfgOvOn1LtnWSkKEqiWeqP0YMOhrEjjSQw8NimIZG hgrsZdSPbzgCcFhdpEpQ/okg614Yk3971CcpsXDW8rzA4ktLaKVjYYPdXS9No14I3KrH ciNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707523283; x=1708128083; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c6ofdqHOHjOqeu37knmsIEqYVGa2yCjdBWHlcP9NF/Q=; b=PcjzirP23Bu8KUUse6fRMKVkHse1qGXETMfiBYr0hrI+pgPewa+6JQDpHBzpwutxLL cwzeF+ZvuqRaeqY9i7YTnyBiu3FMsl3KznD1yI4t1mdxyD0nO2b6rsE988jviuF1xMXL CP4sWfq0KBoSfWzqn6X/IyXZzjMHcf+52dZuTzNtmcmA5xcWpaqdsOhNfJmmuO+9FRZ8 NS3PWZCDVvqEEMD/D3o46JOIQnmzYTwn9CrmbRpJ5IJSonNlfz2mvy8wB5J7BGQbMaSl LV8Ki6aX8KfG7iTeNir9eKQWvsk1pMOQ2l5eF6hlABzsj/vbn107MeDbUhYfze1T2rH5 Cggw== X-Gm-Message-State: AOJu0YzcVaUJx+sqv3PIlzmj6QeBNoeOBvGEiI1XWnABwd1+54U1GpaA mSlclC4cVoZGQPD8RCcrdu7b2D6HuqB+LOJOwu8CtAyYCFUmGojm8TAYsXsnlbvJrg== X-Google-Smtp-Source: AGHT+IF9QXd1fY5X9EOvsnSL9kEOtXqg/M1FMsRHU6x6+GdLrUXw3lbf88I0IE+ePtSMWI89x2Qr0BY= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a17:90a:fc4b:b0:296:c9f1:a67e with SMTP id ee11-20020a17090afc4b00b00296c9f1a67emr10371pjb.6.1707523282741; Fri, 09 Feb 2024 16:01:22 -0800 (PST) Date: Fri, 9 Feb 2024 16:01:21 -0800 In-Reply-To: <5ac3e6uwvhdujq6tywb6b5bh5flqln6d7kedmcbvhyp55jp4yo@65pnej6e2ub6> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <5ac3e6uwvhdujq6tywb6b5bh5flqln6d7kedmcbvhyp55jp4yo@65pnej6e2ub6> Message-ID: Subject: Re: [PATCH v3 bpf-next] net: remove check in __cgroup_bpf_run_filter_skb From: Stanislav Fomichev To: Oliver Crumrine Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On 02/09, Oliver Crumrine wrote: > Originally, this patch removed a redundant check in > BPF_CGROUP_RUN_PROG_INET_EGRESS, as the check was already being done in > the function it called, __cgroup_bpf_run_filter_skb. For v2, it was > reccomended that I remove the check from __cgroup_bpf_run_filter_skb, > and add the checks to the other macro that calls that function, > BPF_CGROUP_RUN_PROG_INET_INGRESS. > > To sum it up, checking that the socket exists and that it is a full > socket is now part of both macros BPF_CGROUP_RUN_PROG_INET_EGRESS and > BPF_CGROUP_RUN_PROG_INET_INGRESS, and it is no longer part of the > function they call, __cgroup_bpf_run_filter_skb. > > Signed-off-by: Oliver Crumrine > > v2->v3: Sent to bpf-next instead of generic patch > v1->v2: Addressed feedback about where check should be removed. > --- > include/linux/bpf-cgroup.h | 7 ++++--- > kernel/bpf/cgroup.c | 3 --- > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h > index a789266feac3..b28dc0ff4218 100644 > --- a/include/linux/bpf-cgroup.h > +++ b/include/linux/bpf-cgroup.h > @@ -195,10 +195,11 @@ static inline bool cgroup_bpf_sock_enabled(struct sock *sk, > #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb) \ > ({ \ > int __ret = 0; \ > - if (cgroup_bpf_enabled(CGROUP_INET_INGRESS) && \ > - cgroup_bpf_sock_enabled(sk, CGROUP_INET_INGRESS)) \ > + if (cgroup_bpf_enabled(CGROUP_INET_INGRESS) && \ > + cgroup_bpf_sock_enabled(sk, CGROUP_INET_INGRESS) && sk && \ > + sk_fullsock(sk)) \ > __ret = __cgroup_bpf_run_filter_skb(sk, skb, \ [..] > - CGROUP_INET_INGRESS); \ > + CGROUP_INET_INGRESS); \ The bot still can't git-am it. And I can't either. Did you somehow manually mangle that part above? The original line has less trailing spaces than what your diff source has, look at: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/include/linux/bpf-cgroup.h#n201 Can you drop this part? Let the idents stay broken :-)