Commit graph

71 commits

Author SHA1 Message Date
Elliott Hughes
ab413c535c Fix mip64 build.
Fallout from the unified sysroot work.

Bug: N/A
Test: builds
Change-Id: If0595a241b9ce0d8c8c7137ddaf8fca932487b7c
2017-10-13 13:22:24 -07:00
Elliott Hughes
d4ca231ae2 Unified sysroot: kill arch-specific include dirs.
<machine/asm.h> was internal use only.

<machine/fenv.h> is quite large, but can live in <bits/...>.

<machine/regdef.h> is trivially replaced by saying $x instead of x in
our assembler.

<machine/setjmp.h> is trivially inlined into <setjmp.h>.

<sgidefs.h> is unused.

Bug: N/A
Test: builds
Change-Id: Id05dbab43a2f9537486efb8f27a5ef167b055815
2017-10-12 13:19:51 -07:00
Stephen Crane
77bb564dc7 Use env to invoke python
/usr/bin/python may be python3. We should respect PATH to find the python
executable so it can be locally overridden to be python2.

Test: Build libc, repo upload
Change-Id: Iaddd7cd4a1c2177c32786e4fa0fc664ab0ad36de
2017-08-31 15:11:50 -07:00
dimitry
daebd05739 Fix pattern to account for '_' prefix in syscalls
Bug: http://b/64549471
Test: make
Change-Id: I7ba856a2cad29adbb028f150aeaabb9894e84d6e
2017-08-10 11:11:00 +02:00
Alessio Balsini
93d4f8b2fa Fix missing parse_open_file method.
gensyscalls.py was failing to execute because of a missing "self"
keyword when calling parse_open_file.

Test: manual test running gensyscalls.py.

Change-Id: I78db2cba704c5ca56a730019e36601a7ccd069f8
2017-04-11 18:27:29 +02:00
Christopher Ferris
5f41ce25c6 Merge "Update to kernel headers v4.10." 2017-02-27 20:09:54 +00:00
Paul Lawrence
7ea4090c65 Autogenerate single policy from syscalls and whitelist
Bug: 35392119
Bug: 34465958
Test: Check boots and same syscalls are blocked as before

Change-Id: I9efa97032c59aebbbfd32e6f0d2d491f6254f0a2
2017-02-23 10:46:56 -08:00
Christopher Ferris
48af7cb2e2 Update to kernel headers v4.10.
Test: Built angler, booted on angler, ran bionic unit tests.
Change-Id: Ia24511e74106116ea84b44ab724865ec492de8f9
2017-02-21 14:42:34 -08:00
Paul Lawrence
eabc352651 Add seccomp support library
Policy library which exports an autogenerated policy from SYSCALLS.TXT
blocking any other calls.

Test: Generate policy, install onto Sailfish, check boots, Chrome runs,
calls are blocked.
Bug: 32313202

Change-Id: Ib590704e50122f077eeae26561eb9b0a70386551
2017-01-19 13:38:47 -08:00
Elliott Hughes
d2f725eaed Don't declare SYS_* constants for unavailable __NR_* constants.
Bug: https://code.google.com/p/android/issues/detail?id=215853
Change-Id: Iaaa3ce888deb8d032208bf636b7badaed6a72d30
2016-07-18 12:48:39 -07:00
Elliott Hughes
8aabbd7f63 Move glibc-syscalls.h into bits/.
Bug: http://b/28519060
Change-Id: I0de1ba16b16eb7b780de89954d3fa45cca2f5295
2016-05-02 12:47:58 -07:00
Christopher Ferris
f5a9123d9f Add unwind information for r7 in arm syscalls.
It turns out that clang can emit code where the sp is saved in the r7
register on arm. Unfortunately, a lot of our syscalls overwrite that
value while the syscall is executing, so unwinding through that syscall
fails.

Update the syscall generation code to add unwinding information for
these uses.

Bug: 28411713
(cherry picked from commit 6e45d37dec)

Change-Id: Ib775effc44c4113735fe9032b0602b9d63e3e390
2016-04-27 20:34:47 -07:00
Mingwei Shi
be91052932 libc: implement kernel vdso syscalls for i386
This patch uses __kernel_vsyscall instead of "int 0x80"
as the syscall entry point. AT_SYSINFO points to
an adapter to mask the arch specific difference and gives a
performance boost on i386 architecture.

