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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C88C433FE for ; Thu, 3 Dec 2020 20:11:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01B2F207B8 for ; Thu, 3 Dec 2020 20:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731154AbgLCULC (ORCPT ); Thu, 3 Dec 2020 15:11:02 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:56650 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726681AbgLCULB (ORCPT ); Thu, 3 Dec 2020 15:11:01 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kkuvd-00BMPH-Py; Thu, 03 Dec 2020 13:10:13 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kkuvc-00B32W-N8; Thu, 03 Dec 2020 13:10:13 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Cc: Linus Torvalds , Peter Zijlstra , Ingo Molnar , Will Deacon , Jann Horn , Vasiliy Kulikov , Al Viro , Bernd Edlinger , Oleg Nesterov , Christopher Yeoh , Cyrill Gorcunov , Sargun Dhillon , Christian Brauner , Arnd Bergmann , Arnaldo Carvalho de Melo Date: Thu, 03 Dec 2020 14:09:39 -0600 Message-ID: <87tut2bqik.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1kkuvc-00B32W-N8;;;mid=<87tut2bqik.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+KAKkx+upN+DyhS/e8mfHxnCYAh8W63fM= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH 0/3] exec: Transform exec_update_mutex into a rw_semaphore X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recently syzbot reported[0] that there is a deadlock amongst the users of exec_update_mutex. The simplest and most robust solution appears to be making exec_update_mutex a read/write lock and having everything execept for exec take the lock for read. This set of changes upgrades rwsem so it has the functionality needed and uses a rw_semaphore to replace the current mutex. Eric W. Biederman (3): rwsem: Implement down_read_killable_nested rwsem: Implement down_read_interruptible exec: Transform exec_update_mutex into a rw_semaphore fs/exec.c | 12 ++++++------ fs/proc/base.c | 10 +++++----- include/linux/rwsem.h | 3 +++ include/linux/sched/signal.h | 11 ++++++----- init/init_task.c | 2 +- kernel/events/core.c | 12 ++++++------ kernel/fork.c | 6 +++--- kernel/kcmp.c | 30 +++++++++++++++--------------- kernel/locking/rwsem.c | 40 ++++++++++++++++++++++++++++++++++++++++ kernel/pid.c | 4 ++-- 10 files changed, 87 insertions(+), 43 deletions(-) [0] https://lkml.kernel.org/r/00000000000063640c05ade8e3de@google.com Eric