From patchwork Mon Jul 27 13:28:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1336955 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com 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 4BFggc2DThz9sRW; Mon, 27 Jul 2020 23:31:23 +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 1k03Do-0000RJ-QI; Mon, 27 Jul 2020 13:31:16 +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 1k03Dn-0000Qf-Ed for kernel-team@lists.ubuntu.com; Mon, 27 Jul 2020 13:31:15 +0000 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k03Dm-0006kT-KN for kernel-team@lists.ubuntu.com; Mon, 27 Jul 2020 13:31:15 +0000 From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU B/D/E/F/focal:linux-oem-5.6 0/2] cgroup refcount is bogus when cgroup_sk_alloc is disabled Date: Mon, 27 Jul 2020 10:28:38 -0300 Message-Id: <20200727132841.356476-1-cascardo@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1886860 This is a followup from LP: #1886668. [Impact] When net_prio and net_cls cgroups are used, cgroup refcount is bogus, as it's not incremented anymore, but decremented when sockets are closed. This might lead to crashes possibly because of use-after-free when packets are received as shown in LP #1886668. [Test case] Ran reproducer from comment #2. [Regression potential] We could break the use of cgroup bpf. The use of cgroup bpf looks to still be working from the reproducer. Cong Wang (2): cgroup: fix cgroup_sk_alloc() for sk_clone_lock() cgroup: Fix sock_cgroup_data on big-endian. include/linux/cgroup-defs.h | 8 ++++++-- include/linux/cgroup.h | 4 +++- kernel/cgroup/cgroup.c | 29 ++++++++++++++++++----------- net/core/sock.c | 2 +- 4 files changed, 28 insertions(+), 15 deletions(-) Acked-by: Stefan Bader Acked-by: Andrea Righi