git: a1b07443998c - stable/13 - x86 __vdso_gettc: add O_CLOEXEC flag to open

Konstantin Belousov kib at FreeBSD.org
Thu Aug 5 00:57:13 UTC 2021


The branch stable/13 has been updated by kib:

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

commit a1b07443998c7e214642e0aea61e0f3af180cf36
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-07-29 01:26:38 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-08-05 00:56:46 +0000

    x86 __vdso_gettc: add O_CLOEXEC flag to open
    
    (cherry picked from commit cbf6f55e77a9176572830a20804cf1d005dfea73)
---
 lib/libc/x86/sys/__vdso_gettc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c
index 7a64f2a0b556..ab10943c811b 100644
--- a/lib/libc/x86/sys/__vdso_gettc.c
+++ b/lib/libc/x86/sys/__vdso_gettc.c
@@ -230,7 +230,7 @@ __vdso_init_hpet(uint32_t u)
 	 * triggering trap_enocap on the device open by absolute path.
 	 */
 	if ((cap_getmode(&mode) == 0 && mode != 0) ||
-	    (fd = _open(devname, O_RDONLY)) == -1) {
+	    (fd = _open(devname, O_RDONLY | O_CLOEXEC)) == -1) {
 		/* Prevent the caller from re-entering. */
 		atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u],
 		    (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
@@ -266,7 +266,7 @@ __vdso_init_hyperv_tsc(void)
 	if (cap_getmode(&mode) == 0 && mode != 0)
 		goto fail;
 
-	fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY);
+	fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY | O_CLOEXEC);
 	if (fd < 0)
 		goto fail;
 	hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ,


More information about the dev-commits-src-all mailing list