From owner-dev-commits-src-branches@freebsd.org Mon Jun 7 01:03:19 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 487B9643FC3; Mon, 7 Jun 2021 01:03:19 +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 4Fyw931ZJvz4sNM; Mon, 7 Jun 2021 01:03:19 +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 1F3415D6E; Mon, 7 Jun 2021 01:03:19 +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 15713JPE099246; Mon, 7 Jun 2021 01:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15713JAD099245; Mon, 7 Jun 2021 01:03:19 GMT (envelope-from git) Date: Mon, 7 Jun 2021 01:03:19 GMT Message-Id: <202106070103.15713JAD099245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cbced258dee4 - stable/12 - x86: Fix lapic_ipi_alloc() on i386 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cbced258dee43b4f65e62572aa2fcd67225eca20 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: Mon, 07 Jun 2021 01:03:19 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cbced258dee43b4f65e62572aa2fcd67225eca20 commit cbced258dee43b4f65e62572aa2fcd67225eca20 Author: Mark Johnston AuthorDate: 2021-05-31 22:51:14 +0000 Commit: Mark Johnston CommitDate: 2021-06-07 01:00:32 +0000 x86: Fix lapic_ipi_alloc() on i386 The loop which checks to see if "dynamic" IDT entries are allocated needs to compare with the trampoline address of the reserved ISR. Otherwise it will never succeed. Reported by: Harry Schmalzbauer Tested by: Harry Schmalzbauer Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 18f55c67f746f0ad12fe972328234d340a621df9) --- sys/x86/x86/local_apic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 2a1c3ad56148..a34cfbb8b1c9 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -2113,6 +2113,10 @@ native_lapic_ipi_vectored(u_int vector, int dest) #endif /* SMP */ +#ifdef __i386__ +extern uintptr_t setidt_disp; +#endif + /* * Since the IDT is shared by all CPUs the IPI slot update needs to be globally * visible. @@ -2141,6 +2145,9 @@ native_lapic_ipi_alloc(inthand_t *ipifunc) for (idx = IPI_DYN_FIRST; idx <= IPI_DYN_LAST; idx++) { ip = &idt[idx]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; +#ifdef __i386__ + func -= setidt_disp; +#endif if ((!pti && func == (uintptr_t)&IDTVEC(rsvd)) || (pti && func == (uintptr_t)&IDTVEC(rsvd_pti))) { vector = idx; @@ -2164,6 +2171,9 @@ native_lapic_ipi_free(int vector) mtx_lock_spin(&icu_lock); ip = &idt[vector]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; +#ifdef __i386__ + func -= setidt_disp; +#endif KASSERT(func != (uintptr_t)&IDTVEC(rsvd) && func != (uintptr_t)&IDTVEC(rsvd_pti), ("invalid idtfunc %#lx", func));