From patchwork Fri Apr 9 14:03:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1464390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FH0Gc5Rrnz9sWk; Sat, 10 Apr 2021 00:03:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lUrjQ-0007Jo-V4; Fri, 09 Apr 2021 14:03:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lUrjP-0007J7-PT for kernel-team@lists.ubuntu.com; Fri, 09 Apr 2021 14:03:31 +0000 Received: from mail-pg1-f198.google.com ([209.85.215.198]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lUrjP-0003bp-Bt for kernel-team@lists.ubuntu.com; Fri, 09 Apr 2021 14:03:31 +0000 Received: by mail-pg1-f198.google.com with SMTP id o9so3211677pgm.15 for ; Fri, 09 Apr 2021 07:03:31 -0700 (PDT) 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=zJF6OIkjE2ar9hPSU1xnMLVxFlQ87xkLoyoel38si4o=; b=tQ5ycyTXRCu2L5jJMcZTXnysw0lP7QFq2zauPXuY4oIwxgufbA3CV9gPLeIJ48rEmI 9hdDZ3LwingMeBTMNeYAuNoXlNYEijcwbP1p/PJPusgCMJBf8UFUMdfVOkK4FrvfiLSJ e9X6PqB6s6m0OsEVVPzxMYFKyGzEy/yaKhBVon+7Wgz/whuGRNL/5KrKZpbWljFbVaZO AhLsGbaUA67x975U26ljF43tVNKdrD3od2U8Bo7/Gy+g6i9/soxWG0GcdebTFe4pOFdc M7hPv03tGST0OfyLlbd0fW2IC0lR6xc31LijBWCiVZ+/EP5kw4ze06cC4NBEAnCc4zYS Cakg== X-Gm-Message-State: AOAM530fhQFtHEMOQcxdeOm8YvU0qcKu0E+ScyWA7Cu3Mx0/sCgWmVnN BZ6dN4G8OOKxOjf2Xl0Ynzx5RP1Hob7fOnxVB4t9jL8pGT2eqEtnPnji629O6m9MzvXDQIyLX5M 9/AWl+t3oOLrleaP4CgMN9sVit9ZYOukhJHeoBeM5EQ== X-Received: by 2002:a17:90a:f3d2:: with SMTP id ha18mr14696495pjb.214.1617977009677; Fri, 09 Apr 2021 07:03:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxra87Zsa+1HaCLLafjPUgSxNn2/4JGLRz+QwbyE+NTlV3Vqn4yLqZOTFSYpPx6hsmpi0evQw== X-Received: by 2002:a17:90a:f3d2:: with SMTP id ha18mr14696485pjb.214.1617977009476; Fri, 09 Apr 2021 07:03:29 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id a26sm2584244pff.149.2021.04.09.07.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 07:03:28 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3][Focal] Revert "netfilter: x_tables: Update remaining dereference to RCU" Date: Fri, 9 Apr 2021 08:03:13 -0600 Message-Id: <20210409140321.7279-3-tim.gardner@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210409140321.7279-1-tim.gardner@canonical.com> References: <20210409140321.7279-1-tim.gardner@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Tomlinson CVE-2021-29650 This reverts commit 443d6e86f821a165fae3fc3fc13086d27ac140b1. This (and the following) patch basically re-implemented the RCU mechanisms of patch 784544739a25. That patch was replaced because of the performance problems that it created when replacing tables. Now, we have the same issue: the call to synchronize_rcu() makes replacing tables slower by as much as an order of magnitude. Revert these patches and fix the issue in a different way. Signed-off-by: Mark Tomlinson Signed-off-by: Pablo Neira Ayuso (cherry picked from commit abe7034b9a8d57737e80cc16d60ed3666990bdbf) Signed-off-by: Tim Gardner --- net/ipv4/netfilter/arp_tables.c | 2 +- net/ipv4/netfilter/ip_tables.c | 2 +- net/ipv6/netfilter/ip6_tables.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 8394afcb2c8f..eaff8c772056 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c @@ -1423,7 +1423,7 @@ static int compat_get_entries(struct net *net, xt_compat_lock(NFPROTO_ARP); t = xt_find_table_lock(net, NFPROTO_ARP, get.name); if (!IS_ERR(t)) { - const struct xt_table_info *private = xt_table_get_private_protected(t); + const struct xt_table_info *private = t->private; struct xt_table_info info; ret = compat_table_info(private, &info); diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 62db61532163..77643a0c4c87 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c @@ -1633,7 +1633,7 @@ compat_get_entries(struct net *net, struct compat_ipt_get_entries __user *uptr, xt_compat_lock(AF_INET); t = xt_find_table_lock(net, AF_INET, get.name); if (!IS_ERR(t)) { - const struct xt_table_info *private = xt_table_get_private_protected(t); + const struct xt_table_info *private = t->private; struct xt_table_info info; ret = compat_table_info(private, &info); if (!ret && get.size == info.size) diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 30eb8307582f..5422a1660e3d 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c @@ -1642,7 +1642,7 @@ compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr, xt_compat_lock(AF_INET6); t = xt_find_table_lock(net, AF_INET6, get.name); if (!IS_ERR(t)) { - const struct xt_table_info *private = xt_table_get_private_protected(t); + const struct xt_table_info *private = t->private; struct xt_table_info info; ret = compat_table_info(private, &info); if (!ret && get.size == info.size)