git: e55d43987086 - main - libthr: fix __thr_pshared_offpage() to not use cancellable close()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 10 Nov 2026 00:19:56 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e55d4398708623522ce773e0cd118180e2ee17fe

commit e55d4398708623522ce773e0cd118180e2ee17fe
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-09 17:10:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-10 00:17:42 +0000

    libthr: fix __thr_pshared_offpage() to not use cancellable close()
    
    __thr_pshared_offpage() is used by pthread functions that must not be
    cancellation points according to POSIX.  Use direct __sys_close() instead
    of interposed close() there.
    
    Fixes:  1bdbd705993e ("Implement process-shared locks support ...")
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D61343
---
 lib/libthr/thread/thr_pshared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libthr/thread/thr_pshared.c b/lib/libthr/thread/thr_pshared.c
index bebae21601a6..c8086ab07560 100644
--- a/lib/libthr/thread/thr_pshared.c
+++ b/lib/libthr/thread/thr_pshared.c
@@ -301,7 +301,7 @@ __thr_pshared_offpage(void *key, int doalloc)
 	if (fd == -1)
 		return (NULL);
 	res = mmap(NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-	close(fd);
+	__sys_close(fd);
 	if (res == MAP_FAILED)
 		return (NULL);
 	pshared_wlock(curthread);