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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=no 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 A272FC3A5A6 for ; Mon, 23 Sep 2019 00:45:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7816720830 for ; Mon, 23 Sep 2019 00:45:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jXYam2Uw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="C7jTYPeF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7816720830 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=EVn4ZXgyyZvKfJe8xAr4tBuc1C3b05fuoGNMxmFLtrw=; b=jXY am2UwDRf8Qq3TnkqDU6L6JTc0fMY/HKh0ANEKalhWGnfYPTjz8CJ62eUrqGAoIg93ki4sbzYS2M19 fwNiLvIK3MrZy4ODDtFPFvlqabkIdt8EiDKXB8OCO9G01Jolc3aZ8MpIFCkVxa0cvVV3iA16g2CS1 b2sSOQplKlLyLMLy1GL9Bf5dQrKevCuv6VwW3Y0FvKpTsYW29n7jUPxvuCPIijCT39ifGaxHkdJt2 HUSzknWh5HvBxPY3jhdOI0/BVZQd1A3BjzUmaAtbZiaOU8ewZaAB74vwPB2A8EPsG7ItXfS+0N/Sf 278yNp8woDPIH73mf2/U89hj/qOqWFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCCTv-0002zz-RP; Mon, 23 Sep 2019 00:45:35 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCCTs-0002zb-85 for linux-riscv@lists.infradead.org; Mon, 23 Sep 2019 00:45:33 +0000 Received: by mail-pl1-x644.google.com with SMTP id d22so4437260pls.0 for ; Sun, 22 Sep 2019 17:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id; bh=wBHZ7zM9MXX6vAa5xiClSfeozP2w4j+/6pxwIyNuhqc=; b=C7jTYPeFAbIbaL5ADjIqF9fdD2IepbODMzxIU5MuN1WOhRRWcGtS+MbLhqN+eRDK4A onM2qCoHTVwTR3E5SIs75A2NQqB6+EATximTQCQOD3c3VzTIhyRNhkKU+JzVMdLsRLTW 2UzRJopPvdmEJGkXebL7tPxmCxP7ksuVf3q6/PJGcI6zrZvNv9MHzjT/vmMwRGzLZijF 4t0/SentLUt/3pKKAuvB1dCXVy1UIYzThsysj9U8G3B13cWoPciVuwQ3Pe6ZKTZRUGLh e4scPzR6bUJZ6fxsjDBXGRVwVctGrHNQVhrjWORjE2sijRN0KT/ZPBD1r5ITXhmpBtYW 6bKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wBHZ7zM9MXX6vAa5xiClSfeozP2w4j+/6pxwIyNuhqc=; b=QmrVe5WjDOo35TeU9iYhT1ePxMPsfTcyotNdHEGylnEOr02XLptjn7itjyorc35RnR WVsY/jqMjJquCXYIspijXUwZRlMk/N+fDHCM2MlF+26q7JVSB5/lDYn2t743/wJHnm/V gDpzdYnfz1KF2BHm84JzuU7QrGZFtuX7+Qp3FnK+Z36PqQc9d6yev+1sRMFSCCTN7T5Y tA282vj0vEL6MPcm0v/6KMtXdMLSQa+NZw+JZvnrPriMGdbKiGkaUDMSFX1H9cOaJaQI qLYkYH6J6IekkfYB27Ebm7tND6J5zcLlc1eWo4EdVyz1bTXUnr6EJ7Ph1vKi0iIXOXQ5 YpxQ== X-Gm-Message-State: APjAAAX0b+Wbnm3ySc1wCHOTxNHcsUmpKwK/0PTimA9cd18gdQSsWTYE Qv2oclpVM2ZEdar0j2aqFVWSqUjjgKs= X-Google-Smtp-Source: APXvYqzNPplEeS/iK1Hs/mYsLPurLGP8THxAyivT2BgkccBkoLr/z6Q4+rBcVrDGe93pO8fC50fLsw== X-Received: by 2002:a17:902:ff08:: with SMTP id f8mr29298899plj.309.1569199529599; Sun, 22 Sep 2019 17:45:29 -0700 (PDT) Received: from localhost.localdomain (220-132-236-182.HINET-IP.hinet.net. [220.132.236.182]) by smtp.gmail.com with ESMTPSA id l7sm9139392pjy.12.2019.09.22.17.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Sep 2019 17:45:29 -0700 (PDT) From: Vincent Chen To: linux-riscv@lists.infradead.org Subject: [PATCH 0/4] riscv: correct the do_trap_break() Date: Mon, 23 Sep 2019 08:45:13 +0800 Message-Id: <1569199517-5884-1-git-send-email-vincent.chen@sifive.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190922_174532_343238_69818CCA X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vincent.chen@sifive.com, palmer@sifive.com, linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, paul.walmsley@sifive.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org The following three situations may occur in the current implementation of do_trap_break(). 1. When the CONFIG_GENERIC_BUG is disabled, if a kernel thread is trapped by BUG(), the whole system will be in the loop that infinitely handles the break exception instead of entering the die function. 2. When the kernel runs code on behalf of a user thread, and the kernel executes a WARN() or WARN_ON(), the user thread will be sent a bogus SIGTRAP. 3. Handling the unexpected ebreak instructions is to send a SIGTRAP to the trapped thread. However, if a kernel executes an unexpected ebreak, it may cause the kernel thread to be stuck in the ebreak instruction. This patch set will solve the above problems by adjusting the implementations of the do_trap_break(). Vincent Chen (4): riscv: avoid kernel hangs when trapped in BUG() rsicv: avoid sending a SIGTRAP to a user thread trapped in WARN() riscv: Correct the handling of unexpected ebreak in do_trap_break() riscv: remove the switch statement in do_trap_break() arch/riscv/kernel/traps.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.7.4 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv