From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18A00C4167B for ; Fri, 30 Dec 2022 15:33:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235142AbiL3Pdm (ORCPT ); Fri, 30 Dec 2022 10:33:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiL3Pd2 (ORCPT ); Fri, 30 Dec 2022 10:33:28 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF17A1B1D6 for ; Fri, 30 Dec 2022 07:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672414361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EmtT4Lf/UIKZ/j5oEdfg0Q+qFtKnbqf0ukhGd9V3ktw=; b=IIY7Y2Y2mmjCnJcjCz9EUgrykXcMM8AYM+ZYDtbD9VrQdBAy2B2j+4Oj9vM/T4teZ9av2K 3Syag2DNTbtNOHSgvlWDx87GiqTcuwd0d0YFQfjESlqI0qQN6KcFLecBgDvOCgbceyN+Yq WBr2VfX+eqi+72/lk0AIkyJtYRnqQTA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-347--hsOhfq_Pvy3F90nDUCFoQ-1; Fri, 30 Dec 2022 10:32:36 -0500 X-MC-Unique: -hsOhfq_Pvy3F90nDUCFoQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0DB13C0DDB7; Fri, 30 Dec 2022 15:32:35 +0000 (UTC) Received: from llong.com (unknown [10.22.32.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B7F440C2005; Fri, 30 Dec 2022 15:32:22 +0000 (UTC) From: Waiman Long To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Phil Auld , Wenjie Li , =?UTF-8?q?David=20Wang=20=E7=8E=8B=E6=A0=87?= , Quentin Perret , Will Deacon , linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH v5 0/2] sched: Fix dup_user_cpus_ptr() & do_set_cpus_allowed() bugs Date: Fri, 30 Dec 2022 10:32:16 -0500 Message-Id: <20221230153218.354214-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v5: - Add an alloc_user_cpus_ptr() helper and use it in patch 2. v4: - Make sure user_cpus_ptr allocation size is large enough for rcu_head. This series fixes a UAF bug in dup_user_cpus_ptr() and uses kfree_rcu() in do_set_cpus_allowed to avoid lockdep splats. Waiman Long (2): sched: Fix use-after-free bug in dup_user_cpus_ptr() sched: Use kfree_rcu() in do_set_cpus_allowed() kernel/sched/core.c | 58 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 7 deletions(-) -- 2.31.1