1 |
commit: 08cef68c75f0523120260fb30ee8cecb31268d7a |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 28 21:24:44 2013 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 28 21:24:44 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/releng.git;a=commit;h=08cef68c |
7 |
|
8 |
tools-uclibc: update patches for uclibc-0.9.33.2-r8 |
9 |
|
10 |
--- |
11 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
12 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
13 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
14 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
15 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
16 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
17 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
18 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
19 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
20 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
21 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
22 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
23 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
24 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
25 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
26 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
27 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
28 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
29 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
30 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
31 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
32 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
33 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
34 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
35 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
36 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
37 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
38 |
.../patches/sys-libs/uclibc/00_fix-eventfd.patch | 59 ------ |
39 |
.../sys-libs/uclibc/03-pread_pwrite-backport.patch | 215 --------------------- |
40 |
...d-isfdtype.patch => 99-libc-add-isfdtype.patch} | 0 |
41 |
30 files changed, 2740 deletions(-) |
42 |
|
43 |
diff --git a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
44 |
deleted file mode 100644 |
45 |
index cfc64de..0000000 |
46 |
--- a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
47 |
+++ /dev/null |
48 |
@@ -1,59 +0,0 @@ |
49 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
50 |
-From: Khem Raj <raj.khem@×××××.com> |
51 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
52 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
53 |
- |
54 |
-eventfd: evntfd assumes to take two arguments instead it |
55 |
-should be one evntfd expects two therefore implement both syscalls with |
56 |
-correct parameters |
57 |
- |
58 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
59 |
- |
60 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
61 |
---- |
62 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
63 |
-index cc3f3f0..96597ab 100644 |
64 |
---- a/libc/sysdeps/linux/common/eventfd.c |
65 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
66 |
-@@ -7,12 +7,24 @@ |
67 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
68 |
- */ |
69 |
- |
70 |
-+#include <errno.h> |
71 |
- #include <sys/syscall.h> |
72 |
- #include <sys/eventfd.h> |
73 |
- |
74 |
- /* |
75 |
- * eventfd() |
76 |
- */ |
77 |
--#ifdef __NR_eventfd |
78 |
--_syscall2(int, eventfd, int, count, int, flags) |
79 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
80 |
-+int eventfd (int count, int flags) |
81 |
-+{ |
82 |
-+#if defined __NR_eventfd2 |
83 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
84 |
-+#elif defined __NR_eventfd |
85 |
-+ if (flags != 0) { |
86 |
-+ __set_errno (EINVAL); |
87 |
-+ return -1; |
88 |
-+ } |
89 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
90 |
-+#endif |
91 |
-+} |
92 |
- #endif |
93 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
94 |
-index 3567b07..1fc2393 100644 |
95 |
---- a/libc/sysdeps/linux/common/stubs.c |
96 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
97 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
98 |
- make_stub(epoll_wait) |
99 |
- #endif |
100 |
- |
101 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
102 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
103 |
- make_stub(eventfd) |
104 |
- #endif |
105 |
- |
106 |
--- |
107 |
-cgit v0.9.1 |
108 |
|
109 |
diff --git a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
110 |
deleted file mode 100644 |
111 |
index 7ea9486..0000000 |
112 |
--- a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
113 |
+++ /dev/null |
114 |
@@ -1,215 +0,0 @@ |
115 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
116 |
-From: Natanael Copa <natanael.copa@×××××.com> |
117 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
118 |
-Subject: pread/pwrite: backport fix |
119 |
- |
120 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
121 |
- |
122 |
-There was a fallback function using lseek for kernels who did not have |
123 |
-this syscall (pre 2.1.60). This is broken in many ways. |
124 |
- |
125 |
-uclibc have been using the broken fallback due to they forgot to rename |
126 |
-pread syscall. |
127 |
- |
128 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
129 |
-which broke in similar ways a windows (msys). |
130 |
- |
131 |
-This issue in uclibc have been reported upstream and fixed in git master |
132 |
-so this patch does not need to be upstreamed. It might be an idea to |
133 |
-backport it properly for 0.9.33 branch though. |
134 |
- |
135 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
136 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
137 |
---- |
138 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
139 |
-index 88e6957..baf8691 100644 |
140 |
---- a/libc/sysdeps/linux/common/pread_write.c |
141 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
142 |
-@@ -17,6 +17,7 @@ |
143 |
- #include <unistd.h> |
144 |
- #include <stdint.h> |
145 |
- #include <endian.h> |
146 |
-+#include <sysdep-cancel.h> |
147 |
- |
148 |
- extern __typeof(pread) __libc_pread; |
149 |
- extern __typeof(pwrite) __libc_pwrite; |
150 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
151 |
- |
152 |
- #include <bits/kernel_types.h> |
153 |
- |
154 |
--#ifdef __NR_pread |
155 |
-- |
156 |
--# define __NR___syscall_pread __NR_pread |
157 |
-+# define __NR___syscall_pread __NR_pread64 |
158 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
159 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
160 |
- |
161 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
162 |
- { |
163 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
164 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
165 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
166 |
-+ LIBC_CANCEL_RESET (oldtype); |
167 |
-+ return result; |
168 |
-+ |
169 |
- } |
170 |
- weak_alias(__libc_pread,pread) |
171 |
- |
172 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
173 |
- { |
174 |
- uint32_t low = offset & 0xffffffff; |
175 |
- uint32_t high = offset >> 32; |
176 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
177 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
178 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
179 |
-+ LIBC_CANCEL_RESET (oldtype); |
180 |
-+ return result; |
181 |
- } |
182 |
- weak_alias(__libc_pread64,pread64) |
183 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
184 |
- |
185 |
--#endif /* __NR_pread */ |
186 |
-- |
187 |
--#ifdef __NR_pwrite |
188 |
-- |
189 |
--# define __NR___syscall_pwrite __NR_pwrite |
190 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
191 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
192 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
193 |
- |
194 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
195 |
- { |
196 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
197 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
198 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
199 |
-+ LIBC_CANCEL_RESET (oldtype); |
200 |
-+ return result; |
201 |
- } |
202 |
- weak_alias(__libc_pwrite,pwrite) |
203 |
- |
204 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
205 |
- { |
206 |
- uint32_t low = offset & 0xffffffff; |
207 |
- uint32_t high = offset >> 32; |
208 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
209 |
--} |
210 |
--weak_alias(__libc_pwrite64,pwrite64) |
211 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
212 |
--#endif /* __NR_pwrite */ |
213 |
-- |
214 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
215 |
-- |
216 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
217 |
-- size_t count, off_t offset, int do_pwrite) |
218 |
--{ |
219 |
-- int save_errno; |
220 |
-- ssize_t result; |
221 |
-- off_t old_offset; |
222 |
-- |
223 |
-- /* Since we must not change the file pointer preserve the |
224 |
-- * value so that we can restore it later. */ |
225 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
226 |
-- return -1; |
227 |
-- |
228 |
-- /* Set to wanted position. */ |
229 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
230 |
-- return -1; |
231 |
-- |
232 |
-- if (do_pwrite == 1) { |
233 |
-- /* Write the data. */ |
234 |
-- result = write(fd, buf, count); |
235 |
-- } else { |
236 |
-- /* Read the data. */ |
237 |
-- result = read(fd, buf, count); |
238 |
-- } |
239 |
-- |
240 |
-- /* Now we have to restore the position. If this fails we |
241 |
-- * have to return this as an error. */ |
242 |
-- save_errno = errno; |
243 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
244 |
-- { |
245 |
-- if (result == -1) |
246 |
-- __set_errno(save_errno); |
247 |
-- return -1; |
248 |
-- } |
249 |
-- __set_errno(save_errno); |
250 |
-- return(result); |
251 |
--} |
252 |
-- |
253 |
--# ifdef __UCLIBC_HAS_LFS__ |
254 |
-- |
255 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
256 |
-- size_t count, off64_t offset, int do_pwrite) |
257 |
--{ |
258 |
-- int save_errno; |
259 |
-- ssize_t result; |
260 |
-- off64_t old_offset; |
261 |
-- |
262 |
-- /* Since we must not change the file pointer preserve the |
263 |
-- * value so that we can restore it later. */ |
264 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
265 |
-- return -1; |
266 |
-- |
267 |
-- /* Set to wanted position. */ |
268 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
269 |
-- return -1; |
270 |
-- |
271 |
-- if (do_pwrite == 1) { |
272 |
-- /* Write the data. */ |
273 |
-- result = write(fd, buf, count); |
274 |
-- } else { |
275 |
-- /* Read the data. */ |
276 |
-- result = read(fd, buf, count); |
277 |
-- } |
278 |
-- |
279 |
-- /* Now we have to restore the position. */ |
280 |
-- save_errno = errno; |
281 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
282 |
-- if (result == -1) |
283 |
-- __set_errno (save_errno); |
284 |
-- return -1; |
285 |
-- } |
286 |
-- __set_errno (save_errno); |
287 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
288 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
289 |
-+ LIBC_CANCEL_RESET (oldtype); |
290 |
- return result; |
291 |
- } |
292 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
293 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
294 |
-- |
295 |
--#ifndef __NR_pread |
296 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
297 |
--{ |
298 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
299 |
--} |
300 |
--weak_alias(__libc_pread,pread) |
301 |
-- |
302 |
--# ifdef __UCLIBC_HAS_LFS__ |
303 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
304 |
--{ |
305 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
306 |
--} |
307 |
--weak_alias(__libc_pread64,pread64) |
308 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
309 |
--#endif /* ! __NR_pread */ |
310 |
-- |
311 |
--#ifndef __NR_pwrite |
312 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
313 |
--{ |
314 |
-- /* we won't actually be modifying the buffer, |
315 |
-- *just cast it to get rid of warnings */ |
316 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
317 |
--} |
318 |
--weak_alias(__libc_pwrite,pwrite) |
319 |
-- |
320 |
--# ifdef __UCLIBC_HAS_LFS__ |
321 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
322 |
--{ |
323 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
324 |
--} |
325 |
- weak_alias(__libc_pwrite64,pwrite64) |
326 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
327 |
--#endif /* ! __NR_pwrite */ |
328 |
--- |
329 |
-cgit v0.9.1 |
330 |
|
331 |
diff --git a/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
332 |
similarity index 100% |
333 |
rename from tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
334 |
rename to tools-uclibc/portage.amd64.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
335 |
|
336 |
diff --git a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
337 |
deleted file mode 100644 |
338 |
index cfc64de..0000000 |
339 |
--- a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
340 |
+++ /dev/null |
341 |
@@ -1,59 +0,0 @@ |
342 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
343 |
-From: Khem Raj <raj.khem@×××××.com> |
344 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
345 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
346 |
- |
347 |
-eventfd: evntfd assumes to take two arguments instead it |
348 |
-should be one evntfd expects two therefore implement both syscalls with |
349 |
-correct parameters |
350 |
- |
351 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
352 |
- |
353 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
354 |
---- |
355 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
356 |
-index cc3f3f0..96597ab 100644 |
357 |
---- a/libc/sysdeps/linux/common/eventfd.c |
358 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
359 |
-@@ -7,12 +7,24 @@ |
360 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
361 |
- */ |
362 |
- |
363 |
-+#include <errno.h> |
364 |
- #include <sys/syscall.h> |
365 |
- #include <sys/eventfd.h> |
366 |
- |
367 |
- /* |
368 |
- * eventfd() |
369 |
- */ |
370 |
--#ifdef __NR_eventfd |
371 |
--_syscall2(int, eventfd, int, count, int, flags) |
372 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
373 |
-+int eventfd (int count, int flags) |
374 |
-+{ |
375 |
-+#if defined __NR_eventfd2 |
376 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
377 |
-+#elif defined __NR_eventfd |
378 |
-+ if (flags != 0) { |
379 |
-+ __set_errno (EINVAL); |
380 |
-+ return -1; |
381 |
-+ } |
382 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
383 |
-+#endif |
384 |
-+} |
385 |
- #endif |
386 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
387 |
-index 3567b07..1fc2393 100644 |
388 |
---- a/libc/sysdeps/linux/common/stubs.c |
389 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
390 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
391 |
- make_stub(epoll_wait) |
392 |
- #endif |
393 |
- |
394 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
395 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
396 |
- make_stub(eventfd) |
397 |
- #endif |
398 |
- |
399 |
--- |
400 |
-cgit v0.9.1 |
401 |
|
402 |
diff --git a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
403 |
deleted file mode 100644 |
404 |
index 7ea9486..0000000 |
405 |
--- a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
406 |
+++ /dev/null |
407 |
@@ -1,215 +0,0 @@ |
408 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
409 |
-From: Natanael Copa <natanael.copa@×××××.com> |
410 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
411 |
-Subject: pread/pwrite: backport fix |
412 |
- |
413 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
414 |
- |
415 |
-There was a fallback function using lseek for kernels who did not have |
416 |
-this syscall (pre 2.1.60). This is broken in many ways. |
417 |
- |
418 |
-uclibc have been using the broken fallback due to they forgot to rename |
419 |
-pread syscall. |
420 |
- |
421 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
422 |
-which broke in similar ways a windows (msys). |
423 |
- |
424 |
-This issue in uclibc have been reported upstream and fixed in git master |
425 |
-so this patch does not need to be upstreamed. It might be an idea to |
426 |
-backport it properly for 0.9.33 branch though. |
427 |
- |
428 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
429 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
430 |
---- |
431 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
432 |
-index 88e6957..baf8691 100644 |
433 |
---- a/libc/sysdeps/linux/common/pread_write.c |
434 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
435 |
-@@ -17,6 +17,7 @@ |
436 |
- #include <unistd.h> |
437 |
- #include <stdint.h> |
438 |
- #include <endian.h> |
439 |
-+#include <sysdep-cancel.h> |
440 |
- |
441 |
- extern __typeof(pread) __libc_pread; |
442 |
- extern __typeof(pwrite) __libc_pwrite; |
443 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
444 |
- |
445 |
- #include <bits/kernel_types.h> |
446 |
- |
447 |
--#ifdef __NR_pread |
448 |
-- |
449 |
--# define __NR___syscall_pread __NR_pread |
450 |
-+# define __NR___syscall_pread __NR_pread64 |
451 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
452 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
453 |
- |
454 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
455 |
- { |
456 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
457 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
458 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
459 |
-+ LIBC_CANCEL_RESET (oldtype); |
460 |
-+ return result; |
461 |
-+ |
462 |
- } |
463 |
- weak_alias(__libc_pread,pread) |
464 |
- |
465 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
466 |
- { |
467 |
- uint32_t low = offset & 0xffffffff; |
468 |
- uint32_t high = offset >> 32; |
469 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
470 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
471 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
472 |
-+ LIBC_CANCEL_RESET (oldtype); |
473 |
-+ return result; |
474 |
- } |
475 |
- weak_alias(__libc_pread64,pread64) |
476 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
477 |
- |
478 |
--#endif /* __NR_pread */ |
479 |
-- |
480 |
--#ifdef __NR_pwrite |
481 |
-- |
482 |
--# define __NR___syscall_pwrite __NR_pwrite |
483 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
484 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
485 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
486 |
- |
487 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
488 |
- { |
489 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
490 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
491 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
492 |
-+ LIBC_CANCEL_RESET (oldtype); |
493 |
-+ return result; |
494 |
- } |
495 |
- weak_alias(__libc_pwrite,pwrite) |
496 |
- |
497 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
498 |
- { |
499 |
- uint32_t low = offset & 0xffffffff; |
500 |
- uint32_t high = offset >> 32; |
501 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
502 |
--} |
503 |
--weak_alias(__libc_pwrite64,pwrite64) |
504 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
505 |
--#endif /* __NR_pwrite */ |
506 |
-- |
507 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
508 |
-- |
509 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
510 |
-- size_t count, off_t offset, int do_pwrite) |
511 |
--{ |
512 |
-- int save_errno; |
513 |
-- ssize_t result; |
514 |
-- off_t old_offset; |
515 |
-- |
516 |
-- /* Since we must not change the file pointer preserve the |
517 |
-- * value so that we can restore it later. */ |
518 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
519 |
-- return -1; |
520 |
-- |
521 |
-- /* Set to wanted position. */ |
522 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
523 |
-- return -1; |
524 |
-- |
525 |
-- if (do_pwrite == 1) { |
526 |
-- /* Write the data. */ |
527 |
-- result = write(fd, buf, count); |
528 |
-- } else { |
529 |
-- /* Read the data. */ |
530 |
-- result = read(fd, buf, count); |
531 |
-- } |
532 |
-- |
533 |
-- /* Now we have to restore the position. If this fails we |
534 |
-- * have to return this as an error. */ |
535 |
-- save_errno = errno; |
536 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
537 |
-- { |
538 |
-- if (result == -1) |
539 |
-- __set_errno(save_errno); |
540 |
-- return -1; |
541 |
-- } |
542 |
-- __set_errno(save_errno); |
543 |
-- return(result); |
544 |
--} |
545 |
-- |
546 |
--# ifdef __UCLIBC_HAS_LFS__ |
547 |
-- |
548 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
549 |
-- size_t count, off64_t offset, int do_pwrite) |
550 |
--{ |
551 |
-- int save_errno; |
552 |
-- ssize_t result; |
553 |
-- off64_t old_offset; |
554 |
-- |
555 |
-- /* Since we must not change the file pointer preserve the |
556 |
-- * value so that we can restore it later. */ |
557 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
558 |
-- return -1; |
559 |
-- |
560 |
-- /* Set to wanted position. */ |
561 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
562 |
-- return -1; |
563 |
-- |
564 |
-- if (do_pwrite == 1) { |
565 |
-- /* Write the data. */ |
566 |
-- result = write(fd, buf, count); |
567 |
-- } else { |
568 |
-- /* Read the data. */ |
569 |
-- result = read(fd, buf, count); |
570 |
-- } |
571 |
-- |
572 |
-- /* Now we have to restore the position. */ |
573 |
-- save_errno = errno; |
574 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
575 |
-- if (result == -1) |
576 |
-- __set_errno (save_errno); |
577 |
-- return -1; |
578 |
-- } |
579 |
-- __set_errno (save_errno); |
580 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
581 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
582 |
-+ LIBC_CANCEL_RESET (oldtype); |
583 |
- return result; |
584 |
- } |
585 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
586 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
587 |
-- |
588 |
--#ifndef __NR_pread |
589 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
590 |
--{ |
591 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
592 |
--} |
593 |
--weak_alias(__libc_pread,pread) |
594 |
-- |
595 |
--# ifdef __UCLIBC_HAS_LFS__ |
596 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
597 |
--{ |
598 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
599 |
--} |
600 |
--weak_alias(__libc_pread64,pread64) |
601 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
602 |
--#endif /* ! __NR_pread */ |
603 |
-- |
604 |
--#ifndef __NR_pwrite |
605 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
606 |
--{ |
607 |
-- /* we won't actually be modifying the buffer, |
608 |
-- *just cast it to get rid of warnings */ |
609 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
610 |
--} |
611 |
--weak_alias(__libc_pwrite,pwrite) |
612 |
-- |
613 |
--# ifdef __UCLIBC_HAS_LFS__ |
614 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
615 |
--{ |
616 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
617 |
--} |
618 |
- weak_alias(__libc_pwrite64,pwrite64) |
619 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
620 |
--#endif /* ! __NR_pwrite */ |
621 |
--- |
622 |
-cgit v0.9.1 |
623 |
|
624 |
diff --git a/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
625 |
similarity index 100% |
626 |
rename from tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
627 |
rename to tools-uclibc/portage.amd64.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
628 |
|
629 |
diff --git a/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
630 |
deleted file mode 100644 |
631 |
index cfc64de..0000000 |
632 |
--- a/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
633 |
+++ /dev/null |
634 |
@@ -1,59 +0,0 @@ |
635 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
636 |
-From: Khem Raj <raj.khem@×××××.com> |
637 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
638 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
639 |
- |
640 |
-eventfd: evntfd assumes to take two arguments instead it |
641 |
-should be one evntfd expects two therefore implement both syscalls with |
642 |
-correct parameters |
643 |
- |
644 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
645 |
- |
646 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
647 |
---- |
648 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
649 |
-index cc3f3f0..96597ab 100644 |
650 |
---- a/libc/sysdeps/linux/common/eventfd.c |
651 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
652 |
-@@ -7,12 +7,24 @@ |
653 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
654 |
- */ |
655 |
- |
656 |
-+#include <errno.h> |
657 |
- #include <sys/syscall.h> |
658 |
- #include <sys/eventfd.h> |
659 |
- |
660 |
- /* |
661 |
- * eventfd() |
662 |
- */ |
663 |
--#ifdef __NR_eventfd |
664 |
--_syscall2(int, eventfd, int, count, int, flags) |
665 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
666 |
-+int eventfd (int count, int flags) |
667 |
-+{ |
668 |
-+#if defined __NR_eventfd2 |
669 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
670 |
-+#elif defined __NR_eventfd |
671 |
-+ if (flags != 0) { |
672 |
-+ __set_errno (EINVAL); |
673 |
-+ return -1; |
674 |
-+ } |
675 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
676 |
-+#endif |
677 |
-+} |
678 |
- #endif |
679 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
680 |
-index 3567b07..1fc2393 100644 |
681 |
---- a/libc/sysdeps/linux/common/stubs.c |
682 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
683 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
684 |
- make_stub(epoll_wait) |
685 |
- #endif |
686 |
- |
687 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
688 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
689 |
- make_stub(eventfd) |
690 |
- #endif |
691 |
- |
692 |
--- |
693 |
-cgit v0.9.1 |
694 |
|
695 |
diff --git a/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
696 |
deleted file mode 100644 |
697 |
index 7ea9486..0000000 |
698 |
--- a/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
699 |
+++ /dev/null |
700 |
@@ -1,215 +0,0 @@ |
701 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
702 |
-From: Natanael Copa <natanael.copa@×××××.com> |
703 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
704 |
-Subject: pread/pwrite: backport fix |
705 |
- |
706 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
707 |
- |
708 |
-There was a fallback function using lseek for kernels who did not have |
709 |
-this syscall (pre 2.1.60). This is broken in many ways. |
710 |
- |
711 |
-uclibc have been using the broken fallback due to they forgot to rename |
712 |
-pread syscall. |
713 |
- |
714 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
715 |
-which broke in similar ways a windows (msys). |
716 |
- |
717 |
-This issue in uclibc have been reported upstream and fixed in git master |
718 |
-so this patch does not need to be upstreamed. It might be an idea to |
719 |
-backport it properly for 0.9.33 branch though. |
720 |
- |
721 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
722 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
723 |
---- |
724 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
725 |
-index 88e6957..baf8691 100644 |
726 |
---- a/libc/sysdeps/linux/common/pread_write.c |
727 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
728 |
-@@ -17,6 +17,7 @@ |
729 |
- #include <unistd.h> |
730 |
- #include <stdint.h> |
731 |
- #include <endian.h> |
732 |
-+#include <sysdep-cancel.h> |
733 |
- |
734 |
- extern __typeof(pread) __libc_pread; |
735 |
- extern __typeof(pwrite) __libc_pwrite; |
736 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
737 |
- |
738 |
- #include <bits/kernel_types.h> |
739 |
- |
740 |
--#ifdef __NR_pread |
741 |
-- |
742 |
--# define __NR___syscall_pread __NR_pread |
743 |
-+# define __NR___syscall_pread __NR_pread64 |
744 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
745 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
746 |
- |
747 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
748 |
- { |
749 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
750 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
751 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
752 |
-+ LIBC_CANCEL_RESET (oldtype); |
753 |
-+ return result; |
754 |
-+ |
755 |
- } |
756 |
- weak_alias(__libc_pread,pread) |
757 |
- |
758 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
759 |
- { |
760 |
- uint32_t low = offset & 0xffffffff; |
761 |
- uint32_t high = offset >> 32; |
762 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
763 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
764 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
765 |
-+ LIBC_CANCEL_RESET (oldtype); |
766 |
-+ return result; |
767 |
- } |
768 |
- weak_alias(__libc_pread64,pread64) |
769 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
770 |
- |
771 |
--#endif /* __NR_pread */ |
772 |
-- |
773 |
--#ifdef __NR_pwrite |
774 |
-- |
775 |
--# define __NR___syscall_pwrite __NR_pwrite |
776 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
777 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
778 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
779 |
- |
780 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
781 |
- { |
782 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
783 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
784 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
785 |
-+ LIBC_CANCEL_RESET (oldtype); |
786 |
-+ return result; |
787 |
- } |
788 |
- weak_alias(__libc_pwrite,pwrite) |
789 |
- |
790 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
791 |
- { |
792 |
- uint32_t low = offset & 0xffffffff; |
793 |
- uint32_t high = offset >> 32; |
794 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
795 |
--} |
796 |
--weak_alias(__libc_pwrite64,pwrite64) |
797 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
798 |
--#endif /* __NR_pwrite */ |
799 |
-- |
800 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
801 |
-- |
802 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
803 |
-- size_t count, off_t offset, int do_pwrite) |
804 |
--{ |
805 |
-- int save_errno; |
806 |
-- ssize_t result; |
807 |
-- off_t old_offset; |
808 |
-- |
809 |
-- /* Since we must not change the file pointer preserve the |
810 |
-- * value so that we can restore it later. */ |
811 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
812 |
-- return -1; |
813 |
-- |
814 |
-- /* Set to wanted position. */ |
815 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
816 |
-- return -1; |
817 |
-- |
818 |
-- if (do_pwrite == 1) { |
819 |
-- /* Write the data. */ |
820 |
-- result = write(fd, buf, count); |
821 |
-- } else { |
822 |
-- /* Read the data. */ |
823 |
-- result = read(fd, buf, count); |
824 |
-- } |
825 |
-- |
826 |
-- /* Now we have to restore the position. If this fails we |
827 |
-- * have to return this as an error. */ |
828 |
-- save_errno = errno; |
829 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
830 |
-- { |
831 |
-- if (result == -1) |
832 |
-- __set_errno(save_errno); |
833 |
-- return -1; |
834 |
-- } |
835 |
-- __set_errno(save_errno); |
836 |
-- return(result); |
837 |
--} |
838 |
-- |
839 |
--# ifdef __UCLIBC_HAS_LFS__ |
840 |
-- |
841 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
842 |
-- size_t count, off64_t offset, int do_pwrite) |
843 |
--{ |
844 |
-- int save_errno; |
845 |
-- ssize_t result; |
846 |
-- off64_t old_offset; |
847 |
-- |
848 |
-- /* Since we must not change the file pointer preserve the |
849 |
-- * value so that we can restore it later. */ |
850 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
851 |
-- return -1; |
852 |
-- |
853 |
-- /* Set to wanted position. */ |
854 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
855 |
-- return -1; |
856 |
-- |
857 |
-- if (do_pwrite == 1) { |
858 |
-- /* Write the data. */ |
859 |
-- result = write(fd, buf, count); |
860 |
-- } else { |
861 |
-- /* Read the data. */ |
862 |
-- result = read(fd, buf, count); |
863 |
-- } |
864 |
-- |
865 |
-- /* Now we have to restore the position. */ |
866 |
-- save_errno = errno; |
867 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
868 |
-- if (result == -1) |
869 |
-- __set_errno (save_errno); |
870 |
-- return -1; |
871 |
-- } |
872 |
-- __set_errno (save_errno); |
873 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
874 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
875 |
-+ LIBC_CANCEL_RESET (oldtype); |
876 |
- return result; |
877 |
- } |
878 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
879 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
880 |
-- |
881 |
--#ifndef __NR_pread |
882 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
883 |
--{ |
884 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
885 |
--} |
886 |
--weak_alias(__libc_pread,pread) |
887 |
-- |
888 |
--# ifdef __UCLIBC_HAS_LFS__ |
889 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
890 |
--{ |
891 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
892 |
--} |
893 |
--weak_alias(__libc_pread64,pread64) |
894 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
895 |
--#endif /* ! __NR_pread */ |
896 |
-- |
897 |
--#ifndef __NR_pwrite |
898 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
899 |
--{ |
900 |
-- /* we won't actually be modifying the buffer, |
901 |
-- *just cast it to get rid of warnings */ |
902 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
903 |
--} |
904 |
--weak_alias(__libc_pwrite,pwrite) |
905 |
-- |
906 |
--# ifdef __UCLIBC_HAS_LFS__ |
907 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
908 |
--{ |
909 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
910 |
--} |
911 |
- weak_alias(__libc_pwrite64,pwrite64) |
912 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
913 |
--#endif /* ! __NR_pwrite */ |
914 |
--- |
915 |
-cgit v0.9.1 |
916 |
|
917 |
diff --git a/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
918 |
similarity index 100% |
919 |
rename from tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
920 |
rename to tools-uclibc/portage.armv7a.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
921 |
|
922 |
diff --git a/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
923 |
deleted file mode 100644 |
924 |
index cfc64de..0000000 |
925 |
--- a/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
926 |
+++ /dev/null |
927 |
@@ -1,59 +0,0 @@ |
928 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
929 |
-From: Khem Raj <raj.khem@×××××.com> |
930 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
931 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
932 |
- |
933 |
-eventfd: evntfd assumes to take two arguments instead it |
934 |
-should be one evntfd expects two therefore implement both syscalls with |
935 |
-correct parameters |
936 |
- |
937 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
938 |
- |
939 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
940 |
---- |
941 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
942 |
-index cc3f3f0..96597ab 100644 |
943 |
---- a/libc/sysdeps/linux/common/eventfd.c |
944 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
945 |
-@@ -7,12 +7,24 @@ |
946 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
947 |
- */ |
948 |
- |
949 |
-+#include <errno.h> |
950 |
- #include <sys/syscall.h> |
951 |
- #include <sys/eventfd.h> |
952 |
- |
953 |
- /* |
954 |
- * eventfd() |
955 |
- */ |
956 |
--#ifdef __NR_eventfd |
957 |
--_syscall2(int, eventfd, int, count, int, flags) |
958 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
959 |
-+int eventfd (int count, int flags) |
960 |
-+{ |
961 |
-+#if defined __NR_eventfd2 |
962 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
963 |
-+#elif defined __NR_eventfd |
964 |
-+ if (flags != 0) { |
965 |
-+ __set_errno (EINVAL); |
966 |
-+ return -1; |
967 |
-+ } |
968 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
969 |
-+#endif |
970 |
-+} |
971 |
- #endif |
972 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
973 |
-index 3567b07..1fc2393 100644 |
974 |
---- a/libc/sysdeps/linux/common/stubs.c |
975 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
976 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
977 |
- make_stub(epoll_wait) |
978 |
- #endif |
979 |
- |
980 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
981 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
982 |
- make_stub(eventfd) |
983 |
- #endif |
984 |
- |
985 |
--- |
986 |
-cgit v0.9.1 |
987 |
|
988 |
diff --git a/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
989 |
deleted file mode 100644 |
990 |
index 7ea9486..0000000 |
991 |
--- a/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
992 |
+++ /dev/null |
993 |
@@ -1,215 +0,0 @@ |
994 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
995 |
-From: Natanael Copa <natanael.copa@×××××.com> |
996 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
997 |
-Subject: pread/pwrite: backport fix |
998 |
- |
999 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
1000 |
- |
1001 |
-There was a fallback function using lseek for kernels who did not have |
1002 |
-this syscall (pre 2.1.60). This is broken in many ways. |
1003 |
- |
1004 |
-uclibc have been using the broken fallback due to they forgot to rename |
1005 |
-pread syscall. |
1006 |
- |
1007 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
1008 |
-which broke in similar ways a windows (msys). |
1009 |
- |
1010 |
-This issue in uclibc have been reported upstream and fixed in git master |
1011 |
-so this patch does not need to be upstreamed. It might be an idea to |
1012 |
-backport it properly for 0.9.33 branch though. |
1013 |
- |
1014 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
1015 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
1016 |
---- |
1017 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
1018 |
-index 88e6957..baf8691 100644 |
1019 |
---- a/libc/sysdeps/linux/common/pread_write.c |
1020 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
1021 |
-@@ -17,6 +17,7 @@ |
1022 |
- #include <unistd.h> |
1023 |
- #include <stdint.h> |
1024 |
- #include <endian.h> |
1025 |
-+#include <sysdep-cancel.h> |
1026 |
- |
1027 |
- extern __typeof(pread) __libc_pread; |
1028 |
- extern __typeof(pwrite) __libc_pwrite; |
1029 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
1030 |
- |
1031 |
- #include <bits/kernel_types.h> |
1032 |
- |
1033 |
--#ifdef __NR_pread |
1034 |
-- |
1035 |
--# define __NR___syscall_pread __NR_pread |
1036 |
-+# define __NR___syscall_pread __NR_pread64 |
1037 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
1038 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1039 |
- |
1040 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1041 |
- { |
1042 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1043 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1044 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1045 |
-+ LIBC_CANCEL_RESET (oldtype); |
1046 |
-+ return result; |
1047 |
-+ |
1048 |
- } |
1049 |
- weak_alias(__libc_pread,pread) |
1050 |
- |
1051 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1052 |
- { |
1053 |
- uint32_t low = offset & 0xffffffff; |
1054 |
- uint32_t high = offset >> 32; |
1055 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1056 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1057 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1058 |
-+ LIBC_CANCEL_RESET (oldtype); |
1059 |
-+ return result; |
1060 |
- } |
1061 |
- weak_alias(__libc_pread64,pread64) |
1062 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1063 |
- |
1064 |
--#endif /* __NR_pread */ |
1065 |
-- |
1066 |
--#ifdef __NR_pwrite |
1067 |
-- |
1068 |
--# define __NR___syscall_pwrite __NR_pwrite |
1069 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
1070 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
1071 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1072 |
- |
1073 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1074 |
- { |
1075 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1076 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1077 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1078 |
-+ LIBC_CANCEL_RESET (oldtype); |
1079 |
-+ return result; |
1080 |
- } |
1081 |
- weak_alias(__libc_pwrite,pwrite) |
1082 |
- |
1083 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1084 |
- { |
1085 |
- uint32_t low = offset & 0xffffffff; |
1086 |
- uint32_t high = offset >> 32; |
1087 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1088 |
--} |
1089 |
--weak_alias(__libc_pwrite64,pwrite64) |
1090 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1091 |
--#endif /* __NR_pwrite */ |
1092 |
-- |
1093 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
1094 |
-- |
1095 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
1096 |
-- size_t count, off_t offset, int do_pwrite) |
1097 |
--{ |
1098 |
-- int save_errno; |
1099 |
-- ssize_t result; |
1100 |
-- off_t old_offset; |
1101 |
-- |
1102 |
-- /* Since we must not change the file pointer preserve the |
1103 |
-- * value so that we can restore it later. */ |
1104 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
1105 |
-- return -1; |
1106 |
-- |
1107 |
-- /* Set to wanted position. */ |
1108 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
1109 |
-- return -1; |
1110 |
-- |
1111 |
-- if (do_pwrite == 1) { |
1112 |
-- /* Write the data. */ |
1113 |
-- result = write(fd, buf, count); |
1114 |
-- } else { |
1115 |
-- /* Read the data. */ |
1116 |
-- result = read(fd, buf, count); |
1117 |
-- } |
1118 |
-- |
1119 |
-- /* Now we have to restore the position. If this fails we |
1120 |
-- * have to return this as an error. */ |
1121 |
-- save_errno = errno; |
1122 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
1123 |
-- { |
1124 |
-- if (result == -1) |
1125 |
-- __set_errno(save_errno); |
1126 |
-- return -1; |
1127 |
-- } |
1128 |
-- __set_errno(save_errno); |
1129 |
-- return(result); |
1130 |
--} |
1131 |
-- |
1132 |
--# ifdef __UCLIBC_HAS_LFS__ |
1133 |
-- |
1134 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
1135 |
-- size_t count, off64_t offset, int do_pwrite) |
1136 |
--{ |
1137 |
-- int save_errno; |
1138 |
-- ssize_t result; |
1139 |
-- off64_t old_offset; |
1140 |
-- |
1141 |
-- /* Since we must not change the file pointer preserve the |
1142 |
-- * value so that we can restore it later. */ |
1143 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
1144 |
-- return -1; |
1145 |
-- |
1146 |
-- /* Set to wanted position. */ |
1147 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
1148 |
-- return -1; |
1149 |
-- |
1150 |
-- if (do_pwrite == 1) { |
1151 |
-- /* Write the data. */ |
1152 |
-- result = write(fd, buf, count); |
1153 |
-- } else { |
1154 |
-- /* Read the data. */ |
1155 |
-- result = read(fd, buf, count); |
1156 |
-- } |
1157 |
-- |
1158 |
-- /* Now we have to restore the position. */ |
1159 |
-- save_errno = errno; |
1160 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
1161 |
-- if (result == -1) |
1162 |
-- __set_errno (save_errno); |
1163 |
-- return -1; |
1164 |
-- } |
1165 |
-- __set_errno (save_errno); |
1166 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1167 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1168 |
-+ LIBC_CANCEL_RESET (oldtype); |
1169 |
- return result; |
1170 |
- } |
1171 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1172 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
1173 |
-- |
1174 |
--#ifndef __NR_pread |
1175 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1176 |
--{ |
1177 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
1178 |
--} |
1179 |
--weak_alias(__libc_pread,pread) |
1180 |
-- |
1181 |
--# ifdef __UCLIBC_HAS_LFS__ |
1182 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1183 |
--{ |
1184 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
1185 |
--} |
1186 |
--weak_alias(__libc_pread64,pread64) |
1187 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1188 |
--#endif /* ! __NR_pread */ |
1189 |
-- |
1190 |
--#ifndef __NR_pwrite |
1191 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1192 |
--{ |
1193 |
-- /* we won't actually be modifying the buffer, |
1194 |
-- *just cast it to get rid of warnings */ |
1195 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
1196 |
--} |
1197 |
--weak_alias(__libc_pwrite,pwrite) |
1198 |
-- |
1199 |
--# ifdef __UCLIBC_HAS_LFS__ |
1200 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1201 |
--{ |
1202 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
1203 |
--} |
1204 |
- weak_alias(__libc_pwrite64,pwrite64) |
1205 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1206 |
--#endif /* ! __NR_pwrite */ |
1207 |
--- |
1208 |
-cgit v0.9.1 |
1209 |
|
1210 |
diff --git a/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1211 |
similarity index 100% |
1212 |
rename from tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
1213 |
rename to tools-uclibc/portage.armv7a.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1214 |
|
1215 |
diff --git a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1216 |
deleted file mode 100644 |
1217 |
index cfc64de..0000000 |
1218 |
--- a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1219 |
+++ /dev/null |
1220 |
@@ -1,59 +0,0 @@ |
1221 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
1222 |
-From: Khem Raj <raj.khem@×××××.com> |
1223 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
1224 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
1225 |
- |
1226 |
-eventfd: evntfd assumes to take two arguments instead it |
1227 |
-should be one evntfd expects two therefore implement both syscalls with |
1228 |
-correct parameters |
1229 |
- |
1230 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
1231 |
- |
1232 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
1233 |
---- |
1234 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
1235 |
-index cc3f3f0..96597ab 100644 |
1236 |
---- a/libc/sysdeps/linux/common/eventfd.c |
1237 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
1238 |
-@@ -7,12 +7,24 @@ |
1239 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
1240 |
- */ |
1241 |
- |
1242 |
-+#include <errno.h> |
1243 |
- #include <sys/syscall.h> |
1244 |
- #include <sys/eventfd.h> |
1245 |
- |
1246 |
- /* |
1247 |
- * eventfd() |
1248 |
- */ |
1249 |
--#ifdef __NR_eventfd |
1250 |
--_syscall2(int, eventfd, int, count, int, flags) |
1251 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
1252 |
-+int eventfd (int count, int flags) |
1253 |
-+{ |
1254 |
-+#if defined __NR_eventfd2 |
1255 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
1256 |
-+#elif defined __NR_eventfd |
1257 |
-+ if (flags != 0) { |
1258 |
-+ __set_errno (EINVAL); |
1259 |
-+ return -1; |
1260 |
-+ } |
1261 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
1262 |
-+#endif |
1263 |
-+} |
1264 |
- #endif |
1265 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
1266 |
-index 3567b07..1fc2393 100644 |
1267 |
---- a/libc/sysdeps/linux/common/stubs.c |
1268 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
1269 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
1270 |
- make_stub(epoll_wait) |
1271 |
- #endif |
1272 |
- |
1273 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
1274 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
1275 |
- make_stub(eventfd) |
1276 |
- #endif |
1277 |
- |
1278 |
--- |
1279 |
-cgit v0.9.1 |
1280 |
|
1281 |
diff --git a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1282 |
deleted file mode 100644 |
1283 |
index 7ea9486..0000000 |
1284 |
--- a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1285 |
+++ /dev/null |
1286 |
@@ -1,215 +0,0 @@ |
1287 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
1288 |
-From: Natanael Copa <natanael.copa@×××××.com> |
1289 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
1290 |
-Subject: pread/pwrite: backport fix |
1291 |
- |
1292 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
1293 |
- |
1294 |
-There was a fallback function using lseek for kernels who did not have |
1295 |
-this syscall (pre 2.1.60). This is broken in many ways. |
1296 |
- |
1297 |
-uclibc have been using the broken fallback due to they forgot to rename |
1298 |
-pread syscall. |
1299 |
- |
1300 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
1301 |
-which broke in similar ways a windows (msys). |
1302 |
- |
1303 |
-This issue in uclibc have been reported upstream and fixed in git master |
1304 |
-so this patch does not need to be upstreamed. It might be an idea to |
1305 |
-backport it properly for 0.9.33 branch though. |
1306 |
- |
1307 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
1308 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
1309 |
---- |
1310 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
1311 |
-index 88e6957..baf8691 100644 |
1312 |
---- a/libc/sysdeps/linux/common/pread_write.c |
1313 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
1314 |
-@@ -17,6 +17,7 @@ |
1315 |
- #include <unistd.h> |
1316 |
- #include <stdint.h> |
1317 |
- #include <endian.h> |
1318 |
-+#include <sysdep-cancel.h> |
1319 |
- |
1320 |
- extern __typeof(pread) __libc_pread; |
1321 |
- extern __typeof(pwrite) __libc_pwrite; |
1322 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
1323 |
- |
1324 |
- #include <bits/kernel_types.h> |
1325 |
- |
1326 |
--#ifdef __NR_pread |
1327 |
-- |
1328 |
--# define __NR___syscall_pread __NR_pread |
1329 |
-+# define __NR___syscall_pread __NR_pread64 |
1330 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
1331 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1332 |
- |
1333 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1334 |
- { |
1335 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1336 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1337 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1338 |
-+ LIBC_CANCEL_RESET (oldtype); |
1339 |
-+ return result; |
1340 |
-+ |
1341 |
- } |
1342 |
- weak_alias(__libc_pread,pread) |
1343 |
- |
1344 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1345 |
- { |
1346 |
- uint32_t low = offset & 0xffffffff; |
1347 |
- uint32_t high = offset >> 32; |
1348 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1349 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1350 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1351 |
-+ LIBC_CANCEL_RESET (oldtype); |
1352 |
-+ return result; |
1353 |
- } |
1354 |
- weak_alias(__libc_pread64,pread64) |
1355 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1356 |
- |
1357 |
--#endif /* __NR_pread */ |
1358 |
-- |
1359 |
--#ifdef __NR_pwrite |
1360 |
-- |
1361 |
--# define __NR___syscall_pwrite __NR_pwrite |
1362 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
1363 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
1364 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1365 |
- |
1366 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1367 |
- { |
1368 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1369 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1370 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1371 |
-+ LIBC_CANCEL_RESET (oldtype); |
1372 |
-+ return result; |
1373 |
- } |
1374 |
- weak_alias(__libc_pwrite,pwrite) |
1375 |
- |
1376 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1377 |
- { |
1378 |
- uint32_t low = offset & 0xffffffff; |
1379 |
- uint32_t high = offset >> 32; |
1380 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1381 |
--} |
1382 |
--weak_alias(__libc_pwrite64,pwrite64) |
1383 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1384 |
--#endif /* __NR_pwrite */ |
1385 |
-- |
1386 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
1387 |
-- |
1388 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
1389 |
-- size_t count, off_t offset, int do_pwrite) |
1390 |
--{ |
1391 |
-- int save_errno; |
1392 |
-- ssize_t result; |
1393 |
-- off_t old_offset; |
1394 |
-- |
1395 |
-- /* Since we must not change the file pointer preserve the |
1396 |
-- * value so that we can restore it later. */ |
1397 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
1398 |
-- return -1; |
1399 |
-- |
1400 |
-- /* Set to wanted position. */ |
1401 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
1402 |
-- return -1; |
1403 |
-- |
1404 |
-- if (do_pwrite == 1) { |
1405 |
-- /* Write the data. */ |
1406 |
-- result = write(fd, buf, count); |
1407 |
-- } else { |
1408 |
-- /* Read the data. */ |
1409 |
-- result = read(fd, buf, count); |
1410 |
-- } |
1411 |
-- |
1412 |
-- /* Now we have to restore the position. If this fails we |
1413 |
-- * have to return this as an error. */ |
1414 |
-- save_errno = errno; |
1415 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
1416 |
-- { |
1417 |
-- if (result == -1) |
1418 |
-- __set_errno(save_errno); |
1419 |
-- return -1; |
1420 |
-- } |
1421 |
-- __set_errno(save_errno); |
1422 |
-- return(result); |
1423 |
--} |
1424 |
-- |
1425 |
--# ifdef __UCLIBC_HAS_LFS__ |
1426 |
-- |
1427 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
1428 |
-- size_t count, off64_t offset, int do_pwrite) |
1429 |
--{ |
1430 |
-- int save_errno; |
1431 |
-- ssize_t result; |
1432 |
-- off64_t old_offset; |
1433 |
-- |
1434 |
-- /* Since we must not change the file pointer preserve the |
1435 |
-- * value so that we can restore it later. */ |
1436 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
1437 |
-- return -1; |
1438 |
-- |
1439 |
-- /* Set to wanted position. */ |
1440 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
1441 |
-- return -1; |
1442 |
-- |
1443 |
-- if (do_pwrite == 1) { |
1444 |
-- /* Write the data. */ |
1445 |
-- result = write(fd, buf, count); |
1446 |
-- } else { |
1447 |
-- /* Read the data. */ |
1448 |
-- result = read(fd, buf, count); |
1449 |
-- } |
1450 |
-- |
1451 |
-- /* Now we have to restore the position. */ |
1452 |
-- save_errno = errno; |
1453 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
1454 |
-- if (result == -1) |
1455 |
-- __set_errno (save_errno); |
1456 |
-- return -1; |
1457 |
-- } |
1458 |
-- __set_errno (save_errno); |
1459 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1460 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1461 |
-+ LIBC_CANCEL_RESET (oldtype); |
1462 |
- return result; |
1463 |
- } |
1464 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1465 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
1466 |
-- |
1467 |
--#ifndef __NR_pread |
1468 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1469 |
--{ |
1470 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
1471 |
--} |
1472 |
--weak_alias(__libc_pread,pread) |
1473 |
-- |
1474 |
--# ifdef __UCLIBC_HAS_LFS__ |
1475 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1476 |
--{ |
1477 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
1478 |
--} |
1479 |
--weak_alias(__libc_pread64,pread64) |
1480 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1481 |
--#endif /* ! __NR_pread */ |
1482 |
-- |
1483 |
--#ifndef __NR_pwrite |
1484 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1485 |
--{ |
1486 |
-- /* we won't actually be modifying the buffer, |
1487 |
-- *just cast it to get rid of warnings */ |
1488 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
1489 |
--} |
1490 |
--weak_alias(__libc_pwrite,pwrite) |
1491 |
-- |
1492 |
--# ifdef __UCLIBC_HAS_LFS__ |
1493 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1494 |
--{ |
1495 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
1496 |
--} |
1497 |
- weak_alias(__libc_pwrite64,pwrite64) |
1498 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1499 |
--#endif /* ! __NR_pwrite */ |
1500 |
--- |
1501 |
-cgit v0.9.1 |
1502 |
|
1503 |
diff --git a/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1504 |
similarity index 100% |
1505 |
rename from tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
1506 |
rename to tools-uclibc/portage.i686.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1507 |
|
1508 |
diff --git a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1509 |
deleted file mode 100644 |
1510 |
index cfc64de..0000000 |
1511 |
--- a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1512 |
+++ /dev/null |
1513 |
@@ -1,59 +0,0 @@ |
1514 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
1515 |
-From: Khem Raj <raj.khem@×××××.com> |
1516 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
1517 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
1518 |
- |
1519 |
-eventfd: evntfd assumes to take two arguments instead it |
1520 |
-should be one evntfd expects two therefore implement both syscalls with |
1521 |
-correct parameters |
1522 |
- |
1523 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
1524 |
- |
1525 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
1526 |
---- |
1527 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
1528 |
-index cc3f3f0..96597ab 100644 |
1529 |
---- a/libc/sysdeps/linux/common/eventfd.c |
1530 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
1531 |
-@@ -7,12 +7,24 @@ |
1532 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
1533 |
- */ |
1534 |
- |
1535 |
-+#include <errno.h> |
1536 |
- #include <sys/syscall.h> |
1537 |
- #include <sys/eventfd.h> |
1538 |
- |
1539 |
- /* |
1540 |
- * eventfd() |
1541 |
- */ |
1542 |
--#ifdef __NR_eventfd |
1543 |
--_syscall2(int, eventfd, int, count, int, flags) |
1544 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
1545 |
-+int eventfd (int count, int flags) |
1546 |
-+{ |
1547 |
-+#if defined __NR_eventfd2 |
1548 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
1549 |
-+#elif defined __NR_eventfd |
1550 |
-+ if (flags != 0) { |
1551 |
-+ __set_errno (EINVAL); |
1552 |
-+ return -1; |
1553 |
-+ } |
1554 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
1555 |
-+#endif |
1556 |
-+} |
1557 |
- #endif |
1558 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
1559 |
-index 3567b07..1fc2393 100644 |
1560 |
---- a/libc/sysdeps/linux/common/stubs.c |
1561 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
1562 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
1563 |
- make_stub(epoll_wait) |
1564 |
- #endif |
1565 |
- |
1566 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
1567 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
1568 |
- make_stub(eventfd) |
1569 |
- #endif |
1570 |
- |
1571 |
--- |
1572 |
-cgit v0.9.1 |
1573 |
|
1574 |
diff --git a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1575 |
deleted file mode 100644 |
1576 |
index 7ea9486..0000000 |
1577 |
--- a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1578 |
+++ /dev/null |
1579 |
@@ -1,215 +0,0 @@ |
1580 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
1581 |
-From: Natanael Copa <natanael.copa@×××××.com> |
1582 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
1583 |
-Subject: pread/pwrite: backport fix |
1584 |
- |
1585 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
1586 |
- |
1587 |
-There was a fallback function using lseek for kernels who did not have |
1588 |
-this syscall (pre 2.1.60). This is broken in many ways. |
1589 |
- |
1590 |
-uclibc have been using the broken fallback due to they forgot to rename |
1591 |
-pread syscall. |
1592 |
- |
1593 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
1594 |
-which broke in similar ways a windows (msys). |
1595 |
- |
1596 |
-This issue in uclibc have been reported upstream and fixed in git master |
1597 |
-so this patch does not need to be upstreamed. It might be an idea to |
1598 |
-backport it properly for 0.9.33 branch though. |
1599 |
- |
1600 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
1601 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
1602 |
---- |
1603 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
1604 |
-index 88e6957..baf8691 100644 |
1605 |
---- a/libc/sysdeps/linux/common/pread_write.c |
1606 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
1607 |
-@@ -17,6 +17,7 @@ |
1608 |
- #include <unistd.h> |
1609 |
- #include <stdint.h> |
1610 |
- #include <endian.h> |
1611 |
-+#include <sysdep-cancel.h> |
1612 |
- |
1613 |
- extern __typeof(pread) __libc_pread; |
1614 |
- extern __typeof(pwrite) __libc_pwrite; |
1615 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
1616 |
- |
1617 |
- #include <bits/kernel_types.h> |
1618 |
- |
1619 |
--#ifdef __NR_pread |
1620 |
-- |
1621 |
--# define __NR___syscall_pread __NR_pread |
1622 |
-+# define __NR___syscall_pread __NR_pread64 |
1623 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
1624 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1625 |
- |
1626 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1627 |
- { |
1628 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1629 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1630 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1631 |
-+ LIBC_CANCEL_RESET (oldtype); |
1632 |
-+ return result; |
1633 |
-+ |
1634 |
- } |
1635 |
- weak_alias(__libc_pread,pread) |
1636 |
- |
1637 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1638 |
- { |
1639 |
- uint32_t low = offset & 0xffffffff; |
1640 |
- uint32_t high = offset >> 32; |
1641 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1642 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1643 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1644 |
-+ LIBC_CANCEL_RESET (oldtype); |
1645 |
-+ return result; |
1646 |
- } |
1647 |
- weak_alias(__libc_pread64,pread64) |
1648 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1649 |
- |
1650 |
--#endif /* __NR_pread */ |
1651 |
-- |
1652 |
--#ifdef __NR_pwrite |
1653 |
-- |
1654 |
--# define __NR___syscall_pwrite __NR_pwrite |
1655 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
1656 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
1657 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1658 |
- |
1659 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1660 |
- { |
1661 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1662 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1663 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1664 |
-+ LIBC_CANCEL_RESET (oldtype); |
1665 |
-+ return result; |
1666 |
- } |
1667 |
- weak_alias(__libc_pwrite,pwrite) |
1668 |
- |
1669 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1670 |
- { |
1671 |
- uint32_t low = offset & 0xffffffff; |
1672 |
- uint32_t high = offset >> 32; |
1673 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1674 |
--} |
1675 |
--weak_alias(__libc_pwrite64,pwrite64) |
1676 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1677 |
--#endif /* __NR_pwrite */ |
1678 |
-- |
1679 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
1680 |
-- |
1681 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
1682 |
-- size_t count, off_t offset, int do_pwrite) |
1683 |
--{ |
1684 |
-- int save_errno; |
1685 |
-- ssize_t result; |
1686 |
-- off_t old_offset; |
1687 |
-- |
1688 |
-- /* Since we must not change the file pointer preserve the |
1689 |
-- * value so that we can restore it later. */ |
1690 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
1691 |
-- return -1; |
1692 |
-- |
1693 |
-- /* Set to wanted position. */ |
1694 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
1695 |
-- return -1; |
1696 |
-- |
1697 |
-- if (do_pwrite == 1) { |
1698 |
-- /* Write the data. */ |
1699 |
-- result = write(fd, buf, count); |
1700 |
-- } else { |
1701 |
-- /* Read the data. */ |
1702 |
-- result = read(fd, buf, count); |
1703 |
-- } |
1704 |
-- |
1705 |
-- /* Now we have to restore the position. If this fails we |
1706 |
-- * have to return this as an error. */ |
1707 |
-- save_errno = errno; |
1708 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
1709 |
-- { |
1710 |
-- if (result == -1) |
1711 |
-- __set_errno(save_errno); |
1712 |
-- return -1; |
1713 |
-- } |
1714 |
-- __set_errno(save_errno); |
1715 |
-- return(result); |
1716 |
--} |
1717 |
-- |
1718 |
--# ifdef __UCLIBC_HAS_LFS__ |
1719 |
-- |
1720 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
1721 |
-- size_t count, off64_t offset, int do_pwrite) |
1722 |
--{ |
1723 |
-- int save_errno; |
1724 |
-- ssize_t result; |
1725 |
-- off64_t old_offset; |
1726 |
-- |
1727 |
-- /* Since we must not change the file pointer preserve the |
1728 |
-- * value so that we can restore it later. */ |
1729 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
1730 |
-- return -1; |
1731 |
-- |
1732 |
-- /* Set to wanted position. */ |
1733 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
1734 |
-- return -1; |
1735 |
-- |
1736 |
-- if (do_pwrite == 1) { |
1737 |
-- /* Write the data. */ |
1738 |
-- result = write(fd, buf, count); |
1739 |
-- } else { |
1740 |
-- /* Read the data. */ |
1741 |
-- result = read(fd, buf, count); |
1742 |
-- } |
1743 |
-- |
1744 |
-- /* Now we have to restore the position. */ |
1745 |
-- save_errno = errno; |
1746 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
1747 |
-- if (result == -1) |
1748 |
-- __set_errno (save_errno); |
1749 |
-- return -1; |
1750 |
-- } |
1751 |
-- __set_errno (save_errno); |
1752 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1753 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1754 |
-+ LIBC_CANCEL_RESET (oldtype); |
1755 |
- return result; |
1756 |
- } |
1757 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1758 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
1759 |
-- |
1760 |
--#ifndef __NR_pread |
1761 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1762 |
--{ |
1763 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
1764 |
--} |
1765 |
--weak_alias(__libc_pread,pread) |
1766 |
-- |
1767 |
--# ifdef __UCLIBC_HAS_LFS__ |
1768 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1769 |
--{ |
1770 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
1771 |
--} |
1772 |
--weak_alias(__libc_pread64,pread64) |
1773 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1774 |
--#endif /* ! __NR_pread */ |
1775 |
-- |
1776 |
--#ifndef __NR_pwrite |
1777 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1778 |
--{ |
1779 |
-- /* we won't actually be modifying the buffer, |
1780 |
-- *just cast it to get rid of warnings */ |
1781 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
1782 |
--} |
1783 |
--weak_alias(__libc_pwrite,pwrite) |
1784 |
-- |
1785 |
--# ifdef __UCLIBC_HAS_LFS__ |
1786 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1787 |
--{ |
1788 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
1789 |
--} |
1790 |
- weak_alias(__libc_pwrite64,pwrite64) |
1791 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1792 |
--#endif /* ! __NR_pwrite */ |
1793 |
--- |
1794 |
-cgit v0.9.1 |
1795 |
|
1796 |
diff --git a/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1797 |
similarity index 100% |
1798 |
rename from tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
1799 |
rename to tools-uclibc/portage.i686.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
1800 |
|
1801 |
diff --git a/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1802 |
deleted file mode 100644 |
1803 |
index cfc64de..0000000 |
1804 |
--- a/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
1805 |
+++ /dev/null |
1806 |
@@ -1,59 +0,0 @@ |
1807 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
1808 |
-From: Khem Raj <raj.khem@×××××.com> |
1809 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
1810 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
1811 |
- |
1812 |
-eventfd: evntfd assumes to take two arguments instead it |
1813 |
-should be one evntfd expects two therefore implement both syscalls with |
1814 |
-correct parameters |
1815 |
- |
1816 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
1817 |
- |
1818 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
1819 |
---- |
1820 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
1821 |
-index cc3f3f0..96597ab 100644 |
1822 |
---- a/libc/sysdeps/linux/common/eventfd.c |
1823 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
1824 |
-@@ -7,12 +7,24 @@ |
1825 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
1826 |
- */ |
1827 |
- |
1828 |
-+#include <errno.h> |
1829 |
- #include <sys/syscall.h> |
1830 |
- #include <sys/eventfd.h> |
1831 |
- |
1832 |
- /* |
1833 |
- * eventfd() |
1834 |
- */ |
1835 |
--#ifdef __NR_eventfd |
1836 |
--_syscall2(int, eventfd, int, count, int, flags) |
1837 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
1838 |
-+int eventfd (int count, int flags) |
1839 |
-+{ |
1840 |
-+#if defined __NR_eventfd2 |
1841 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
1842 |
-+#elif defined __NR_eventfd |
1843 |
-+ if (flags != 0) { |
1844 |
-+ __set_errno (EINVAL); |
1845 |
-+ return -1; |
1846 |
-+ } |
1847 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
1848 |
-+#endif |
1849 |
-+} |
1850 |
- #endif |
1851 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
1852 |
-index 3567b07..1fc2393 100644 |
1853 |
---- a/libc/sysdeps/linux/common/stubs.c |
1854 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
1855 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
1856 |
- make_stub(epoll_wait) |
1857 |
- #endif |
1858 |
- |
1859 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
1860 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
1861 |
- make_stub(eventfd) |
1862 |
- #endif |
1863 |
- |
1864 |
--- |
1865 |
-cgit v0.9.1 |
1866 |
|
1867 |
diff --git a/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1868 |
deleted file mode 100644 |
1869 |
index 7ea9486..0000000 |
1870 |
--- a/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
1871 |
+++ /dev/null |
1872 |
@@ -1,215 +0,0 @@ |
1873 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
1874 |
-From: Natanael Copa <natanael.copa@×××××.com> |
1875 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
1876 |
-Subject: pread/pwrite: backport fix |
1877 |
- |
1878 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
1879 |
- |
1880 |
-There was a fallback function using lseek for kernels who did not have |
1881 |
-this syscall (pre 2.1.60). This is broken in many ways. |
1882 |
- |
1883 |
-uclibc have been using the broken fallback due to they forgot to rename |
1884 |
-pread syscall. |
1885 |
- |
1886 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
1887 |
-which broke in similar ways a windows (msys). |
1888 |
- |
1889 |
-This issue in uclibc have been reported upstream and fixed in git master |
1890 |
-so this patch does not need to be upstreamed. It might be an idea to |
1891 |
-backport it properly for 0.9.33 branch though. |
1892 |
- |
1893 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
1894 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
1895 |
---- |
1896 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
1897 |
-index 88e6957..baf8691 100644 |
1898 |
---- a/libc/sysdeps/linux/common/pread_write.c |
1899 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
1900 |
-@@ -17,6 +17,7 @@ |
1901 |
- #include <unistd.h> |
1902 |
- #include <stdint.h> |
1903 |
- #include <endian.h> |
1904 |
-+#include <sysdep-cancel.h> |
1905 |
- |
1906 |
- extern __typeof(pread) __libc_pread; |
1907 |
- extern __typeof(pwrite) __libc_pwrite; |
1908 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
1909 |
- |
1910 |
- #include <bits/kernel_types.h> |
1911 |
- |
1912 |
--#ifdef __NR_pread |
1913 |
-- |
1914 |
--# define __NR___syscall_pread __NR_pread |
1915 |
-+# define __NR___syscall_pread __NR_pread64 |
1916 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
1917 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1918 |
- |
1919 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
1920 |
- { |
1921 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1922 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1923 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1924 |
-+ LIBC_CANCEL_RESET (oldtype); |
1925 |
-+ return result; |
1926 |
-+ |
1927 |
- } |
1928 |
- weak_alias(__libc_pread,pread) |
1929 |
- |
1930 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
1931 |
- { |
1932 |
- uint32_t low = offset & 0xffffffff; |
1933 |
- uint32_t high = offset >> 32; |
1934 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1935 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1936 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1937 |
-+ LIBC_CANCEL_RESET (oldtype); |
1938 |
-+ return result; |
1939 |
- } |
1940 |
- weak_alias(__libc_pread64,pread64) |
1941 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
1942 |
- |
1943 |
--#endif /* __NR_pread */ |
1944 |
-- |
1945 |
--#ifdef __NR_pwrite |
1946 |
-- |
1947 |
--# define __NR___syscall_pwrite __NR_pwrite |
1948 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
1949 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
1950 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
1951 |
- |
1952 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
1953 |
- { |
1954 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1955 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
1956 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
1957 |
-+ LIBC_CANCEL_RESET (oldtype); |
1958 |
-+ return result; |
1959 |
- } |
1960 |
- weak_alias(__libc_pwrite,pwrite) |
1961 |
- |
1962 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
1963 |
- { |
1964 |
- uint32_t low = offset & 0xffffffff; |
1965 |
- uint32_t high = offset >> 32; |
1966 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
1967 |
--} |
1968 |
--weak_alias(__libc_pwrite64,pwrite64) |
1969 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
1970 |
--#endif /* __NR_pwrite */ |
1971 |
-- |
1972 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
1973 |
-- |
1974 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
1975 |
-- size_t count, off_t offset, int do_pwrite) |
1976 |
--{ |
1977 |
-- int save_errno; |
1978 |
-- ssize_t result; |
1979 |
-- off_t old_offset; |
1980 |
-- |
1981 |
-- /* Since we must not change the file pointer preserve the |
1982 |
-- * value so that we can restore it later. */ |
1983 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
1984 |
-- return -1; |
1985 |
-- |
1986 |
-- /* Set to wanted position. */ |
1987 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
1988 |
-- return -1; |
1989 |
-- |
1990 |
-- if (do_pwrite == 1) { |
1991 |
-- /* Write the data. */ |
1992 |
-- result = write(fd, buf, count); |
1993 |
-- } else { |
1994 |
-- /* Read the data. */ |
1995 |
-- result = read(fd, buf, count); |
1996 |
-- } |
1997 |
-- |
1998 |
-- /* Now we have to restore the position. If this fails we |
1999 |
-- * have to return this as an error. */ |
2000 |
-- save_errno = errno; |
2001 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
2002 |
-- { |
2003 |
-- if (result == -1) |
2004 |
-- __set_errno(save_errno); |
2005 |
-- return -1; |
2006 |
-- } |
2007 |
-- __set_errno(save_errno); |
2008 |
-- return(result); |
2009 |
--} |
2010 |
-- |
2011 |
--# ifdef __UCLIBC_HAS_LFS__ |
2012 |
-- |
2013 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
2014 |
-- size_t count, off64_t offset, int do_pwrite) |
2015 |
--{ |
2016 |
-- int save_errno; |
2017 |
-- ssize_t result; |
2018 |
-- off64_t old_offset; |
2019 |
-- |
2020 |
-- /* Since we must not change the file pointer preserve the |
2021 |
-- * value so that we can restore it later. */ |
2022 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
2023 |
-- return -1; |
2024 |
-- |
2025 |
-- /* Set to wanted position. */ |
2026 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
2027 |
-- return -1; |
2028 |
-- |
2029 |
-- if (do_pwrite == 1) { |
2030 |
-- /* Write the data. */ |
2031 |
-- result = write(fd, buf, count); |
2032 |
-- } else { |
2033 |
-- /* Read the data. */ |
2034 |
-- result = read(fd, buf, count); |
2035 |
-- } |
2036 |
-- |
2037 |
-- /* Now we have to restore the position. */ |
2038 |
-- save_errno = errno; |
2039 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
2040 |
-- if (result == -1) |
2041 |
-- __set_errno (save_errno); |
2042 |
-- return -1; |
2043 |
-- } |
2044 |
-- __set_errno (save_errno); |
2045 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2046 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2047 |
-+ LIBC_CANCEL_RESET (oldtype); |
2048 |
- return result; |
2049 |
- } |
2050 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2051 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
2052 |
-- |
2053 |
--#ifndef __NR_pread |
2054 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2055 |
--{ |
2056 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
2057 |
--} |
2058 |
--weak_alias(__libc_pread,pread) |
2059 |
-- |
2060 |
--# ifdef __UCLIBC_HAS_LFS__ |
2061 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2062 |
--{ |
2063 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
2064 |
--} |
2065 |
--weak_alias(__libc_pread64,pread64) |
2066 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2067 |
--#endif /* ! __NR_pread */ |
2068 |
-- |
2069 |
--#ifndef __NR_pwrite |
2070 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2071 |
--{ |
2072 |
-- /* we won't actually be modifying the buffer, |
2073 |
-- *just cast it to get rid of warnings */ |
2074 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
2075 |
--} |
2076 |
--weak_alias(__libc_pwrite,pwrite) |
2077 |
-- |
2078 |
--# ifdef __UCLIBC_HAS_LFS__ |
2079 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2080 |
--{ |
2081 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
2082 |
--} |
2083 |
- weak_alias(__libc_pwrite64,pwrite64) |
2084 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2085 |
--#endif /* ! __NR_pwrite */ |
2086 |
--- |
2087 |
-cgit v0.9.1 |
2088 |
|
2089 |
diff --git a/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2090 |
similarity index 100% |
2091 |
rename from tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
2092 |
rename to tools-uclibc/portage.mips32r2.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2093 |
|
2094 |
diff --git a/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2095 |
deleted file mode 100644 |
2096 |
index cfc64de..0000000 |
2097 |
--- a/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2098 |
+++ /dev/null |
2099 |
@@ -1,59 +0,0 @@ |
2100 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
2101 |
-From: Khem Raj <raj.khem@×××××.com> |
2102 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
2103 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
2104 |
- |
2105 |
-eventfd: evntfd assumes to take two arguments instead it |
2106 |
-should be one evntfd expects two therefore implement both syscalls with |
2107 |
-correct parameters |
2108 |
- |
2109 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
2110 |
- |
2111 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
2112 |
---- |
2113 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
2114 |
-index cc3f3f0..96597ab 100644 |
2115 |
---- a/libc/sysdeps/linux/common/eventfd.c |
2116 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
2117 |
-@@ -7,12 +7,24 @@ |
2118 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
2119 |
- */ |
2120 |
- |
2121 |
-+#include <errno.h> |
2122 |
- #include <sys/syscall.h> |
2123 |
- #include <sys/eventfd.h> |
2124 |
- |
2125 |
- /* |
2126 |
- * eventfd() |
2127 |
- */ |
2128 |
--#ifdef __NR_eventfd |
2129 |
--_syscall2(int, eventfd, int, count, int, flags) |
2130 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
2131 |
-+int eventfd (int count, int flags) |
2132 |
-+{ |
2133 |
-+#if defined __NR_eventfd2 |
2134 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
2135 |
-+#elif defined __NR_eventfd |
2136 |
-+ if (flags != 0) { |
2137 |
-+ __set_errno (EINVAL); |
2138 |
-+ return -1; |
2139 |
-+ } |
2140 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
2141 |
-+#endif |
2142 |
-+} |
2143 |
- #endif |
2144 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
2145 |
-index 3567b07..1fc2393 100644 |
2146 |
---- a/libc/sysdeps/linux/common/stubs.c |
2147 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
2148 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
2149 |
- make_stub(epoll_wait) |
2150 |
- #endif |
2151 |
- |
2152 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
2153 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
2154 |
- make_stub(eventfd) |
2155 |
- #endif |
2156 |
- |
2157 |
--- |
2158 |
-cgit v0.9.1 |
2159 |
|
2160 |
diff --git a/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2161 |
deleted file mode 100644 |
2162 |
index 7ea9486..0000000 |
2163 |
--- a/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2164 |
+++ /dev/null |
2165 |
@@ -1,215 +0,0 @@ |
2166 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
2167 |
-From: Natanael Copa <natanael.copa@×××××.com> |
2168 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
2169 |
-Subject: pread/pwrite: backport fix |
2170 |
- |
2171 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
2172 |
- |
2173 |
-There was a fallback function using lseek for kernels who did not have |
2174 |
-this syscall (pre 2.1.60). This is broken in many ways. |
2175 |
- |
2176 |
-uclibc have been using the broken fallback due to they forgot to rename |
2177 |
-pread syscall. |
2178 |
- |
2179 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
2180 |
-which broke in similar ways a windows (msys). |
2181 |
- |
2182 |
-This issue in uclibc have been reported upstream and fixed in git master |
2183 |
-so this patch does not need to be upstreamed. It might be an idea to |
2184 |
-backport it properly for 0.9.33 branch though. |
2185 |
- |
2186 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
2187 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
2188 |
---- |
2189 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
2190 |
-index 88e6957..baf8691 100644 |
2191 |
---- a/libc/sysdeps/linux/common/pread_write.c |
2192 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
2193 |
-@@ -17,6 +17,7 @@ |
2194 |
- #include <unistd.h> |
2195 |
- #include <stdint.h> |
2196 |
- #include <endian.h> |
2197 |
-+#include <sysdep-cancel.h> |
2198 |
- |
2199 |
- extern __typeof(pread) __libc_pread; |
2200 |
- extern __typeof(pwrite) __libc_pwrite; |
2201 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
2202 |
- |
2203 |
- #include <bits/kernel_types.h> |
2204 |
- |
2205 |
--#ifdef __NR_pread |
2206 |
-- |
2207 |
--# define __NR___syscall_pread __NR_pread |
2208 |
-+# define __NR___syscall_pread __NR_pread64 |
2209 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
2210 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2211 |
- |
2212 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2213 |
- { |
2214 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2215 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2216 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2217 |
-+ LIBC_CANCEL_RESET (oldtype); |
2218 |
-+ return result; |
2219 |
-+ |
2220 |
- } |
2221 |
- weak_alias(__libc_pread,pread) |
2222 |
- |
2223 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2224 |
- { |
2225 |
- uint32_t low = offset & 0xffffffff; |
2226 |
- uint32_t high = offset >> 32; |
2227 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2228 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2229 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2230 |
-+ LIBC_CANCEL_RESET (oldtype); |
2231 |
-+ return result; |
2232 |
- } |
2233 |
- weak_alias(__libc_pread64,pread64) |
2234 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2235 |
- |
2236 |
--#endif /* __NR_pread */ |
2237 |
-- |
2238 |
--#ifdef __NR_pwrite |
2239 |
-- |
2240 |
--# define __NR___syscall_pwrite __NR_pwrite |
2241 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
2242 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
2243 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2244 |
- |
2245 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2246 |
- { |
2247 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2248 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2249 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2250 |
-+ LIBC_CANCEL_RESET (oldtype); |
2251 |
-+ return result; |
2252 |
- } |
2253 |
- weak_alias(__libc_pwrite,pwrite) |
2254 |
- |
2255 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2256 |
- { |
2257 |
- uint32_t low = offset & 0xffffffff; |
2258 |
- uint32_t high = offset >> 32; |
2259 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2260 |
--} |
2261 |
--weak_alias(__libc_pwrite64,pwrite64) |
2262 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2263 |
--#endif /* __NR_pwrite */ |
2264 |
-- |
2265 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
2266 |
-- |
2267 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
2268 |
-- size_t count, off_t offset, int do_pwrite) |
2269 |
--{ |
2270 |
-- int save_errno; |
2271 |
-- ssize_t result; |
2272 |
-- off_t old_offset; |
2273 |
-- |
2274 |
-- /* Since we must not change the file pointer preserve the |
2275 |
-- * value so that we can restore it later. */ |
2276 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
2277 |
-- return -1; |
2278 |
-- |
2279 |
-- /* Set to wanted position. */ |
2280 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
2281 |
-- return -1; |
2282 |
-- |
2283 |
-- if (do_pwrite == 1) { |
2284 |
-- /* Write the data. */ |
2285 |
-- result = write(fd, buf, count); |
2286 |
-- } else { |
2287 |
-- /* Read the data. */ |
2288 |
-- result = read(fd, buf, count); |
2289 |
-- } |
2290 |
-- |
2291 |
-- /* Now we have to restore the position. If this fails we |
2292 |
-- * have to return this as an error. */ |
2293 |
-- save_errno = errno; |
2294 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
2295 |
-- { |
2296 |
-- if (result == -1) |
2297 |
-- __set_errno(save_errno); |
2298 |
-- return -1; |
2299 |
-- } |
2300 |
-- __set_errno(save_errno); |
2301 |
-- return(result); |
2302 |
--} |
2303 |
-- |
2304 |
--# ifdef __UCLIBC_HAS_LFS__ |
2305 |
-- |
2306 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
2307 |
-- size_t count, off64_t offset, int do_pwrite) |
2308 |
--{ |
2309 |
-- int save_errno; |
2310 |
-- ssize_t result; |
2311 |
-- off64_t old_offset; |
2312 |
-- |
2313 |
-- /* Since we must not change the file pointer preserve the |
2314 |
-- * value so that we can restore it later. */ |
2315 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
2316 |
-- return -1; |
2317 |
-- |
2318 |
-- /* Set to wanted position. */ |
2319 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
2320 |
-- return -1; |
2321 |
-- |
2322 |
-- if (do_pwrite == 1) { |
2323 |
-- /* Write the data. */ |
2324 |
-- result = write(fd, buf, count); |
2325 |
-- } else { |
2326 |
-- /* Read the data. */ |
2327 |
-- result = read(fd, buf, count); |
2328 |
-- } |
2329 |
-- |
2330 |
-- /* Now we have to restore the position. */ |
2331 |
-- save_errno = errno; |
2332 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
2333 |
-- if (result == -1) |
2334 |
-- __set_errno (save_errno); |
2335 |
-- return -1; |
2336 |
-- } |
2337 |
-- __set_errno (save_errno); |
2338 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2339 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2340 |
-+ LIBC_CANCEL_RESET (oldtype); |
2341 |
- return result; |
2342 |
- } |
2343 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2344 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
2345 |
-- |
2346 |
--#ifndef __NR_pread |
2347 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2348 |
--{ |
2349 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
2350 |
--} |
2351 |
--weak_alias(__libc_pread,pread) |
2352 |
-- |
2353 |
--# ifdef __UCLIBC_HAS_LFS__ |
2354 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2355 |
--{ |
2356 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
2357 |
--} |
2358 |
--weak_alias(__libc_pread64,pread64) |
2359 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2360 |
--#endif /* ! __NR_pread */ |
2361 |
-- |
2362 |
--#ifndef __NR_pwrite |
2363 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2364 |
--{ |
2365 |
-- /* we won't actually be modifying the buffer, |
2366 |
-- *just cast it to get rid of warnings */ |
2367 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
2368 |
--} |
2369 |
--weak_alias(__libc_pwrite,pwrite) |
2370 |
-- |
2371 |
--# ifdef __UCLIBC_HAS_LFS__ |
2372 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2373 |
--{ |
2374 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
2375 |
--} |
2376 |
- weak_alias(__libc_pwrite64,pwrite64) |
2377 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2378 |
--#endif /* ! __NR_pwrite */ |
2379 |
--- |
2380 |
-cgit v0.9.1 |
2381 |
|
2382 |
diff --git a/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2383 |
similarity index 100% |
2384 |
rename from tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
2385 |
rename to tools-uclibc/portage.mips32r2.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2386 |
|
2387 |
diff --git a/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2388 |
deleted file mode 100644 |
2389 |
index cfc64de..0000000 |
2390 |
--- a/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2391 |
+++ /dev/null |
2392 |
@@ -1,59 +0,0 @@ |
2393 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
2394 |
-From: Khem Raj <raj.khem@×××××.com> |
2395 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
2396 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
2397 |
- |
2398 |
-eventfd: evntfd assumes to take two arguments instead it |
2399 |
-should be one evntfd expects two therefore implement both syscalls with |
2400 |
-correct parameters |
2401 |
- |
2402 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
2403 |
- |
2404 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
2405 |
---- |
2406 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
2407 |
-index cc3f3f0..96597ab 100644 |
2408 |
---- a/libc/sysdeps/linux/common/eventfd.c |
2409 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
2410 |
-@@ -7,12 +7,24 @@ |
2411 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
2412 |
- */ |
2413 |
- |
2414 |
-+#include <errno.h> |
2415 |
- #include <sys/syscall.h> |
2416 |
- #include <sys/eventfd.h> |
2417 |
- |
2418 |
- /* |
2419 |
- * eventfd() |
2420 |
- */ |
2421 |
--#ifdef __NR_eventfd |
2422 |
--_syscall2(int, eventfd, int, count, int, flags) |
2423 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
2424 |
-+int eventfd (int count, int flags) |
2425 |
-+{ |
2426 |
-+#if defined __NR_eventfd2 |
2427 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
2428 |
-+#elif defined __NR_eventfd |
2429 |
-+ if (flags != 0) { |
2430 |
-+ __set_errno (EINVAL); |
2431 |
-+ return -1; |
2432 |
-+ } |
2433 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
2434 |
-+#endif |
2435 |
-+} |
2436 |
- #endif |
2437 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
2438 |
-index 3567b07..1fc2393 100644 |
2439 |
---- a/libc/sysdeps/linux/common/stubs.c |
2440 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
2441 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
2442 |
- make_stub(epoll_wait) |
2443 |
- #endif |
2444 |
- |
2445 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
2446 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
2447 |
- make_stub(eventfd) |
2448 |
- #endif |
2449 |
- |
2450 |
--- |
2451 |
-cgit v0.9.1 |
2452 |
|
2453 |
diff --git a/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2454 |
deleted file mode 100644 |
2455 |
index 7ea9486..0000000 |
2456 |
--- a/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2457 |
+++ /dev/null |
2458 |
@@ -1,215 +0,0 @@ |
2459 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
2460 |
-From: Natanael Copa <natanael.copa@×××××.com> |
2461 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
2462 |
-Subject: pread/pwrite: backport fix |
2463 |
- |
2464 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
2465 |
- |
2466 |
-There was a fallback function using lseek for kernels who did not have |
2467 |
-this syscall (pre 2.1.60). This is broken in many ways. |
2468 |
- |
2469 |
-uclibc have been using the broken fallback due to they forgot to rename |
2470 |
-pread syscall. |
2471 |
- |
2472 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
2473 |
-which broke in similar ways a windows (msys). |
2474 |
- |
2475 |
-This issue in uclibc have been reported upstream and fixed in git master |
2476 |
-so this patch does not need to be upstreamed. It might be an idea to |
2477 |
-backport it properly for 0.9.33 branch though. |
2478 |
- |
2479 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
2480 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
2481 |
---- |
2482 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
2483 |
-index 88e6957..baf8691 100644 |
2484 |
---- a/libc/sysdeps/linux/common/pread_write.c |
2485 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
2486 |
-@@ -17,6 +17,7 @@ |
2487 |
- #include <unistd.h> |
2488 |
- #include <stdint.h> |
2489 |
- #include <endian.h> |
2490 |
-+#include <sysdep-cancel.h> |
2491 |
- |
2492 |
- extern __typeof(pread) __libc_pread; |
2493 |
- extern __typeof(pwrite) __libc_pwrite; |
2494 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
2495 |
- |
2496 |
- #include <bits/kernel_types.h> |
2497 |
- |
2498 |
--#ifdef __NR_pread |
2499 |
-- |
2500 |
--# define __NR___syscall_pread __NR_pread |
2501 |
-+# define __NR___syscall_pread __NR_pread64 |
2502 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
2503 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2504 |
- |
2505 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2506 |
- { |
2507 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2508 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2509 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2510 |
-+ LIBC_CANCEL_RESET (oldtype); |
2511 |
-+ return result; |
2512 |
-+ |
2513 |
- } |
2514 |
- weak_alias(__libc_pread,pread) |
2515 |
- |
2516 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2517 |
- { |
2518 |
- uint32_t low = offset & 0xffffffff; |
2519 |
- uint32_t high = offset >> 32; |
2520 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2521 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2522 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2523 |
-+ LIBC_CANCEL_RESET (oldtype); |
2524 |
-+ return result; |
2525 |
- } |
2526 |
- weak_alias(__libc_pread64,pread64) |
2527 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2528 |
- |
2529 |
--#endif /* __NR_pread */ |
2530 |
-- |
2531 |
--#ifdef __NR_pwrite |
2532 |
-- |
2533 |
--# define __NR___syscall_pwrite __NR_pwrite |
2534 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
2535 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
2536 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2537 |
- |
2538 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2539 |
- { |
2540 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2541 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2542 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2543 |
-+ LIBC_CANCEL_RESET (oldtype); |
2544 |
-+ return result; |
2545 |
- } |
2546 |
- weak_alias(__libc_pwrite,pwrite) |
2547 |
- |
2548 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2549 |
- { |
2550 |
- uint32_t low = offset & 0xffffffff; |
2551 |
- uint32_t high = offset >> 32; |
2552 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2553 |
--} |
2554 |
--weak_alias(__libc_pwrite64,pwrite64) |
2555 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2556 |
--#endif /* __NR_pwrite */ |
2557 |
-- |
2558 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
2559 |
-- |
2560 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
2561 |
-- size_t count, off_t offset, int do_pwrite) |
2562 |
--{ |
2563 |
-- int save_errno; |
2564 |
-- ssize_t result; |
2565 |
-- off_t old_offset; |
2566 |
-- |
2567 |
-- /* Since we must not change the file pointer preserve the |
2568 |
-- * value so that we can restore it later. */ |
2569 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
2570 |
-- return -1; |
2571 |
-- |
2572 |
-- /* Set to wanted position. */ |
2573 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
2574 |
-- return -1; |
2575 |
-- |
2576 |
-- if (do_pwrite == 1) { |
2577 |
-- /* Write the data. */ |
2578 |
-- result = write(fd, buf, count); |
2579 |
-- } else { |
2580 |
-- /* Read the data. */ |
2581 |
-- result = read(fd, buf, count); |
2582 |
-- } |
2583 |
-- |
2584 |
-- /* Now we have to restore the position. If this fails we |
2585 |
-- * have to return this as an error. */ |
2586 |
-- save_errno = errno; |
2587 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
2588 |
-- { |
2589 |
-- if (result == -1) |
2590 |
-- __set_errno(save_errno); |
2591 |
-- return -1; |
2592 |
-- } |
2593 |
-- __set_errno(save_errno); |
2594 |
-- return(result); |
2595 |
--} |
2596 |
-- |
2597 |
--# ifdef __UCLIBC_HAS_LFS__ |
2598 |
-- |
2599 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
2600 |
-- size_t count, off64_t offset, int do_pwrite) |
2601 |
--{ |
2602 |
-- int save_errno; |
2603 |
-- ssize_t result; |
2604 |
-- off64_t old_offset; |
2605 |
-- |
2606 |
-- /* Since we must not change the file pointer preserve the |
2607 |
-- * value so that we can restore it later. */ |
2608 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
2609 |
-- return -1; |
2610 |
-- |
2611 |
-- /* Set to wanted position. */ |
2612 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
2613 |
-- return -1; |
2614 |
-- |
2615 |
-- if (do_pwrite == 1) { |
2616 |
-- /* Write the data. */ |
2617 |
-- result = write(fd, buf, count); |
2618 |
-- } else { |
2619 |
-- /* Read the data. */ |
2620 |
-- result = read(fd, buf, count); |
2621 |
-- } |
2622 |
-- |
2623 |
-- /* Now we have to restore the position. */ |
2624 |
-- save_errno = errno; |
2625 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
2626 |
-- if (result == -1) |
2627 |
-- __set_errno (save_errno); |
2628 |
-- return -1; |
2629 |
-- } |
2630 |
-- __set_errno (save_errno); |
2631 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2632 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2633 |
-+ LIBC_CANCEL_RESET (oldtype); |
2634 |
- return result; |
2635 |
- } |
2636 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2637 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
2638 |
-- |
2639 |
--#ifndef __NR_pread |
2640 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2641 |
--{ |
2642 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
2643 |
--} |
2644 |
--weak_alias(__libc_pread,pread) |
2645 |
-- |
2646 |
--# ifdef __UCLIBC_HAS_LFS__ |
2647 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2648 |
--{ |
2649 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
2650 |
--} |
2651 |
--weak_alias(__libc_pread64,pread64) |
2652 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2653 |
--#endif /* ! __NR_pread */ |
2654 |
-- |
2655 |
--#ifndef __NR_pwrite |
2656 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2657 |
--{ |
2658 |
-- /* we won't actually be modifying the buffer, |
2659 |
-- *just cast it to get rid of warnings */ |
2660 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
2661 |
--} |
2662 |
--weak_alias(__libc_pwrite,pwrite) |
2663 |
-- |
2664 |
--# ifdef __UCLIBC_HAS_LFS__ |
2665 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2666 |
--{ |
2667 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
2668 |
--} |
2669 |
- weak_alias(__libc_pwrite64,pwrite64) |
2670 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2671 |
--#endif /* ! __NR_pwrite */ |
2672 |
--- |
2673 |
-cgit v0.9.1 |
2674 |
|
2675 |
diff --git a/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2676 |
similarity index 100% |
2677 |
rename from tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
2678 |
rename to tools-uclibc/portage.mipsel3.hardened/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2679 |
|
2680 |
diff --git a/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch b/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2681 |
deleted file mode 100644 |
2682 |
index cfc64de..0000000 |
2683 |
--- a/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/00_fix-eventfd.patch |
2684 |
+++ /dev/null |
2685 |
@@ -1,59 +0,0 @@ |
2686 |
-From e118373cbb58ba5ffa5fb6670957678d5b87cdb9 Mon Sep 17 00:00:00 2001 |
2687 |
-From: Khem Raj <raj.khem@×××××.com> |
2688 |
-Date: Sun, 10 Jun 2012 16:36:23 +0000 |
2689 |
-Subject: eventfd: Implement eventfd2 and fix eventfd |
2690 |
- |
2691 |
-eventfd: evntfd assumes to take two arguments instead it |
2692 |
-should be one evntfd expects two therefore implement both syscalls with |
2693 |
-correct parameters |
2694 |
- |
2695 |
-Thanks Eugene Rudoy for reporting it and also providing the patch |
2696 |
- |
2697 |
-Signed-off-by: Khem Raj <raj.khem@×××××.com> |
2698 |
---- |
2699 |
-diff --git a/libc/sysdeps/linux/common/eventfd.c b/libc/sysdeps/linux/common/eventfd.c |
2700 |
-index cc3f3f0..96597ab 100644 |
2701 |
---- a/libc/sysdeps/linux/common/eventfd.c |
2702 |
-+++ b/libc/sysdeps/linux/common/eventfd.c |
2703 |
-@@ -7,12 +7,24 @@ |
2704 |
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
2705 |
- */ |
2706 |
- |
2707 |
-+#include <errno.h> |
2708 |
- #include <sys/syscall.h> |
2709 |
- #include <sys/eventfd.h> |
2710 |
- |
2711 |
- /* |
2712 |
- * eventfd() |
2713 |
- */ |
2714 |
--#ifdef __NR_eventfd |
2715 |
--_syscall2(int, eventfd, int, count, int, flags) |
2716 |
-+#if defined __NR_eventfd || defined __NR_eventfd2 |
2717 |
-+int eventfd (int count, int flags) |
2718 |
-+{ |
2719 |
-+#if defined __NR_eventfd2 |
2720 |
-+ return INLINE_SYSCALL (eventfd2, 2, count, flags); |
2721 |
-+#elif defined __NR_eventfd |
2722 |
-+ if (flags != 0) { |
2723 |
-+ __set_errno (EINVAL); |
2724 |
-+ return -1; |
2725 |
-+ } |
2726 |
-+ return INLINE_SYSCALL (eventfd, 1, count); |
2727 |
-+#endif |
2728 |
-+} |
2729 |
- #endif |
2730 |
-diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c |
2731 |
-index 3567b07..1fc2393 100644 |
2732 |
---- a/libc/sysdeps/linux/common/stubs.c |
2733 |
-+++ b/libc/sysdeps/linux/common/stubs.c |
2734 |
-@@ -110,7 +110,7 @@ make_stub(epoll_pwait) |
2735 |
- make_stub(epoll_wait) |
2736 |
- #endif |
2737 |
- |
2738 |
--#if !defined __NR_eventfd && defined __UCLIBC_LINUX_SPECIFIC__ |
2739 |
-+#if !defined __NR_eventfd && !defined __NR_eventfd2 && defined __UCLIBC_LINUX_SPECIFIC__ |
2740 |
- make_stub(eventfd) |
2741 |
- #endif |
2742 |
- |
2743 |
--- |
2744 |
-cgit v0.9.1 |
2745 |
|
2746 |
diff --git a/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch b/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2747 |
deleted file mode 100644 |
2748 |
index 7ea9486..0000000 |
2749 |
--- a/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/03-pread_pwrite-backport.patch |
2750 |
+++ /dev/null |
2751 |
@@ -1,215 +0,0 @@ |
2752 |
-From 342a3d861fde5651ee53486addbacddcec6a0a58 Mon Sep 17 00:00:00 2001 |
2753 |
-From: Natanael Copa <natanael.copa@×××××.com> |
2754 |
-Date: Sat, 04 Aug 2012 17:32:45 +0000 |
2755 |
-Subject: pread/pwrite: backport fix |
2756 |
- |
2757 |
-pread/pwrite syscalls has been renamed to pread64/pwrite in 2.6 kernel. |
2758 |
- |
2759 |
-There was a fallback function using lseek for kernels who did not have |
2760 |
-this syscall (pre 2.1.60). This is broken in many ways. |
2761 |
- |
2762 |
-uclibc have been using the broken fallback due to they forgot to rename |
2763 |
-pread syscall. |
2764 |
- |
2765 |
-This got detected with git-1.7.11 which introduced threaded index-pack |
2766 |
-which broke in similar ways a windows (msys). |
2767 |
- |
2768 |
-This issue in uclibc have been reported upstream and fixed in git master |
2769 |
-so this patch does not need to be upstreamed. It might be an idea to |
2770 |
-backport it properly for 0.9.33 branch though. |
2771 |
- |
2772 |
-Signed-off-by: Natanael Copa <natanael.copa@×××××.com> |
2773 |
-Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@×××××.com> |
2774 |
---- |
2775 |
-diff --git a/libc/sysdeps/linux/common/pread_write.c b/libc/sysdeps/linux/common/pread_write.c |
2776 |
-index 88e6957..baf8691 100644 |
2777 |
---- a/libc/sysdeps/linux/common/pread_write.c |
2778 |
-+++ b/libc/sysdeps/linux/common/pread_write.c |
2779 |
-@@ -17,6 +17,7 @@ |
2780 |
- #include <unistd.h> |
2781 |
- #include <stdint.h> |
2782 |
- #include <endian.h> |
2783 |
-+#include <sysdep-cancel.h> |
2784 |
- |
2785 |
- extern __typeof(pread) __libc_pread; |
2786 |
- extern __typeof(pwrite) __libc_pwrite; |
2787 |
-@@ -27,15 +28,17 @@ extern __typeof(pwrite64) __libc_pwrite64; |
2788 |
- |
2789 |
- #include <bits/kernel_types.h> |
2790 |
- |
2791 |
--#ifdef __NR_pread |
2792 |
-- |
2793 |
--# define __NR___syscall_pread __NR_pread |
2794 |
-+# define __NR___syscall_pread __NR_pread64 |
2795 |
- static __inline__ _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, |
2796 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2797 |
- |
2798 |
- ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2799 |
- { |
2800 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2801 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2802 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2803 |
-+ LIBC_CANCEL_RESET (oldtype); |
2804 |
-+ return result; |
2805 |
-+ |
2806 |
- } |
2807 |
- weak_alias(__libc_pread,pread) |
2808 |
- |
2809 |
-@@ -44,22 +47,24 @@ ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2810 |
- { |
2811 |
- uint32_t low = offset & 0xffffffff; |
2812 |
- uint32_t high = offset >> 32; |
2813 |
-- return __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2814 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2815 |
-+ int result = __syscall_pread(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2816 |
-+ LIBC_CANCEL_RESET (oldtype); |
2817 |
-+ return result; |
2818 |
- } |
2819 |
- weak_alias(__libc_pread64,pread64) |
2820 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2821 |
- |
2822 |
--#endif /* __NR_pread */ |
2823 |
-- |
2824 |
--#ifdef __NR_pwrite |
2825 |
-- |
2826 |
--# define __NR___syscall_pwrite __NR_pwrite |
2827 |
-+# define __NR___syscall_pwrite __NR_pwrite64 |
2828 |
- static __inline__ _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, |
2829 |
- size_t, count, off_t, offset_hi, off_t, offset_lo) |
2830 |
- |
2831 |
- ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2832 |
- { |
2833 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2834 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2835 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(offset >> 31, offset)); |
2836 |
-+ LIBC_CANCEL_RESET (oldtype); |
2837 |
-+ return result; |
2838 |
- } |
2839 |
- weak_alias(__libc_pwrite,pwrite) |
2840 |
- |
2841 |
-@@ -68,120 +73,10 @@ ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2842 |
- { |
2843 |
- uint32_t low = offset & 0xffffffff; |
2844 |
- uint32_t high = offset >> 32; |
2845 |
-- return __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2846 |
--} |
2847 |
--weak_alias(__libc_pwrite64,pwrite64) |
2848 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2849 |
--#endif /* __NR_pwrite */ |
2850 |
-- |
2851 |
--#if ! defined __NR_pread || ! defined __NR_pwrite |
2852 |
-- |
2853 |
--static ssize_t __fake_pread_write(int fd, void *buf, |
2854 |
-- size_t count, off_t offset, int do_pwrite) |
2855 |
--{ |
2856 |
-- int save_errno; |
2857 |
-- ssize_t result; |
2858 |
-- off_t old_offset; |
2859 |
-- |
2860 |
-- /* Since we must not change the file pointer preserve the |
2861 |
-- * value so that we can restore it later. */ |
2862 |
-- if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1) |
2863 |
-- return -1; |
2864 |
-- |
2865 |
-- /* Set to wanted position. */ |
2866 |
-- if (lseek(fd, offset, SEEK_SET) == (off_t) -1) |
2867 |
-- return -1; |
2868 |
-- |
2869 |
-- if (do_pwrite == 1) { |
2870 |
-- /* Write the data. */ |
2871 |
-- result = write(fd, buf, count); |
2872 |
-- } else { |
2873 |
-- /* Read the data. */ |
2874 |
-- result = read(fd, buf, count); |
2875 |
-- } |
2876 |
-- |
2877 |
-- /* Now we have to restore the position. If this fails we |
2878 |
-- * have to return this as an error. */ |
2879 |
-- save_errno = errno; |
2880 |
-- if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1) |
2881 |
-- { |
2882 |
-- if (result == -1) |
2883 |
-- __set_errno(save_errno); |
2884 |
-- return -1; |
2885 |
-- } |
2886 |
-- __set_errno(save_errno); |
2887 |
-- return(result); |
2888 |
--} |
2889 |
-- |
2890 |
--# ifdef __UCLIBC_HAS_LFS__ |
2891 |
-- |
2892 |
--static ssize_t __fake_pread_write64(int fd, void *buf, |
2893 |
-- size_t count, off64_t offset, int do_pwrite) |
2894 |
--{ |
2895 |
-- int save_errno; |
2896 |
-- ssize_t result; |
2897 |
-- off64_t old_offset; |
2898 |
-- |
2899 |
-- /* Since we must not change the file pointer preserve the |
2900 |
-- * value so that we can restore it later. */ |
2901 |
-- if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1) |
2902 |
-- return -1; |
2903 |
-- |
2904 |
-- /* Set to wanted position. */ |
2905 |
-- if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1) |
2906 |
-- return -1; |
2907 |
-- |
2908 |
-- if (do_pwrite == 1) { |
2909 |
-- /* Write the data. */ |
2910 |
-- result = write(fd, buf, count); |
2911 |
-- } else { |
2912 |
-- /* Read the data. */ |
2913 |
-- result = read(fd, buf, count); |
2914 |
-- } |
2915 |
-- |
2916 |
-- /* Now we have to restore the position. */ |
2917 |
-- save_errno = errno; |
2918 |
-- if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) { |
2919 |
-- if (result == -1) |
2920 |
-- __set_errno (save_errno); |
2921 |
-- return -1; |
2922 |
-- } |
2923 |
-- __set_errno (save_errno); |
2924 |
-+ int oldtype = LIBC_CANCEL_ASYNC (); |
2925 |
-+ int result = __syscall_pwrite(fd, buf, count, __LONG_LONG_PAIR(high, low)); |
2926 |
-+ LIBC_CANCEL_RESET (oldtype); |
2927 |
- return result; |
2928 |
- } |
2929 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2930 |
--#endif /* ! defined __NR_pread || ! defined __NR_pwrite */ |
2931 |
-- |
2932 |
--#ifndef __NR_pread |
2933 |
--ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) |
2934 |
--{ |
2935 |
-- return __fake_pread_write(fd, buf, count, offset, 0); |
2936 |
--} |
2937 |
--weak_alias(__libc_pread,pread) |
2938 |
-- |
2939 |
--# ifdef __UCLIBC_HAS_LFS__ |
2940 |
--ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) |
2941 |
--{ |
2942 |
-- return __fake_pread_write64(fd, buf, count, offset, 0); |
2943 |
--} |
2944 |
--weak_alias(__libc_pread64,pread64) |
2945 |
--# endif /* __UCLIBC_HAS_LFS__ */ |
2946 |
--#endif /* ! __NR_pread */ |
2947 |
-- |
2948 |
--#ifndef __NR_pwrite |
2949 |
--ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) |
2950 |
--{ |
2951 |
-- /* we won't actually be modifying the buffer, |
2952 |
-- *just cast it to get rid of warnings */ |
2953 |
-- return __fake_pread_write(fd, (void*)buf, count, offset, 1); |
2954 |
--} |
2955 |
--weak_alias(__libc_pwrite,pwrite) |
2956 |
-- |
2957 |
--# ifdef __UCLIBC_HAS_LFS__ |
2958 |
--ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) |
2959 |
--{ |
2960 |
-- return __fake_pread_write64(fd, (void*)buf, count, offset, 1); |
2961 |
--} |
2962 |
- weak_alias(__libc_pwrite64,pwrite64) |
2963 |
- # endif /* __UCLIBC_HAS_LFS__ */ |
2964 |
--#endif /* ! __NR_pwrite */ |
2965 |
--- |
2966 |
-cgit v0.9.1 |
2967 |
|
2968 |
diff --git a/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch b/tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |
2969 |
similarity index 100% |
2970 |
rename from tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/02-libc-add-isfdtype.patch |
2971 |
rename to tools-uclibc/portage.mipsel3.vanilla/patches/sys-libs/uclibc/99-libc-add-isfdtype.patch |