Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2547474lqb; Tue, 28 May 2024 03:30:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0//3/ODZ28qG8qRjum/cIUrLKSIMwVBkOEwVtR2E3Gs/+husoROeoMOMH5zToxSWm3ww8NiEc6fQCGTI5BFmUuF3mlVfJfsV+CRje5w== X-Google-Smtp-Source: AGHT+IFX+hHfluPTRWpWnrAaxBMTVYop14rJuwcR0i9Ge7selp9UA+WaGHh9kAub38Mr3qw1sQUf X-Received: by 2002:a50:871d:0:b0:578:62e7:e5a7 with SMTP id 4fb4d7f45d1cf-57862e7e68dmr9338427a12.4.1716892241313; Tue, 28 May 2024 03:30:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716892241; cv=pass; d=google.com; s=arc-20160816; b=bDdj8EyPlnMErWIyx7ffzDu458f7C4DOVVZ8dLRLNl7m7RstATndtVlFX/cl7OsabY qZgSLzTByOUvWjtQLJQTMEj8aw3nszHymdVpVTf5NRW8ARZIN7Pwnj2ZGL14611ro5Xs JyrgGjF9H2JVWEKuZXwmAPuqki7Ej59k8Ooa6E4WfnrEBlyfzJX+nHNH67XW+UlGWjCp JJZXNp2c13tdT4gxWKX8g0IHM3jJ5j8pb8UJ+sCGfEoS9/axk3Y4vTPvlpy3A3qKwTBC OGT9gvtZHF/APYv3WDxALPpWTOIukIu27YlGtp4pbtupqmDiZN6ux0IgwyH64gc3pbg5 e2xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=VL2Z0sryL60j2O6+EZFdPX9QWsHVRcNkoM1i+xZAZ6o=; fh=5ja/XhJp1xYUUiT+OBI9jwq3JXFECfMaSob5sNllm+A=; b=ZVgvbcnXkjmcdE52dUeeJ5VlxZto8LTwoSThQSW9WMvlWnYb7vqnbCuJwbk/XxAPpA +HfNXMi5treTwp8Lol/4BUm690Og2wNtnJdDdsxccA0hePjjXXuiMQAjDVz4Qls4bEIL ZJOpcQY6rbYebjdeGY4SNtsD1UkNko0g5vlXCNhHfskY3Zsb7PsV7r2zKhrhES1qOJLG yRHf1YIDloE6TvGCW3/BPStSJ664iMSShT6vMzTBkSp3gZNlJA9dI6X3brHVxRS3xE8m if5VjKMUyhvza8PyP/FUOR1K7gUNFWZaHUBkDGqtlqXkGzEvhVdDSdmXP51NJa9zx7uH ayHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zhaoxin.com); spf=pass (google.com: domain of linux-kernel+bounces-192118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192118-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57864b00239si3881417a12.468.2024.05.28.03.30.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 03:30:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zhaoxin.com); spf=pass (google.com: domain of linux-kernel+bounces-192118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192118-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 127491F2443E for ; Tue, 28 May 2024 10:30:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B2C016B736; Tue, 28 May 2024 10:30:34 +0000 (UTC) Received: from mx1.zhaoxin.com (MX1.ZHAOXIN.COM [210.0.225.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEAA44D59B for ; Tue, 28 May 2024 10:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.0.225.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716892233; cv=none; b=IDHCuIilhuC0OfaesFCC1mNDXTBoHmbvbVxlffw/WcZ3hc5KBGkKm33bUldLO5N9BAGWIZIqPe4YwObbQmyphJt7u6HClFj7kVf53fK6myaHuGU5RtYdDNZCo40R2U3HOuAoJ1+JO/tC2Hn0QXVCW95r1SL93JGuJ/AD46hhFJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716892233; c=relaxed/simple; bh=m2xLQ4LCjpYiulwHCl7+pHf3KWKMiBRwWIdPLUxEUno=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=OngCQYAjt2gVGCzBKy0ce3W9xuLcK+7YOz475pzHDvL9Su8+jlM1OsXQ3ubcWFMQXoj0oX14dd1ZwR0cE2T8G3cjOUyWfMEko39Zn9h0za0dj+mrwyIxhRu3MfV1QFf8ApPfhygmKQ+oco+DiWg1PAJ6Y1ayEkr8t3Emnh9Fuh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com; spf=pass smtp.mailfrom=zhaoxin.com; arc=none smtp.client-ip=210.0.225.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zhaoxin.com X-ASG-Debug-ID: 1716891601-086e23110611970001-xx1T2L Received: from ZXSHMBX3.zhaoxin.com (ZXSHMBX3.zhaoxin.com [10.28.252.165]) by mx1.zhaoxin.com with ESMTP id CCGBquudrnAo6hvN (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 28 May 2024 18:20:01 +0800 (CST) X-Barracuda-Envelope-From: TonyWWang-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.165 Received: from ZXBJMBX02.zhaoxin.com (10.29.252.6) by ZXSHMBX3.zhaoxin.com (10.28.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 28 May 2024 18:20:00 +0800 Received: from localhost.localdomain (10.32.65.162) by ZXBJMBX02.zhaoxin.com (10.29.252.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 28 May 2024 18:19:59 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.165 From: Tony W Wang-oc X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.6 To: , , , , , , , , , , CC: , , Subject: [PATCH] linux-4.19.y/printk: Avoid logbuf_lock deadlock in oops_end() Date: Tue, 28 May 2024 18:19:57 +0800 X-ASG-Orig-Subj: [PATCH] linux-4.19.y/printk: Avoid logbuf_lock deadlock in oops_end() Message-ID: <20240528101957.7277-1-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX02.zhaoxin.com (10.29.252.6) X-Barracuda-Connect: ZXSHMBX3.zhaoxin.com[10.28.252.165] X-Barracuda-Start-Time: 1716891601 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.35:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 1555 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.125455 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- A CPU executing vprintk_emit might be interrupted by #PF exception, this may leads to logbuf_lock deadlock: CPU x: CPU x: ---- ---- vprintk_emit() logbuf_lock_irqsave() printk_safe_enter_irqsave() A: raw_spin_lock(&logbuf_lock) vprintk_store() #PF do_page_fault ... oops_end bust_spinlocks(0) console_unlock() ... printk_safe_enter_irqsave() B: raw_spin_lock(&logbuf_lock) logbuf_lock is taken at A and the deadlock happends at B. Pass 1 to bust_spinlocks() in the oops_end() to avoid this deadlock. Signed-off-by: Tony W Wang-oc --- arch/x86/kernel/dumpstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 7e698c45760c..b4c145ee9536 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -336,7 +336,7 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr) if (regs && kexec_should_crash(current)) crash_kexec(regs); - bust_spinlocks(0); + bust_spinlocks(1); die_owner = -1; add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); die_nest_count--; -- 2.25.1