| <html devsite> |
| <head> |
| <title>Interface Requirements</title> |
| <meta name="project_path" value="/_project.yaml" /> |
| <meta name="book_path" value="/_book.yaml" /> |
| </head> |
| <body> |
| <!-- |
| Copyright 2017 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <p>This page describes a subset of the Linux kernel interfaces on which Android |
| relies to function properly. The presence and correctness of these interfaces is |
| tested as part of the <a href="/devices/tech/vts/index.html">Vendor Test Suite |
| (VTS)</a>. This subset will grow over time to contain a larger portion of |
| Android kernel interfaces.</p> |
| |
| <h2 id="system-calls">System calls</h2> |
| <p>System calls are expected to provide the same signatures and semantics as in |
| the upstream Linux kernel.</p> |
| |
| <p>ARM64 system calls required by bionic per |
| <code>bionic/libc/SYSCALLS.txt</code>:</p> |
| |
| <table> |
| <tr> |
| <td class="devsite-click-to-copy">accept4, acct, adjtimex, bind, brk, capget, capset, chdir, chroot, clock_adjtime, clock_getres, clock_gettime, clock_nanosleep, clock_settime, close, connect, delete_module, dup3, dup, epoll_create1, epoll_ctl, epoll_pwait, eventfd2, execve, exit, exit_group, faccessat, fadvise64, fallocate, fchdir, fchmodat, fchmod, fchownat, fchown, fcntl, fdatasync, fgetxattr, flistxattr, flock, fremovexattr, fsetxattr, fstat, newfstatat, fstatfs, fsync, ftruncate, getcpu, getcwd, getdents64, getegid, geteuid, getgid, getgroups, getitimer, getpeername, getpgid, getpid, getppid, getpriority, getresgid, getresuid, getrlimit, getrusage, getsid, getsockname, getsockopt, gettimeofday, getuid, getxattr, init_module, inotify_add_watch, inotify_init1, inotify_rm_watch, ioctl, kill, syslog, lgetxattr, linkat, listen, listxattr, llistxattr, lremovexattr, lseek, lsetxattr, madvise, mincore, mkdirat, mknodat, mlockall, mlock, mmap, mount, mprotect, mremap, msync, munlockall, munlock, munmap, nanosleep, openat, personality, pipe2, ppoll, prctl, pread64, preadv, prlimit64, process_vm_readv, process_vm_writev, pselect6, ptrace, pwrite64, pwritev, quotactl, readahead, readlinkat, read, readv, reboot, recvfrom, recvmmsg, recvmsg, removexattr, renameat, rt_sigaction, rt_sigpending, rt_sigprocmask, rt_sigqueueinfo, rt_sigsuspend, rt_sigtimedwait, sched_getaffinity, sched_getparam, sched_get_priority_max, sched_get_priority_min, sched_getscheduler, sched_rr_get_interval, sched_setaffinity, sched_setparam, sched_setscheduler, sched_yield, sendfile, sendmmsg, sendmsg, sendto, setdomainname, setfsgid, setfsuid, setgid, setgroups, sethostname, setitimer, setns, setpgid, setpriority, setregid, setresgid, setresuid, setreuid, setrlimit, setsid, setsockopt, set_tid_address, settimeofday, setuid, setxattr, shutdown, sigaltstack, signalfd4, socketpair, socket, splice, statfs, swapoff, swapon, symlinkat, sync_file_range, sync, sysinfo, tee, tgkill, timer_create, timer_delete, timerfd_create, timerfd_gettime, timerfd_settime, timer_getoverrun, timer_gettime, timer_settime, times, truncate, umask, umount2, uname, unlinkat, unshare, utimensat, vmsplice, wait4, waitid, write, writev</td> |
| </tr></table> |
| |
| <p>ARM32 system calls required by bionic per |
| <code>bionic/libc/SYSCALLS.txt</code>:</p> |
| |
| <table> |
| <tr> |
| <td class="devsite-click-to-copy">accept4, acct, adjtimex, arm_fadvise64_64, bind, brk, cacheflush, capget, capset, chdir, chroot, clock_adjtime, clock_getres, clock_gettime, clock_nanosleep, clock_settime, close, connect, delete_module, dup3, dup, epoll_create1, epoll_ctl, epoll_pwait, eventfd2, execve, exit, exit_group, faccessat, fallocate, fchdir, fchmodat, fchmod, fchownat, fchown32, fcntl64, fdatasync, fgetxattr, flistxattr, flock, fremovexattr, fsetxattr, fstat64, fstatat64, fstatfs64, fsync, ftruncate64, getcpu, getcwd, getdents64, getegid32, geteuid32, getgid32, getgroups32, getitimer, getpeername, getpgid, getpid, getppid, getpriority, getresgid32, getresuid32, ugetrlimit, getrusage, getsid, getsockname, getsockopt, gettimeofday, getuid32, getxattr, init_module, inotify_add_watch, inotify_init1, inotify_rm_watch, ioctl, kill, syslog, lgetxattr, linkat, listen, listxattr, llistxattr, _llseek, lremovexattr, lseek, lsetxattr, madvise, mincore, mkdirat, mknodat, mlockall, mlock, mmap2, mount, mprotect, mremap, msync, munlockall, munlock, munmap, nanosleep, openat, personality, pipe2, ppoll, prctl, pread64, preadv, prlimit64, process_vm_readv, process_vm_writev, pselect6, ptrace, pwrite64, pwritev, quotactl, readahead, readlinkat, read, readv, reboot, recvfrom, recvmmsg, recvmsg, removexattr, renameat, rt_sigaction, rt_sigpending, rt_sigprocmask, rt_sigqueueinfo, rt_sigsuspend, rt_sigtimedwait, sched_getaffinity, sched_getparam, sched_get_priority_max, sched_get_priority_min, sched_getscheduler, sched_rr_get_interval, sched_setaffinity, sched_setparam, sched_setscheduler, sched_yield, sendfile64, sendfile, sendmmsg, sendmsg, sendto, setdomainname, setfsgid, setfsuid, setgid32, setgroups32, sethostname, setitimer, setns, setpgid, setpriority, setregid32, setresgid32, setresuid32, setreuid32, setrlimit, setsid, setsockopt, set_tid_address, settimeofday, set_tls, setuid32, setxattr, shutdown, sigaction, sigaltstack, signalfd4, socketpair, socket, splice, statfs64, swapoff, swapon, symlinkat, sync_file_range2, sync, sysinfo, tee, tgkill, timer_create, timer_delete, timerfd_create, timerfd_gettime, timerfd_settime, timer_getoverrun, timer_gettime, timer_settime, times, truncate64, truncate, umask, umount2, uname, unlinkat, unshare, utimensat, vmsplice, wait4, waitid, write, writev</td> |
| </tr></table> |
| |
| <p>The system calls listed below are made by bypassing bionic:</p> |
| |
| <table> |
| <tr> |
| <th style="width:20%">All Architectures</th> |
| <td>gettid, futex, clone, rt_sigreturn, rt_tgsigqueueinfo, restart_syscall, |
| getrandom, perf_event_open, syncfs, tkill, seccomp</td> |
| </tr> |
| <tr> |
| <th>arm</th> |
| <td>vfork, sigreturn, pipe, access, stat64, lstat64, open, getdents, eventfd, |
| epoll_wait, readlink, epoll_create, creat, unlink</td> |
| </tr> |
| <tr> |
| <th>arm64</th> |
| <td>pivot_root, ioprio_get, ioprio_set</td> |
| </tr> |
| </table> |
| |
| <aside class="note"><strong>Note:</strong> x86 and x86_64 system calls will be |
| added in a future release.</aside> |
| |
| <h3 id="prctl">prctl</h3> |
| <p>In addition to the upstream <code>prctl</code> operations for supported |
| kernel versions, Android relies on additional <code>prctl</code> operations, the |
| implementation of which can be found in the android-common kernel.</p> |
| |
| <pre class="prettyprint"> |
| PR_SET_TIMERSLACK_PID |
| PR_SET_VMA |
| </pre> |
| |
| <h2 id="filesystems">Filesystems</h2> |
| <p>The Linux kernel exports interfaces via several filesystems. Android expects |
| these interfaces to communicate the same information, in the same format, and |
| provide the same semantics as in the upstream Linux kernel. For interfaces that |
| do not exist upstream, the appropriate behavior is dictated by the corresponding |
| branch of the Android common kernel.</p> |
| |
| <h3 id="procfs">procfs</h3> |
| <table> |
| <tr> |
| <th>Path</th> |
| <th>Description</th> |
| </tr> |
| <tr> |
| <td><code>/proc/cmdline</code></td> |
| <td>Read-only file containing command line arguments passed to the kernel. |
| </td> |
| </tr> |
| <tr> |
| <td><code>/proc/config.gz</code></td> |
| <td>Read-only file containing kernel build configuration.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/cpuinfo</code></td> |
| <td>Read-only file containing architecture-specific CPU details.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/kmsg</code></td> |
| <td>Read-only file showing kernel messages in real time.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/meminfo</code></td> |
| <td>Read-only file showing memory subsystem details.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/modules</code></td> |
| <td>Read-only file containing information about loaded kernel modules.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/mounts</code></td> |
| <td>Symlink to <code>/proc/self/mounts</code>, which is a read-only file |
| listing information about the mounted filesystems.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/net/xt_qtaguid/ctrl</code></td> |
| <td>Read-write file providing information about tagged sockets.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/self/maps</code></td> |
| <td>Read-only file containing the currently mapped memory regions and |
| permissions.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/stat</code></td> |
| <td>Read-only file containing various kernel and system statistics.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/kernel/kptr_restrict</code></td> |
| <td>Read-write file that determines whether kernel pointers are printed in |
| <code>proc</code> files and other interfaces.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/kernel/randomize_va_space</code></td> |
| <td>Read-write file that determines the address layout randomization policy |
| for the system.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/vm/mmap_min_addr</code></td> |
| <td>Read-write file that determines the minimum address than can be |
| <code>mmap</code>'d.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/vm/mmap_rnd_bits</code></td> |
| <td>Read-write file that specifies the amount of randomness in |
| <code>mmap</code>'d addresses.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/vm/mmap_rnd_compat_bits</code></td> |
| <td>Read-write file that specifies the amount of randomness in |
| <code>mmap</code>'d addresses.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/sys/vm/overcommit_memory</code></td> |
| <td>Read-write file that determines the kernel virtual memory accounting |
| mode.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/uid_cputime/remove_uid_range</code></td> |
| <td>Write-only file that, when written, removes UIDs from being shown in |
| <code>/proc/uid_cputime/show_uid_stat</code>.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/uid_cputime/show_uid_stat</code></td> |
| <td>Read-only file containing the time a UID's processes spent in user and |
| kernel space.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/version</code></td> |
| <td>Read-only file containing a string describing the kernel version.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/vmallocinfo</code></td> |
| <td>Read-only file containing <code>vmalloc</code>'d ranges.</td> |
| </tr> |
| <tr> |
| <td><code>/proc/zoneinfo</code></td> |
| <td>Read-only file containing information about memory zones.</td> |
| </tr> |
| </table> |
| |
| <h3 id="dev">dev</h3> |
| |
| <table> |
| <tr> |
| <th>Path</th> |
| <th>Description</th> |
| </tr> |
| <tr> |
| <td><code>/dev/ashmem</code></td> |
| <td>Anonymous shared memory device file.</td> |
| </tr> |
| <tr> |
| <td><code>/dev/binder</code></td> |
| <td>Binder device file.</td> |
| </tr> |
| <tr> |
| <td><code>/dev/hwbinder</code></td> |
| <td>Hardware binder device file.</td> |
| </tr> |
| <tr> |
| <td><code>/dev/tun</code></td> |
| <td>Universal TUN/TAP device file.</td> |
| </tr> |
| <tr> |
| <td><code>/dev/xt_qtaguid</code></td> |
| <td>QTAGUID netfilter device file.</td> |
| </tr> |
| </table> |
| |
| <h3 id="sysfs">sysfs</h3> |
| <table> |
| <tr> |
| <th>Path</th> |
| <th>Description</th> |
| </tr> |
| <tr> |
| <td><code>/sys/devices/system/cpu/online</code></td> |
| <td>Read-only file showing ranges of CPUs that are currently online.</td> |
| </tr> |
| <tr> |
| <td><code>/sys/kernel/wakeup_reasons/last_resume_reason</code></td> |
| <td>Read-only file showing a textual description of why the system exited the |
| last instance of suspend.</td> |
| </tr> |
| <tr> |
| <td><code>/sys/devices/system/cpu/kernel_max</code></td> |
| <td>Read-only file showing the maximum CPU index supported by the kernel. |
| </td> |
| </tr> |
| </table> |
| |
| <h3 id="selinuxfs">selinuxfs</h3> |
| <p>The framework mounts <code>selinuxfs</code> at <code>/sys/fs/selinux</code>. |
| </p> |
| |
| <table> |
| <tr> |
| <th>Path</th> |
| <th>Description</th> |
| </tr> |
| <tr> |
| <td><code>/sys/fs/selinux/checkreqprot</code></td> |
| <td>Read/write file containing a binary flag that determines how selinux |
| protections are checked on <code>mmap</code> and <code>mprotect</code> calls. |
| </td> |
| </tr> |
| <tr> |
| <td><code>/sys/fs/selinux/null</code></td> |
| <td>Read/write null device for use by selinux.</td> |
| </tr> |
| <tr> |
| <td><code>/sys/fs/selinux/policy</code></td> |
| <td>Read-only file containing the selinux policy in binary form.</td> |
| </tr> |
| </table> |
| |
| <aside class="note"><strong>Note:</strong> For details on SELinux in Android |
| 8.0, see <a href="/security/selinux/images/SELinux_Treble.pdf">SELinux for |
| Android 8.0</a>.</aside> |
| |
| </body> |
| </html> |