* [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
@ 2017-05-11 23:50 Tom Cherry
2017-05-12 0:18 ` William Roberts
2017-05-12 13:22 ` Stephen Smalley
0 siblings, 2 replies; 6+ messages in thread
From: Tom Cherry @ 2017-05-11 23:50 UTC (permalink / raw)
To: selinux; +Cc: nnk, enh, Tom Cherry
This check is not specific to Android devices. If libselinux were used
with Bionic on a normal Linux system this check would still be needed.
Signed-off-by: Tom Cherry <tomcherry@google.com>
---
libselinux/src/procattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
index ebc0adec..48dd8aff 100644
--- a/libselinux/src/procattr.c
+++ b/libselinux/src/procattr.c
@@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
static int destructor_key_initialized = 0;
static __thread char destructor_initialized;
-#ifndef __ANDROID__
-/* Android declares this in unistd.h and has a definition for it */
+#ifndef __BIONIC__
+/* Bionic declares this in unistd.h and has a definition for it */
static pid_t gettid(void)
{
return syscall(__NR_gettid);
--
2.13.0.rc2.291.g57267f2277-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
2017-05-11 23:50 [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__ Tom Cherry
@ 2017-05-12 0:18 ` William Roberts
2017-05-12 0:19 ` enh
2017-05-12 13:22 ` Stephen Smalley
1 sibling, 1 reply; 6+ messages in thread
From: William Roberts @ 2017-05-12 0:18 UTC (permalink / raw)
To: Tom Cherry; +Cc: selinux@tycho.nsa.gov, enh@google.com
[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]
On Thursday, May 11, 2017, Tom Cherry via Selinux <selinux@tycho.nsa.gov>
wrote:
> This check is not specific to Android devices. If libselinux were used
> with Bionic on a normal Linux system this check would still be needed.
>
> Signed-off-by: Tom Cherry <tomcherry@google.com <javascript:;>>
> ---
> libselinux/src/procattr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
> index ebc0adec..48dd8aff 100644
> --- a/libselinux/src/procattr.c
> +++ b/libselinux/src/procattr.c
> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
> static int destructor_key_initialized = 0;
> static __thread char destructor_initialized;
>
> -#ifndef __ANDROID__
> -/* Android declares this in unistd.h and has a definition for it */
> +#ifndef __BIONIC__
> +/* Bionic declares this in unistd.h and has a definition for it */
> static pid_t gettid(void)
> {
> return syscall(__NR_gettid);
> --
> 2.13.0.rc2.291.g57267f2277-goog
Ack.. thanks for this. There might be other places I used Android when I
should have used bionic
--
Respectfully,
William C Roberts
[-- Attachment #2: Type: text/html, Size: 1590 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
2017-05-12 0:18 ` William Roberts
@ 2017-05-12 0:19 ` enh
0 siblings, 0 replies; 6+ messages in thread
From: enh @ 2017-05-12 0:19 UTC (permalink / raw)
To: William Roberts; +Cc: Tom Cherry, selinux@tycho.nsa.gov
don't feel bad: the Android tree has the same problem --- even bionic
itself didn't always get this right :-)
we're spotting these now because we're actually trying to use bionic
on non-Android Linux too.
On Thu, May 11, 2017 at 5:18 PM, William Roberts
<bill.c.roberts@gmail.com> wrote:
> On Thursday, May 11, 2017, Tom Cherry via Selinux <selinux@tycho.nsa.gov>
> wrote:
>>
>> This check is not specific to Android devices. If libselinux were used
>> with Bionic on a normal Linux system this check would still be needed.
>>
>> Signed-off-by: Tom Cherry <tomcherry@google.com>
>> ---
>> libselinux/src/procattr.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
>> index ebc0adec..48dd8aff 100644
>> --- a/libselinux/src/procattr.c
>> +++ b/libselinux/src/procattr.c
>> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
>> static int destructor_key_initialized = 0;
>> static __thread char destructor_initialized;
>>
>> -#ifndef __ANDROID__
>> -/* Android declares this in unistd.h and has a definition for it */
>> +#ifndef __BIONIC__
>> +/* Bionic declares this in unistd.h and has a definition for it */
>> static pid_t gettid(void)
>> {
>> return syscall(__NR_gettid);
>> --
>> 2.13.0.rc2.291.g57267f2277-goog
>
>
>
> Ack.. thanks for this. There might be other places I used Android when I
> should have used bionic
>
>
>
>
> --
> Respectfully,
>
> William C Roberts
>
>
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
2017-05-11 23:50 [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__ Tom Cherry
2017-05-12 0:18 ` William Roberts
@ 2017-05-12 13:22 ` Stephen Smalley
2017-05-12 18:01 ` Tom Cherry
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Smalley @ 2017-05-12 13:22 UTC (permalink / raw)
To: Tom Cherry, selinux; +Cc: enh, William Roberts
On Thu, 2017-05-11 at 16:50 -0700, Tom Cherry via Selinux wrote:
> This check is not specific to Android devices. If libselinux were
> used
> with Bionic on a normal Linux system this check would still be
> needed.
>
> Signed-off-by: Tom Cherry <tomcherry@google.com>
Thanks, applied. This was actually switched from ANDROID to _ANDROID__
by nnk in 044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
to have any other uses of __ANDROID__, but we do have a number of uses
of ANDROID. Offhand though these other uses of ANDROID don't appear to
be related to bionic but instead reflect differences in SELinux
userspace integration in Android vs GNU/Linux. If however your
bionic/Linux system integrates SELinux support in an Android-like
manner (e.g. kernel policy file is /sepolicy, no /etc/selinux/config,
...), then you might need to generalize those as well.
> ---
> libselinux/src/procattr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
> index ebc0adec..48dd8aff 100644
> --- a/libselinux/src/procattr.c
> +++ b/libselinux/src/procattr.c
> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
> static int destructor_key_initialized = 0;
> static __thread char destructor_initialized;
>
> -#ifndef __ANDROID__
> -/* Android declares this in unistd.h and has a definition for it */
> +#ifndef __BIONIC__
> +/* Bionic declares this in unistd.h and has a definition for it */
> static pid_t gettid(void)
> {
> return syscall(__NR_gettid);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
2017-05-12 13:22 ` Stephen Smalley
@ 2017-05-12 18:01 ` Tom Cherry
2017-05-12 22:11 ` William Roberts
0 siblings, 1 reply; 6+ messages in thread
From: Tom Cherry @ 2017-05-12 18:01 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux, Elliott Hughes, William Roberts
On Fri, May 12, 2017 at 6:22 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On Thu, 2017-05-11 at 16:50 -0700, Tom Cherry via Selinux wrote:
>> This check is not specific to Android devices. If libselinux were
>> used
>> with Bionic on a normal Linux system this check would still be
>> needed.
>>
>> Signed-off-by: Tom Cherry <tomcherry@google.com>
>
> Thanks, applied. This was actually switched from ANDROID to _ANDROID__
> by nnk in 044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
> to have any other uses of __ANDROID__, but we do have a number of uses
> of ANDROID. Offhand though these other uses of ANDROID don't appear to
> be related to bionic but instead reflect differences in SELinux
> userspace integration in Android vs GNU/Linux. If however your
> bionic/Linux system integrates SELinux support in an Android-like
> manner (e.g. kernel policy file is /sepolicy, no /etc/selinux/config,
> ...), then you might need to generalize those as well.
Thanks! I took a look at the other ANDROID ifdefs in the code and I'm not sure
how or if they would need to be changed. This change is needed to get
libselinux building with bionic on the host which is just the first step.
>
>> ---
>> libselinux/src/procattr.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
>> index ebc0adec..48dd8aff 100644
>> --- a/libselinux/src/procattr.c
>> +++ b/libselinux/src/procattr.c
>> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
>> static int destructor_key_initialized = 0;
>> static __thread char destructor_initialized;
>>
>> -#ifndef __ANDROID__
>> -/* Android declares this in unistd.h and has a definition for it */
>> +#ifndef __BIONIC__
>> +/* Bionic declares this in unistd.h and has a definition for it */
>> static pid_t gettid(void)
>> {
>> return syscall(__NR_gettid);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__
2017-05-12 18:01 ` Tom Cherry
@ 2017-05-12 22:11 ` William Roberts
0 siblings, 0 replies; 6+ messages in thread
From: William Roberts @ 2017-05-12 22:11 UTC (permalink / raw)
To: Tom Cherry; +Cc: Stephen Smalley, selinux@tycho.nsa.gov, Elliott Hughes
[-- Attachment #1: Type: text/plain, Size: 2232 bytes --]
On Fri, May 12, 2017 at 11:01 AM, Tom Cherry <tomcherry@google.com> wrote:
> On Fri, May 12, 2017 at 6:22 AM, Stephen Smalley <sds@tycho.nsa.gov>
> wrote:
> > On Thu, 2017-05-11 at 16:50 -0700, Tom Cherry via Selinux wrote:
> >> This check is not specific to Android devices. If libselinux were
> >> used
> >> with Bionic on a normal Linux system this check would still be
> >> needed.
> >>
> >> Signed-off-by: Tom Cherry <tomcherry@google.com>
> >
> > Thanks, applied. This was actually switched from ANDROID to _ANDROID__
> > by nnk in 044f6ef104c8a9d8f42faa8756e71a0525198f5b. We don't appear
> > to have any other uses of __ANDROID__, but we do have a number of uses
> > of ANDROID. Offhand though these other uses of ANDROID don't appear to
> > be related to bionic but instead reflect differences in SELinux
> > userspace integration in Android vs GNU/Linux. If however your
> > bionic/Linux system integrates SELinux support in an Android-like
> > manner (e.g. kernel policy file is /sepolicy, no /etc/selinux/config,
> > ...), then you might need to generalize those as well.
>
> Thanks! I took a look at the other ANDROID ifdefs in the code and I'm not
> sure
> how or if they would need to be changed. This change is needed to get
> libselinux building with bionic on the host which is just the first step.
>
Thanks for checking, and I am glad (and surprised) this was the only issue
to get
it to build for a host using bionic.
>
> >
> >> ---
> >> libselinux/src/procattr.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libselinux/src/procattr.c b/libselinux/src/procattr.c
> >> index ebc0adec..48dd8aff 100644
> >> --- a/libselinux/src/procattr.c
> >> +++ b/libselinux/src/procattr.c
> >> @@ -22,8 +22,8 @@ static pthread_key_t destructor_key;
> >> static int destructor_key_initialized = 0;
> >> static __thread char destructor_initialized;
> >>
> >> -#ifndef __ANDROID__
> >> -/* Android declares this in unistd.h and has a definition for it */
> >> +#ifndef __BIONIC__
> >> +/* Bionic declares this in unistd.h and has a definition for it */
> >> static pid_t gettid(void)
> >> {
> >> return syscall(__NR_gettid);
>
--
Respectfully,
William C Roberts
[-- Attachment #2: Type: text/html, Size: 3313 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-12 22:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-11 23:50 [PATCH] procattr.c: Use __BIONIC__ instead of __ANDROID__ Tom Cherry
2017-05-12 0:18 ` William Roberts
2017-05-12 0:19 ` enh
2017-05-12 13:22 ` Stephen Smalley
2017-05-12 18:01 ` Tom Cherry
2017-05-12 22:11 ` William Roberts
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.