From patchwork Thu Jul 11 09:40:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 11039507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A9AA112C for ; Thu, 11 Jul 2019 09:40:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C3CA28A31 for ; Thu, 11 Jul 2019 09:40:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 007B928A0C; Thu, 11 Jul 2019 09:40:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FSL_HELO_FAKE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA803289AA for ; Thu, 11 Jul 2019 09:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726088AbfGKJkn (ORCPT ); Thu, 11 Jul 2019 05:40:43 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43477 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728325AbfGKJkm (ORCPT ); Thu, 11 Jul 2019 05:40:42 -0400 Received: by mail-wr1-f65.google.com with SMTP id p13so5494125wru.10; Thu, 11 Jul 2019 02:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1LhwbybOGre7jhb9MoBzIWHJmyAAMUo2nsbdJ6LEPDI=; b=p68Tx2INzL2LCfeAo+Ah/ECT1Y6fkuWczzZAZNiwWbKsPklZ5GEJoJRDU6gdjypsNy LEh5h6d9ROyQShNx+m6H6EdoVtd2pvuIcN5umVsD64YZCK2i2Cqhv019NfwCNfbLnthp E5azYG7Ud02+C7621L0dy+0w0NB/evjMkruljxfbkEXIzDJqBFw/Ib0oiJDYhCMXucXe k5//NzhzdH7MmPhSiQ0s1GeLXlWCtD1isO7ahU6WVgGWBHjDC6+ZUoj7MQhNpeUtFgpU xF9dQ2bMP3mgOEi6mpjJyeeTcAzRxzUItIx6ESzpZCm6dTdULB6RPjJ4Z4VBD0LmhCJ1 X8ow== 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:in-reply-to :references; bh=1LhwbybOGre7jhb9MoBzIWHJmyAAMUo2nsbdJ6LEPDI=; b=ZHZzXGNw3hz6zl76rHF1ts1ucSxqjkwSdEWJ9aVux0rFoYCUdoEUUAlUQSlbXdXiek TXHOUCnY7qk+BJAV72Mb53pBVLJX6mIgqqiN5lBW+1bmW4oT3qW0G8PI47B0vwkPvJuG 65vkIluNwDGh4aTmrLjWjRl2s62WAome7eZdrAaP3i/kR7uVEyGwg8B1VQfT/8IjPdWg Q2qAmAm1YynLmc5ZY5ZwGGxIpROAFH/sKNlsgVPULQ7Ilm5a+gt2Wz+jcZNfDn0VIACD H8iffJzCHH2AmXsnTn1FcPh8Qwj1y7gGpcEopmYbWZIlDMLEDVnqd1iv3oz5t7ag8g9X 77CQ== X-Gm-Message-State: APjAAAWmKDBF6YMHdKdh+71ctUg6AL8ym9lxj3UaLu+6h3yxhOUtUjdQ AJ6tm8bqaechNaXS1LSbitU= X-Google-Smtp-Source: APXvYqyV/tQeJFgCQZnuwWh2X7e5VUP2qfLJEzcAR283FEg7rszD4Y2qfxkGMupe+sfEy1sNjigoPw== X-Received: by 2002:adf:efd2:: with SMTP id i18mr3932710wrp.145.1562838039741; Thu, 11 Jul 2019 02:40:39 -0700 (PDT) Received: from gmail.com (net-5-95-187-49.cust.vodafonedsl.it. [5.95.187.49]) by smtp.gmail.com with ESMTPSA id j10sm5005385wrw.96.2019.07.11.02.40.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 02:40:39 -0700 (PDT) From: Paolo Pisati To: --to=Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "David S . Miller" , Shuah Khan , Jakub Kicinski , Jiong Wang Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] bpf: bpf_csum_diff: fold the checksum before returning the value Date: Thu, 11 Jul 2019 11:40:36 +0200 Message-Id: <1562838037-1884-2-git-send-email-p.pisati@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562838037-1884-1-git-send-email-p.pisati@gmail.com> References: <20190710231439.GD32439@tassilo.jf.intel.com> <1562838037-1884-1-git-send-email-p.pisati@gmail.com> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Pisati With this change, bpf_csum_diff behave homogeneously among different checksum calculation code / csum_partial() (tested on x86-64, arm64 and arm). Signed-off-by: Paolo Pisati --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index f615e42cf4ef..8db7f58f1ea1 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -1990,7 +1990,7 @@ BPF_CALL_5(bpf_csum_diff, __be32 *, from, u32, from_size, for (i = 0; i < to_size / sizeof(__be32); i++, j++) sp->diff[j] = to[i]; - return csum_partial(sp->diff, diff_size, seed); + return csum_fold(csum_partial(sp->diff, diff_size, seed)); } static const struct bpf_func_proto bpf_csum_diff_proto = { From patchwork Thu Jul 11 09:40:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Pisati X-Patchwork-Id: 11039509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90B7614DB for ; Thu, 11 Jul 2019 09:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8069628A0C for ; Thu, 11 Jul 2019 09:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75062289B4; Thu, 11 Jul 2019 09:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FSL_HELO_FAKE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E044289AB for ; Thu, 11 Jul 2019 09:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728304AbfGKJkt (ORCPT ); Thu, 11 Jul 2019 05:40:49 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35258 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728354AbfGKJkn (ORCPT ); Thu, 11 Jul 2019 05:40:43 -0400 Received: by mail-wr1-f65.google.com with SMTP id y4so5540980wrm.2; Thu, 11 Jul 2019 02:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XCX9jE72PgkcoZQV6rWjyFaKhpvGYfcrX9M8ab1CPrw=; b=tTnECAgQENTRAvFolzVMqQNAdRuuxyLIyO6WnwNCZtbl+6ZtEcBnIX9+BmrieYKt0K ruIexHnyZNoen+DLPZDU1/k8ZbGwLWSiw5AYk/hFDoEYbUhlKti0+fnOwa5lTtRI+UH7 7xOqP5rO9g+eeYOIRxNGsgobWuaJDCBZw75r5HKaYFW4sijjGQZC1u/MMis9O0HjR1N6 BX8gYw/BsczC2hruBtbVBrsJ8bhLHDskAAqQ4S5QZuPwZnfrtyVj4MvBugcysLV0cO7S WpE5dLEal/9OjBdOcFi1RLySx29lVIORPeTBWspYjza4r1V8gkhdWgGuc9Z9LJtgZB9G zF3Q== 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:in-reply-to :references; bh=XCX9jE72PgkcoZQV6rWjyFaKhpvGYfcrX9M8ab1CPrw=; b=HGcx844vXWb0QHbOZWjaXmENPPaDmPMpUB+lkL2nmOhr1uCKPaHwWmZ/1z6cmtLVL8 kuTEmlK0ql5irVjSm+pvjadxLWWa55sl3CZyRHyUYJTJQYPQO2KSHa5eZDYSyhQN5qjX eDjVBMBnPBsbxRpyk3T616skzo206E6jPvDWhYhQvgA3xy2l34HIo5lindYJ18QvCUuk 57CkRriVQ+3TvqDYF/WEAVy2F+2Qlz3LxtcvwsBqVMlIavkO7OGBn0KneT0qPb3vQuZA oMHjR9+iQAdpdO+gQM5qvrw/Nkv+VFiKpj7+E76/MnSPMm2sAMahLQmhC0Tp6eWX3Se5 NdsA== X-Gm-Message-State: APjAAAU274vc9KhrOfdiDiS1G9VcegQyiYcQmSmLwaRJ83yYxxQUEdRG a1CIk+HdG0dnHeV99B0O0QY= X-Google-Smtp-Source: APXvYqxf5RE+8jpE6XU2p2NQvJdttw5dquomhM5T/35Dwg7JJMJHsZKUgzddC7X0DKbJsdQmhngvlA== X-Received: by 2002:adf:e841:: with SMTP id d1mr4073489wrn.204.1562838041120; Thu, 11 Jul 2019 02:40:41 -0700 (PDT) Received: from gmail.com (net-5-95-187-49.cust.vodafonedsl.it. [5.95.187.49]) by smtp.gmail.com with ESMTPSA id r5sm5075433wmh.35.2019.07.11.02.40.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2019 02:40:40 -0700 (PDT) From: Paolo Pisati To: --to=Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "David S . Miller" , Shuah Khan , Jakub Kicinski , Jiong Wang Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] bpf, selftest: fix checksum value for test #13 Date: Thu, 11 Jul 2019 11:40:37 +0200 Message-Id: <1562838037-1884-3-git-send-email-p.pisati@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562838037-1884-1-git-send-email-p.pisati@gmail.com> References: <20190710231439.GD32439@tassilo.jf.intel.com> <1562838037-1884-1-git-send-email-p.pisati@gmail.com> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Pisati Signed-off-by: Paolo Pisati --- tools/testing/selftests/bpf/verifier/array_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/verifier/array_access.c b/tools/testing/selftests/bpf/verifier/array_access.c index bcb83196e459..4698f560d756 100644 --- a/tools/testing/selftests/bpf/verifier/array_access.c +++ b/tools/testing/selftests/bpf/verifier/array_access.c @@ -255,7 +255,7 @@ .prog_type = BPF_PROG_TYPE_SCHED_CLS, .fixup_map_array_ro = { 3 }, .result = ACCEPT, - .retval = -29, + .retval = 28, }, { "invalid write map access into a read-only array 1",