Change-ID: Ib340c604d02c6c25714a95793737e3cfdc3fc5d7
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
2016-03-25 14:10:05 -07:00
Christopher Ferris
fa5faa0ce6 Make gensyscalls.py use the ALIAS_SYMBOL macro.
Change-Id: Ib94c0abb6fc85126ecc5ed3f1962b2b8b90b9952
2015-03-24 21:08:26 -07:00
Nick Kralevich
00490ae3f3 Ensure raw fchmod/fchmodat syscalls are hidden.
In https://android-review.googlesource.com/#/c/127908/5/libc/SYSCALLS.TXT@116
Elliott said:

  for LP64 these will be hidden. for LP32 we were cowards and left
  them all public for compatibility (though i don't think we ever
  dremeled to see whether it was needed). we don't have an easy
  way to recognize additions, though, so we can't prevent adding
  new turds.

Add a mechanism to prevent the adding of new turds, and use that
mechanism on the fchmod/fchmodat system calls.

Bug: 19233951
Change-Id: I98f98345970b631a379f348df57858f9fc3d57c0
2015-02-03 12:10:30 -08:00
Elliott Hughes
011e111d29 Ensure __set_errno is still visible on LP32.
The use of the .hidden directive to avoid going via the PLT for
__set_errno had the side-effect of actually making __set_errno
hidden (which is odd because assembler directives don't usually
affect symbols defined in a different file --- you can't even
create a weak reference to a symbol that's defined in a different
file).

This change switches the system call stubs over to a new always-hidden
__set_errno_internal and has a visible __set_errno on LP32 just for
binary compatibility with old NDK apps.

(cherry-pick of 7efad83d430f4d824f2aaa75edea5106f6ff8aae.)

Bug: 17423135
Change-Id: I6b6d7a05dda85f923d22e5ffd169a91e23499b7b
2014-09-08 16:46:50 -07:00
Elliott Hughes
dc1fb7000a Clean up some of our python scripts.
Change-Id: Ifa75345db43434298cfb6113fbe2f7a33b88c79d
2014-08-20 11:16:11 -07:00
Dan Albert
bc9f9f25bf Make __set_errno hidden in asm.
This fixes the build after the -Bsymbolic change.

Bug: 16853291
Change-Id: I989c9fec3c32e0289ea257a3bd2b7fd2709b6ce2
2014-08-08 15:35:47 -07:00
Dan Albert
3726f9c38b Revert "Fix incorrect relocations for x86."
Bug: 16853291
This reverts commit 512bc52326.
2014-08-08 22:26:47 +00:00
Christopher Ferris
92f0c91b82 Merge "Create a distinct temp directory for each run." 2014-08-07 15:46:11 +00:00
Christopher Ferris
01bd32e0e4 Create a distinct temp directory for each run.
Modify make__NR_name so that only __ARM_NR_ is exempted from the
__NR_ being prepended. This avoids a case where using a name starting
with __ but is not a valid syscall name in SYSCALLS.TXT does not generate
code that will compile but references the function itself and causes
link errors.

Fix all of the directory references from dir_part1 + dir_part2 to
use os.path.join() instead.

Change-Id: Ib9527eba6f25f26a30c5cb0ad431f3f88a7683cf
2014-08-07 19:33:22 -07:00
Dan Albert
512bc52326 Fix incorrect relocations for x86.
These calls were not going through the PLT like they should have been.

Bug: 16853291
Change-Id: Id70488b077256a70137c4417f21be2c2d1d4341c
2014-08-07 16:21:47 -07:00
Serban Constantinescu
602b4e482c AArch64: Remove Frame Record from ARM64 syscalls
This patch removes the frame record created on svc calls.

Change-Id: I67cf926ba59540e824fb9749d30538e332df7c1e
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-06-09 11:36:37 -07:00
Elliott Hughes
15a0456d0b Remove unnecessary instructions from x86/x86_64 syscalls.
__set_errno returns -1 exactly so that callers don't need to bother.
The other architectures were already taking advantage of this, but
no one had ever fixed x86 and x86_64.

Change-Id: Ie131494be664f6c4a1bbf8c61bbbed58eac56122
2014-06-05 17:24:30 -07:00
Christopher Ferris
15b91e92a0 Fix x86 cfi directives for syscalls.
The syscall generation always used 4 bytes for each push cfi directive.
However, the first push should always use an offset of 8 bytes, each
subsequent push after that is only 4 bytes though.

Change-Id: Ibaabd107f399ef67010b9a08213783957c2f74a9
2014-05-29 19:04:36 -07:00
Christopher Ferris
df22a121b2 Add cfi directives for arm64 assembler.
Fix syscall generator to add cfi directives and add the directives
for all arm64 assembler.

