void-packages/srcpkgs/libffi/patches/libffi-race-condition.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

38 lines
1.1 KiB
Diff

Description: fixes race condition
Author: Stefan Bühler <buehler@cert.uni-stuttgart.de>
Origin: libffi_3.2.1-9.debian.tar.xz
From 48d2e46528fb6e621d95a7fa194069fd136b712d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BChler?= <buehler@cert.uni-stuttgart.de>
Date: Wed, 7 Sep 2016 15:49:48 +0200
Subject: [PATCH 1/2] dlmmap_locked always needs locking as it always modifies
execsize
---
src/closures.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
--- a/src/closures.c
+++ b/src/closures.c
@@ -568,16 +568,11 @@
MREMAP_DUP and prot at this point. */
}
- if (execsize == 0 || execfd == -1)
- {
- pthread_mutex_lock (&open_temp_exec_file_mutex);
- ptr = dlmmap_locked (start, length, prot, flags, offset);
- pthread_mutex_unlock (&open_temp_exec_file_mutex);
+ pthread_mutex_lock (&open_temp_exec_file_mutex);
+ ptr = dlmmap_locked (start, length, prot, flags, offset);
+ pthread_mutex_unlock (&open_temp_exec_file_mutex);
- return ptr;
- }
-
- return dlmmap_locked (start, length, prot, flags, offset);
+ return ptr;
}
/* Release memory at the given address, as well as the corresponding