Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp998639ybt; Fri, 19 Jun 2020 21:05:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMtpbkNSmdXkc54UQRKD4HKY0TLS6k27V/9URx3E9OqOciCJZcOHPdVOud0acomFuoGCHT X-Received: by 2002:aa7:c71a:: with SMTP id i26mr6364285edq.149.1592625947003; Fri, 19 Jun 2020 21:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625946; cv=none; d=google.com; s=arc-20160816; b=FGvj5zkqxP1EzmLHEG4j9ixNquEOBHWhbzmTgve2Dc1Sld4LRuuvSyx+tSDdP2lM1T 72NC5jyWnt7nwUDqZfjATV8WQxEh+oRWNsE/gmeAO5avV6bUKgndDAUfipN6zE8r80DN eC95caTJM5I3Z75h1O/PnWgNoqcKGRwoeEZbMX/wbpgHwY2tLnUY37PuL+ublNieZMc3 CHyjs9W8xZKgLy1+bFnGoDt35iH2/6kAGEzjZUZmXkSJS7qDF7rn8gzYtwClSbMGYFTx N07XM1Y15hdDFv6aHxK/Ql+EFdIQL8jTagv2urFUzC39sfnn29aUgN0aYPknRcAb76Qu 4LmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YttGocJXssI8Q9ujxLUJbHMd5N95k9Uxc4ja8bum4Nw=; b=fa6Aq+alC9hAKrURrRd5FSuKdh6zDiVNJ1mSoCt4L07aYDxCB3y6IMO+i+0pYpa5Xm hSlL2aIG2Nq1sQNzWOc7FiE7+Rn5HbZYo8gmBd4eA3Zrw/a64fK1sEPzmgC+OECitHXq 2vhB4//e7cAMSG49EZ1t+/huOmM0VXUVwq/yzBAWJpT6YynGrA1yC4i6vybaMpREnseq Zo4/ql37q8iVTFBPLhvXMZBreoi1S/CODR53TZDY+jH2SYL+dOPsKoigcFJbw3GQ9a5V t8KTL3VnPE7YkqZt69GYOGybOrLpd6jj1/YX0OFlzXIWtQ9C4idgwxnQP+m0eVl21eHx 1EWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hfoUg6eK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si5220884ejs.551.2020.06.19.21.05.25; Fri, 19 Jun 2020 21:05:46 -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=hfoUg6eK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394059AbgFSQod (ORCPT + 99 others); Fri, 19 Jun 2020 12:44:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388095AbgFSOnH (ORCPT ); Fri, 19 Jun 2020 10:43:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E1202168B; Fri, 19 Jun 2020 14:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577788; bh=/YRsKm+UuUQSjVNhO4o+amEOfE2Aw0EN2Skl2Q46c+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfoUg6eKXR0/ybKawEd16AymW+zu3hP6yiXXBgnyuvQT2Ac7d02BbPCkrflPhCPYp AracQco/y1utrmAf8fX3IqcWfMp5EUL9kGKrE5An7MOdLMvZcXSPi6pPQ6WTHJ1OkY lxVAiRpORL61Aef3/PiiF/kU+P55Qii5OmB6mozo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Daniel Thompson , Sasha Levin Subject: [PATCH 4.9 060/128] kgdb: Prevent infinite recursive entries to the debugger Date: Fri, 19 Jun 2020 16:32:34 +0200 Message-Id: <20200619141623.389129571@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson [ Upstream commit 3ca676e4ca60d1834bb77535dafe24169cadacef ] If we detect that we recursively entered the debugger we should hack our I/O ops to NULL so that the panic() in the next line won't actually cause another recursion into the debugger. The first line of kgdb_panic() will check this and return. Signed-off-by: Douglas Anderson Reviewed-by: Daniel Thompson Link: https://lore.kernel.org/r/20200507130644.v4.6.I89de39f68736c9de610e6f241e68d8dbc44bc266@changeid Signed-off-by: Daniel Thompson Signed-off-by: Sasha Levin --- kernel/debug/debug_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 79517e5549f1..9c939c6bf21c 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -443,6 +443,7 @@ static int kgdb_reenter_check(struct kgdb_state *ks) if (exception_level > 1) { dump_stack(); + kgdb_io_module_registered = false; panic("Recursive entry to debugger"); } -- 2.25.1