Bug: 15138290
Change-Id: I7f0e4a16c141ac624e5276917a3a1ed45778e057
2014-05-21 17:46:52 -07:00
Elliott Hughes
d465eb4e76 Remove the useless _C_LABEL from generated system calls.
Change-Id: Id1d2fd39972652831ea825f6f9cf940b08f42b5c
2014-02-19 18:59:19 -08:00
Elliott Hughes
9abbbdc534 Make mips/mips64 syscall stubs more like the other architectures.
Change-Id: I55f8c1a95f643a6e484f12fbcc25e2c77e55b6b8
2014-02-19 14:54:31 -08:00
Elliott Hughes
eae27dc55a Make mips generated assembler more like the mips64 stuff.
I broke the mips build yesterday because it doesn't use
<private/bionic_asm.h> like the other architectures, including mips64.
I want to move mips closer to mips64 to try to avoid this kind of thing
in future.

Change-Id: Idb985587ff355b9e5e765c1f5671dc0144cd2488
2014-02-19 12:20:00 -08:00
Elliott Hughes
986f906710 Fix build by avoiding the _C_LABEL macro.
Change-Id: Ide367c2b65071388bd95fbc81a4ed6ae94aec4e4
2014-02-18 16:42:36 -08:00
Elliott Hughes
b3a23bd017 Build syscall stubs in their own library.
This lets us lose the auto-generated makefiles.

Change-Id: I2de0c71b3b9c08f9cce8f4ff7fd7254dda008c86
2014-02-11 13:52:02 -08:00
Chris Dearman
5043212b76 [MIPS64] Add syscall related files
Change-Id: I2f5d05df0e767538a6fe467ca0a2386325f8b71f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
Signed-off-by: Duane Sand <duane.sand@imgtec.com>
2014-02-06 15:39:38 -08:00
Colin Cross
d1973ca513 bionic: rename aarch64 target to arm64
Rename aarch64 build targets to arm64.  The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
2014-01-23 18:35:39 -08:00
Christopher Ferris
e4bc756121 Add cfi directives to x86 syscalls.
Modify the syscalls script to generate the cfi directives for x86
syscalls.

Update the x86 syscalls.

Change-Id: Ia1993dc714a7e79f917087fff8200e9a02c52603
2014-01-06 16:39:10 -08:00
Elliott Hughes
887e1140fe Clean up <sched.h>.
This patch switches to using the uapi constants. It also adds the missing
setns system call, fixes sched_getcpu's error behavior, and fixes the
gensyscalls script now ARM is uapi-only too.

Change-Id: I8e16b1693d6d32cd9b8499e46b5d8b0a50bc4f1d
2014-01-02 12:05:50 -08:00
Christopher Ferris
ed45970ac5 Add cfi directives to all arm assembly.
Since the ENTRY/END macros now have .cfi_startproc/.cfi_endproc, most of the
custom arm assembly has no unwind information. Adding the proper cfi directives
for these and removing the arm directives.

Update the gensyscalls.py script to add these cfi directives for the generated
assembly. Also fix the references to non-uapi headers to the proper uapi
header.

In addition, remove the kill.S, tkill.S, tgkill.S for arm since they are not
needed at all. The unwinder (libunwind) is able to properly unwind using the
normal abort.

After this change, I can unwind through the system calls again.

Bug: 11559337
Bug: 11825869
Bug: 11321283

Change-Id: I18b48089ef2d000a67913ce6febc6544bbe934a3
2013-12-02 19:13:12 -08:00
Elliott Hughes
ed74484dcb Stop using the non-uapi <linux/err.h> header file.
We only need it for MAX_ERRNO, and it's time we had somewhere to put
the little assembler utility macros we've been putting off writing.

Change-Id: I9354d2e0dc47c689296a34b5b229fc9ba75f1a83
2013-11-07 10:31:05 -08:00
Serban Constantinescu
feaa89a1bc AArch64: Add support for AArch64 to the syscall interface
This patch adds support for AArch64 to the syscall interface. The kernel
implementation exports a set of canonical syscalls, therefore some of
the userspace exported syscalls are implemented as stubs based on the
canonical set.

Change-Id: Ia965d71e97769b8be9d7655193fc40303964c4df
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2013-10-28 16:16:34 -07:00
Elliott Hughes
6b53c2349a Fix the exit syscall stub's name.
I've left the exit_group syscall as _exit because otherwise we'd have to
convince the compiler that our _exit (which just calls __exit_group) is
actually "noreturn", and it seems like that would be less clean than just
cutting out the middleman.

