From owner-svn-ports-head@freebsd.org Tue Jul 4 13:47:47 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ACC7D92167; Tue, 4 Jul 2017 13:47:47 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F1337B850; Tue, 4 Jul 2017 13:47:47 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v64Dlkeu028955; Tue, 4 Jul 2017 13:47:46 GMT (envelope-from jbeich@FreeBSD.org) Received: (from jbeich@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v64Dlkx7028953; Tue, 4 Jul 2017 13:47:46 GMT (envelope-from jbeich@FreeBSD.org) Message-Id: <201707041347.v64Dlkx7028953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jbeich set sender to jbeich@FreeBSD.org using -f From: Jan Beich Date: Tue, 4 Jul 2017 13:47:46 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r445016 - in head/x11/libxshmfence: . files X-SVN-Group: ports-head X-SVN-Commit-Author: jbeich X-SVN-Commit-Paths: in head/x11/libxshmfence: . files X-SVN-Commit-Revision: 445016 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 13:47:47 -0000 Author: jbeich Date: Tue Jul 4 13:47:46 2017 New Revision: 445016 URL: https://svnweb.freebsd.org/changeset/ports/445016 Log: x11/libxshmfence: don't leak /tmp/shmfd* files with O_CLOEXEC - Both mkostemp() and mkstemp() need explicit call to unlink() - Unobfuscate fallback if both O_TMPFILE and mksotemp() are N/A - O_TMPFILE (Linux-only) appeared after O_CLOEXEC, no need to check PR: 217676 (for tracking) MFH: 2017Q3 2017Q2 Modified: head/x11/libxshmfence/Makefile (contents, props changed) head/x11/libxshmfence/files/patch-src__xshmfence_alloc.c (contents, props changed) Modified: head/x11/libxshmfence/Makefile ============================================================================== --- head/x11/libxshmfence/Makefile Tue Jul 4 12:04:07 2017 (r445015) +++ head/x11/libxshmfence/Makefile Tue Jul 4 13:47:46 2017 (r445016) @@ -2,7 +2,7 @@ PORTNAME= libxshmfence PORTVERSION= 1.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11 MAINTAINER= x11@FreeBSD.org Modified: head/x11/libxshmfence/files/patch-src__xshmfence_alloc.c ============================================================================== --- head/x11/libxshmfence/files/patch-src__xshmfence_alloc.c Tue Jul 4 12:04:07 2017 (r445015) +++ head/x11/libxshmfence/files/patch-src__xshmfence_alloc.c Tue Jul 4 13:47:46 2017 (r445016) @@ -1,24 +1,14 @@ --- src/xshmfence_alloc.c.orig 2015-03-04 15:28:23 UTC +++ src/xshmfence_alloc.c -@@ -67,15 +67,19 @@ int - xshmfence_alloc_shm(void) - { - char template[] = SHMDIR "/shmfd-XXXXXX"; -- int fd; -+ int fd = -1; - - #if HAVE_MEMFD_CREATE - fd = memfd_create("xshmfence", MFD_CLOEXEC|MFD_ALLOW_SEALING); - if (fd < 0) - #endif - { --#ifdef O_TMPFILE -+#if defined(O_CLOEXEC) -+#if defined(HAVE_MKOSTEMP) -+ fd = mkostemp(template, O_CLOEXEC); -+#elif defined(O_TMPFILE) - fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666); -+#endif +@@ -79,7 +79,11 @@ xshmfence_alloc_shm(void) if (fd < 0) #endif { ++#ifdef HAVE_MKOSTEMP ++ fd = mkostemp(template, O_CLOEXEC); ++#else + fd = mkstemp(template); ++#endif + if (fd < 0) + return fd; + unlink(template);