From patchwork Wed Nov 11 23:29:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1398599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=iWZ9mWMy; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CWgw11hr9z9sPB for ; Thu, 12 Nov 2020 10:30:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ADB948254A; Thu, 12 Nov 2020 00:30:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="iWZ9mWMy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B7C882543; Thu, 12 Nov 2020 00:30:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0852F82526 for ; Thu, 12 Nov 2020 00:30:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1605137417; bh=ASxnht6/SaCHYkyJS1B7dUwCST9AGi5ineJ7U+QVAcQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=iWZ9mWMy1od4tQqnELg9Bu1rNAuTTQszh2s2SCcW2g3+NUMjyzSQ7uoXZXtfy1J2b SKNM7RMBZQX836WSDOuPm5ivyVTP2wjBH4fYmLtnaqhkZVLs9MvzJ+Mu8FTFH+w3c3 tmofsdBjWbHDa1jOgFURQPotXV/huDGfMj1t998U= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.135]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MDhlV-1kTslS12H9-00Ap40; Thu, 12 Nov 2020 00:30:17 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Alexander Graf , Heinrich Schuchardt Subject: [PATCH v2 0/4] sandbox: exception handling Date: Thu, 12 Nov 2020 00:29:55 +0100 Message-Id: <20201111232959.11241-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:5Wn4hgpXLF7rN0z4wLgUmpWTxFWOKd7V4njfCNkdghyGeCW/3Bg 03rwgFLZBGWmeTkcvcVKPZeB0H3IN8Gfg9uRU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IJ+ rjZJ5lorwP5junzqg/kg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Currently if an exception SIGILL, SIGBUS, SIGSEGV occurs the sandbox stops execution. This does not match the behavior on other architectures. Instead print the current program counter and if any the involved UEFI binaries. Then depending on a customizing system either reset the system or exit to the OS. When testing UEFI binaries like the Self Certification Test exceptions may occur. Without information about the UEFI binary where the exception was caused it is difficult to analyze the cause. The exception command is implemented for the sandbox. This command allows to trigger SIGILL or SIGSEGV. v2: add a customizing switch set SA_NODEFER flag for sigaction provide a unit test for the exception command Heinrich Schuchardt (4): sandbox: add handler for exceptions cmd: sandbox: implement exception command efi_selftest: implement exception test for sandbox test: unit test for exception command arch/Kconfig | 1 + arch/sandbox/Kconfig | 9 ++++ arch/sandbox/cpu/os.c | 40 ++++++++++++++++++ arch/sandbox/cpu/start.c | 4 ++ arch/sandbox/lib/interrupts.c | 35 ++++++++++++++++ cmd/Kconfig | 2 +- cmd/Makefile | 1 + cmd/sandbox/Makefile | 3 ++ cmd/sandbox/exception.c | 41 +++++++++++++++++++ include/os.h | 17 ++++++++ .../efi_selftest_miniapp_exception.c | 2 + test/py/tests/test_sandbox_exit.py | 24 +++++++++++ 12 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 cmd/sandbox/Makefile create mode 100644 cmd/sandbox/exception.c --- 2.28.0