We'll just have to trust ourselves not to add anything to SYSCALLS.TXT
that ought to be private but that only has a single leading underscore.
Hopefully we can manage that.

Change-Id: Iac47faea9f516186e1774381846c54cafabc4354
2013-10-24 22:41:50 -07:00
Elliott Hughes
fff6e272e9 Use hidden visibility for generated stubs whose names begin with underscores.
Change-Id: Idb39fd04b7a14114801624e744e76e0e7913d951
2013-10-24 17:03:20 -07:00
Elliott Hughes
103ccde8fe Sort the syscalls.mk files, give all generated files the same header.
No non-comment changes to the .S files.

Change-Id: Iafcfd004c3ea92b64268f80ab16df615b97cefac
2013-10-16 14:27:59 -07:00
Elliott Hughes
0437f3ff29 Refactor the syscall generation script.
Primarily so that the new x86_64 alias functionality is now available for
all architectures.

Change-Id: I9fde59093a1d08de98923f121a6e3d05ec5801d2
2013-10-07 23:53:13 -07:00
H.J. Lu
6fe4e87954 Add an optional alias list to SYSCALLS.TXT
This patch adds an optional alias list to SYSCALLS.TXT.  It is used to
create aliases for a syscall.  For x86-64, lseek64 is an alias for lseek.

Change-Id: Icb11fd2bb461ea4f5f0a26bfc585471d7d7cc468
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-10-07 21:37:12 +04:00
Pavel Chupin
f12a18b850 x86_64: Add x86_64 syscalls and tune gen scripts for x86_64
* Tune syscall stubs generator for 4th target: x86_64
* Update SYSCALLS.TXT with x86_64 syscalls:
 - Most of the x86 syscalls are equally supported
 - *32 syscalls are not supported on 64-bit
 - *64 syscalls are replaced accordingly without 64 suffix
 - Some syscalls are not supported, replaced with x86_64 analog

Syscalls are regenerated as separate patch for review convenience.

Change-Id: I4ea2e0f13759b0aa61f05208ca68da8d6bc7c048
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-10-01 13:27:07 -07:00
Elliott Hughes
d612165c67 Make it easier to add syscalls for another architecture.
Much of the per-architecture duplication can be removed, so let's do so
before we add the 64-bit architectures.

Change-Id: Ieb796503c8e5353ea38c3bab768bb9a690c9a767
2013-09-26 08:57:17 -07:00
Elliott Hughes
18bc975bfe Slight script cleanup; make gensyscalls work from any directory.
Also remove a ton of dead code.

Change-Id: I1315623695a004f643b155f121cbafe24b715b8a
2013-06-17 10:39:33 -07:00
Elliott Hughes
1b91c6c11f Stop generating <sys/linux-syscalls.h>.
The <asm/unistd.h> files contain the canonical data, and
<sys/glibc-syscalls.h> contain new glibc-compatible names,
and if you #include the standard <sys/syscall.h> you get
both sets of names.

Change-Id: I9919c080931c0ba1660f5e37c6a6265ea716d603
2013-03-22 18:56:24 -07:00
Elliott Hughes
cda62094ef Use the correct names for the __ARM_NR_* syscalls.
This lets us move all the ARM syscall stubs over to the kernel <asm/unistd.h>.
Our generated <sys/linux-syscalls.h> is now unused, but I'll remove that in a
later change.

Change-Id: Ie5ff2cc4abce1938576af7cbaef615a79c7f310d
2013-03-22 13:53:43 -07:00
Elliott Hughes
5c2772f59d The SYS_ constants should cover all __NR_ values.
<sys/linux-syscalls.h> only contains constants for the syscalls
we're generating stubs for. We want all the syscalls available
on the architecture in question.

Keep using <sys/linux-syscalls.h> on ARM for now because the
__NR_ARM_set_tls and __NR_ARM_cacheflush values aren't in <asm/unistd.h>.

Change-Id: I66683950d87d9b18d6107d0acc0ed238a4496f44
2013-03-21 22:26:20 -07:00
Elliott Hughes
9724ce3a09 Don't #define SYS_ constants unless they make sense for the current architecture.
Fixes the MIPS and x86 builds. strace tests whether syscalls
are supported using #ifdef of the appropriate SYS_ constant.

Change-Id: I90be118dc42abfdaf5b0f9b1e676e8601f55106e
2013-03-21 19:44:36 -07:00