Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp877600pxk; Thu, 17 Sep 2020 20:05:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5hLYJbyrJPEaVYJy8cbH9CtkJ9dpJhGWLwnkqhpyiG2E5HNWci3tRtseXgBsNwX87jY9i X-Received: by 2002:aa7:c054:: with SMTP id k20mr36735435edo.224.1600398343287; Thu, 17 Sep 2020 20:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398343; cv=none; d=google.com; s=arc-20160816; b=Utt4HiP2CpwPVFaI2Iukl83gGIz9DfOZnL40onQTFI1euyFgJVEX9tR1+e8+R9TFHd 8dOMqt8omYVR9olku3pzWfzNgxxrXJUiMkkxTk2hZW5KeJ/Hy94i+GxAb7Yz32HzfFPd y+udkBb0w/nkAJDpUHGmT4jWm23jJCvMO28fcrWP4Jf9y7MCSvPC/4uir6M5Dnsl4XIl wgCNGN7So5TVmBz+5FEKAmY7thynFOOi0Fp7yNHyETL3xkMI9hGtdNqfv7NlkDF/eusz H7GCrRM5XgFy8OdqLWXpdcwzHIN3gBt/yNDQZcGJ2s8p7PCea+P8ptSq090c6Z5MEXtt XmWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i6qPeem3D/f+Sop00MJBso5IKC9OE9X9EN3NcnaSCEo=; b=wtS1EhTMjib5G6C8PwEOCba2n0LXzZ7ubOnTnlWda+TeYEdNncxZ4byw0anxRYpY1M bbQY3VCPUAEWZ4j8PmyfBlxKZVy2g51gLNHPhH+aW+kUSYzCgvrim9xMpISjpoLhs4EU rjShndIiKbLetAnlyvD5tKCZLt995hmB3ytjAhcZXhVCXK0Ie+qz+WX8Hjkl//KnfPFK /enuFYrQPKbm5flYa/RYyk7bJaSE2YSOfVtBltJENpqjSLsZSsMukDnXD6HpD5Uh1Oq8 ihOnjVWH39VMaxAsfSsZoF4SgDV9ywXmZDnvLLWtAvcVZ/f1eIjJfYIZ1WeoZnPWiQHD 6vSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X4A58lfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si1420284edj.408.2020.09.17.20.05.19; Thu, 17 Sep 2020 20:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X4A58lfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729838AbgIRDCr (ORCPT + 99 others); Thu, 17 Sep 2020 23:02:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:53544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbgIRCFT (ORCPT ); Thu, 17 Sep 2020 22:05:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC06F2389E; Fri, 18 Sep 2020 02:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394719; bh=6h2dBenQ50K3IFjlwte/EwE+N6avJPpgBmGXxDM0h9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4A58lfZoVhWB+sw1qXgYZdZbXsYhpjUiN87J7CwxMBRY/Te8xfNY8oAjr5TPJ1jO pHa73f4TQ9qEAsqaD4kzdeH9xh/hY2mYToxo3TFA61SKnF444E3W873EtpF28GQNkU JKmhJDg8VKcZxXDrpQAEi84MpTKNMboLXM3xDCKI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bernd Edlinger , "Eric W . Biederman" , Sasha Levin Subject: [PATCH AUTOSEL 5.4 203/330] proc: io_accounting: Use new infrastructure to fix deadlocks in execve Date: Thu, 17 Sep 2020 21:59:03 -0400 Message-Id: <20200918020110.2063155-203-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bernd Edlinger [ Upstream commit 76518d3798855242817e8a8ed76b2d72f4415624 ] This changes do_io_accounting to use the new exec_update_mutex instead of cred_guard_mutex. This fixes possible deadlocks when the trace is accessing /proc/$pid/io for instance. This should be safe, as the credentials are only used for reading. Signed-off-by: Bernd Edlinger Signed-off-by: Eric W. Biederman Signed-off-by: Sasha Levin --- fs/proc/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 4fdfe4faa74ee..529d0c6ec6f9c 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2770,7 +2770,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh unsigned long flags; int result; - result = mutex_lock_killable(&task->signal->cred_guard_mutex); + result = mutex_lock_killable(&task->signal->exec_update_mutex); if (result) return result; @@ -2806,7 +2806,7 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh result = 0; out_unlock: - mutex_unlock(&task->signal->cred_guard_mutex); + mutex_unlock(&task->signal->exec_update_mutex); return result; } -- 2.25.1