Mail archive
alpine-aports

[alpine-aports] [PATCH v3.2] /guile: security upgrade - fixes #6367

From: Sergey Lukin <sergej.lukin_at_gmail.com>
Date: Thu, 8 Dec 2016 13:45:35 +0000

CVE-2016-8605
guile-1.8.8 is not affected by CVE-2016-8606 (repl server was introduced in 2.0)
---
 main/guile/APKBUILD            | 13 +++++---
 main/guile/CVE-2016-8605.patch | 70 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 5 deletions(-)
 create mode 100644 main/guile/CVE-2016-8605.patch
diff --git a/main/guile/APKBUILD b/main/guile/APKBUILD
index c4563e3..d3dc029 100644
--- a/main/guile/APKBUILD
+++ b/main/guile/APKBUILD
_at_@ -1,7 +1,8 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
+# Contributer: Sergey Lukin <sergej.lukin_at_gmail.com>
 pkgname=guile
 pkgver=1.8.8
-pkgrel=2
+pkgrel=3
 pkgdesc="Guile is a portable, embeddable Scheme implementation written in C"
 url="http://www.gnu.org/software/guile/"
 arch="all"
_at_@ -13,11 +14,13 @@ install=
 source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.gz
 	guile-1.8.7-gcc45.patch
 	fix-defines.patch
+	CVE-2016-8605.patch
 	"
+# guile-1.8.8 is not affected by CVE-2016-8606 (repl server introduced in 2.0)
 
-_builddir="$srcdir"/$pkgname-$pkgver
+builddir="$srcdir"/$pkgname-$pkgver
 prepare() {
-	cd "$_builddir"
+	cd "$builddir"
 	update_config_sub || return 1
 	for i in $source; do
 		case "$i" in
_at_@ -30,7 +33,7 @@ prepare() {
 }
 
 build() {
-	cd "$_builddir"
+	cd "$builddir"
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
_at_@ -41,7 +44,7 @@ build() {
 }
 
 package() {
-	cd "$_builddir"
+	cd "$builddir"
 	make DESTDIR="$pkgdir" install || return 1
 	rm "$pkgdir"/usr/lib/*.la
 }
diff --git a/main/guile/CVE-2016-8605.patch b/main/guile/CVE-2016-8605.patch
new file mode 100644
index 0000000..0f179ce
--- /dev/null
+++ b/main/guile/CVE-2016-8605.patch
_at_@ -0,0 +1,70 @@
+CVE-2016-8605: Thread-unsafe umask modification
+https://bugs.alpinelinux.org/issues/6367
+http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=245608911698adb3472803856019bdd5670b6614
+
+Remove 'umask' calls from 'mkdir'.
+Fixes <http://bugs.gnu.org/24659>.
+
+* libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is
+unbound; instead, use 0777 as the mode.  Update docstring to clarify
+this.
+* doc/ref/posix.texi (File System): Adjust accordingly.
+
+diff -ru guile-1.8.8.orig/doc/ref/posix.texi guile-1.8.8/doc/ref/posix.texi
+--- guile-1.8.8.orig/doc/ref/posix.texi
++++ guile-1.8.8/doc/ref/posix.texi
+_at_@ -815,9 +815,10 @@
+ _at_deffn {Scheme Procedure} mkdir path [mode]
+ _at_deffnx {C Function} scm_mkdir (path, mode)
+ Create a new directory named by _at_var{path}.  If @var{mode} is omitted
+-then the permissions of the directory file are set using the current
+-umask (_at_pxref{Processes}).  Otherwise they are set to the decimal
+-value specified with _at_var{mode}.  The return value is unspecified.
++then the permissions of the directory are set to _at_code{#o777}
++masked with the current umask (_at_pxref{Processes, @code{umask}}).
++Otherwise they are set to the value specified with _at_var{mode}.
++The return value is unspecified.
+ _at_end deffn
+ 
+ _at_deffn {Scheme Procedure} rmdir path
+diff -ru guile-1.8.8.orig/libguile/filesys.c guile-1.8.8/libguile/filesys.c
+--- guile-1.8.8.orig/libguile/filesys.c
++++ guile-1.8.8/libguile/filesys.c
+_at_@ -790,27 +790,22 @@
+ #ifdef HAVE_MKDIR
+ SCM_DEFINE (scm_mkdir, "mkdir", 1, 1, 0,
+             (SCM path, SCM mode),
+-	    "Create a new directory named by _at_var{path}.  If @var{mode} is omitted\n"
+-	    "then the permissions of the directory file are set using the current\n"
+-	    "umask.  Otherwise they are set to the decimal value specified with\n"
+-	    "_at_var{mode}.  The return value is unspecified.")
++      "Create a new directory named by _at_var{path}.  If @var{mode} is omitted\n"
++      "then the permissions of the directory are set to _at_code{#o777}\n"
++      "masked with the current umask (_at_pxref{Processes, @code{umask}}).\n"
++      "Otherwise they are set to the value specified with _at_var{mode}.\n"
++      "The return value is unspecified.")
+ #define FUNC_NAME s_scm_mkdir
+ {
+   int rv;
+-  mode_t mask;
++  mode_t c_mode;
+ 
+-  if (SCM_UNBNDP (mode))
+-    {
+-      mask = umask (0);
+-      umask (mask);
+-      STRING_SYSCALL (path, c_path, rv = mkdir (c_path, 0777 ^ mask));
+-    }
+-  else
+-    {
+-      STRING_SYSCALL (path, c_path, rv = mkdir (c_path, scm_to_uint (mode)));
+-    }
++  c_mode = SCM_UNBNDP (mode) ? 0777 : scm_to_uint (mode);
++
++  STRING_SYSCALL (path, c_path, rv = mkdir (c_path, c_mode));
+   if (rv != 0)
+     SCM_SYSERROR;
++
+   return SCM_UNSPECIFIED;
+ }
+ #undef FUNC_NAME
-- 
2.4.11
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Thu Dec 08 2016 - 13:45:35 GMT