diff options
2 files changed, 53 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch b/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch new file mode 100644 index 000000000..8524517cb --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From f4f9d24860e1b5cd4f6a014f3fda7cd33ebe5be7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Petr Lautrbach <plautrba@redhat.com> | ||
3 | Date: Sat, 27 Jul 2019 08:20:20 -0700 | ||
4 | Subject: [PATCH] libselinux: Do not define gettid() if glibc >= 2.30 is used | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Since version 2.30 glibc implements gettid() system call wrapper, see | ||
10 | https://sourceware.org/bugzilla/show_bug.cgi?id=6399 | ||
11 | |||
12 | Fixes: | ||
13 | cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -c -o procattr.o procattr.c | ||
14 | procattr.c:28:14: error: static declaration of ‘gettid’ follows non-static declaration | ||
15 | 28 | static pid_t gettid(void) | ||
16 | | ^~~~~~ | ||
17 | In file included from /usr/include/unistd.h:1170, | ||
18 | from procattr.c:2: | ||
19 | /usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here | ||
20 | 34 | extern __pid_t gettid (void) __THROW; | ||
21 | | ^~~~~~ | ||
22 | |||
23 | Signed-off-by: Petr Lautrbach <plautrba@redhat.com> | ||
24 | Acked-by: Stephen Smalley <sds@tycho.nsa.gov> | ||
25 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
26 | --- | ||
27 | src/procattr.c | 14 +++++++++++++- | ||
28 | 1 file changed, 13 insertions(+), 1 deletion(-) | ||
29 | |||
30 | --- a/src/procattr.c | ||
31 | +++ b/src/procattr.c | ||
32 | @@ -8,7 +8,19 @@ | ||
33 | #include "selinux_internal.h" | ||
34 | #include "policy.h" | ||
35 | |||
36 | -#ifndef __BIONIC__ | ||
37 | +/* Bionic and glibc >= 2.30 declare gettid() system call wrapper in unistd.h and | ||
38 | + * has a definition for it */ | ||
39 | +#ifdef __BIONIC__ | ||
40 | + #define OVERRIDE_GETTID 0 | ||
41 | +#elif !defined(__GLIBC_PREREQ) | ||
42 | + #define OVERRIDE_GETTID 1 | ||
43 | +#elif !__GLIBC_PREREQ(2,29) | ||
44 | + #define OVERRIDE_GETTID 1 | ||
45 | +#else | ||
46 | + #define OVERRIDE_GETTID 0 | ||
47 | +#endif | ||
48 | + | ||
49 | +#if OVERRIDE_GETTID | ||
50 | static pid_t gettid(void) | ||
51 | { | ||
52 | return syscall(__NR_gettid); | ||
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb index e09cd829d..d84fcaecc 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb | |||
@@ -41,6 +41,7 @@ SRC_URI = " \ | |||
41 | file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \ | 41 | file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \ |
42 | file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \ | 42 | file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \ |
43 | file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \ | 43 | file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \ |
44 | file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \ | ||
44 | file://android-tools-adbd.service \ | 45 | file://android-tools-adbd.service \ |
45 | file://gitignore \ | 46 | file://gitignore \ |
46 | file://adb.mk;subdir=${BPN} \ | 47 | file://adb.mk;subdir=${BPN} \ |