Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2871636pxb; Tue, 19 Jan 2021 08:05:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvptKHcS4VQjk2aBPO1WxjQkzAx/KthHMZPazliC9mso+kqLhvPyHE3Js762D6QOF5Q8Yo X-Received: by 2002:a17:906:780c:: with SMTP id u12mr3316187ejm.125.1611072321489; Tue, 19 Jan 2021 08:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611072321; cv=none; d=google.com; s=arc-20160816; b=YyuG1HHA6vxthhBETMej6Xk6kMdy19q9Tk6k3FlGiyJnnrksZ/DungIGhNPkOtmGBW kPsw4c1l59Zx3H3gI0C+gbuo/Nf7HRgWWd1YCuL5L8Fymyqhpdz8xxt+N/QfWRZIaME/ JAQqvnw9aSqotKdIMJ/lur9afHuGF/5lZdTNKVoE5UQSI9HzvUasUNU72QwdayA7b/GK YTd/UnVw0PQYsdJvLFswcQoc1WLYRMI7tLrn838gGvGwdvoB5w00COg8toGfw35h5SOT 0AFGvIcFv/W2jmQv8a6IEgOnYfP8Ek4ExJytW6ff4WDtF278c3SPpvyCpZKYwCxNzNMw R6Ng== 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=h3ezeIdxQA6HUcVbMIawXV4uO3GjVDrBBcxqIn97pLo=; b=gLfukIbeD/HBHqVqN6CeiJ7QCYM/L+wi9tnteLPR7ui3IdIb3KvIFxOJfvRebjXqG5 WD9y4jeOx7dlm9LyLHDGiErzp+iR7ax58VpbXhL+eFWSpdgJwqE72XrGPnWvnjSOVIK+ ts5KMq7s2ShU/ZtqmwcaTy7k3rC4MXnBXRNiXqCxnDWu3onzE9PrMjSP03ZJmrKo34m6 +mUZgXFAwglMFOqfeEIWeq/8np5rqQuYK5PmeYjtU2YkMo7XbYMraaAOGogoxY7wvL2j 12yPD7TUPLsIcUxc/WOpISK3DsDzxYJmVnDXJ445iPlCZ92hpILyNLJxiRJi7NY9KOnb 3pNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jOWsETPq; 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 i5si1552905eds.603.2021.01.19.08.04.51; Tue, 19 Jan 2021 08:05:21 -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=jOWsETPq; 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 S2389924AbhASQDC (ORCPT + 99 others); Tue, 19 Jan 2021 11:03:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391650AbhASQAu (ORCPT ); Tue, 19 Jan 2021 11:00:50 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC95C061573 for ; Tue, 19 Jan 2021 08:00:07 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id a9so16787003wrt.5 for ; Tue, 19 Jan 2021 08:00:07 -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=h3ezeIdxQA6HUcVbMIawXV4uO3GjVDrBBcxqIn97pLo=; b=jOWsETPqtvTAzVk6EYslXWIDwS+h+JvNnbmzJZvezK6Wlk5xd1fYpNplpzhowgQF1V vCX+AcpJKRCFwa28WJgLKIvITUwPH3HpY75tlBJhgqnBhEKqvrGL8V0UNXc+dTgNqXsJ g7/43H1wZhd4Gr+wynZKkeLoD+VlpVULR/glo= 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=h3ezeIdxQA6HUcVbMIawXV4uO3GjVDrBBcxqIn97pLo=; b=c4/DCh5xy77AJWEmCQyf/c4NT2wST2VEEFQhw+Q+tuf/BWkZKwueZBZ0BgPHnKYoLu qDN4dVJbAKu0m/5wknLODkGJ9XZuqlnP5+RFoaXZBgIpX/5622etLvHQJ+Hu+J12d/lI kRz2vpCBVTXicelCD3+kz16c2raR4LdlTvbKudZtU24ZIPJ7TK+8BVKTiRN6wDm8Ps+h g6541EhI+Eqp7dcfaO/T9rHqTETXVE8Vv5KFDm1t6YmTTUOO1pwwritOvDljrLgRKNMh cEMaJe4HlhMmJ4v2s4wRIQ4xVtEjM/wpU+UFFkF9EkNK+hiuE4DllyZQXPU2gNlnMLwG 4XYw== X-Gm-Message-State: AOAM5315EsFGxTdCKcQ07ABNO96THgyc9blAppWOeNj81h+KrZrTPl6Z LyMYCbRu+5NBfm+Xwux44+kZ2g== X-Received: by 2002:adf:f6cc:: with SMTP id y12mr5038792wrp.35.1611072006140; Tue, 19 Jan 2021 08:00:06 -0800 (PST) Received: from revest.zrh.corp.google.com ([2a00:79e0:42:204:81f8:2ac6:58bf:7d7a]) by smtp.gmail.com with ESMTPSA id n11sm41454944wra.9.2021.01.19.08.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 08:00:05 -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, linux-kernel@vger.kernel.org, Florent Revest Subject: [PATCH bpf-next v5 1/4] bpf: Be less specific about socket cookies guarantees Date: Tue, 19 Jan 2021 16:59:50 +0100 Message-Id: <20210119155953.803818-1-revest@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-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 --- 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.284.gd98b1dd5eaa7-goog