From nobody Tue Nov 23 23:48:55 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D8B66189168C; Tue, 23 Nov 2021 23:48:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HzLSm0CS5z4n59; Tue, 23 Nov 2021 23:48:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB8EF1F9F6; Tue, 23 Nov 2021 23:48:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ANNmt2S077873; Tue, 23 Nov 2021 23:48:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ANNmtqj077872; Tue, 23 Nov 2021 23:48:55 GMT (envelope-from git) Date: Tue, 23 Nov 2021 23:48:55 GMT Message-Id: <202111232348.1ANNmtqj077872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 05504819e39d - stable/13 - riscv: Assert that SUM is not set in SSTATUS for exceptions. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05504819e39d12cbb0772f69e06ceb49a10fd580 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637711336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v96ome54zzjwZeADWBK8WiMDju4EpyUDvKvFC3O0WEM=; b=uy4R0ennhdmEjWsnN0K7AIu/cjsXfrFxb5HelxANZTTeCN5Cdc0hYULu0FNGijwRP0vhwe PK/gfmptD58oXkKwoMZQDUDWjGfgicUgaDuEOGO4A1KFypyy2bHtKPUhczjoC0/sgTk/ix Eme+alpwcS3kMwZxxzehWezh6l2Nro1F+DDUhbAQg0YiATZGtVgtdLlNtTgGDeeE2UlBde RhP8bGj4iCdgdHeV6ySE7pMXIOhLvVa1SjWGYTP5xdRFmZoWxixBKYA5WTHgr3dl9WwrP0 g6jNbZyZWeWeJ7PJeoO1wG+fRQdZNnCcC0kCOqFFUS0Z/+RPmjNfM4P/WEJrXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637711336; a=rsa-sha256; cv=none; b=SePCsFBMJGr7d7Qiy2yFtl6wim1JBiUBmG0uhvWbOs2BXyGpiRO5LZR67EJKRB500ZT//y JfTKMBGT28Zdo94q6AoJ/HSSPKH94GySxBMJXBIOQGDVu8Tz/CsP1/wW2z6O4buriZ4eLb RW3i7OKZvLOdPqUIXj8HClbEm4wXdvC6pfgflFROyYO/s6XwL/jUaiDV/MSEaK9u0ItKwl 26jZqwGKMS7Rcj9Unhh6ZvV1auMqH11wEyTb2Jge0QeiWm0iJyO+jii50z0WCunZnDJN6I IAgUNgm0AuKWcTU84TwR2Hj9iE4nqKdblEczal9Wj44wUX6/WDuoD4RHYTyqzQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=05504819e39d12cbb0772f69e06ceb49a10fd580 commit 05504819e39d12cbb0772f69e06ceb49a10fd580 Author: John Baldwin AuthorDate: 2021-04-21 20:57:20 +0000 Commit: John Baldwin CommitDate: 2021-11-23 23:47:57 +0000 riscv: Assert that SUM is not set in SSTATUS for exceptions. Reviewed by: mhorne Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29764 (cherry picked from commit 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7) --- sys/riscv/riscv/trap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index abf527b2ef13..d378bfe1383d 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -280,6 +280,9 @@ do_trap_supervisor(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP, ("Came from S mode with interrupts enabled")); + KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, + ("Came from S mode with SUM enabled")); + exception = frame->tf_scause & SCAUSE_CODE; if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */ @@ -348,6 +351,9 @@ do_trap_user(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, ("Came from U mode with interrupts enabled")); + KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, + ("Came from U mode with SUM enabled")); + exception = frame->tf_scause & SCAUSE_CODE; if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */