aboutsummaryrefslogtreecommitdiffstats
path: root/libc/arch-arm
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-05-31 13:43:13 -0700
committerNick Kralevich <nnk@google.com>2015-06-02 10:08:05 -0700
commitc92f9f8069f567ad2c2557e2ef56e13de4bf8713 (patch)
treeca362b872bf6f794bc376ba0f39eab65dee85a28 /libc/arch-arm
parentc4ebe60e1a2fc165ff11442765325628e27f2a05 (diff)
downloadandroid_bionic-c92f9f8069f567ad2c2557e2ef56e13de4bf8713.tar.gz
android_bionic-c92f9f8069f567ad2c2557e2ef56e13de4bf8713.tar.bz2
android_bionic-c92f9f8069f567ad2c2557e2ef56e13de4bf8713.zip
libc: Add O_PATH support for fgetxattr / fsetxattr
Support O_PATH file descriptors when handling fgetxattr and fsetxattr. This avoids requiring file read access to pull extended attributes. This is needed to support O_PATH file descriptors when calling SELinux's fgetfilecon() call. In particular, this allows the querying and setting of SELinux file context by using something like the following code: int dirfd = open("/path/to/dir", O_DIRECTORY); int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW); char *context; fgetfilecon(fd, &context); This change was motivated by a comment in https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c (cherrypicked from commit 2825f10b7f61558c264231a536cf3affc0d84204) Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
Diffstat (limited to 'libc/arch-arm')
-rw-r--r--libc/arch-arm/syscalls/___fgetxattr.S (renamed from libc/arch-arm/syscalls/fgetxattr.S)5
-rw-r--r--libc/arch-arm/syscalls/___fsetxattr.S (renamed from libc/arch-arm/syscalls/fsetxattr.S)5
2 files changed, 6 insertions, 4 deletions
diff --git a/libc/arch-arm/syscalls/fgetxattr.S b/libc/arch-arm/syscalls/___fgetxattr.S
index 3f1e5fc4e..e776cd6d3 100644
--- a/libc/arch-arm/syscalls/fgetxattr.S
+++ b/libc/arch-arm/syscalls/___fgetxattr.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(fgetxattr)
+ENTRY(___fgetxattr)
mov ip, r7
ldr r7, =__NR_fgetxattr
swi #0
@@ -11,4 +11,5 @@ ENTRY(fgetxattr)
bxls lr
neg r0, r0
b __set_errno_internal
-END(fgetxattr)
+END(___fgetxattr)
+.hidden ___fgetxattr
diff --git a/libc/arch-arm/syscalls/fsetxattr.S b/libc/arch-arm/syscalls/___fsetxattr.S
index 0e33ad29f..544519173 100644
--- a/libc/arch-arm/syscalls/fsetxattr.S
+++ b/libc/arch-arm/syscalls/___fsetxattr.S
@@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
-ENTRY(fsetxattr)
+ENTRY(___fsetxattr)
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
.cfi_def_cfa_offset 16
@@ -19,4 +19,5 @@ ENTRY(fsetxattr)
bxls lr
neg r0, r0
b __set_errno_internal
-END(fsetxattr)
+END(___fsetxattr)
+.hidden ___fsetxattr