From owner-dev-commits-src-branches@freebsd.org Wed Jul 7 20:24:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B98965C53E; Wed, 7 Jul 2021 20:24:03 +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 4GKrVW0wYHz4vkV; Wed, 7 Jul 2021 20:24:03 +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 07B4F13F25; Wed, 7 Jul 2021 20:24:03 +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 167KO2VK080464; Wed, 7 Jul 2021 20:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 167KO2AW080463; Wed, 7 Jul 2021 20:24:02 GMT (envelope-from git) Date: Wed, 7 Jul 2021 20:24:02 GMT Message-Id: <202107072024.167KO2AW080463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Houchard Subject: git: 82a1d67f018c - stable/13 - arm: Make sure we can handle a thumb entry point. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82a1d67f018c7178485166ae3e06f29bff292263 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 20:24:03 -0000 The branch stable/13 has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=82a1d67f018c7178485166ae3e06f29bff292263 commit 82a1d67f018c7178485166ae3e06f29bff292263 Author: Olivier Houchard AuthorDate: 2021-06-30 20:56:50 +0000 Commit: Olivier Houchard CommitDate: 2021-07-07 20:22:41 +0000 arm: Make sure we can handle a thumb entry point. Similarly to what's been done on arm64 with commit 712c060c94fd447c91b0e6218c12a431206b487a, when executing a binary, if the entry point is a thumb symbol, then make sure we set the PSL_T flag, otherwise the CPU will interpret it in ARM mode, and that will likely leads to an undefined instruction. PR: 256899 MFC after: 1 week (cherry picked from commit 8c3bd133dd52824e427e350c65eae1fd9eb5a3cd) Signed-off-by: Olivier Houchard --- sys/arm/arm/machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 3296adaaa44b..ea5b5a0de251 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -351,6 +351,8 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_svc_lr = 0x77777777; tf->tf_pc = imgp->entry_addr; tf->tf_spsr = PSR_USR32_MODE; + if ((register_t)imgp->entry_addr & 1) + tf->tf_spsr |= PSR_T; } #ifdef VFP