Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1227619pxb; Wed, 10 Feb 2021 03:25:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUJpZBYPtFcf5nZjodXAV4GxsPPQdoZmgX4NeTZFxWwm6d7bw0WzKYVKW6OoqmCQIdzqqk X-Received: by 2002:a17:906:82c9:: with SMTP id a9mr2392186ejy.547.1612956353869; Wed, 10 Feb 2021 03:25:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612956353; cv=none; d=google.com; s=arc-20160816; b=CmEVDfzUnNgXbWlU7pqJ9I9S2kGioMRScTgG7H1kaxV7cz8bnqprCGuVvBm74EiC3Q +LgeTQYRBFMZGexjqI5+P+tWoTFjwfmlyY0K/Szm6TIuT98nk2gTZCaBKuqbUCzp/fhL 8BBuderGJudnDRC3wWTnQ27Y3vAa7uehvq0ulzy4zsjdCuFcT5MAvk6hmeJqH+4XNqnE m76IERxorO2Jive+Xu3bPINIsfHMH2qsDUcgzLK9B9MIAVuAR4u+BS2EaFXA4L6/tieq 1EMZMMWn4+VTrNTbXpsDGZVAkNBdmL+xqZwekR7m5UkeUoBYNN1QJxB78IiJYpSwV0DQ J5Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2HfhdmfvOgq9lw3xcT/xxXPNvZM03QWegWlJQ7ILwdM=; b=MU1WenoXtI3CfJfmXn94b+49boSNHGyu9plDr6zKTpcD/tWcW07DN5Dc6CreaT+bTl QZr7+I/SNE9C/20WJXhI46RmYrorhWLLCmMZ/VL3INv03nZt2KwHqS3f+Z86E16iOAhM 9g30OG/wjSbNeN6e/ulTA5prBQDEuP/+iZzrzfNcA6VrSzzNMK7urXRUFmAL5HE5OMrT AQyBeFiZ83nVonQa3293gptfiGjKdL4q0iWfzD27HOVYiX3g5eSlxrVOIFdkr8MdWseU NwrLwRqoBzE4vUu7Z5wx0hsnHMXeWP6xwMYrlRkELVTlwajAzaYyVOfdRv+La/YR3//A UN4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b1RVOifM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id x23si1089749ejv.558.2021.02.10.03.25.29; Wed, 10 Feb 2021 03:25:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b1RVOifM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231744AbhBJLXo (ORCPT + 99 others); Wed, 10 Feb 2021 06:23:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbhBJLPn (ORCPT ); Wed, 10 Feb 2021 06:15:43 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F18BC0613D6 for ; Wed, 10 Feb 2021 03:14:35 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id i5so1484459wmq.2 for ; Wed, 10 Feb 2021 03:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2HfhdmfvOgq9lw3xcT/xxXPNvZM03QWegWlJQ7ILwdM=; b=b1RVOifMLqgF+xPx8yG8p603Y6/Sz0aniLxmG2yNZcTZ/lDw4oXU6M3O0oWOey50+T FgtNrnzesZgorRpJv2DVtfOjJer7+4y76c/rhhZHq4lioA0ZuzcBUXFMf4020TKgD62S cnBvMMLaABgh4TFxINfut8f0P6Cu33eOB+A4g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2HfhdmfvOgq9lw3xcT/xxXPNvZM03QWegWlJQ7ILwdM=; b=QFsAF+Ht/Evsha0z8UEKBGJ5Ijo0vC7Va843D+ZAUDniGZqz/mI4lQHBYcQFYmXntY fvQpOKQ5+t7c0Paq11euR3O7C6kI5uTkzmaUh9tNBkASh+r+F9AZo7bw0irkIwEfCsRm eUNapdSiWhfabOnf7Ml6bOp0XXyqmLfH4gbeoarPxrYnn0TfR9Qvc3cNg2zt4+3JK1hr 4plU8oOkDBNKtHADbDcqld2utZqJTEBVYIcx363EvrUPyMA7WjXest8UlMC9fc0Jpxo0 tVVGPSfMgY7ukDQp4jcpnafTef9FyaaT0TTshN//8SiQaIqrgItBLN6ujvLc5oRkKvmB iA3Q== X-Gm-Message-State: AOAM531Thg53twJFjY66PbDv+59jCHw0YtgGkmI61WN+g1ktfPmOqO82 xCCQy2OBg9QibMmznSdgvHfk5w== X-Received: by 2002:a7b:c304:: with SMTP id k4mr2434360wmj.11.1612955673931; Wed, 10 Feb 2021 03:14:33 -0800 (PST) Received: from revest.zrh.corp.google.com ([2a00:79e0:42:204:31ae:b3c8:8fe:5f4d]) by smtp.gmail.com with ESMTPSA id u10sm1907633wmj.40.2021.02.10.03.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 03:14:33 -0800 (PST) From: Florent Revest To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@chromium.org, revest@google.com, jackmanb@chromium.org, linux-kernel@vger.kernel.org, Florent Revest , KP Singh Subject: [PATCH bpf-next v7 1/5] bpf: Be less specific about socket cookies guarantees Date: Wed, 10 Feb 2021 12:14:02 +0100 Message-Id: <20210210111406.785541-1-revest@chromium.org> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since "92acdc58ab11 bpf, net: Rework cookie generator as per-cpu one" socket cookies are not guaranteed to be non-decreasing. The bpf_get_socket_cookie helper descriptions are currently specifying that cookies are non-decreasing but we don't want users to rely on that. Reported-by: Daniel Borkmann Signed-off-by: Florent Revest Acked-by: KP Singh --- include/uapi/linux/bpf.h | 8 ++++---- tools/include/uapi/linux/bpf.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c001766adcbc..0b735c2729b2 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1656,22 +1656,22 @@ union bpf_attr { * networking traffic statistics as it provides a global socket * identifier that can be assumed unique. * Return - * A 8-byte long non-decreasing number on success, or 0 if the - * socket field is missing inside *skb*. + * A 8-byte long unique number on success, or 0 if the socket + * field is missing inside *skb*. * * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx) * Description * Equivalent to bpf_get_socket_cookie() helper that accepts * *skb*, but gets socket from **struct bpf_sock_addr** context. * Return - * A 8-byte long non-decreasing number. + * A 8-byte long unique number. * * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx) * Description * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts * *skb*, but gets socket from **struct bpf_sock_ops** context. * Return - * A 8-byte long non-decreasing number. + * A 8-byte long unique number. * * u32 bpf_get_socket_uid(struct sk_buff *skb) * Return diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index c001766adcbc..0b735c2729b2 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1656,22 +1656,22 @@ union bpf_attr { * networking traffic statistics as it provides a global socket * identifier that can be assumed unique. * Return - * A 8-byte long non-decreasing number on success, or 0 if the - * socket field is missing inside *skb*. + * A 8-byte long unique number on success, or 0 if the socket + * field is missing inside *skb*. * * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx) * Description * Equivalent to bpf_get_socket_cookie() helper that accepts * *skb*, but gets socket from **struct bpf_sock_addr** context. * Return - * A 8-byte long non-decreasing number. + * A 8-byte long unique number. * * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx) * Description * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts * *skb*, but gets socket from **struct bpf_sock_ops** context. * Return - * A 8-byte long non-decreasing number. + * A 8-byte long unique number. * * u32 bpf_get_socket_uid(struct sk_buff *skb) * Return -- 2.30.0.478.g8a0d178c01-goog