aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--METADATA3
-rw-r--r--PREUPLOAD.cfg7
-rw-r--r--TEST_MAPPING6
-rw-r--r--android-changes-for-ndk-developers.md15
-rw-r--r--apex/Android.bp75
-rw-r--r--apex/NOTICE203
-rw-r--r--apex/linker.config.json3
-rw-r--r--benchmarks/Android.bp40
-rw-r--r--benchmarks/NOTICE180
-rw-r--r--benchmarks/README.md2
-rw-r--r--benchmarks/get_heap_size_benchmark.cpp4
-rw-r--r--benchmarks/linker_relocation/Android.bp4
-rw-r--r--benchmarks/linker_relocation/gen/Android.bp4
-rwxr-xr-xbenchmarks/linker_relocation/regen/gen_bench.py9
-rw-r--r--benchmarks/pthread_benchmark.cpp7
-rw-r--r--benchmarks/semaphore_benchmark.cpp113
-rw-r--r--benchmarks/spawn/Android.bp32
-rw-r--r--benchmarks/spawn/AndroidTest.xml26
-rw-r--r--benchmarks/spawn/bench_cxa_atexit.cpp67
-rw-r--r--benchmarks/spawn/spawn_benchmarks.cpp2
-rw-r--r--benchmarks/stdio_benchmark.cpp3
-rw-r--r--benchmarks/stdlib_benchmark.cpp3
-rw-r--r--benchmarks/string_benchmark.cpp12
-rw-r--r--build/NOTICE203
-rwxr-xr-xbuild/coverage.sh65
-rw-r--r--docs/32-bit-abi.md24
-rw-r--r--docs/NOTICE203
-rw-r--r--docs/fdsan.md2
-rw-r--r--docs/fdtrack.md70
-rw-r--r--docs/libc_assembler.md3
-rw-r--r--docs/native_allocator.md2
-rw-r--r--libc/Android.bp554
-rw-r--r--libc/NOTICE1208
-rw-r--r--libc/SECCOMP_BLACKLIST_APP.TXT (renamed from libc/SECCOMP_BLOCKLIST_APP.TXT)6
-rw-r--r--libc/SECCOMP_BLACKLIST_COMMON.TXT10
-rw-r--r--libc/SECCOMP_BLOCKLIST_COMMON.TXT10
-rw-r--r--libc/SECCOMP_PRIORITY.TXT2
-rw-r--r--libc/SECCOMP_WHITELIST_APP.TXT (renamed from libc/SECCOMP_ALLOWLIST_APP.TXT)2
-rw-r--r--libc/SECCOMP_WHITELIST_COMMON.TXT (renamed from libc/SECCOMP_ALLOWLIST_COMMON.TXT)6
-rw-r--r--libc/SECCOMP_WHITELIST_SYSTEM.TXT (renamed from libc/SECCOMP_ALLOWLIST_SYSTEM.TXT)2
-rw-r--r--libc/SYSCALLS.TXT6
-rw-r--r--libc/arch-arm/bionic/__bionic_clone.S2
-rw-r--r--libc/arch-arm/bionic/__restore.S7
-rw-r--r--libc/arch-arm/bionic/kuser_helper_on.S4
-rw-r--r--libc/arch-arm/bionic/setjmp.S76
-rw-r--r--libc/arch-arm/generic/bionic/strlen.c4
-rw-r--r--libc/arch-arm64/bionic/__bionic_clone.S2
-rw-r--r--libc/arch-arm64/bionic/_exit_with_stack_teardown.S2
-rw-r--r--libc/arch-arm64/bionic/note_memtag_heap_async.S46
-rw-r--r--libc/arch-arm64/bionic/note_memtag_heap_sync.S46
-rw-r--r--libc/arch-arm64/bionic/setjmp.S19
-rw-r--r--libc/arch-arm64/bionic/syscall.S2
-rw-r--r--libc/arch-arm64/bionic/vfork.S6
-rw-r--r--libc/arch-arm64/default/bionic/memchr.S164
-rw-r--r--libc/arch-arm64/default/bionic/strchr.S153
-rw-r--r--libc/arch-arm64/default/bionic/strcmp.S192
-rw-r--r--libc/arch-arm64/default/bionic/strlen.S227
-rw-r--r--libc/arch-arm64/default/bionic/strncmp.S280
-rw-r--r--libc/arch-arm64/default/bionic/strnlen.S174
-rw-r--r--libc/arch-arm64/dynamic_function_dispatch.cpp77
-rw-r--r--libc/arch-arm64/generic/bionic/__memcpy_chk.S2
-rw-r--r--libc/arch-arm64/generic/bionic/memcmp.S167
-rw-r--r--libc/arch-arm64/generic/bionic/memcpy.S2
-rw-r--r--libc/arch-arm64/generic/bionic/memmove.S2
-rw-r--r--libc/arch-arm64/generic/bionic/memset.S2
-rw-r--r--libc/arch-arm64/generic/bionic/stpcpy.S29
-rw-r--r--libc/arch-arm64/generic/bionic/strcpy.S29
-rw-r--r--libc/arch-arm64/generic/bionic/string_copy.S245
-rw-r--r--libc/arch-arm64/generic/bionic/wmemmove.S2
-rw-r--r--libc/arch-arm64/mte/bionic/memchr.c (renamed from libc/include/android/legacy_unistd_inlines.h)12
-rw-r--r--libc/arch-arm64/mte/bionic/strchr.cpp30
-rw-r--r--libc/arch-arm64/mte/bionic/strcmp.c (renamed from libc/platform/scudo_platform_tls_slot.h)11
-rw-r--r--libc/arch-arm64/mte/bionic/strlen.c (renamed from libc/bionic/heap_zero_init.h)9
-rw-r--r--libc/arch-arm64/mte/bionic/strncmp.c32
-rw-r--r--libc/arch-arm64/mte/bionic/strnlen.c30
-rw-r--r--libc/arch-arm64/static_function_dispatch.S17
-rw-r--r--libc/arch-common/bionic/crtbegin.c19
-rw-r--r--libc/arch-common/bionic/crtbegin_so.c3
-rw-r--r--libc/arch-common/bionic/crtbrand.S10
-rw-r--r--libc/arch-common/bionic/crtend.S10
-rw-r--r--libc/arch-common/bionic/crtend_so.S10
-rw-r--r--libc/arch-x86/atom/string/sse2-memset-atom.S9
-rw-r--r--libc/arch-x86/bionic/__bionic_clone.S1
-rw-r--r--libc/arch-x86/bionic/__libc_init_sysinfo.cpp8
-rw-r--r--libc/arch-x86/bionic/__libc_int0x80.S7
-rw-r--r--libc/arch-x86/bionic/__restore.S102
-rw-r--r--libc/arch-x86/bionic/__stack_chk_fail_local.h (renamed from tests/sys_auxv_test.cpp)48
-rw-r--r--libc/arch-x86/bionic/__x86.get_pc_thunk.S53
-rw-r--r--libc/arch-x86/bionic/setjmp.S48
-rw-r--r--libc/arch-x86/silvermont/string/sse2-memset-slm.S9
-rw-r--r--libc/arch-x86_64/bionic/__restore_rt.S112
-rw-r--r--libc/arch-x86_64/bionic/setjmp.S72
-rw-r--r--libc/async_safe/Android.bp14
-rw-r--r--libc/async_safe/async_safe_log.cpp15
-rw-r--r--libc/async_safe/include/async_safe/CHECK.h14
-rw-r--r--libc/bionic/__bionic_get_shell_path.cpp5
-rw-r--r--libc/bionic/__libc_init_main_thread.cpp19
-rw-r--r--libc/bionic/android_unsafe_frame_pointer_chase.cpp13
-rw-r--r--libc/bionic/atexit.cpp102
-rw-r--r--libc/bionic/bionic_allocator.cpp20
-rw-r--r--libc/bionic/bionic_elf_tls.cpp40
-rw-r--r--libc/bionic/clock.cpp4
-rw-r--r--libc/bionic/eventfd_write.cpp (renamed from libc/private/bionic_asm_note.h)8
-rw-r--r--libc/bionic/exec.cpp15
-rw-r--r--libc/bionic/exit.cpp42
-rw-r--r--libc/bionic/fdsan.cpp8
-rw-r--r--libc/bionic/fdtrack.cpp8
-rw-r--r--libc/bionic/ffs.cpp5
-rw-r--r--libc/bionic/fgetxattr.cpp2
-rw-r--r--libc/bionic/flistxattr.cpp4
-rw-r--r--libc/bionic/fork.cpp8
-rw-r--r--libc/bionic/fortify.cpp3
-rw-r--r--libc/bionic/fts.c130
-rw-r--r--libc/bionic/getauxval.cpp8
-rw-r--r--libc/bionic/gethostname.cpp6
-rw-r--r--libc/bionic/grp_pwd.cpp46
-rw-r--r--libc/bionic/grp_pwd_file.cpp2
-rw-r--r--libc/bionic/grp_pwd_file.h3
-rw-r--r--libc/bionic/gwp_asan_wrappers.cpp1
-rw-r--r--libc/bionic/heap_tagging.cpp144
-rw-r--r--libc/bionic/heap_tagging.h14
-rw-r--r--libc/bionic/heap_zero_init.cpp39
-rw-r--r--libc/bionic/iconv.cpp4
-rw-r--r--libc/bionic/icu.cpp17
-rw-r--r--libc/bionic/libc_init_common.cpp46
-rw-r--r--libc/bionic/libc_init_common.h14
-rw-r--r--libc/bionic/libc_init_dynamic.cpp4
-rw-r--r--libc/bionic/libc_init_static.cpp190
-rw-r--r--libc/bionic/malloc_common.cpp16
-rw-r--r--libc/bionic/malloc_common_dynamic.cpp15
-rw-r--r--libc/bionic/malloc_heapprofd.cpp26
-rw-r--r--libc/bionic/malloc_tagged_pointers.h7
-rw-r--r--libc/bionic/memmem.cpp (renamed from libc/bionic/utmp.cpp)40
-rw-r--r--libc/bionic/ndk_cruft.cpp5
-rw-r--r--libc/bionic/new.cpp2
-rw-r--r--libc/bionic/pidfd.cpp42
-rw-r--r--libc/bionic/pthread_attr.cpp5
-rw-r--r--libc/bionic/pthread_cond.cpp23
-rw-r--r--libc/bionic/pthread_create.cpp22
-rw-r--r--libc/bionic/pthread_exit.cpp20
-rw-r--r--libc/bionic/pthread_internal.cpp76
-rw-r--r--libc/bionic/pthread_internal.h9
-rw-r--r--libc/bionic/pty.cpp46
-rw-r--r--libc/bionic/pututline.c (renamed from libc/bionic/empty_android_ids.h)43
-rw-r--r--libc/bionic/recvmsg.cpp2
-rw-r--r--libc/bionic/scandir.cpp9
-rw-r--r--libc/bionic/scudo/Android.bp63
-rw-r--r--libc/bionic/scudo/exported32.map16
-rw-r--r--libc/bionic/scudo/exported64.map14
-rw-r--r--libc/bionic/scudo/scudo.cpp165
-rw-r--r--libc/bionic/scudo_wrapper.cpp (renamed from tests/libs/thread_exit_cb_helper.cpp)54
-rw-r--r--libc/bionic/sigaction.cpp42
-rw-r--r--libc/bionic/strtol.cpp8
-rw-r--r--libc/bionic/swab.cpp13
-rw-r--r--libc/bionic/sys_thread_properties.cpp152
-rw-r--r--libc/bionic/sysinfo.cpp5
-rw-r--r--libc/bionic/system_property_set.cpp1
-rw-r--r--libc/bionic/tmpfile.cpp109
-rw-r--r--libc/dns/include/resolv_private.h16
-rw-r--r--libc/dns/include/resolv_static.h32
-rw-r--r--libc/dns/net/gethnamaddr.c17
-rw-r--r--libc/dns/net/getnameinfo.c3
-rw-r--r--libc/dns/net/getservent.c10
-rw-r--r--libc/dns/net/sethostent.c7
-rw-r--r--libc/dns/resolv/res_data.c327
-rw-r--r--libc/dns/resolv/res_data.cpp157
-rw-r--r--libc/dns/resolv/res_debug.c20
-rw-r--r--libc/dns/resolv/res_state.c25
-rw-r--r--libc/include/android/api-level.h62
-rw-r--r--libc/include/android/fdsan.h3
-rw-r--r--libc/include/android/legacy_signal_inlines.h26
-rw-r--r--libc/include/android/legacy_strings_inlines.h44
-rw-r--r--libc/include/android/versioning.h61
-rw-r--r--libc/include/bits/auxvec.h8
-rw-r--r--libc/include/bits/elf_arm64.h5
-rw-r--r--libc/include/bits/glibc-syscalls.h21
-rw-r--r--libc/include/bits/stdatomic.h2
-rw-r--r--libc/include/bits/wctype.h4
-rw-r--r--libc/include/dirent.h155
-rw-r--r--libc/include/locale.h2
-rw-r--r--libc/include/malloc.h126
-rw-r--r--libc/include/math.h22
-rw-r--r--libc/include/nl_types.h2
-rw-r--r--libc/include/pty.h7
-rw-r--r--libc/include/stdio.h2
-rw-r--r--libc/include/stdlib.h6
-rw-r--r--libc/include/strings.h44
-rw-r--r--libc/include/sys/auxv.h2
-rw-r--r--libc/include/sys/cdefs.h15
-rw-r--r--libc/include/sys/mman.h10
-rw-r--r--libc/include/sys/pidfd.h76
-rw-r--r--libc/include/sys/procfs.h16
-rw-r--r--libc/include/sys/thread_properties.h97
-rw-r--r--libc/include/unistd.h4
-rw-r--r--libc/include/utmp.h80
-rw-r--r--libc/kernel/README.md36
-rw-r--r--libc/kernel/android/scsi/scsi/scsi.h1
-rwxr-xr-xlibc/kernel/tools/clean_header.py12
-rwxr-xr-xlibc/kernel/tools/cpp.py263
-rw-r--r--libc/kernel/tools/defaults.py13
-rwxr-xr-xlibc/kernel/tools/generate_uapi_headers.sh19
-rw-r--r--libc/kernel/tools/kernel.py17
-rwxr-xr-xlibc/kernel/tools/update_all.py17
-rw-r--r--libc/kernel/tools/utils.py17
-rw-r--r--libc/kernel/uapi/asm-arm/asm/kvm.h216
-rw-r--r--libc/kernel/uapi/asm-arm/asm/setup.h2
-rw-r--r--libc/kernel/uapi/asm-arm/asm/signal.h9
-rw-r--r--libc/kernel/uapi/asm-arm/asm/types.h16
-rw-r--r--libc/kernel/uapi/asm-arm/asm/unistd-common.h7
-rw-r--r--libc/kernel/uapi/asm-arm64/asm/hwcap.h10
-rw-r--r--libc/kernel/uapi/asm-arm64/asm/kvm.h11
-rw-r--r--libc/kernel/uapi/asm-arm64/asm/mman.h5
-rw-r--r--libc/kernel/uapi/asm-arm64/asm/ptrace.h10
-rw-r--r--libc/kernel/uapi/asm-generic/hugetlb_encode.h1
-rw-r--r--libc/kernel/uapi/asm-generic/siginfo.h7
-rw-r--r--libc/kernel/uapi/asm-generic/signal-defs.h25
-rw-r--r--libc/kernel/uapi/asm-generic/signal.h9
-rw-r--r--libc/kernel/uapi/asm-generic/socket.h2
-rw-r--r--libc/kernel/uapi/asm-generic/unistd.h9
-rw-r--r--libc/kernel/uapi/asm-x86/asm/hwcap2.h1
-rw-r--r--libc/kernel/uapi/asm-x86/asm/kvm.h32
-rw-r--r--libc/kernel/uapi/asm-x86/asm/kvm_para.h11
-rw-r--r--libc/kernel/uapi/asm-x86/asm/mce.h1
-rw-r--r--libc/kernel/uapi/asm-x86/asm/sgx.h61
-rw-r--r--libc/kernel/uapi/asm-x86/asm/signal.h9
-rw-r--r--libc/kernel/uapi/asm-x86/asm/svm.h30
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd.h2
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_32.h7
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_64.h7
-rw-r--r--libc/kernel/uapi/asm-x86/asm/unistd_x32.h7
-rw-r--r--libc/kernel/uapi/asm-x86/asm/vmx.h7
-rw-r--r--libc/kernel/uapi/drm/amdgpu_drm.h16
-rw-r--r--libc/kernel/uapi/drm/drm.h1
-rw-r--r--libc/kernel/uapi/drm/drm_fourcc.h81
-rw-r--r--libc/kernel/uapi/drm/drm_mode.h13
-rw-r--r--libc/kernel/uapi/drm/i915_drm.h27
-rw-r--r--libc/kernel/uapi/drm/lima_drm.h1
-rw-r--r--libc/kernel/uapi/drm/msm_drm.h17
-rw-r--r--libc/kernel/uapi/drm/nouveau_drm.h1
-rw-r--r--libc/kernel/uapi/drm/virtgpu_drm.h28
-rw-r--r--libc/kernel/uapi/drm/vmwgfx_drm.h19
-rw-r--r--libc/kernel/uapi/linux/acrn.h263
-rw-r--r--libc/kernel/uapi/linux/android/binder.h1
-rw-r--r--libc/kernel/uapi/linux/audit.h4
-rw-r--r--libc/kernel/uapi/linux/b1lli.h64
-rw-r--r--libc/kernel/uapi/linux/batman_adv.h6
-rw-r--r--libc/kernel/uapi/linux/bcache.h50
-rw-r--r--libc/kernel/uapi/linux/binfmts.h2
-rw-r--r--libc/kernel/uapi/linux/blkzoned.h9
-rw-r--r--libc/kernel/uapi/linux/bpf.h444
-rw-r--r--libc/kernel/uapi/linux/btf.h8
-rw-r--r--libc/kernel/uapi/linux/btrfs.h20
-rw-r--r--libc/kernel/uapi/linux/btrfs_tree.h8
-rw-r--r--libc/kernel/uapi/linux/can.h8
-rw-r--r--libc/kernel/uapi/linux/can/isotp.h69
-rw-r--r--libc/kernel/uapi/linux/can/netlink.h1
-rw-r--r--libc/kernel/uapi/linux/can/raw.h3
-rw-r--r--libc/kernel/uapi/linux/capability.h5
-rw-r--r--libc/kernel/uapi/linux/ccs.h30
-rw-r--r--libc/kernel/uapi/linux/cdrom.h5
-rw-r--r--libc/kernel/uapi/linux/cfm_bridge.h66
-rw-r--r--libc/kernel/uapi/linux/cifs/cifs_netlink.h65
-rw-r--r--libc/kernel/uapi/linux/close_range.h23
-rw-r--r--libc/kernel/uapi/linux/const.h3
-rw-r--r--libc/kernel/uapi/linux/coresight-stm.h6
-rw-r--r--libc/kernel/uapi/linux/cxl_mem.h71
-rw-r--r--libc/kernel/uapi/linux/devlink.h76
-rw-r--r--libc/kernel/uapi/linux/dm-ioctl.h4
-rw-r--r--libc/kernel/uapi/linux/dm-user.h65
-rw-r--r--libc/kernel/uapi/linux/dma-buf.h2
-rw-r--r--libc/kernel/uapi/linux/dma-heap.h33
-rw-r--r--libc/kernel/uapi/linux/dqblk_xfs.h6
-rw-r--r--libc/kernel/uapi/linux/elf.h5
-rw-r--r--libc/kernel/uapi/linux/elfcore.h69
-rw-r--r--libc/kernel/uapi/linux/errqueue.h11
-rw-r--r--libc/kernel/uapi/linux/ethtool.h87
-rw-r--r--libc/kernel/uapi/linux/ethtool_netlink.h467
-rw-r--r--libc/kernel/uapi/linux/f2fs.h85
-rw-r--r--libc/kernel/uapi/linux/fanotify.h7
-rw-r--r--libc/kernel/uapi/linux/fb.h1
-rw-r--r--libc/kernel/uapi/linux/fcntl.h2
-rw-r--r--libc/kernel/uapi/linux/fd.h17
-rw-r--r--libc/kernel/uapi/linux/fdreg.h19
-rw-r--r--libc/kernel/uapi/linux/fiemap.h4
-rw-r--r--libc/kernel/uapi/linux/fpga-dfl.h11
-rw-r--r--libc/kernel/uapi/linux/fs.h1
-rw-r--r--libc/kernel/uapi/linux/fscrypt.h21
-rw-r--r--libc/kernel/uapi/linux/fsl_mc.h30
-rw-r--r--libc/kernel/uapi/linux/fsverity.h28
-rw-r--r--libc/kernel/uapi/linux/fuse.h46
-rw-r--r--libc/kernel/uapi/linux/genetlink.h11
-rw-r--r--libc/kernel/uapi/linux/gfs2_ondisk.h10
-rw-r--r--libc/kernel/uapi/linux/gigaset_dev.h (renamed from libc/kernel/uapi/linux/remoteproc_cdev.h)16
-rw-r--r--libc/kernel/uapi/linux/gpio.h124
-rw-r--r--libc/kernel/uapi/linux/gtp.h1
-rw-r--r--libc/kernel/uapi/linux/hdlc/ioctl.h8
-rw-r--r--libc/kernel/uapi/linux/hidraw.h5
-rw-r--r--libc/kernel/uapi/linux/hyperv.h4
-rw-r--r--libc/kernel/uapi/linux/hysdn_if.h (renamed from libc/kernel/uapi/linux/pidfd.h)19
-rw-r--r--libc/kernel/uapi/linux/i2c.h1
-rw-r--r--libc/kernel/uapi/linux/icmp.h17
-rw-r--r--libc/kernel/uapi/linux/icmpv6.h2
-rw-r--r--libc/kernel/uapi/linux/idxd.h278
-rw-r--r--libc/kernel/uapi/linux/if.h2
-rw-r--r--libc/kernel/uapi/linux/if_alg.h8
-rw-r--r--libc/kernel/uapi/linux/if_bonding.h9
-rw-r--r--libc/kernel/uapi/linux/if_bridge.h330
-rw-r--r--libc/kernel/uapi/linux/if_ether.h2
-rw-r--r--libc/kernel/uapi/linux/if_frad.h79
-rw-r--r--libc/kernel/uapi/linux/if_link.h42
-rw-r--r--libc/kernel/uapi/linux/if_macsec.h14
-rw-r--r--libc/kernel/uapi/linux/if_packet.h11
-rw-r--r--libc/kernel/uapi/linux/if_xdp.h3
-rw-r--r--libc/kernel/uapi/linux/iio/types.h1
-rw-r--r--libc/kernel/uapi/linux/in.h5
-rw-r--r--libc/kernel/uapi/linux/in6.h1
-rw-r--r--libc/kernel/uapi/linux/incrementalfs.h176
-rw-r--r--libc/kernel/uapi/linux/inet_diag.h14
-rw-r--r--libc/kernel/uapi/linux/input-event-codes.h11
-rw-r--r--libc/kernel/uapi/linux/io_uring.h152
-rw-r--r--libc/kernel/uapi/linux/iommu.h17
-rw-r--r--libc/kernel/uapi/linux/ipmi_msgdefs.h2
-rw-r--r--libc/kernel/uapi/linux/ipv6.h3
-rw-r--r--libc/kernel/uapi/linux/kernel.h4
-rw-r--r--libc/kernel/uapi/linux/keyboard.h2
-rw-r--r--libc/kernel/uapi/linux/keyctl.h2
-rw-r--r--libc/kernel/uapi/linux/kfd_ioctl.h24
-rw-r--r--libc/kernel/uapi/linux/kvm.h169
-rw-r--r--libc/kernel/uapi/linux/l2tp.h2
-rw-r--r--libc/kernel/uapi/linux/lirc.h1
-rw-r--r--libc/kernel/uapi/linux/loop.h10
-rw-r--r--libc/kernel/uapi/linux/lwtunnel.h1
-rw-r--r--libc/kernel/uapi/linux/magic.h3
-rw-r--r--libc/kernel/uapi/linux/mdio.h24
-rw-r--r--libc/kernel/uapi/linux/media-bus-format.h3
-rw-r--r--libc/kernel/uapi/linux/media.h1
-rw-r--r--libc/kernel/uapi/linux/mei.h12
-rw-r--r--libc/kernel/uapi/linux/membarrier.h5
-rw-r--r--libc/kernel/uapi/linux/mempolicy.h3
-rw-r--r--libc/kernel/uapi/linux/mic_common.h96
-rw-r--r--libc/kernel/uapi/linux/mic_ioctl.h (renamed from libc/kernel/uapi/misc/uacce/hisi_qm.h)19
-rw-r--r--libc/kernel/uapi/linux/mii.h17
-rw-r--r--libc/kernel/uapi/linux/misc/bcm_vk.h70
-rw-r--r--libc/kernel/uapi/linux/mman.h2
-rw-r--r--libc/kernel/uapi/linux/mmc/ioctl.h1
-rw-r--r--libc/kernel/uapi/linux/mount.h10
-rw-r--r--libc/kernel/uapi/linux/mptcp.h134
-rw-r--r--libc/kernel/uapi/linux/mroute.h3
-rw-r--r--libc/kernel/uapi/linux/mroute6.h2
-rw-r--r--libc/kernel/uapi/linux/mrp_bridge.h79
-rw-r--r--libc/kernel/uapi/linux/ndctl.h5
-rw-r--r--libc/kernel/uapi/linux/neighbour.h13
-rw-r--r--libc/kernel/uapi/linux/net_dropmon.h1
-rw-r--r--libc/kernel/uapi/linux/net_tstamp.h3
-rw-r--r--libc/kernel/uapi/linux/netfilter.h3
-rw-r--r--libc/kernel/uapi/linux/netfilter/ipset/ip_set.h6
-rw-r--r--libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h6
-rw-r--r--libc/kernel/uapi/linux/netfilter/nf_nat.h3
-rw-r--r--libc/kernel/uapi/linux/netfilter/nf_tables.h58
-rw-r--r--libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h9
-rw-r--r--libc/kernel/uapi/linux/netfilter/nfnetlink_cthelper.h2
-rw-r--r--libc/kernel/uapi/linux/netfilter/x_tables.h2
-rw-r--r--libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h10
-rw-r--r--libc/kernel/uapi/linux/netlink.h38
-rw-r--r--libc/kernel/uapi/linux/nexthop.h1
-rw-r--r--libc/kernel/uapi/linux/nfs3.h5
-rw-r--r--libc/kernel/uapi/linux/nfs4.h5
-rw-r--r--libc/kernel/uapi/linux/nfs_fs.h1
-rw-r--r--libc/kernel/uapi/linux/nfsacl.h2
-rw-r--r--libc/kernel/uapi/linux/nitro_enclaves.h67
-rw-r--r--libc/kernel/uapi/linux/nl80211.h176
-rw-r--r--libc/kernel/uapi/linux/openat2.h33
-rw-r--r--libc/kernel/uapi/linux/openvswitch.h17
-rw-r--r--libc/kernel/uapi/linux/pci_regs.h21
-rw-r--r--libc/kernel/uapi/linux/pcitest.h6
-rw-r--r--libc/kernel/uapi/linux/perf_event.h50
-rw-r--r--libc/kernel/uapi/linux/pkt_cls.h27
-rw-r--r--libc/kernel/uapi/linux/pkt_sched.h55
-rw-r--r--libc/kernel/uapi/linux/ppp-ioctl.h2
-rw-r--r--libc/kernel/uapi/linux/prctl.h14
-rw-r--r--libc/kernel/uapi/linux/psample.h21
-rw-r--r--libc/kernel/uapi/linux/psp-sev.h1
-rw-r--r--libc/kernel/uapi/linux/ptp_clock.h17
-rw-r--r--libc/kernel/uapi/linux/ptrace.h3
-rw-r--r--libc/kernel/uapi/linux/random.h1
-rw-r--r--libc/kernel/uapi/linux/raw.h1
-rw-r--r--libc/kernel/uapi/linux/rds.h3
-rw-r--r--libc/kernel/uapi/linux/rfkill.h17
-rw-r--r--libc/kernel/uapi/linux/rkisp1-config.h371
-rw-r--r--libc/kernel/uapi/linux/rpl.h43
-rw-r--r--libc/kernel/uapi/linux/rpl_iptunnel.h28
-rw-r--r--libc/kernel/uapi/linux/rpmsg_types.h25
-rw-r--r--libc/kernel/uapi/linux/rtc.h13
-rw-r--r--libc/kernel/uapi/linux/rtnetlink.h22
-rw-r--r--libc/kernel/uapi/linux/rxrpc.h2
-rw-r--r--libc/kernel/uapi/linux/sched.h4
-rw-r--r--libc/kernel/uapi/linux/sctp.h6
-rw-r--r--libc/kernel/uapi/linux/sdla.h91
-rw-r--r--libc/kernel/uapi/linux/seccomp.h12
-rw-r--r--libc/kernel/uapi/linux/seg6_local.h1
-rw-r--r--libc/kernel/uapi/linux/serial_core.h16
-rw-r--r--libc/kernel/uapi/linux/serio.h9
-rw-r--r--libc/kernel/uapi/linux/smc.h105
-rw-r--r--libc/kernel/uapi/linux/snmp.h5
-rw-r--r--libc/kernel/uapi/linux/sock_diag.h20
-rw-r--r--libc/kernel/uapi/linux/spi/spi.h44
-rw-r--r--libc/kernel/uapi/linux/spi/spidev.h17
-rw-r--r--libc/kernel/uapi/linux/stat.h9
-rw-r--r--libc/kernel/uapi/linux/surface_aggregator/cdev.h46
-rw-r--r--libc/kernel/uapi/linux/swab.h4
-rw-r--r--libc/kernel/uapi/linux/switchtec_ioctl.h14
-rw-r--r--libc/kernel/uapi/linux/sysctl.h3
-rw-r--r--libc/kernel/uapi/linux/target_core_user.h21
-rw-r--r--libc/kernel/uapi/linux/taskstats.h3
-rw-r--r--libc/kernel/uapi/linux/tc_act/tc_gate.h56
-rw-r--r--libc/kernel/uapi/linux/tc_act/tc_mpls.h1
-rw-r--r--libc/kernel/uapi/linux/tc_act/tc_vlan.h4
-rw-r--r--libc/kernel/uapi/linux/tcp.h19
-rw-r--r--libc/kernel/uapi/linux/tee.h6
-rw-r--r--libc/kernel/uapi/linux/termios.h11
-rw-r--r--libc/kernel/uapi/linux/thermal.h75
-rw-r--r--libc/kernel/uapi/linux/time.h14
-rw-r--r--libc/kernel/uapi/linux/tipc.h1
-rw-r--r--libc/kernel/uapi/linux/tipc_netlink.h4
-rw-r--r--libc/kernel/uapi/linux/tls.h13
-rw-r--r--libc/kernel/uapi/linux/udp.h1
-rw-r--r--libc/kernel/uapi/linux/um_timetravel.h38
-rw-r--r--libc/kernel/uapi/linux/usb/ch9.h25
-rw-r--r--libc/kernel/uapi/linux/usb/charger.h16
-rw-r--r--libc/kernel/uapi/linux/usb/raw_gadget.h89
-rw-r--r--libc/kernel/uapi/linux/usb/tmc.h2
-rw-r--r--libc/kernel/uapi/linux/userfaultfd.h14
-rw-r--r--libc/kernel/uapi/linux/v4l2-controls.h645
-rw-r--r--libc/kernel/uapi/linux/v4l2-mediabus.h9
-rw-r--r--libc/kernel/uapi/linux/v4l2-subdev.h15
-rw-r--r--libc/kernel/uapi/linux/vbox_vmmdev_types.h3
-rw-r--r--libc/kernel/uapi/linux/vboxguest.h17
-rw-r--r--libc/kernel/uapi/linux/vdpa.h43
-rw-r--r--libc/kernel/uapi/linux/version.h7
-rw-r--r--libc/kernel/uapi/linux/vfio.h77
-rw-r--r--libc/kernel/uapi/linux/vfio_ccw.h8
-rw-r--r--libc/kernel/uapi/linux/vhost.h11
-rw-r--r--libc/kernel/uapi/linux/vhost_types.h11
-rw-r--r--libc/kernel/uapi/linux/videodev2.h43
-rw-r--r--libc/kernel/uapi/linux/virtio_9p.h4
-rw-r--r--libc/kernel/uapi/linux/virtio_balloon.h12
-rw-r--r--libc/kernel/uapi/linux/virtio_blk.h26
-rw-r--r--libc/kernel/uapi/linux/virtio_config.h3
-rw-r--r--libc/kernel/uapi/linux/virtio_console.h8
-rw-r--r--libc/kernel/uapi/linux/virtio_crypto.h26
-rw-r--r--libc/kernel/uapi/linux/virtio_fs.h3
-rw-r--r--libc/kernel/uapi/linux/virtio_gpu.h78
-rw-r--r--libc/kernel/uapi/linux/virtio_ids.h8
-rw-r--r--libc/kernel/uapi/linux/virtio_input.h18
-rw-r--r--libc/kernel/uapi/linux/virtio_mem.h81
-rw-r--r--libc/kernel/uapi/linux/virtio_mmio.h5
-rw-r--r--libc/kernel/uapi/linux/virtio_net.h75
-rw-r--r--libc/kernel/uapi/linux/virtio_pci.h9
-rw-r--r--libc/kernel/uapi/linux/virtio_pmem.h4
-rw-r--r--libc/kernel/uapi/linux/virtio_ring.h20
-rw-r--r--libc/kernel/uapi/linux/virtio_scsi.h20
-rw-r--r--libc/kernel/uapi/linux/vm_sockets.h7
-rw-r--r--libc/kernel/uapi/linux/vsoc_shm.h84
-rw-r--r--libc/kernel/uapi/linux/watch_queue.h85
-rw-r--r--libc/kernel/uapi/linux/wimax.h (renamed from libc/kernel/uapi/linux/vfio_zdev.h)84
-rw-r--r--libc/kernel/uapi/linux/wimax/i2400m.h309
-rw-r--r--libc/kernel/uapi/linux/wireguard.h76
-rw-r--r--libc/kernel/uapi/linux/wireless.h3
-rw-r--r--libc/kernel/uapi/linux/xattr.h2
-rw-r--r--libc/kernel/uapi/linux/xdp_diag.h10
-rw-r--r--libc/kernel/uapi/linux/xfrm.h1
-rw-r--r--libc/kernel/uapi/misc/fastrpc.h1
-rw-r--r--libc/kernel/uapi/misc/habanalabs.h278
-rw-r--r--libc/kernel/uapi/misc/pvpanic.h23
-rw-r--r--libc/kernel/uapi/misc/uacce/uacce.h30
-rw-r--r--libc/kernel/uapi/mtd/mtd-abi.h1
-rw-r--r--libc/kernel/uapi/rdma/efa-abi.h12
-rw-r--r--libc/kernel/uapi/rdma/hfi/hfi1_user.h1
-rw-r--r--libc/kernel/uapi/rdma/hns-abi.h12
-rw-r--r--libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h123
-rw-r--r--libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h57
-rw-r--r--libc/kernel/uapi/rdma/ib_user_verbs.h16
-rw-r--r--libc/kernel/uapi/rdma/mlx5-abi.h15
-rw-r--r--libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h62
-rw-r--r--libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h8
-rw-r--r--libc/kernel/uapi/rdma/qedr-abi.h24
-rw-r--r--libc/kernel/uapi/rdma/rdma_netlink.h5
-rw-r--r--libc/kernel/uapi/rdma/rdma_user_cm.h14
-rw-r--r--libc/kernel/uapi/rdma/rdma_user_rxe.h14
-rw-r--r--libc/kernel/uapi/rdma/vmw_pvrdma-abi.h6
-rw-r--r--libc/kernel/uapi/scsi/fc/fc_els.h131
-rw-r--r--libc/kernel/uapi/scsi/scsi_bsg_ufs.h1
-rw-r--r--libc/kernel/uapi/sound/asoc.h16
-rw-r--r--libc/kernel/uapi/sound/asound.h125
-rw-r--r--libc/kernel/uapi/sound/compress_offload.h2
-rw-r--r--libc/kernel/uapi/sound/compress_params.h34
-rw-r--r--libc/kernel/uapi/sound/emu10k1.h38
-rw-r--r--libc/kernel/uapi/sound/hdsp.h11
-rw-r--r--libc/kernel/uapi/sound/hdspm.h7
-rw-r--r--libc/kernel/uapi/sound/skl-tplg-interface.h2
-rw-r--r--libc/kernel/uapi/sound/sof/abi.h2
-rw-r--r--libc/kernel/uapi/sound/sof/tokens.h15
-rw-r--r--libc/libc.map.txt21
-rw-r--r--libc/malloc_debug/Android.bp10
-rw-r--r--libc/malloc_debug/MapData.cpp7
-rw-r--r--libc/malloc_debug/PointerData.cpp4
-rw-r--r--libc/malloc_debug/UnwindBacktrace.cpp10
-rw-r--r--libc/malloc_debug/malloc_debug.cpp7
-rw-r--r--libc/malloc_debug/tests/malloc_debug_system_tests.cpp71
-rw-r--r--libc/malloc_hooks/Android.bp10
-rw-r--r--libc/malloc_hooks/README.md4
-rw-r--r--libc/platform/bionic/fdtrack.h4
-rw-r--r--libc/platform/bionic/macros.h10
-rw-r--r--libc/platform/bionic/malloc.h18
-rw-r--r--libc/platform/bionic/mte.h12
-rw-r--r--libc/platform/bionic/mte_kernel.h (renamed from libc/include/bits/swab.h)39
-rw-r--r--libc/platform/bionic/pac.h42
-rw-r--r--libc/platform/bionic/reserved_signals.h8
-rw-r--r--libc/private/WriteProtected.h42
-rw-r--r--libc/private/bionic_allocator.h5
-rw-r--r--libc/private/bionic_asm.h10
-rw-r--r--libc/private/bionic_asm_arm64.h35
-rw-r--r--libc/private/bionic_asm_dwarf_exprs.h101
-rw-r--r--libc/private/bionic_auxv.h2
-rw-r--r--libc/private/bionic_defs.h8
-rw-r--r--libc/private/bionic_elf_tls.h26
-rw-r--r--libc/private/bionic_fdtrack.h81
-rw-r--r--libc/private/bionic_fortify.h8
-rw-r--r--libc/private/bionic_globals.h17
-rw-r--r--libc/private/bionic_ifuncs.h3
-rw-r--r--libc/private/bionic_inline_raise.h12
-rw-r--r--libc/private/bionic_string_utils.h (renamed from libc/private/bsd_sys_param.h)18
-rw-r--r--libc/seccomp/seccomp_policy.cpp4
-rw-r--r--libc/stdio/local.h4
-rw-r--r--libc/stdio/stdio.cpp93
-rw-r--r--libc/stdlib/exit.c42
-rw-r--r--libc/system_properties/Android.bp27
-rw-r--r--libc/system_properties/context_lookup_benchmark.cpp145
-rw-r--r--libc/system_properties/context_lookup_benchmark_data.h1011
-rw-r--r--libc/system_properties/contexts_split.cpp12
-rw-r--r--libc/system_properties/include/system_properties/contexts_split.h4
-rw-r--r--libc/system_properties/system_properties.cpp2
-rw-r--r--libc/tools/Android.bp42
-rwxr-xr-xlibc/tools/check-symbols-glibc.py36
-rwxr-xr-xlibc/tools/check-symbols.py87
-rwxr-xr-xlibc/tools/generate-NOTICE.py (renamed from libc/tools/generate_notice.py)148
-rwxr-xr-xlibc/tools/genfunctosyscallnrs.py95
-rwxr-xr-xlibc/tools/genseccomp.py88
-rwxr-xr-xlibc/tools/genserv.py2
-rwxr-xr-xlibc/tools/gensyscalls.py27
-rw-r--r--libc/tools/mypy.ini3
-rwxr-xr-xlibc/tools/ndk_missing_symbols.py2
-rw-r--r--libc/tools/pylintrc286
-rw-r--r--libc/tools/symbols.py7
-rwxr-xr-xlibc/tools/test_genseccomp.py195
-rw-r--r--libc/tzcode/bionic.cpp51
-rw-r--r--libc/tzcode/strptime.c171
-rw-r--r--libc/upstream-netbsd/android/include/netbsd-compat.h2
-rw-r--r--libc/upstream-netbsd/lib/libc/gen/utmp.c106
-rw-r--r--libc/upstream-netbsd/lib/libc/stdlib/_rand48.c16
-rw-r--r--libc/upstream-openbsd/android/include/arc4random.h8
-rw-r--r--libc/upstream-openbsd/android/include/openbsd-compat.h12
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h14
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h6
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/gethex.c7
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c26
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/misc.c4
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/strtod.c5
-rw-r--r--libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c5
-rw-r--r--libc/upstream-openbsd/lib/libc/gen/fnmatch.c695
-rw-r--r--libc/upstream-openbsd/lib/libc/locale/mbtowc.c15
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/fgetln.c22
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/fputwc.c4
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/fvwrite.c18
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/fwide.c6
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/getdelim.c6
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/open_memstream.c8
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/tempnam.c100
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/tmpnam.c53
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/vasprintf.c27
-rw-r--r--libc/upstream-openbsd/lib/libc/stdio/vdprintf.c4
-rw-r--r--libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c81
-rw-r--r--libc/upstream-openbsd/lib/libc/stdlib/setenv.c29
-rw-r--r--libc/upstream-openbsd/lib/libc/string/memmem.c184
-rw-r--r--libc/upstream-openbsd/lib/libc/string/strstr.c14
-rw-r--r--libdl/Android.bp48
-rw-r--r--libdl/NOTICE214
l---------libfdtrack/.clang-format2
-rw-r--r--libfdtrack/Android.bp15
-rw-r--r--libfdtrack/NOTICE56
-rw-r--r--libfdtrack/fdtrack.cpp142
-rw-r--r--libfdtrack/libfdtrack.map.txt1
-rw-r--r--libm/Android.bp45
-rw-r--r--libm/NOTICE1158
-rw-r--r--libm/arm64/lrint.S2
-rw-r--r--libm/arm64/sqrt.S2
-rw-r--r--libm/upstream-freebsd/lib/msun/bsdsrc/b_exp.c10
-rw-r--r--libm/upstream-freebsd/lib/msun/bsdsrc/b_log.c10
-rw-r--r--libm/upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c10
-rw-r--r--libm/upstream-freebsd/lib/msun/bsdsrc/mathimpl.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/e_powl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/e_rem_pio2l.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/invtrig.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/invtrig.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/k_expl.h16
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/s_exp2l.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/s_expl.c7
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/s_logl.c23
-rw-r--r--libm/upstream-freebsd/lib/msun/ld128/s_nanl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/catrig.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/catrigf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/catrigl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_asin.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_atan2.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_atan2f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_atan2l.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_coshl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_exp.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_expf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_fmod.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_fmodf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_fmodl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_hypot.c8
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_hypotf.c4
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_hypotl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_j0.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_j0f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_j1.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_j1f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_jn.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_jnf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_lgammaf_r.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_pow.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_powf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_rem_pio2.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_remainder.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_remainderf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_remainderl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_sinhl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/e_sqrtl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_exp.c9
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_expf.c9
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_sincos.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_sincosf.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/k_sincosl.h6
-rw-r--r--libm/upstream-freebsd/lib/msun/src/math_private.h2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_carg.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cargf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cargl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cbrt.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_ccosh.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_ccoshf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cexp.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cexpf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cimag.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cimagf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cimagl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_clog.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_clogf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_clogl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_conj.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_conjf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_conjl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_copysignl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cosl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cpow.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cpowf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cpowl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cproj.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cprojf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_cprojl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_creal.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_crealf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_creall.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_csinh.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_csinhf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_csqrt.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_csqrtf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_csqrtl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_ctanh.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_ctanhf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_erf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_exp2.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_exp2f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_expm1.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_expm1f.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fabsl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fdim.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fma.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmaf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmal.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmax.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmaxf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmaxl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fmin.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fminf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_fminl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_frexpl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_logbl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_lrint.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_lround.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_modfl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_nan.c11
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_nearbyint.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_remquo.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_remquof.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_remquol.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_rintl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_round.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_roundf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_roundl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_scalbln.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_scalbn.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_scalbnf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_scalbnl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_sincos.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_sincosf.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_sincosl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_sinl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_tanhl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_tanl.c2
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_tgammaf.c2
-rw-r--r--libm/x86/e_acos.S2
-rw-r--r--libm/x86/e_asin.S2
-rw-r--r--libm/x86/e_atan2.S2
-rw-r--r--libm/x86/e_cosh.S2
-rw-r--r--libm/x86/e_hypot.S2
-rw-r--r--libm/x86/e_log10.S2
-rw-r--r--libm/x86/e_sinh.S2
-rw-r--r--libm/x86/libm_reduce_pi04l.S2
-rw-r--r--libm/x86/libm_sincos_huge.S2
-rw-r--r--libm/x86/libm_tancot_huge.S2
-rw-r--r--libm/x86/s_atan.S2
-rw-r--r--libm/x86/s_cbrt.S2
-rw-r--r--libm/x86/s_cos.S2
-rw-r--r--libm/x86/s_expm1.S2
-rw-r--r--libm/x86/s_log1p.S2
-rw-r--r--libm/x86/s_sin.S2
-rw-r--r--libm/x86/s_tan.S2
-rw-r--r--libm/x86/s_tanh.S2
-rw-r--r--libm/x86_64/e_acos.S2
-rw-r--r--libm/x86_64/e_asin.S2
-rw-r--r--libm/x86_64/e_atan2.S2
-rw-r--r--libm/x86_64/e_cosh.S2
-rw-r--r--libm/x86_64/e_hypot.S2
-rw-r--r--libm/x86_64/e_log10.S2
-rw-r--r--libm/x86_64/e_sinh.S2
-rw-r--r--libm/x86_64/s_atan.S2
-rw-r--r--libm/x86_64/s_cbrt.S2
-rw-r--r--libm/x86_64/s_cos.S2
-rw-r--r--libm/x86_64/s_expm1.S2
-rw-r--r--libm/x86_64/s_log1p.S2
-rw-r--r--libm/x86_64/s_sin.S2
-rw-r--r--libm/x86_64/s_tan.S2
-rw-r--r--libm/x86_64/s_tanh.S2
-rw-r--r--libstdc++/NOTICE16
-rw-r--r--libstdc++/include/new22
-rw-r--r--linker/Android.bp87
-rw-r--r--linker/MODULE_LICENSE_APACHE2 (renamed from linker/MODULE_LICENSE_BSD)0
-rw-r--r--linker/NOTICE311
-rw-r--r--linker/dlfcn.cpp3
-rw-r--r--linker/ld.config.format.md4
-rw-r--r--[-rwxr-xr-x]linker/ldd (renamed from linker/ldd.sh)2
-rw-r--r--linker/linker.cpp363
-rw-r--r--linker/linker.h16
-rw-r--r--linker/linker_block_allocator.cpp26
-rw-r--r--linker/linker_block_allocator_test.cpp10
-rw-r--r--linker/linker_cfi.cpp3
-rw-r--r--linker/linker_config.cpp15
-rw-r--r--linker/linker_config.h11
-rw-r--r--linker/linker_config_test.cpp13
-rw-r--r--linker/linker_debuggerd_android.cpp30
-rw-r--r--linker/linker_globals.cpp11
-rw-r--r--linker/linker_globals.h3
-rw-r--r--linker/linker_logger.cpp10
-rw-r--r--linker/linker_logger.h4
-rw-r--r--linker/linker_main.cpp39
-rw-r--r--linker/linker_main.h1
-rw-r--r--linker/linker_namespaces.cpp5
-rw-r--r--linker/linker_namespaces.h31
-rw-r--r--linker/linker_note_gnu_property.cpp186
-rw-r--r--linker/linker_note_gnu_property.h93
-rw-r--r--linker/linker_note_gnu_property_test.cpp435
-rw-r--r--linker/linker_phdr.cpp165
-rw-r--r--linker/linker_phdr.h19
-rw-r--r--linker/linker_sdk_versions.cpp5
-rw-r--r--linker/linker_soinfo.cpp31
-rw-r--r--linker/linker_soinfo.h14
-rw-r--r--linker/linker_tls.cpp2
-rw-r--r--linker/linker_translate_path.cpp34
-rw-r--r--linker/linker_transparent_hugepage_support.cpp44
-rw-r--r--tests/Android.bp423
-rw-r--r--tests/Android.build.prebuilt.mk30
-rw-r--r--tests/Android.mk37
-rw-r--r--tests/BionicDeathTest.h48
-rw-r--r--tests/NOTICE356
-rw-r--r--tests/__cxa_demangle_test.cpp48
-rw-r--r--tests/arpa_inet_test.cpp92
-rw-r--r--tests/assert_test.cpp8
-rw-r--r--tests/bionic_allocator_test.cpp8
-rw-r--r--tests/cfi_test.cpp9
-rw-r--r--tests/clang_fortify_tests.cpp55
-rw-r--r--tests/dirent_test.cpp12
-rw-r--r--tests/dl_test.cpp86
-rw-r--r--tests/dlext_private.h4
-rw-r--r--tests/dlext_test.cpp45
-rw-r--r--tests/dlfcn_test.cpp36
-rw-r--r--tests/error_test.cpp4
-rw-r--r--tests/eventfd_test.cpp4
-rw-r--r--tests/fdsan_test.cpp52
-rw-r--r--tests/fdtrack_test.cpp138
-rw-r--r--tests/fenv_test.cpp12
-rw-r--r--tests/fnmatch_test.cpp123
-rw-r--r--tests/fortify_test.cpp23
-rw-r--r--tests/ftw_test.cpp14
-rw-r--r--tests/grp_pwd_test.cpp40
-rw-r--r--tests/gtest_globals.cpp9
-rw-r--r--tests/gtest_globals.h6
-rw-r--r--tests/gtest_globals_cts.cpp11
-rw-r--r--tests/headers/Android.bp4
-rw-r--r--tests/headers/posix/Android.bp4
-rw-r--r--tests/headers/posix/strings_h.c4
-rw-r--r--tests/heap_tagging_level_test.cpp212
-rw-r--r--tests/iconv_test.cpp8
-rw-r--r--tests/ifunc_test.cpp3
-rw-r--r--tests/leak_test.cpp21
-rw-r--r--tests/libs/Android.bp105
-rw-r--r--tests/libs/Android.build.dlext_testzip.mk7
-rw-r--r--tests/libs/dlopen_b.cpp7
-rw-r--r--tests/libs/elftls_dynamic.cpp4
-rw-r--r--tests/libs/heap_tagging_helper.cpp52
-rw-r--r--tests/libs/ld_config_test_helper.cpp9
-rw-r--r--tests/libs/ld_config_test_helper_lib1.cpp21
-rw-r--r--tests/libs/ld_config_test_helper_lib2.cpp12
-rw-r--r--tests/libs/ld_config_test_helper_lib3.cpp24
-rw-r--r--tests/libs/segment_gap_outer.cpp5
-rw-r--r--tests/libs/segment_gap_outer.lds22
-rw-r--r--tests/libs/tls_properties_helper.cpp128
-rw-r--r--tests/link_test.cpp2
-rw-r--r--tests/make_fortify_compile_test.mk4
-rw-r--r--tests/malloc_iterate_test.cpp6
-rw-r--r--tests/malloc_test.cpp229
-rw-r--r--tests/math_test.cpp24
-rw-r--r--tests/mte_test.cpp14
-rw-r--r--tests/netinet_ether_test.cpp10
-rw-r--r--tests/netinet_in_test.cpp9
-rw-r--r--tests/pidfd_test.cpp107
-rw-r--r--tests/prio_ctor_test.cpp41
-rw-r--r--tests/pthread_test.cpp57
-rw-r--r--tests/pty_test.cpp54
-rw-r--r--tests/sched_test.cpp4
-rw-r--r--tests/search_test.cpp28
-rw-r--r--tests/semaphore_test.cpp10
-rw-r--r--tests/setjmp_test.cpp64
-rw-r--r--tests/signal_test.cpp99
-rw-r--r--tests/stack_protector_test.cpp5
-rw-r--r--tests/stack_unwinding_test.cpp31
-rw-r--r--tests/stdatomic_test.cpp6
-rw-r--r--tests/stdio_test.cpp277
-rw-r--r--tests/stdlib_test.cpp41
-rw-r--r--tests/string_test.cpp67
-rw-r--r--tests/strings_test.cpp42
-rw-r--r--tests/struct_layout_test.cpp158
-rw-r--r--tests/sys_epoll_test.cpp6
-rw-r--r--tests/sys_procfs_test.cpp15
-rw-r--r--tests/sys_socket_test.cpp2
-rw-r--r--tests/sys_stat_test.cpp6
-rw-r--r--tests/sys_thread_properties_test.cpp47
-rw-r--r--tests/sys_vfs_test.cpp28
-rw-r--r--tests/sys_wait_test.cpp44
-rw-r--r--tests/sys_xattr_test.cpp13
-rw-r--r--tests/system_properties_test.cpp4
-rw-r--r--tests/tagged_pointers_test.cpp84
-rw-r--r--tests/threads_test.cpp5
-rw-r--r--tests/time_test.cpp144
-rw-r--r--tests/unistd_test.cpp49
-rw-r--r--tests/utils.h53
-rw-r--r--tests/utmp_test.cpp6
-rw-r--r--tests/wchar_test.cpp190
-rw-r--r--tools/Android.bp15
-rw-r--r--tools/NOTICE32
-rwxr-xr-xtools/generate-version-script.py2
-rwxr-xr-xtools/update_notice.sh13
-rw-r--r--tools/versioner/Android.bp4
-rwxr-xr-xtools/versioner/run_tests.py2
-rw-r--r--tools/versioner/src/Android.bp4
-rw-r--r--tools/versioner/src/DeclarationDatabase.cpp12
-rw-r--r--tools/versioner/src/Driver.cpp3
-rw-r--r--tools/versioner/src/Preprocessor.cpp14
-rw-r--r--tools/versioner/src/Utils.cpp2
-rw-r--r--tools/versioner/src/versioner.cpp10
-rw-r--r--tools/versioner/src/versioner.h8
-rw-r--r--tools/versioner/tests/multiple_decl_mismatch/expected_fail2
-rw-r--r--tools/versioner/tests/multiple_definition/expected_fail2
-rw-r--r--tools/versioner/tests/version_mismatch/expected_fail2
898 files changed, 10327 insertions, 23138 deletions
diff --git a/.gitignore b/.gitignore
index 415166b7e..5a5ea87a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.pyc
*.*~
+libc/kernel/original
diff --git a/METADATA b/METADATA
deleted file mode 100644
index d97975ca3..000000000
--- a/METADATA
+++ /dev/null
@@ -1,3 +0,0 @@
-third_party {
- license_type: NOTICE
-}
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index b4223eaf8..11d9fe624 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,9 +1,8 @@
+[Hook Scripts]
+notice = tools/update_notice.sh
+
[Builtin Hooks]
clang_format = true
[Builtin Hooks Options]
clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
-
-[Hook Scripts]
-aosp_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "."
-notice = tools/update_notice.sh
diff --git a/TEST_MAPPING b/TEST_MAPPING
index da16e6524..ae6130473 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -4,12 +4,6 @@
"name": "CtsBionicTestCases"
},
{
- "name": "CtsTaggingHostTestCases"
- },
- {
- "name": "debuggerd_test"
- },
- {
"name": "fdtrack_test"
},
{
diff --git a/android-changes-for-ndk-developers.md b/android-changes-for-ndk-developers.md
index 13c891121..a0f3c3c50 100644
--- a/android-changes-for-ndk-developers.md
+++ b/android-changes-for-ndk-developers.md
@@ -6,11 +6,6 @@ loading in various Android releases.
See also [bionic status](docs/status.md) for general libc/libm/libdl
behavior changes.
-See also the
-[unwinder documentation](https://android.googlesource.com/platform/system/unwinding/+/refs/heads/master/libunwindstack/AndroidVersions.md)
-for details about changes in stack unwinding (crash dumps) between
-different releases.
-
Required tools: the NDK has an _arch_-linux-android-readelf binary
(e.g. arm-linux-androideabi-readelf or i686-linux-android-readelf)
for each architecture (under toolchains/), but you can use readelf for
@@ -180,9 +175,11 @@ and libssl.so). In order to give you more time to transition, we will
temporarily support these libraries; so if you see a warning that means
your code will not work in a future release -- please fix it now!
-Between O and R, this compatibility mode could be disabled by setting a
-system property (`debug.ld.greylist_disabled`). This property is ignored
-in S and later.
+In O and later, the system property `debug.ld.greylist_disabled` can be
+used to deny access to the greylist even to an app that would normally
+be allowed it. This allows you to test compatibility without bumping the
+app's `targetSdkVersion`. Use `setprop debug.ld.greylist_disabled true`
+to turn this on (any other value leaves the greylist enabled).
```
$ readelf --dynamic libBroken.so | grep NEEDED
@@ -221,7 +218,7 @@ from known vulnerabilities.
Each ELF file has additional information contained in the section
headers. These headers must be present now, because the dynamic linker
-uses them for validity checking. Some developers strip them in an
+uses them for sanity checking. Some developers strip them in an
attempt to obfuscate the binary and prevent reverse engineering. (This
doesn't really help because it is possible to reconstruct the stripped
information using widely-available tools.)
diff --git a/apex/Android.bp b/apex/Android.bp
index 4879f474c..f62f930ed 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -3,21 +3,6 @@
// In Q this contained Bionic, ART and Libcore.
// It keeps the name /apex/com.android.runtime for app compat reasons.
-package {
- default_applicable_licenses: ["bionic_apex_license"],
-}
-
-license {
- name: "bionic_apex_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
android_app_certificate {
name: "com.android.runtime.certificate",
certificate: "com.android.runtime",
@@ -41,69 +26,11 @@ apex {
"libc_malloc_debug",
"libc_malloc_hooks",
],
- binaries: [
- "linkerconfig",
- ],
multilib: {
both: {
- binaries: [
- "crash_dump",
- "linker",
- ],
+ binaries: ["linker"],
},
},
key: "com.android.runtime.key",
certificate: ":com.android.runtime.certificate",
- prebuilts: [
- "bionic-linker-config",
- ],
- updatable: false,
- generate_hashtree: false,
-}
-
-sdk {
- name: "runtime-module-sdk",
- defaults: ["linux_bionic_supported"],
-
- native_header_libs: [
- "bionic_libc_platform_headers",
- "libc_headers",
- ],
- native_shared_libs: [
- "libc",
- "libdl",
- "libdl_android",
- "libm",
- ],
- native_static_libs: [
- "libasync_safe",
- "note_memtag_heap_async",
- "note_memtag_heap_sync",
- ],
- native_objects: [
- "crtbegin_dynamic",
- "crtbegin_so",
- "crtend_android",
- "crtend_so",
- ],
-}
-
-module_exports {
- name: "runtime-module-host-exports",
- host_supported: true,
- device_supported: false,
- compile_multilib: "64",
-
- native_binaries: ["linkerconfig"],
- target: {
- linux_bionic: {
- native_binaries: ["linker"],
- },
- },
-}
-
-linker_config {
- name: "bionic-linker-config",
- src: "linker.config.json",
- installable: false,
}
diff --git a/apex/NOTICE b/apex/NOTICE
deleted file mode 100644
index ccd61dcfe..000000000
--- a/apex/NOTICE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- https://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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
-
- https://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.
-
diff --git a/apex/linker.config.json b/apex/linker.config.json
deleted file mode 100644
index 67c076eca..000000000
--- a/apex/linker.config.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "visible": true
-}
diff --git a/benchmarks/Android.bp b/benchmarks/Android.bp
index 5dfc38f5c..5f8c11306 100644
--- a/benchmarks/Android.bp
+++ b/benchmarks/Android.bp
@@ -14,22 +14,6 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["bionic_benchmarks_license"],
-}
-
-license {
- name: "bionic_benchmarks_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-BSD",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_defaults {
name: "bionic-benchmarks-defaults",
cflags: [
@@ -45,6 +29,7 @@ cc_defaults {
"bionic_benchmarks.cpp",
"atomic_benchmark.cpp",
"ctype_benchmark.cpp",
+ "dlfcn_benchmark.cpp",
"get_heap_size_benchmark.cpp",
"inttypes_benchmark.cpp",
"malloc_benchmark.cpp",
@@ -95,9 +80,6 @@ cc_defaults {
cc_benchmark {
name: "bionic-benchmarks",
defaults: ["bionic-benchmarks-defaults"],
- srcs: [
- "dlfcn_benchmark.cpp",
- ],
data: ["suites/*"],
static_libs: [
"libsystemproperties",
@@ -106,26 +88,16 @@ cc_benchmark {
include_dirs: ["bionic/libc"],
}
-cc_benchmark {
- name: "bionic-benchmarks-static",
- defaults: ["bionic-benchmarks-defaults"],
- data: ["suites/*"],
- static_libs: [
- "liblog",
- "libsystemproperties",
- "libasync_safe",
- ],
- include_dirs: ["bionic/libc"],
- static_executable: true,
-}
+// We don't build a static benchmark executable because it's not usually
+// useful. If you're trying to run the current benchmarks on an older
+// release, it's (so far at least) always because you want to measure the
+// performance of the old release's libc, and a static benchmark isn't
+// going to let you do that.
// Build benchmarks for the host (against glibc!). Run with:
cc_benchmark_host {
name: "bionic-benchmarks-glibc",
defaults: ["bionic-benchmarks-defaults"],
- srcs: [
- "dlfcn_benchmark.cpp",
- ],
target: {
darwin: {
// Only supported on linux systems.
diff --git a/benchmarks/NOTICE b/benchmarks/NOTICE
deleted file mode 100644
index f720e2331..000000000
--- a/benchmarks/NOTICE
+++ /dev/null
@@ -1,180 +0,0 @@
-Copyright (C) 2012 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2013 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 1fd17a18f..fe447d170 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -184,5 +184,5 @@ otherwise prints:
Some devices have a `perf-setup.sh` script that locks CPU and GPU frequencies. Some TradeFed
benchmarks appear to be using the script. For more information:
* run `get_build_var BOARD_PERFSETUP_SCRIPT`
- * run `m perf-setup` to install the script into `${OUT}/data/local/tmp/perf-setup.sh`
+ * run `m perf-setup.sh` to install the script into `${OUT}/data/local/tmp/perf-setup.sh`
* see: https://android.googlesource.com/platform/platform_testing/+/refs/heads/master/scripts/perf-setup/
diff --git a/benchmarks/get_heap_size_benchmark.cpp b/benchmarks/get_heap_size_benchmark.cpp
index 47d5b183c..c3680dc44 100644
--- a/benchmarks/get_heap_size_benchmark.cpp
+++ b/benchmarks/get_heap_size_benchmark.cpp
@@ -30,6 +30,8 @@
#include <benchmark/benchmark.h>
#include "util.h"
+static volatile size_t sink;
+
static constexpr int NTHREADS = 5;
static std::atomic<int> thread_count;
@@ -55,7 +57,7 @@ static void BM_mallinfo(benchmark::State& state) {
sched_yield();
}
for (auto _ : state) {
- benchmark::DoNotOptimize(mallinfo().uordblks);
+ sink = mallinfo().uordblks;
}
for (int i = 0; i < 5; i++) {
int res = pthread_join(t[i], NULL);
diff --git a/benchmarks/linker_relocation/Android.bp b/benchmarks/linker_relocation/Android.bp
index b78eb8edb..6955c67dc 100644
--- a/benchmarks/linker_relocation/Android.bp
+++ b/benchmarks/linker_relocation/Android.bp
@@ -24,10 +24,6 @@
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
// SUCH DAMAGE.
-package {
- default_applicable_licenses: ["bionic_benchmarks_license"],
-}
-
cc_library_headers {
name: "linker_reloc_bench_headers",
defaults: ["bionic_spawn_benchmark_targets"],
diff --git a/benchmarks/linker_relocation/gen/Android.bp b/benchmarks/linker_relocation/gen/Android.bp
index c8f0b4a00..e535e5396 100644
--- a/benchmarks/linker_relocation/gen/Android.bp
+++ b/benchmarks/linker_relocation/gen/Android.bp
@@ -1,8 +1,4 @@
// AUTO-GENERATED BY gen_bench.py -- do not edit
-package {
- default_applicable_licenses: ["bionic_benchmarks_license"],
-}
-
cc_defaults {
name: "linker_reloc_bench_all_libs",
runtime_libs: [
diff --git a/benchmarks/linker_relocation/regen/gen_bench.py b/benchmarks/linker_relocation/regen/gen_bench.py
index 65331898d..61156cea1 100755
--- a/benchmarks/linker_relocation/regen/gen_bench.py
+++ b/benchmarks/linker_relocation/regen/gen_bench.py
@@ -62,7 +62,7 @@ kBionicSonames: Set[str] = set([
])
# Skip these symbols so the benchmark runs on multiple C libraries (glibc, Bionic, musl).
-kBionicIgnoredSymbols: Set[str] = set([
+kBionicSymbolBlacklist: Set[str] = set([
'__FD_ISSET_chk',
'__FD_SET_chk',
'__assert',
@@ -137,7 +137,7 @@ def build_symbol_index(lib: LoadedLibrary) -> Definitions:
return defs
-def check_rels(root: LoadedLibrary, defs: Definitions) -> None:
+def sanity_check_rels(root: LoadedLibrary, defs: Definitions) -> None:
# Find every symbol for every relocation in the load group.
has_missing = False
for lib in bfs_walk(root):
@@ -169,7 +169,7 @@ def make_asm_file(lib: LoadedLibrary, is_main: bool, out_filename: Path, map_out
nonlocal defs
d = defs.get(name)
if d is not None and d.soname in kBionicSonames:
- if name in kBionicIgnoredSymbols: return None
+ if name in kBionicSymbolBlacklist: return None
# Discard relocations to newer Bionic symbols, because there aren't many of them, and
# they would limit where the benchmark can run.
if ver == 'LIBC': return name
@@ -328,7 +328,6 @@ def make_soong_benchmark(root: LoadedLibrary, defs: Definitions, out: Path) -> N
bp = open(out / 'Android.bp', 'w')
bp.write(f'// AUTO-GENERATED BY {os.path.basename(__file__)} -- do not edit\n')
- bp.write(f'package {{ default_applicable_licenses: ["bionic_benchmarks_license"], }}\n')
bp.write(f'cc_defaults {{\n')
bp.write(f' name: "{g_benchmark_name}_all_libs",\n')
bp.write(f' runtime_libs: [\n')
@@ -390,7 +389,7 @@ def main() -> None:
with open(Path(args.input)) as f:
root = json_to_elf_tree(json.load(f))
defs = build_symbol_index(root)
- check_rels(root, defs)
+ sanity_check_rels(root, defs)
if out.exists(): shutil.rmtree(out)
os.makedirs(str(out))
diff --git a/benchmarks/pthread_benchmark.cpp b/benchmarks/pthread_benchmark.cpp
index 856f1502e..9a68a12d0 100644
--- a/benchmarks/pthread_benchmark.cpp
+++ b/benchmarks/pthread_benchmark.cpp
@@ -53,14 +53,15 @@ static void BM_pthread_setspecific(benchmark::State& state) {
}
BIONIC_BENCHMARK(BM_pthread_setspecific);
-static void NoOpPthreadOnceInitFunction() {}
+static void DummyPthreadOnceInitFunction() {
+}
static void BM_pthread_once(benchmark::State& state) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
- pthread_once(&once, NoOpPthreadOnceInitFunction);
+ pthread_once(&once, DummyPthreadOnceInitFunction);
while (state.KeepRunning()) {
- pthread_once(&once, NoOpPthreadOnceInitFunction);
+ pthread_once(&once, DummyPthreadOnceInitFunction);
}
}
BIONIC_BENCHMARK(BM_pthread_once);
diff --git a/benchmarks/semaphore_benchmark.cpp b/benchmarks/semaphore_benchmark.cpp
index ffccc82d7..cf5148983 100644
--- a/benchmarks/semaphore_benchmark.cpp
+++ b/benchmarks/semaphore_benchmark.cpp
@@ -28,8 +28,8 @@ static void BM_semaphore_sem_getvalue(benchmark::State& state) {
sem_init(&semaphore, 1, 1);
while (state.KeepRunning()) {
- int unused;
- sem_getvalue(&semaphore, &unused);
+ int dummy;
+ sem_getvalue(&semaphore, &dummy);
}
}
BIONIC_BENCHMARK(BM_semaphore_sem_getvalue);
@@ -44,3 +44,112 @@ static void BM_semaphore_sem_wait_sem_post(benchmark::State& state) {
}
}
BIONIC_BENCHMARK(BM_semaphore_sem_wait_sem_post);
+
+// This test reports the overhead of the underlying futex wake syscall on
+// the producer. It does not report the overhead from issuing the wake to the
+// point where the posted consumer thread wakes up. It suffers from
+// clock_gettime syscall overhead. Lock the CPU speed for consistent results
+// as we may not reach >50% cpu utilization.
+//
+// We will run a background thread that catches the sem_post wakeup and
+// loops immediately returning back to sleep in sem_wait for the next one. This
+// thread is run with policy SCHED_OTHER (normal policy), a middle policy.
+//
+// The primary thread will run at SCHED_IDLE (lowest priority policy) when
+// monitoring the background thread to detect when it hits sem_wait sleep. It
+// will do so with no clock running. Once we are ready, we will switch to
+// SCHED_FIFO (highest priority policy) to time the act of running sem_post
+// with the benchmark clock running. This ensures nothing else in the system
+// can preempt our timed activity, including the background thread. We are
+// also protected with the scheduling policy of letting a process hit a
+// resource limit rather than get hit with a context switch.
+//
+// The background thread will start executing either on another CPU, or
+// after we back down from SCHED_FIFO, but certainly not in the context of
+// the timing of the sem_post.
+
+static atomic_int BM_semaphore_sem_post_running;
+
+static void* BM_semaphore_sem_post_start_thread(void* arg) {
+ sem_t* semaphore = reinterpret_cast<sem_t*>(arg);
+ while ((BM_semaphore_sem_post_running > 0) && !sem_wait(semaphore)) {
+ }
+ BM_semaphore_sem_post_running = -1;
+ return nullptr;
+}
+
+class SemaphoreFixture : public benchmark::Fixture {
+ public:
+ void SetUp(const benchmark::State&) override {
+ sem_init(&semaphore, 0, 0);
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+
+ memset(&param, 0, sizeof(param));
+ pthread_attr_setschedparam(&attr, &param);
+ pthread_attr_setschedpolicy(&attr, SCHED_OTHER);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_t pthread;
+ pthread_create(&pthread, &attr, BM_semaphore_sem_post_start_thread, &semaphore);
+ pthread_attr_destroy(&attr);
+
+ sched_setscheduler(0, SCHED_IDLE, &param);
+
+ BM_semaphore_sem_post_running = 1;
+ setup = true;
+ }
+
+ ~SemaphoreFixture() override {
+ if (setup) {
+ // Only do this if the test was actually run.
+ sched_setscheduler(0, SCHED_OTHER, &param);
+
+ if (BM_semaphore_sem_post_running > 0) {
+ BM_semaphore_sem_post_running = 0;
+ }
+ do {
+ sem_post(&semaphore);
+ sched_yield();
+ } while (BM_semaphore_sem_post_running != -1);
+ }
+ }
+
+ sem_t semaphore;
+ sched_param param;
+ bool setup = false;
+};
+
+// This is commented out because dynamic benchmark registering doesn't currently support fixtures.
+// Uncomment it and recompile to run this benchmark on every run.
+/* BENCHMARK_F(SemaphoreFixture, semaphore_sem_post)(benchmark::State& state) {
+ while (state.KeepRunning()) {
+ state.PauseTiming();
+
+ int trys = 3, dummy = 0;
+ do {
+ if (BM_semaphore_sem_post_running < 0) {
+ sched_setscheduler(0, SCHED_OTHER, &param);
+ fprintf(stderr, "BM_semaphore_sem_post: start_thread died unexpectedly\n");
+ abort();
+ }
+ sched_yield();
+ sem_getvalue(&semaphore, &dummy);
+ if (dummy < 0) { // POSIX.1-2001 possibility 1
+ break;
+ }
+ if (dummy == 0) { // POSIX.1-2001 possibility 2
+ --trys;
+ }
+ } while (trys);
+
+ param.sched_priority = 1;
+ sched_setscheduler(0, SCHED_FIFO, &param);
+
+ state.ResumeTiming();
+ sem_post(&semaphore);
+
+ param.sched_priority = 0;
+ sched_setscheduler(0, SCHED_IDLE, &param);
+ }
+}*/
diff --git a/benchmarks/spawn/Android.bp b/benchmarks/spawn/Android.bp
index 89d22e3f7..2276d2e01 100644
--- a/benchmarks/spawn/Android.bp
+++ b/benchmarks/spawn/Android.bp
@@ -26,10 +26,6 @@
// SUCH DAMAGE.
//
-package {
- default_applicable_licenses: ["bionic_benchmarks_license"],
-}
-
cc_defaults {
name: "bionic_spawn_benchmark_targets",
host_supported: true,
@@ -72,7 +68,6 @@ cc_benchmark {
// Install these binaries in the same directory as the main benchmark binary.
data: [
- ":bench_cxa_atexit",
":bench_noop",
":bench_noop_nostl",
":bench_noop_static",
@@ -80,7 +75,7 @@ cc_benchmark {
}
cc_defaults {
- name: "bionic_spawn_benchmark_binary",
+ name: "noop_binary_defaults",
defaults: ["bionic_spawn_benchmark_targets"],
compile_multilib: "both",
@@ -92,11 +87,16 @@ cc_defaults {
suffix: "64",
},
},
+}
+
+cc_binary {
+ defaults: ["noop_binary_defaults"],
+ name: "bench_noop",
+ srcs: ["noop.cpp"],
// When this binary is installed to host/linux-x86/bin, its runpath is ${ORIGIN}/../lib64, which
// is fine for finding host/linux-x86/lib64/libc++.so. When it's installed to
- // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..". This
- // argument has no effect when a static executable is produced.
+ // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..".
target: {
linux_glibc_x86_64: {
ldflags: [
@@ -107,26 +107,14 @@ cc_defaults {
}
cc_binary {
- defaults: ["bionic_spawn_benchmark_binary"],
- name: "bench_cxa_atexit",
- srcs: ["bench_cxa_atexit.cpp"],
-}
-
-cc_binary {
- defaults: ["bionic_spawn_benchmark_binary"],
- name: "bench_noop",
- srcs: ["noop.cpp"],
-}
-
-cc_binary {
- defaults: ["bionic_spawn_benchmark_binary"],
+ defaults: ["noop_binary_defaults"],
name: "bench_noop_nostl",
srcs: ["noop.cpp"],
stl: "none",
}
cc_binary {
- defaults: ["bionic_spawn_benchmark_binary"],
+ defaults: ["noop_binary_defaults"],
name: "bench_noop_static",
srcs: ["noop.cpp"],
static_executable: true,
diff --git a/benchmarks/spawn/AndroidTest.xml b/benchmarks/spawn/AndroidTest.xml
index 466dc7fb0..93316754d 100644
--- a/benchmarks/spawn/AndroidTest.xml
+++ b/benchmarks/spawn/AndroidTest.xml
@@ -1,4 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+-->
<configuration description="Runs bionic-spawn-benchmarks.">
<option name="test-suite-tag" value="apct" />
diff --git a/benchmarks/spawn/bench_cxa_atexit.cpp b/benchmarks/spawn/bench_cxa_atexit.cpp
deleted file mode 100644
index 95849f407..000000000
--- a/benchmarks/spawn/bench_cxa_atexit.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <string>
-
-extern "C" int __cxa_atexit(void (*func)(void*), void* arg, void* dso);
-
-extern void* __dso_handle;
-
-static void dtor_func(void*) {}
-
-// Prevent the compiler from optimizing out the __cxa_atexit call.
-void (*volatile g_pdtor_func)(void*) = dtor_func;
-
-int main(int argc, char* argv[]) {
- auto usage = [&argv]() {
- fprintf(stderr, "usage: %s COUNT MODE\n", argv[0]);
- fprintf(stderr, "MODE is one of '_Exit' or 'exit'.\n");
- exit(1);
- };
-
- if (argc != 3) usage();
-
- int count = atoi(argv[1]);
-
- // Two modes: "_Exit" ==> exit early w/o calling dtors, "exit" ==> call dtors on exit.
- std::string mode = argv[2];
- if (mode != "_Exit" && mode != "exit") usage();
-
- for (int i = 0; i < count; ++i) {
- __cxa_atexit(g_pdtor_func, nullptr, &__dso_handle);
- }
-
- if (mode == "_Exit") {
- _Exit(0);
- } else {
- exit(0);
- }
-}
diff --git a/benchmarks/spawn/spawn_benchmarks.cpp b/benchmarks/spawn/spawn_benchmarks.cpp
index 18dacf938..931a8be5a 100644
--- a/benchmarks/spawn/spawn_benchmarks.cpp
+++ b/benchmarks/spawn/spawn_benchmarks.cpp
@@ -31,8 +31,6 @@
SPAWN_BENCHMARK(noop, test_program("bench_noop").c_str());
SPAWN_BENCHMARK(noop_nostl, test_program("bench_noop_nostl").c_str());
SPAWN_BENCHMARK(noop_static, test_program("bench_noop_static").c_str());
-SPAWN_BENCHMARK(bench_cxa_atexit, test_program("bench_cxa_atexit").c_str(), "100000", "_Exit");
-SPAWN_BENCHMARK(bench_cxa_atexit_full, test_program("bench_cxa_atexit").c_str(), "100000", "exit");
// Android has a /bin -> /system/bin symlink, but use /system/bin explicitly so we can more easily
// compare Bionic-vs-glibc on a Linux desktop machine.
diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp
index 03f3f2903..037bbd911 100644
--- a/benchmarks/stdio_benchmark.cpp
+++ b/benchmarks/stdio_benchmark.cpp
@@ -155,8 +155,9 @@ static void FopenFgetcFclose(benchmark::State& state, bool no_locking) {
while (state.KeepRunning()) {
FILE* fp = fopen("/dev/zero", "re");
if (no_locking) __fsetlocking(fp, FSETLOCKING_BYCALLER);
+ volatile int c __attribute__((unused));
for (size_t i = 0; i < nbytes; ++i) {
- benchmark::DoNotOptimize(fgetc(fp));
+ c = fgetc(fp);
}
fclose(fp);
}
diff --git a/benchmarks/stdlib_benchmark.cpp b/benchmarks/stdlib_benchmark.cpp
index b6ea58db3..45b953f61 100644
--- a/benchmarks/stdlib_benchmark.cpp
+++ b/benchmarks/stdlib_benchmark.cpp
@@ -189,8 +189,9 @@ static void BM_stdlib_mbstowcs(benchmark::State& state) {
buf[l++] = i, buf[l++] = j, buf[l++] = 0x80, buf[l++] = k;
buf[l++] = 0;
+ volatile size_t c __attribute__((unused)) = 0;
for (auto _ : state) {
- benchmark::DoNotOptimize(mbstowcs(widebuf_aligned, buf_aligned, 500000));
+ c = mbstowcs(widebuf_aligned, buf_aligned, 500000);
}
state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(500000));
diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp
index 9be54c7b5..d1766758c 100644
--- a/benchmarks/string_benchmark.cpp
+++ b/benchmarks/string_benchmark.cpp
@@ -31,8 +31,9 @@ static void BM_string_memcmp(benchmark::State& state) {
char* src_aligned = GetAlignedPtrFilled(&src, src_alignment, nbytes, 'x');
char* dst_aligned = GetAlignedPtrFilled(&dst, dst_alignment, nbytes, 'x');
+ volatile int c __attribute__((unused)) = 0;
while (state.KeepRunning()) {
- benchmark::DoNotOptimize(memcmp(dst_aligned, src_aligned, nbytes));
+ c += memcmp(dst_aligned, src_aligned, nbytes);
}
state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
@@ -128,8 +129,9 @@ static void BM_string_strlen(benchmark::State& state) {
char* buf_aligned = GetAlignedPtrFilled(&buf, alignment, nbytes + 1, 'x');
buf_aligned[nbytes - 1] = '\0';
+ volatile int c __attribute__((unused)) = 0;
while (state.KeepRunning()) {
- benchmark::DoNotOptimize(strlen(buf_aligned));
+ c += strlen(buf_aligned);
}
state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
@@ -237,8 +239,9 @@ static void BM_string_strcmp(benchmark::State& state) {
s1_aligned[nbytes - 1] = '\0';
s2_aligned[nbytes - 1] = '\0';
+ volatile int c __attribute__((unused));
while (state.KeepRunning()) {
- benchmark::DoNotOptimize(strcmp(s1_aligned, s2_aligned));
+ c = strcmp(s1_aligned, s2_aligned);
}
state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
@@ -255,8 +258,9 @@ static void BM_string_strncmp(benchmark::State& state) {
char* s1_aligned = GetAlignedPtrFilled(&s1, s1_alignment, nbytes, 'x');
char* s2_aligned = GetAlignedPtrFilled(&s2, s2_alignment, nbytes, 'x');
+ volatile int c __attribute__((unused));
for (auto _ : state) {
- benchmark::DoNotOptimize(strncmp(s1_aligned, s2_aligned, nbytes));
+ c = strncmp(s1_aligned, s2_aligned, nbytes);
}
state.SetBytesProcessed(uint64_t(state.iterations()) * uint64_t(nbytes));
diff --git a/build/NOTICE b/build/NOTICE
deleted file mode 100644
index ccd61dcfe..000000000
--- a/build/NOTICE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- https://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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
-
- https://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.
-
diff --git a/build/coverage.sh b/build/coverage.sh
deleted file mode 100755
index 13fabc5d0..000000000
--- a/build/coverage.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-
-# This script generates coverage for bionic.
-#
-# Prereqs: Coverage-enabled build.
-#
-# $ lunch <target>
-# $ m NATIVE_COVERAGE_PATHS="bionic" CLANG_COVERAGE=true
-# $ m NATIVE_COVERAGE_PATHS="bionic" CLANG_COVERAGE=true bionic-unit-tests
-#
-# Do *NOT* then rebuild at the top level, or you'll clobber the
-# coverage-enabled libc!
-#
-# Flash image and set $ANDROID_SERIAL.
-#
-# Usage: $ bionic/build/coverage.sh
-# Output: HTML report is generated to /tmp/bionic-coverage/html/index.html
-#
-
-eval "$(cd ${ANDROID_BUILD_TOP}; build/soong/soong_ui.bash --dumpvars-mode --vars="TARGET_ARCH TARGET_ARCH_VARIANT")"
-
-LLVM_PROFDATA=${ANDROID_BUILD_TOP}/prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-profdata
-LLVM_COV=${ANDROID_BUILD_TOP}/prebuilts/clang/host/linux-x86/llvm-binutils-stable/llvm-cov
-
-DEVICE_TEST_DIR32=/data/local/tmp/bionic-coverage32
-DEVICE_TEST_DIR64=/data/local/tmp/bionic-coverage64
-DEVICE_PROF_DIR=/data/local/tmp/bionic-profraw
-HOST_PROFDATA_DIR=/tmp/bionic-coverage
-
-# Run bionic-unit-tests
-adb shell rm -rf ${DEVICE_TEST_DIR32} ${DEVICE_TEST_DIR64} ${DEVICE_PROF_DIR}
-adb shell mkdir ${DEVICE_TEST_DIR32} ${DEVICE_TEST_DIR64} ${DEVICE_PROF_DIR}
-adb push $OUT/data/nativetest/bionic-loader-test-libs ${DEVICE_TEST_DIR32}
-adb push $OUT/data/nativetest/bionic-unit-tests ${DEVICE_TEST_DIR32}
-adb push $OUT/data/nativetest64/bionic-loader-test-libs ${DEVICE_TEST_DIR64}
-adb push $OUT/data/nativetest64/bionic-unit-tests ${DEVICE_TEST_DIR64}
-adb shell LLVM_PROFILE_FILE=${DEVICE_PROF_DIR}/bionic-%p-%m.profraw \
- LD_LIBRARY_PATH=${DEVICE_TEST_DIR32}/bionic-loader-test-libs \
- ${DEVICE_TEST_DIR32}/bionic-unit-tests/bionic-unit-tests
-adb shell LLVM_PROFILE_FILE=${DEVICE_PROF_DIR}/bionic-%p-%m.profraw \
- LD_LIBRARY_PATH=${DEVICE_TEST_DIR64}/bionic-loader-test-libs \
- ${DEVICE_TEST_DIR64}/bionic-unit-tests/bionic-unit-tests
-
-# Pull coverage files and post-process
-rm -rf ${HOST_PROFDATA_DIR}
-mkdir ${HOST_PROFDATA_DIR}
-adb pull ${DEVICE_PROF_DIR} ${HOST_PROFDATA_DIR}/profraws
-
-${LLVM_PROFDATA} merge \
- --output=${HOST_PROFDATA_DIR}/bionic.profdata \
- ${HOST_PROFDATA_DIR}/profraws/*.profraw
-
-${LLVM_COV} show \
- --instr-profile=${HOST_PROFDATA_DIR}/bionic.profdata \
- --format=html \
- $OUT/symbols/apex/com.android.runtime/lib64/bionic/libc.so \
- --object=$OUT/symbols/apex/com.android.runtime/lib64/bionic/libm.so \
- --object=$OUT/symbols/data/nativetest64/bionic-unit-tests/bionic-unit-tests \
- --object=$OUT/symbols/apex/com.android.runtime/lib/bionic/libc.so \
- --object=$OUT/symbols/apex/com.android.runtime/lib/bionic/libm.so \
- --object=$OUT/symbols/data/nativetest/bionic-unit-tests/bionic-unit-tests \
- /proc/self/cwd/bionic/libc \
- /proc/self/cwd/bionic/libm \
- --output-dir=${HOST_PROFDATA_DIR}/html \
- --show-region-summary=false
diff --git a/docs/32-bit-abi.md b/docs/32-bit-abi.md
index 3be6b1a8a..81afd14c9 100644
--- a/docs/32-bit-abi.md
+++ b/docs/32-bit-abi.md
@@ -81,23 +81,13 @@ For source compatibility, the names containing `64` are also available
in the 64-bit ABI even though they're identical to the non-`64` names.
-## `time_t` is 32-bit on LP32 (y2038)
-
-On 32-bit Android, `time_t` is 32-bit, which will overflow in 2038.
-
-In the 64-bit ABI, `time_t` is 64-bit, which will not overflow until
-long after the death of the star around which we currently circle.
-
-The header `<time64.h>` and type `time64_t` exist as a workaround,
-but the kernel interfaces exposed on 32-bit Android all use the 32-bit
-`time_t` and `struct timespec`/`struct timeval`. Linux 5.x kernels
-do offer extra interfaces so that 32-bit processes can pass 64-bit
-times to/from the kernel, but we do not plan on adding support for
-these to the C library. Convenient use of the new calls would require
-an equivalent to `_FILE_OFFSET_BITS=64`, which we wouldn't be able
-to globally flip for reasons similar to `_FILE_OFFSET_BITS`, mentioned
-above. All apps are already required to offer 64-bit variants, and we
-expect 64-bit-only devices within the next few years.
+## `time_t` is 32-bit
+
+On 32-bit Android, `time_t` is 32-bit. The header `<time64.h>` and type
+`time64_t` exist as a workaround, but the kernel interfaces exposed on 32-bit
+Android all use the 32-bit `time_t`.
+
+In the 64-bit ABI, `time_t` is 64-bit.
## `pthread_mutex_t` is too small for large pids
diff --git a/docs/NOTICE b/docs/NOTICE
deleted file mode 100644
index ccd61dcfe..000000000
--- a/docs/NOTICE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- https://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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
-
- https://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.
-
diff --git a/docs/fdsan.md b/docs/fdsan.md
index e0cf80ab2..0e6783de1 100644
--- a/docs/fdsan.md
+++ b/docs/fdsan.md
@@ -2,8 +2,6 @@
[TOC]
-fdsan is a file descriptor sanitizer added to Android in API level 29.
-
### Background
*What problem is fdsan trying to solve? Why should I care?*
diff --git a/docs/fdtrack.md b/docs/fdtrack.md
deleted file mode 100644
index 7cf6e1fe5..000000000
--- a/docs/fdtrack.md
+++ /dev/null
@@ -1,70 +0,0 @@
-## fdtrack
-
-[TOC]
-
-fdtrack is a file descriptor leak checker added to Android in API level 30.
-
-fdtrack consists of two parts: a set of hooks in bionic to register a callback
-that's invoked on file descriptor operations, and a library that implements a
-hook to perform and store backtraces for file descriptor creation.
-
-### bionic hooks
-bionic provides a header in the `bionic_libc_platform_headers` header_lib at <[bionic/fdtrack.h](https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/platform/bionic/fdtrack.h)>.
-Register a callback with `android_fdtrack_compare_exchange_hook` to receive
-callbacks upon file descriptor creation and destruction. This function can be
-called at any point in order to start capturing events, but be sure to properly
-handle unbalanced closes. This callback may be called from an async signal safe
-context, but not vfork (bionic tracks whether a thread is vforked, and chooses
-not to call callbacks when this is the case).
-
-### libfdtrack
-[libfdtrack](https://android.googlesource.com/platform/bionic/+/refs/heads/master/libfdtrack)
-implements a library that uses libunwindstack to unwind and store fd creation backtraces.
-
-
-#### Using libfdtrack
-libfdtrack registers its hook upon being loaded, so to start capturing
-backtraces, `dlopen("libfdtrack.so", RTLD_GLOBAL)` is all that's needed. To dump
-its output to logcat, either use `fdtrack_dump`, or send the signal
-`BIONIC_SIGNAL_FDTRACK` (available from `<bionic/reserved_signals.h>`) to the
-process. If you wish to iterate through the results programmatically,
-`fdtrack_iterate` can be used (warning: this interface is currently unstable,
-don't use it in code that can be used on multiple platform versions.)
-
-libfdtrack adds a significant amount of overhead, so for processes that are
-latency-critical like system_server, it's not feasible to always capture
-backtraces. Instead, if you can detect that an fd leak is ongoing, turning on
-backtraces for a while and then triggering a dump can be sufficient.
-system_server [implements this approach](https://android.googlesource.com/platform/frameworks/base/+/679f3e4242b8e018eb7df90ef433f81088a64fff%5E%21/),
-spawning a thread that regularly checks the count of fds in the process, turns
-on fdtrack when it hits a threshold, and then aborts after another threshold.
-This dumps the output to logcat, which will be available in both the tombstone
-and logcat from bugreports.
-
-#### Implementation details
-There are multiple methods to unwind in Android:
-
- * libunwindstack
- * Pros
- * Primary method on the platform
- * Able to unwind through ART
- * Cons
- * Uses malloc internally: unsafe unless a separate allocator is
- statically-linked and steps are taken to prevent the unwind from being
- interrupted by a signal
- * Slow - infeasible to be used always in latency-sensitive processes
- * `android_unsafe_frame_pointer_chase`
- * Pros
- * Definitely async signal safe
- * Fast
- * Cons
- * Unable to unwind through ART because it doesn't maintain the frame pointer
- * Requires -fno-omit-frame-pointer to be used on all code being unwound
- through, which currently isn't the case on Android
- * Frame layout is a mess on 32-bit ARM: the ARM standard, clang, and GCC
- [all disagree](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92172)
- * Chasing the frame pointer will often result in multiple frames inside the
- same function
-
-libfdtrack chooses to use libunwindstack for now, since unwinding through ART
-is critical to being useful for the initial user, system_server.
diff --git a/docs/libc_assembler.md b/docs/libc_assembler.md
index 43bcfc753..44c00366d 100644
--- a/docs/libc_assembler.md
+++ b/docs/libc_assembler.md
@@ -10,8 +10,7 @@ verify that the routine is being properly tested.
* Rerun the benchmarks using the updated image that uses the code for
the new routine. See the [Performance](#Performance) section for details about
benchmarking.
-* Verify that unwind information for new routine looks correct. See
-the [Unwind Info](#unwind-info) section for details about how to verify this.
+* Verify that unwind information for new routine looks sane. See the [Unwind Info](#unwind-info) section for details about how to verify this.
When benchmarking, it's best to verify on the latest Pixel device supported.
Make sure that you benchmark both the big and little cores to verify that
diff --git a/docs/native_allocator.md b/docs/native_allocator.md
index 9fc9a31bc..139d664d9 100644
--- a/docs/native_allocator.md
+++ b/docs/native_allocator.md
@@ -329,7 +329,7 @@ the option [record\_allocs](https://android.googlesource.com/platform/bionic/+/m
To run these benchmarks, first copy the trace files to the target using
these commands:
- adb push system/extras/memory_replay/traces /data/local/tmp
+ adb shell push system/extras/traces /data/local/tmp
Since all of the traces come from applications, the `memory_replay` program
will always call `mallopt(M_DECAY_TIME, 1)' before running the trace.
diff --git a/libc/Android.bp b/libc/Android.bp
index 2c0656f72..d3271ae91 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1,32 +1,13 @@
// Define the common source files for all the libc instances
// =========================================================
-package {
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
-license {
- name: "bionic_libc_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-BSD",
- "SPDX-license-identifier-ISC",
- "SPDX-license-identifier-MIT",
- "legacy_notice",
- "legacy_unencumbered",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
libc_common_src_files = [
+ "async_safe/async_safe_log.cpp",
"bionic/ether_aton.c",
"bionic/ether_ntoa.c",
- "bionic/exit.cpp",
"bionic/fts.c",
"bionic/initgroups.c",
"bionic/isatty.c",
+ "bionic/pututline.c",
"bionic/sched_cpualloc.c",
"bionic/sched_cpucount.c",
"stdio/fmemopen.cpp",
@@ -36,6 +17,7 @@ libc_common_src_files = [
"stdio/stdio_ext.cpp",
"stdio/vfscanf.cpp",
"stdio/vfwscanf.c",
+ "stdlib/exit.c",
]
// off64_t/time64_t support on LP32.
@@ -81,19 +63,9 @@ cc_defaults {
cppflags: [],
include_dirs: [
"bionic/libc/async_safe/include",
- "bionic/libc/platform",
- // For android_filesystem_config.h.
- "system/core/libcutils/include",
],
- header_libs: [
- "libc_headers",
- "gwp_asan_headers",
- "liblog_headers", // needed by bionic/libc/async_safe/include
- ],
- export_header_lib_headers: [
- "libc_headers",
- ],
+ header_libs: ["gwp_asan_headers"],
stl: "none",
system_shared_libs: [],
@@ -103,8 +75,8 @@ cc_defaults {
// TODO(b/132640749): Fix broken fuzzer support.
fuzzer: false,
},
+ native_coverage: false,
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
@@ -113,14 +85,8 @@ cc_defaults {
ldflags: ["-Wl,-z,muldefs"],
product_variables: {
- malloc_zero_contents: {
- cflags: ["-DSCUDO_ZERO_CONTENTS"],
- },
- malloc_pattern_fill_contents: {
- cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
- },
- malloc_not_svelte: {
- cflags: ["-DUSE_SCUDO"],
+ experimental_mte: {
+ cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
},
},
}
@@ -190,7 +156,6 @@ cc_library_static {
x86: {
srcs: [
"arch-x86/bionic/__libc_init_sysinfo.cpp",
- "arch-x86/bionic/__libc_int0x80.S",
"arch-x86/bionic/__set_tls.cpp",
],
},
@@ -275,7 +240,7 @@ cc_library_static {
defaults: ["libc_defaults"],
srcs: [
- "dns/**/*.c*",
+ "dns/**/*.c",
"upstream-netbsd/lib/libc/isc/ev_streams.c",
"upstream-netbsd/lib/libc/isc/ev_timers.c",
@@ -287,7 +252,6 @@ cc_library_static {
"-Wno-unused-parameter",
"-include netbsd-compat.h",
"-Wframe-larger-than=66000",
- "-include private/bsd_sys_param.h",
],
local_include_dirs: [
@@ -413,6 +377,7 @@ cc_library_static {
"upstream-netbsd/lib/libc/gen/nice.c",
"upstream-netbsd/lib/libc/gen/psignal.c",
"upstream-netbsd/lib/libc/gen/utime.c",
+ "upstream-netbsd/lib/libc/gen/utmp.c",
"upstream-netbsd/lib/libc/inet/nsap_addr.c",
"upstream-netbsd/lib/libc/regex/regcomp.c",
"upstream-netbsd/lib/libc/regex/regerror.c",
@@ -525,6 +490,8 @@ cc_library_static {
"upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
"upstream-openbsd/lib/libc/stdio/rget.c",
"upstream-openbsd/lib/libc/stdio/setvbuf.c",
+ "upstream-openbsd/lib/libc/stdio/tempnam.c",
+ "upstream-openbsd/lib/libc/stdio/tmpnam.c",
"upstream-openbsd/lib/libc/stdio/ungetc.c",
"upstream-openbsd/lib/libc/stdio/ungetwc.c",
"upstream-openbsd/lib/libc/stdio/vasprintf.c",
@@ -546,7 +513,6 @@ cc_library_static {
"upstream-openbsd/lib/libc/stdlib/llabs.c",
"upstream-openbsd/lib/libc/stdlib/lldiv.c",
"upstream-openbsd/lib/libc/stdlib/lsearch.c",
- "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
"upstream-openbsd/lib/libc/stdlib/remque.c",
"upstream-openbsd/lib/libc/stdlib/setenv.c",
"upstream-openbsd/lib/libc/stdlib/tfind.c",
@@ -588,7 +554,6 @@ cc_library_static {
srcs: [
"stdio/vfprintf.cpp",
"stdio/vfwprintf.cpp",
- "upstream-openbsd/lib/libc/string/memmem.c",
"upstream-openbsd/lib/libc/string/strstr.c",
],
cflags: [
@@ -598,7 +563,6 @@ cc_library_static {
],
local_include_dirs: [
- "private",
"upstream-openbsd/android/include/",
"upstream-openbsd/lib/libc/include/",
"upstream-openbsd/lib/libc/gdtoa/",
@@ -644,7 +608,6 @@ cc_library_static {
arm64: {
exclude_srcs: [
"upstream-openbsd/lib/libc/string/memchr.c",
- "upstream-openbsd/lib/libc/string/memrchr.c",
"upstream-openbsd/lib/libc/string/stpcpy.c",
"upstream-openbsd/lib/libc/string/strcpy.c",
"upstream-openbsd/lib/libc/string/strncmp.c",
@@ -814,7 +777,6 @@ cc_library_static {
"bionic/android_set_abort_message.cpp",
"bionic/strchr.cpp",
- "bionic/strchrnul.cpp",
"bionic/strnlen.c",
"bionic/strrchr.cpp",
],
@@ -875,11 +837,28 @@ cc_library_static {
},
arm64: {
srcs: [
+ "arch-arm64/generic/bionic/memcmp.S",
"arch-arm64/generic/bionic/memcpy.S",
"arch-arm64/generic/bionic/memmove.S",
"arch-arm64/generic/bionic/memset.S",
+ "arch-arm64/generic/bionic/stpcpy.S",
+ "arch-arm64/generic/bionic/strcpy.S",
"arch-arm64/generic/bionic/wmemmove.S",
+ "arch-arm64/default/bionic/memchr.S",
+ "arch-arm64/default/bionic/strchr.S",
+ "arch-arm64/default/bionic/strcmp.S",
+ "arch-arm64/default/bionic/strlen.S",
+ "arch-arm64/default/bionic/strncmp.S",
+ "arch-arm64/default/bionic/strnlen.S",
+
+ "arch-arm64/mte/bionic/memchr.c",
+ "arch-arm64/mte/bionic/strchr.cpp",
+ "arch-arm64/mte/bionic/strcmp.c",
+ "arch-arm64/mte/bionic/strlen.c",
+ "arch-arm64/mte/bionic/strncmp.c",
+ "arch-arm64/mte/bionic/strnlen.c",
+
"arch-arm64/bionic/__bionic_clone.S",
"arch-arm64/bionic/_exit_with_stack_teardown.S",
"arch-arm64/bionic/setjmp.S",
@@ -889,9 +868,7 @@ cc_library_static {
exclude_srcs: [
"bionic/__memcpy_chk.cpp",
"bionic/strchr.cpp",
- "bionic/strchrnul.cpp",
"bionic/strnlen.c",
- "bionic/strrchr.cpp",
],
},
@@ -934,7 +911,6 @@ cc_library_static {
"arch-x86/bionic/setjmp.S",
"arch-x86/bionic/syscall.S",
"arch-x86/bionic/vfork.S",
- "arch-x86/bionic/__x86.get_pc_thunk.S",
// ssse3 functions
"arch-x86/atom/string/ssse3-strcat-atom.S",
@@ -1033,6 +1009,7 @@ cc_library_static {
"bionic/bionic_arc4random.cpp",
"bionic/bionic_futex.cpp",
"bionic/bionic_netlink.cpp",
+ "bionic/bionic_systrace.cpp",
"bionic/bionic_time_conversions.cpp",
"bionic/brk.cpp",
"bionic/c16rtomb.cpp",
@@ -1079,7 +1056,6 @@ cc_library_static {
"bionic/get_device_api_level.cpp",
"bionic/grp_pwd.cpp",
"bionic/grp_pwd_file.cpp",
- "bionic/heap_zero_init.cpp",
"bionic/iconv.cpp",
"bionic/icu_wrappers.cpp",
"bionic/ifaddrs.cpp",
@@ -1098,6 +1074,7 @@ cc_library_static {
"bionic/mblen.cpp",
"bionic/mbrtoc16.cpp",
"bionic/mbrtoc32.cpp",
+ "bionic/memmem.cpp",
"bionic/mempcpy.cpp",
"bionic/mkdir.cpp",
"bionic/mkfifo.cpp",
@@ -1111,7 +1088,6 @@ cc_library_static {
"bionic/open.cpp",
"bionic/pathconf.cpp",
"bionic/pause.cpp",
- "bionic/pidfd.cpp",
"bionic/pipe.cpp",
"bionic/poll.cpp",
"bionic/posix_fadvise.cpp",
@@ -1145,6 +1121,7 @@ cc_library_static {
"bionic/spawn.cpp",
"bionic/stat.cpp",
"bionic/stdlib_l.cpp",
+ "bionic/strchrnul.cpp",
"bionic/strerror.cpp",
"bionic/string_l.cpp",
"bionic/strings_l.cpp",
@@ -1176,7 +1153,6 @@ cc_library_static {
"bionic/umount.cpp",
"bionic/unlink.cpp",
"bionic/usleep.cpp",
- "bionic/utmp.cpp",
"bionic/wait.cpp",
"bionic/wchar.cpp",
"bionic/wchar_l.cpp",
@@ -1201,10 +1177,7 @@ cc_library_static {
cflags: ["-DTREBLE_LINKER_NAMESPACES"],
},
},
- whole_static_libs: [
- "libc_bionic_systrace",
- "libsystemproperties",
- ],
+ whole_static_libs: ["libsystemproperties"],
cppflags: ["-Wold-style-cast"],
local_include_dirs: ["stdio"],
include_dirs: ["bionic/libstdc++/include"],
@@ -1213,21 +1186,6 @@ cc_library_static {
}
// ========================================================
-// libc_bionic_systrace.a
-// ========================================================
-
-cc_library_static {
- name: "libc_bionic_systrace",
- defaults: ["libc_defaults"],
- srcs: [
- "bionic/bionic_systrace.cpp",
- ],
- apex_available: [
- "com.android.runtime",
- ],
-}
-
-// ========================================================
// libc_pthread.a - pthreads parts that previously lived in
// libc_bionic.a. Relocated to their own library because
// they can't be included in libc_ndk.a (as the layout of
@@ -1262,7 +1220,6 @@ cc_library_static {
"bionic/pthread_setname_np.cpp",
"bionic/pthread_setschedparam.cpp",
"bionic/pthread_spinlock.cpp",
- "bionic/sys_thread_properties.cpp",
// The following implementations depend on pthread data or implementation,
// so we can't include them in libc_ndk.a.
@@ -1288,9 +1245,6 @@ genrule {
srcs: ["SYSCALLS.TXT"],
tool_files: [":bionic-gensyscalls"],
cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- }
}
genrule {
@@ -1299,9 +1253,6 @@ genrule {
srcs: ["SYSCALLS.TXT"],
tool_files: [":bionic-gensyscalls"],
cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
}
genrule {
@@ -1310,9 +1261,6 @@ genrule {
srcs: ["SYSCALLS.TXT"],
tool_files: [":bionic-gensyscalls"],
cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
}
genrule {
@@ -1321,9 +1269,6 @@ genrule {
srcs: ["SYSCALLS.TXT"],
tool_files: [":bionic-gensyscalls"],
cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
- bazel_module: {
- bp2build_available: true,
- },
}
cc_library_static {
@@ -1383,7 +1328,6 @@ cc_library_static {
"libc_native_allocator_defaults",
],
ramdisk_available: false,
- vendor_ramdisk_available: false,
srcs: libc_common_src_files + [
"bionic/gwp_asan_wrappers.cpp",
"bionic/heap_tagging.cpp",
@@ -1414,8 +1358,6 @@ cc_library_static {
whole_static_libs: [
"gwp_asan",
- "libarm-optimized-routines-string",
- "libasync_safe",
"libc_bionic_ndk",
"libc_bootstrap",
"libc_fortify",
@@ -1446,8 +1388,6 @@ cc_library_static {
name: "libc_nopthread",
whole_static_libs: [
- "libarm-optimized-routines-string",
- "libasync_safe",
"libc_bionic",
"libc_bionic_ndk",
"libc_bootstrap",
@@ -1610,7 +1550,6 @@ filegroup {
"bionic/NetdClient.cpp",
"arch-common/bionic/crtend_so.S",
],
- bazel_module: { bp2build_available: true },
}
filegroup {
@@ -1621,7 +1560,6 @@ filegroup {
"bionic/malloc_common.cpp",
"bionic/malloc_limit.cpp",
],
- bazel_module: { bp2build_available: true },
}
filegroup {
@@ -1630,7 +1568,6 @@ filegroup {
"arch-arm/bionic/exidx_dynamic.c",
"arch-arm/bionic/atexit_legacy.c",
],
- bazel_module: { bp2build_available: true },
}
// ========================================================
@@ -1643,6 +1580,7 @@ cc_library {
],
name: "libc",
static_ndk_lib: true,
+ export_include_dirs: ["include"],
product_variables: {
platform_sdk_version: {
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
@@ -1664,7 +1602,6 @@ cc_library {
"gwp_asan",
"libc_init_dynamic",
"libc_common_shared",
- "libunwind-exported",
],
},
@@ -1701,14 +1638,11 @@ cc_library {
ldflags: ["-Wl,--hash-style=both"],
version_script: ":libc.arm.map",
- no_libcrt: true,
shared: {
srcs: [":libc_sources_shared_arm"],
// special for arm
cflags: ["-DCRT_LEGACY_WORKAROUND"],
- // For backwards-compatibility, some arm32 builtins are exported from libc.so.
- static_libs: ["libclang_rt.builtins-arm-android-exported"],
},
// Arm 32 bit does not produce complete exidx unwind information
@@ -1718,6 +1652,8 @@ cc_library {
strip: {
keep_symbols_and_debug_frame: true,
},
+
+ whole_static_libs: [ "libunwind_llvm" ],
},
arm64: {
version_script: ":libc.arm64.map",
@@ -1727,6 +1663,8 @@ cc_library {
strip: {
keep_symbols: true,
},
+
+ whole_static_libs: [ "libgcc_stripped" ],
},
x86: {
// TODO: This is to work around b/24465209. Remove after root cause is fixed.
@@ -1734,18 +1672,14 @@ cc_library {
ldflags: ["-Wl,--hash-style=both"],
version_script: ":libc.x86.map",
- no_libcrt: true,
-
- shared: {
- // For backwards-compatibility, some x86 builtins are exported from libc.so.
- static_libs: ["libclang_rt.builtins-i686-android-exported"],
- },
// Leave the symbols in the shared library so that stack unwinders can produce
// meaningful name resolution.
strip: {
keep_symbols: true,
},
+
+ whole_static_libs: [ "libgcc_stripped" ],
},
x86_64: {
version_script: ":libc.x86_64.map",
@@ -1755,6 +1689,8 @@ cc_library {
strip: {
keep_symbols: true,
},
+
+ whole_static_libs: [ "libgcc_stripped" ],
},
},
@@ -1763,15 +1699,10 @@ cc_library {
versions: [
"29",
"R",
- "current",
+ "10000",
],
},
- llndk: {
- symbol_file: "libc.map.txt",
- export_headers_as_system: true,
- export_preprocessed_headers: ["include"],
- export_llndk_headers: ["libc_llndk_headers"],
- },
+
apex_available: [
"//apex_available:platform",
"com.android.runtime",
@@ -1780,10 +1711,6 @@ cc_library {
// Sorting bss symbols by size usually results in less dirty pages at run
// time, because small symbols are grouped together.
sort_bss_symbols_by_size: true,
-
- lto: {
- never: true,
- },
}
genrule {
@@ -1792,7 +1719,6 @@ genrule {
srcs: ["libc.map.txt"],
tool_files: [":bionic-generate-version-script"],
cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
- bazel_module: { bp2build_available: true },
}
genrule {
@@ -1801,7 +1727,6 @@ genrule {
srcs: ["libc.map.txt"],
tool_files: [":bionic-generate-version-script"],
cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
- bazel_module: { bp2build_available: true },
}
genrule {
@@ -1810,7 +1735,6 @@ genrule {
srcs: ["libc.map.txt"],
tool_files: [":bionic-generate-version-script"],
cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
- bazel_module: { bp2build_available: true },
}
genrule {
@@ -1819,13 +1743,11 @@ genrule {
srcs: ["libc.map.txt"],
tool_files: [":bionic-generate-version-script"],
cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
- bazel_module: { bp2build_available: true },
}
// Headers that only other parts of the platform can include.
cc_library_headers {
name: "bionic_libc_platform_headers",
- defaults: ["linux_bionic_supported"],
visibility: [
"//art:__subpackages__",
"//bionic:__subpackages__",
@@ -1835,15 +1757,11 @@ cc_library_headers {
"//external/perfetto:__subpackages__",
"//external/scudo:__subpackages__",
"//system/core/debuggerd:__subpackages__",
- "//system/core/libcutils:__subpackages__",
"//system/memory/libmemunreachable:__subpackages__",
- "//system/unwinding/libunwindstack:__subpackages__",
- "//tools/security/sanitizer-status:__subpackages__",
],
+ host_supported: true,
vendor_available: true,
- product_available: true,
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
export_include_dirs: [
@@ -1853,25 +1771,21 @@ cc_library_headers {
stl: "none",
sdk_version: "current",
- min_sdk_version: "29",
apex_available: [
"//apex_available:platform",
- "//apex_available:anyapex",
+ "com.android.runtime",
+ "com.android.art.release", // from libdexfile_external
+ "com.android.art.debug", // from libdexfile_external
],
- bazel_module: { bp2build_available: true },
}
+// libc_headers for libasync_safe and libpropertyinfoparser
cc_library_headers {
- name: "libc_llndk_headers",
- visibility: ["//visibility:private"],
- llndk: {
- llndk_headers: true,
- },
+ name: "libc_headers",
+
host_supported: true,
vendor_available: true,
- product_available: true,
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
apex_available: [
@@ -1880,6 +1794,14 @@ cc_library_headers {
],
// used by most APEXes indirectly via libunwind_llvm
min_sdk_version: "apex_inherit",
+ visibility: [
+ ":__subpackages__", // visible to bionic
+ // ... and only to these places (b/152668052)
+ "//external/gwp_asan",
+ "//external/libunwind_llvm",
+ "//system/core/property_service/libpropertyinfoparser",
+ "//system/extras/toolchain-extras",
+ ],
no_libcrt: true,
stl: "none",
@@ -1893,80 +1815,34 @@ cc_library_headers {
// is correct because the headers can support any sdk_version.
sdk_version: "1",
- export_system_include_dirs: [
+ export_include_dirs: [
+ "include",
"kernel/uapi",
- "kernel/android/scsi",
"kernel/android/uapi",
],
arch: {
arm: {
- export_system_include_dirs: ["kernel/uapi/asm-arm"],
+ export_include_dirs: [
+ "kernel/uapi/asm-arm",
+ ],
},
arm64: {
- export_system_include_dirs: ["kernel/uapi/asm-arm64"],
+ export_include_dirs: [
+ "kernel/uapi/asm-arm64",
+ ],
},
x86: {
- export_system_include_dirs: ["kernel/uapi/asm-x86"],
+ export_include_dirs: [
+ "kernel/uapi/asm-x86",
+ ],
},
x86_64: {
- export_system_include_dirs: ["kernel/uapi/asm-x86"],
- },
- },
- bazel_module: { bp2build_available: true },
-}
-
-cc_library_headers {
- name: "libc_headers",
- host_supported: true,
- native_bridge_supported: true,
- vendor_available: true,
- product_available: true,
- ramdisk_available: true,
- vendor_ramdisk_available: true,
- recovery_available: true,
- sdk_version: "1",
-
- apex_available: [
- "//apex_available:platform",
- "//apex_available:anyapex",
- ],
- // used by most APEXes indirectly via libunwind_llvm
- min_sdk_version: "apex_inherit",
- visibility: [
- "//bionic:__subpackages__", // visible to bionic
- // ... and only to these places (b/152668052)
- "//external/arm-optimized-routines",
- "//external/gwp_asan",
- "//external/jemalloc_new",
- "//external/libunwind_llvm",
- "//external/scudo",
- "//system/core/property_service/libpropertyinfoparser",
- "//system/extras/toolchain-extras",
- // TODO(b/153662223): Clean up these users that needed visibility when
- // the implicit addition of system Bionic paths was removed.
- "//art/tools/cpp-define-generator",
- "//external/boringssl",
- "//external/minijail",
- ],
-
- stl: "none",
- no_libcrt: true,
- system_shared_libs: [],
-
- target: {
- android: {
- export_system_include_dirs: ["include"],
- header_libs: ["libc_llndk_headers"],
- export_header_lib_headers: ["libc_llndk_headers"],
- },
- linux_bionic: {
- export_system_include_dirs: ["include"],
- header_libs: ["libc_llndk_headers"],
- export_header_lib_headers: ["libc_llndk_headers"],
+ export_include_dirs: [
+ "kernel/uapi/asm-x86",
+ ],
},
},
- bazel_module: { bp2build_available: true },
}
// ========================================================
@@ -2054,19 +1930,15 @@ cc_defaults {
name: "crt_defaults",
defaults: ["linux_bionic_supported"],
vendor_available: true,
- product_available: true,
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
- // Generate NDK variants of the CRT objects for every supported API level.
- min_sdk_version: "16",
- stl: "none",
- crt: true,
+ // crt* objects are used by most cc_binary/cc_library in "anyapex"
+ min_sdk_version: "apex_inherit",
cflags: [
"-Wno-gcc-compat",
"-Wall",
@@ -2095,10 +1967,7 @@ cc_defaults {
cc_object {
name: "crtbrand",
// crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
- local_include_dirs: [
- "include",
- "private", // crtbrand.S depends on private/bionic_asm_note.h
- ],
+ local_include_dirs: ["include"],
product_variables: {
platform_sdk_version: {
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
@@ -2107,64 +1976,63 @@ cc_object {
srcs: ["arch-common/bionic/crtbrand.S"],
defaults: ["crt_so_defaults"],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
- name: "crtbegin_so",
+ name: "crtbegin_so1",
local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin_so.c"],
defaults: ["crt_so_defaults"],
+}
+
+cc_object {
+ name: "crtbegin_so",
+
+ defaults: ["crt_so_defaults"],
objs: [
+ "crtbegin_so1",
"crtbrand",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
name: "crtend_so",
- local_include_dirs: [
- "include",
- "private", // crtend_so.S depends on private/bionic_asm_arm64.h
- ],
+ local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtend_so.S"],
defaults: ["crt_so_defaults"],
+}
- bazel_module: { bp2build_available: true },
+cc_object {
+ name: "crtbegin_static1",
+ local_include_dirs: ["include"],
+ srcs: ["arch-common/bionic/crtbegin.c"],
+ defaults: ["crt_defaults"],
}
cc_object {
name: "crtbegin_static",
- local_include_dirs: [
- "include",
- "bionic", // crtbegin.c includes bionic/libc_init_common.h
- ],
-
- srcs: ["arch-common/bionic/crtbegin.c"],
objs: [
+ "crtbegin_static1",
"crtbrand",
],
defaults: ["crt_defaults"],
- // When using libc.a, we're using the latest library regardless of target API level.
- min_sdk_version: "current",
+}
- bazel_module: { bp2build_available: true },
+cc_object {
+ name: "crtbegin_dynamic1",
+ local_include_dirs: ["include"],
+ srcs: ["arch-common/bionic/crtbegin.c"],
+ defaults: ["crt_defaults"],
}
cc_object {
name: "crtbegin_dynamic",
- local_include_dirs: [
- "include",
- "bionic", // crtbegin.c includes bionic/libc_init_common.h
- ],
- srcs: ["arch-common/bionic/crtbegin.c"],
objs: [
+ "crtbegin_dynamic1",
"crtbrand",
],
target: {
@@ -2176,47 +2044,16 @@ cc_object {
},
},
defaults: ["crt_defaults"],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
// We rename crtend.o to crtend_android.o to avoid a
// name clash between gcc and bionic.
name: "crtend_android",
- local_include_dirs: [
- "include",
- "private", // crtend.S depends on private/bionic_asm_arm64.h
- ],
+ local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtend.S"],
defaults: ["crt_defaults"],
-
- bazel_module: { bp2build_available: true },
-}
-
-cc_library_static {
- name: "note_memtag_heap_async",
- arch: {
- arm64: {
- srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
- }
- },
- sdk_version: "minimum",
-
- defaults: ["crt_defaults"],
-}
-
-cc_library_static {
- name: "note_memtag_heap_sync",
- arch: {
- arm64: {
- srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
- }
- },
- sdk_version: "minimum",
-
- defaults: ["crt_defaults"],
}
// ========================================================
@@ -2299,10 +2136,46 @@ ndk_headers {
ndk_library {
name: "libc",
+ native_bridge_supported: true,
symbol_file: "libc.map.txt",
first_version: "9",
}
+llndk_library {
+ name: "libc",
+ symbol_file: "libc.map.txt",
+ export_headers_as_system: true,
+ export_preprocessed_headers: ["include"],
+ native_bridge_supported: true,
+ export_include_dirs: [
+ "kernel/android/scsi",
+ "kernel/android/uapi",
+ "kernel/uapi",
+ ],
+ arch: {
+ arm: {
+ export_include_dirs: [
+ "kernel/uapi/asm-arm",
+ ],
+ },
+ arm64: {
+ export_include_dirs: [
+ "kernel/uapi/asm-arm64",
+ ],
+ },
+ x86: {
+ export_include_dirs: [
+ "kernel/uapi/asm-x86",
+ ],
+ },
+ x86_64: {
+ export_include_dirs: [
+ "kernel/uapi/asm-x86",
+ ],
+ },
+ },
+}
+
ndk_library {
name: "libstdc++",
symbol_file: "libstdc++.map.txt",
@@ -2316,7 +2189,6 @@ filegroup {
"kernel/uapi/linux/input.h",
"kernel/uapi/linux/input-event-codes.h",
],
- bazel_module: { bp2build_available: true },
}
// Generate a syscall name / number mapping. These objects are text files
@@ -2342,8 +2214,6 @@ cc_object {
"kernel/uapi/asm-arm",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2353,8 +2223,6 @@ cc_object {
"kernel/uapi/asm-arm64",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2366,8 +2234,6 @@ cc_object {
"kernel/uapi/asm-x86",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
cc_object {
@@ -2379,16 +2245,55 @@ cc_object {
"kernel/uapi/asm-x86",
"kernel/uapi",
],
-
- bazel_module: { bp2build_available: true },
}
-filegroup {
- name: "all_kernel_uapi_headers",
- srcs: ["kernel/uapi/**/*.h"],
- bazel_module: { bp2build_available: true },
+// Generate the C++ policy sources for app and system seccomp-bpf filters.
+python_binary_host {
+ name: "genseccomp",
+ main: "tools/genseccomp.py",
+
+ srcs: [
+ "tools/genseccomp.py",
+ "tools/gensyscalls.py",
+ ],
+
+ data: [
+ "kernel/uapi/**/*.h",
+ ],
+
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
}
+python_binary_host {
+ name: "genfunctosyscallnrs",
+ main: "tools/genfunctosyscallnrs.py",
+
+ srcs: [
+ "tools/genseccomp.py",
+ "tools/genfunctosyscallnrs.py",
+ "tools/gensyscalls.py",
+ ],
+
+ data: [
+ "kernel/uapi/**/*.h",
+ ],
+
+ version: {
+ py2: {
+ enabled: true,
+ },
+ py3: {
+ enabled: false,
+ },
+ },
+}
cc_genrule {
name: "func_to_syscall_nrs",
@@ -2410,11 +2315,11 @@ cc_genrule {
],
}
-// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
+// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
genrule {
- name: "generate_app_zygote_blocklist",
- out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
- srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
+ name: "generate_app_zygote_blacklist",
+ out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
+ srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
}
@@ -2427,11 +2332,11 @@ cc_genrule {
srcs: [
"SYSCALLS.TXT",
- "SECCOMP_ALLOWLIST_COMMON.TXT",
- "SECCOMP_ALLOWLIST_APP.TXT",
- "SECCOMP_BLOCKLIST_COMMON.TXT",
+ "SECCOMP_WHITELIST_COMMON.TXT",
+ "SECCOMP_WHITELIST_APP.TXT",
+ "SECCOMP_BLACKLIST_COMMON.TXT",
"SECCOMP_PRIORITY.TXT",
- ":generate_app_zygote_blocklist",
+ ":generate_app_zygote_blacklist",
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
":libseccomp_gen_syscall_nrs_x86",
@@ -2455,10 +2360,10 @@ cc_genrule {
srcs: [
"SYSCALLS.TXT",
- "SECCOMP_ALLOWLIST_COMMON.TXT",
- "SECCOMP_ALLOWLIST_APP.TXT",
- "SECCOMP_BLOCKLIST_COMMON.TXT",
- "SECCOMP_BLOCKLIST_APP.TXT",
+ "SECCOMP_WHITELIST_COMMON.TXT",
+ "SECCOMP_WHITELIST_APP.TXT",
+ "SECCOMP_BLACKLIST_COMMON.TXT",
+ "SECCOMP_BLACKLIST_APP.TXT",
"SECCOMP_PRIORITY.TXT",
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
@@ -2483,9 +2388,9 @@ cc_genrule {
srcs: [
"SYSCALLS.TXT",
- "SECCOMP_ALLOWLIST_COMMON.TXT",
- "SECCOMP_ALLOWLIST_SYSTEM.TXT",
- "SECCOMP_BLOCKLIST_COMMON.TXT",
+ "SECCOMP_WHITELIST_COMMON.TXT",
+ "SECCOMP_WHITELIST_SYSTEM.TXT",
+ "SECCOMP_BLACKLIST_COMMON.TXT",
"SECCOMP_PRIORITY.TXT",
":libseccomp_gen_syscall_nrs_arm",
":libseccomp_gen_syscall_nrs_arm64",
@@ -2528,6 +2433,75 @@ cc_library {
},
}
+// This is a temporary library that will use scudo as the native memory
+// allocator. To use it, add it as the first shared library.
+cc_defaults {
+ name: "libc_scudo_wrapper_defaults",
+ srcs: [
+ "bionic/gwp_asan_wrappers.cpp",
+ "bionic/heap_tagging.cpp",
+ "bionic/malloc_common.cpp",
+ "bionic/malloc_common_dynamic.cpp",
+ "bionic/malloc_heapprofd.cpp",
+ "bionic/malloc_limit.cpp",
+ "bionic/scudo_wrapper.cpp",
+ "bionic/__set_errno.cpp",
+ ],
+ cflags: [
+ "-DUSE_SCUDO",
+ "-fno-emulated-tls", // Required for GWP-ASan.
+ ],
+ shared_libs: ["libscudo_wrapper"],
+
+ header_libs: [
+ "libc_headers",
+ "gwp_asan_headers",
+ ],
+
+ static_libs: [
+ "libasync_safe",
+ "gwp_asan",
+ ],
+
+ arch: {
+ arm: {
+ srcs: [":syscalls-arm.S"],
+ },
+ arm64: {
+ srcs: [":syscalls-arm64.S"],
+ },
+ x86: {
+ srcs: [
+ "arch-x86/bionic/__libc_init_sysinfo.cpp",
+ ":syscalls-x86.S",
+ ],
+ },
+ x86_64: {
+ srcs: [":syscalls-x86_64.S"],
+ },
+ },
+
+ // Mark this library as global so it overrides all the allocation
+ // definitions properly.
+ ldflags: ["-Wl,-z,global"],
+}
+
+cc_library_shared {
+ name: "libc_scudo",
+ vendor_available: true,
+ stl: "none",
+ system_shared_libs: [],
+
+ allow_undefined_symbols: true,
+ // Like libc, disable native coverage for libc_scudo.
+ native_coverage: false,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.media.swcodec",
+ ],
+ min_sdk_version: "apex_inherit",
+}
+
subdirs = [
"bionic/scudo",
]
diff --git a/libc/NOTICE b/libc/NOTICE
index 26fef0577..8245ff890 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -1,3 +1,60 @@
+ Copyright (c) 2014, ARM Limited
+ All rights Reserved.
+ Copyright (c) 2014, Linaro Ltd.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the company nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+ Copyright (c) 2014, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 1993 John Brezak
All rights reserved.
@@ -63,6 +120,165 @@ is preserved.
-------------------------------------------------------------------
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+Optimized by Bruce D. Evans.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+k_sinf.c and k_cosf.c merged by Steven G. Kargl.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+s_sin.c and s_cos.c merged by Steven G. Kargl. Descriptions of the
+algorithms are contained in the original files.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+Optimized by Bruce D. Evans.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+k_sin.c and k_cos.c merged by Steven G. Kargl.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+Optimized by Bruce D. Evans.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+
+Developed at SunSoft, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+k_sinl.c and k_cosl.c merged by Steven G. Kargl
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+Copyright (c) 2009-2011, Bruce D. Evans, Steven G. Kargl, David Schultz.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+====================================================
+
+The argument reduction and testing for exceptional cases was
+written by Steven G. Kargl with input from Bruce D. Evans
+and David A. Schultz.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
+
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
+====================================================
+Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
+Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
Based on the UCB version with the ID appearing below.
This is ANSIish only when "multibyte character == plain character".
@@ -592,6 +808,32 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (C) 2014 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -855,50 +1097,6 @@ SUCH DAMAGE.
-------------------------------------------------------------------
Copyright (C) 2020 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2021 The Android Open Source Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -1347,6 +1545,39 @@ are met:
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 1985, 1993
+ The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -1558,6 +1789,39 @@ are met:
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 1988, 1993
+ The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -2145,6 +2409,38 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 1990, 1993, 1994
+ The Regents of the University of California. All rights reserved.
+
+This code is derived from software contributed to Berkeley by
+Chris Torek.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 1991 The Regents of the University of California.
All rights reserved.
@@ -2345,6 +2641,39 @@ are met:
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the University of
+ California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 1992, 1993
+ The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -2732,7 +3061,7 @@ POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
-Copyright (c) 1997 Todd C. Miller <millert@openbsd.org>
+Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -3184,6 +3513,35 @@ POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2002 The NetBSD Foundation, Inc.
+All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation
+by Christos Zoulas.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2002 Tim J. Robbins
All rights reserved.
@@ -3334,6 +3692,34 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2003 Dag-Erling Smørgrav
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer
+ in this position and unchanged.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
All rights reserved.
@@ -3360,6 +3746,33 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
+Copyright (c) 2002 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2003 Networks Associates Technology, Inc.
All rights reserved.
@@ -3432,6 +3845,32 @@ Materiel Command, USAF, under agreement number F39502-99-1-0512.
-------------------------------------------------------------------
+Copyright (c) 2003, Steven G. Kargl
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
All rights reserved.
@@ -3458,6 +3897,32 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2004 Stefan Farfeleder
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
Copyright (c) 1995,1999 by Internet Software Consortium.
@@ -3689,6 +4154,58 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2005 Tim J. Robbins.
All rights reserved.
@@ -3732,30 +4249,59 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------
-Copyright (c) 2005-2018 Rich Felker
+Copyright (c) 2005-2008 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+-------------------------------------------------------------------
+
+Copyright (c) 2005-2011 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
-------------------------------------------------------------------
-Copyright (c) 2005-2020 Rich Felker, et al.
+Copyright (c) 2005-2014 Rich Felker
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -3778,6 +4324,148 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------
+Copyright (c) 2007 David Schultz
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+Derived from s_modf.c, which has the following Copyright:
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2007 Steven G. Kargl
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2007 The NetBSD Foundation, Inc.
+All rights reserved.
+
+This code is derived from software written by Stephen L. Moshier.
+It is redistributed by the NetBSD Foundation by permission of the author.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2007 Todd C. Miller <millert@openbsd.org>
Permission to use, copy, modify, and distribute this software for any
@@ -3794,6 +4482,34 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------
+Copyright (c) 2007, 2010-2013 Steven G. Kargl
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+s_sinl.c and s_cosl.c merged by Steven G. Kargl.
+
+-------------------------------------------------------------------
+
Copyright (c) 2007-2008 Michael G Schwern
This software originally derived from Paul Sheer's pivotal_gmtime_r.c.
@@ -3849,7 +4565,85 @@ Modified for Bionic by the Android Open Source Project
-------------------------------------------------------------------
-Copyright (c) 2008, 2016 Todd C. Miller <millert@openbsd.org>
+Copyright (c) 2007-2008 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2007-2013 Bruce D. Evans
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2008 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -3865,7 +4659,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------
-Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
+Copyright (c) 2008 Todd C. Miller <millert@openbsd.org>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -3981,6 +4775,34 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2009-2013 Steven G. Kargl
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Optimized by Bruce D. Evans.
+
+-------------------------------------------------------------------
+
Copyright (c) 2010 The NetBSD Foundation, Inc.
All rights reserved.
@@ -4109,6 +4931,58 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2011 David Schultz
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2011 David Schultz <das@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
David Chisnall <theraven@FreeBSD.org>
All rights reserved.
@@ -4298,6 +5172,87 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
+Copyright (c) 2017 Mahdi Mokhtari <mmokhi@FreeBSD.org>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2012, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2012-2013, Linaro Limited
All rights reserved.
@@ -4397,6 +5352,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-------------------------------------------------------------------
+Copyright (c) 2013 Bruce D. Evans
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice unmodified, this list of conditions, and the following
+ disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c) 2013 The NetBSD Foundation, Inc.
All rights reserved.
@@ -4453,6 +5434,64 @@ Copyright (c) 2013, Linaro Limited
-------------------------------------------------------------------
+Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
+Johnny Qiu <joqiu@nvidia.com>
+Shu Zhang <chazhang@nvidia.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
+Copyright (c) 2013-2015, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+
+-------------------------------------------------------------------
+
Copyright (c) 2014, Intel Corporation
All rights reserved.
@@ -4593,6 +5632,34 @@ SUCH DAMAGE.
-------------------------------------------------------------------
+Copyright (c) 2017 ARM Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the company may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c)1999 Citrus Project,
All rights reserved.
@@ -4735,6 +5802,17 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------
+From: @(#)s_ilogb.c 5.1 93/09/24
+====================================================
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+
+-------------------------------------------------------------------
+
Portions Copyright (C) 2004, 2005, 2008, 2009 Internet Systems Consortium, Inc. ("ISC")
Portions Copyright (C) 1996-2003 Internet Software Consortium.
diff --git a/libc/SECCOMP_BLOCKLIST_APP.TXT b/libc/SECCOMP_BLACKLIST_APP.TXT
index f14e11c51..40ca22275 100644
--- a/libc/SECCOMP_BLOCKLIST_APP.TXT
+++ b/libc/SECCOMP_BLACKLIST_APP.TXT
@@ -1,8 +1,8 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
-# The final seccomp allowlist is SYSCALLS.TXT - SECCOMP_BLOCKLIST.TXT + SECCOMP_ALLOWLIST.TXT
-# Any entry in the blocklist must be in the syscalls file and not be in the allowlist file
+# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
+# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
#
# This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_BLACKLIST_COMMON.TXT b/libc/SECCOMP_BLACKLIST_COMMON.TXT
new file mode 100644
index 000000000..8ae21c197
--- /dev/null
+++ b/libc/SECCOMP_BLACKLIST_COMMON.TXT
@@ -0,0 +1,10 @@
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
+# Note that the resultant policy is applied only to zygote spawned processes.
+#
+# The final seccomp whitelist is SYSCALLS.TXT - SECCOMP_BLACKLIST.TXT + SECCOMP_WHITELIST.TXT
+# Any entry in the blacklist must be in the syscalls file and not be in the whitelist file
+#
+# This file is processed by a python script named genseccomp.py.
+
+int swapon(const char*, int) all
+int swapoff(const char*) all
diff --git a/libc/SECCOMP_BLOCKLIST_COMMON.TXT b/libc/SECCOMP_BLOCKLIST_COMMON.TXT
deleted file mode 100644
index 22c9844b3..000000000
--- a/libc/SECCOMP_BLOCKLIST_COMMON.TXT
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
-# Note that the resultant policy is applied only to zygote spawned processes.
-#
-# The final seccomp allowlist is SYSCALLS.TXT - SECCOMP_BLOCKLIST.TXT + SECCOMP_ALLOWLIST.TXT
-# Any entry in the blocklist must be in the syscalls file and not be in the allowlist file
-#
-# This file is processed by a python script named genseccomp.py.
-
-int swapon(const char*, int) all
-int swapoff(const char*) all
diff --git a/libc/SECCOMP_PRIORITY.TXT b/libc/SECCOMP_PRIORITY.TXT
index bccc426b4..fb5ad4a79 100644
--- a/libc/SECCOMP_PRIORITY.TXT
+++ b/libc/SECCOMP_PRIORITY.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
# This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_ALLOWLIST_APP.TXT b/libc/SECCOMP_WHITELIST_APP.TXT
index ba40b607e..dc48715ae 100644
--- a/libc/SECCOMP_ALLOWLIST_APP.TXT
+++ b/libc/SECCOMP_WHITELIST_APP.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
# This file is processed by a python script named genseccomp.py.
diff --git a/libc/SECCOMP_ALLOWLIST_COMMON.TXT b/libc/SECCOMP_WHITELIST_COMMON.TXT
index 6650d7e32..56f9d1d34 100644
--- a/libc/SECCOMP_ALLOWLIST_COMMON.TXT
+++ b/libc/SECCOMP_WHITELIST_COMMON.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
# This file is processed by a python script named genseccomp.py.
@@ -72,5 +72,5 @@ int semtimedop_time64(int, sembuf*, size_t, const timespec64*) lp32
int rt_sigtimedwait_time64(const sigset64_t*, siginfo_t*, const timespec64*, size_t) lp32
int futex_time64(int*, int, int, const timespec64*, int*, int) lp32
int sched_rr_get_interval_time64(pid_t, timespec64*) lp32
-# Since Linux 5.4, not in glibc. Probed for and conditionally used by ART.
-int userfaultfd(int) all
+# Since Linux 5.3, not in glibc.
+int pidfd_open(pid_t pid, unsigned int flags) all
diff --git a/libc/SECCOMP_ALLOWLIST_SYSTEM.TXT b/libc/SECCOMP_WHITELIST_SYSTEM.TXT
index 756affed1..266fe30f7 100644
--- a/libc/SECCOMP_ALLOWLIST_SYSTEM.TXT
+++ b/libc/SECCOMP_WHITELIST_SYSTEM.TXT
@@ -1,4 +1,4 @@
-# This file is used to populate seccomp's allowlist policy in combination with SYSCALLS.TXT.
+# This file is used to populate seccomp's whitelist policy in combination with SYSCALLS.TXT.
# Note that the resultant policy is applied only to zygote spawned processes.
#
# This file is processed by a python script named genseccomp.py.
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 391e7af16..6142bafb0 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -113,7 +113,6 @@ void* __mremap:mremap(void*, size_t, size_t, int, void*) all
int msync(const void*, size_t, int) all
int mprotect(const void*, size_t, int) all
int madvise(void*, size_t, int) all
-ssize_t process_madvise(int, const struct iovec*, size_t, int, unsigned int) all
int mlock(const void* addr, size_t len) all
int mlock2(const void* addr, size_t len, int flags) all
int munlock(const void* addr, size_t len) all
@@ -358,8 +357,3 @@ int __gettimeofday:gettimeofday(struct timeval*, struct timezone*) all
# <sys/random.h>
ssize_t getrandom(void*, size_t, unsigned) all
-
-# <sys/pidfd.h>
-int __pidfd_open:pidfd_open(pid_t, unsigned int) all
-int __pidfd_getfd:pidfd_getfd(int, int, unsigned int) all
-int pidfd_send_signal(int, int, siginfo_t*, unsigned int) all
diff --git a/libc/arch-arm/bionic/__bionic_clone.S b/libc/arch-arm/bionic/__bionic_clone.S
index 3fe212b47..6669b93a2 100644
--- a/libc/arch-arm/bionic/__bionic_clone.S
+++ b/libc/arch-arm/bionic/__bionic_clone.S
@@ -61,8 +61,6 @@ ENTRY_PRIVATE(__bionic_clone)
b __set_errno_internal
.L_bc_child:
- # We're in the child now. Set the end of the frame record chain.
- mov fp, #0
# Setting lr to 0 will make the unwinder stop at __start_thread.
mov lr, #0
# Call __start_thread with the 'fn' and 'arg' we stored on the child stack.
diff --git a/libc/arch-arm/bionic/__restore.S b/libc/arch-arm/bionic/__restore.S
index 529174398..8c1e41d53 100644
--- a/libc/arch-arm/bionic/__restore.S
+++ b/libc/arch-arm/bionic/__restore.S
@@ -28,14 +28,13 @@
#include <private/bionic_asm.h>
-// gdb is able to unwind through signal frames with just the regular
+// gdb is smart enough to unwind through signal frames with just the regular
// CFI information but libgcc and libunwind both need extra help. We do this
// by using .fnstart/.fnend and inserting a nop before both __restore and
// __restore_rt (but covered by the .fnstart/.fnend) so that although they're
// not inside the functions from objdump's point of view, an unwinder that
-// just assumes it should look at the previous instruction (but is then smart
-// enough to check the unwind information to find out where it landed) gets
-// the right answer.
+// blindly looks at the previous instruction (but is then smart enough to check
+// the unwind information to find out where it landed) gets the right answer.
// Make sure not to have both DWARF and ARM unwind information, so only
// use the ARM unwind information.
diff --git a/libc/arch-arm/bionic/kuser_helper_on.S b/libc/arch-arm/bionic/kuser_helper_on.S
index 2a1d86dde..cff2073b7 100644
--- a/libc/arch-arm/bionic/kuser_helper_on.S
+++ b/libc/arch-arm/bionic/kuser_helper_on.S
@@ -26,15 +26,13 @@
* SUCH DAMAGE.
*/
-#include <private/bionic_asm_note.h>
-
.section .note.android.kuser_helper_on,"a",%note
.balign 4
.type kuser_helper_on, %object
kuser_helper_on:
.long 2f-1f // int32_t namesz
.long 3f-2f // int32_t descsz
- .long NT_TYPE_KUSER // int32_t type
+ .long 3 // int32_t type
1:.ascii "Android\0" // char name[]
2:.long 1 // int32_t on
3:
diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S
index 2579143f6..5fbcaf39f 100644
--- a/libc/arch-arm/bionic/setjmp.S
+++ b/libc/arch-arm/bionic/setjmp.S
@@ -87,6 +87,28 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
b sigsetjmp
END(_setjmp)
+#define MANGLE_REGISTERS 1
+#define USE_CHECKSUM 1
+
+.macro m_mangle_registers reg
+#if MANGLE_REGISTERS
+ eor r4, r4, \reg
+ eor r5, r5, \reg
+ eor r6, r6, \reg
+ eor r7, r7, \reg
+ eor r8, r8, \reg
+ eor r9, r9, \reg
+ eor r10, r10, \reg
+ eor r11, r11, \reg
+ eor r13, r13, \reg
+ eor r14, r14, \reg
+#endif
+.endm
+
+.macro m_unmangle_registers reg
+ m_mangle_registers \reg
+.endm
+
.macro m_calculate_checksum dst, src, scratch
mov \dst, #0
.irp i,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
@@ -145,30 +167,12 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
// Save core registers.
add r1, r0, #(_JB_CORE_BASE * 4)
- // Mangle the easy registers in-place, write them out in one go, and unmangle
- // them again.
- eor r4, r4, r2
- eor r5, r5, r2
- eor r6, r6, r2
- eor r7, r7, r2
- eor r8, r8, r2
- eor r9, r9, r2
- eor r10, r10, r2
- eor r11, r11, r2
- stmia r1, {r4-r11}
- eor r4, r4, r2
- eor r5, r5, r2
- eor r6, r6, r2
- eor r7, r7, r2
- eor r8, r8, r2
- eor r9, r9, r2
- eor r10, r10, r2
- eor r11, r11, r2
- // We need to avoid invalid values in sp or lr (http://b/152210274).
- eor r3, lr, r2
- str r3, [r1, #(8 * 4)]
- eor r3, sp, r2
- str r3, [r1, #(9 * 4)]
+ m_mangle_registers r2
+
+ // ARM deprecates using sp in the register list for stmia.
+ stmia r1, {r4-r11, lr}
+ str sp, [r1, #(9 * 4)]
+ m_unmangle_registers r2
// Save floating-point registers.
add r1, r0, #(_JB_FLOAT_BASE * 4)
@@ -178,9 +182,11 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
fmrx r1, fpscr
str r1, [r0, #(_JB_FLOAT_STATE * 4)]
+#if USE_CHECKSUM
// Calculate the checksum.
m_calculate_checksum r12, r0, r2
str r12, [r0, #(_JB_CHECKSUM * 4)]
+#endif
mov r0, #0
bx lr
@@ -195,11 +201,14 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
.cfi_rel_offset r1, 4
.cfi_rel_offset lr, 8
+#if USE_CHECKSUM
// Check the checksum before doing anything.
m_calculate_checksum r12, r0, r3
ldr r2, [r0, #(_JB_CHECKSUM * 4)]
+
teq r2, r12
bne __bionic_setjmp_checksum_mismatch
+#endif
// Fetch the signal flag.
ldr r1, [r0, #(_JB_SIGFLAG * 4)]
@@ -236,21 +245,10 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
// Restore core registers.
add r2, r0, #(_JB_CORE_BASE * 4)
- // Do all the easy registers in one go.
- ldmia r2, {r4-r11}
- eor r4, r4, r3
- eor r5, r5, r3
- eor r6, r6, r3
- eor r7, r7, r3
- eor r8, r8, r3
- eor r9, r9, r3
- eor r10, r10, r3
- eor r11, r11, r3
- // We need to avoid invalid values in sp or lr (http://b/152210274).
- ldr r0, [r2, #(8 * 4)]
- eor lr, r0, r3
- ldr r0, [r2, #(9 * 4)]
- eor sp, r0, r3
+ // ARM deprecates using sp in the register list for ldmia.
+ ldmia r2, {r4-r11, lr}
+ ldr sp, [r2, #(9 * 4)]
+ m_unmangle_registers r3
// Save the return value/address and check the setjmp cookie.
stmfd sp!, {r1, lr}
diff --git a/libc/arch-arm/generic/bionic/strlen.c b/libc/arch-arm/generic/bionic/strlen.c
index a6fde8b5f..43d9e514c 100644
--- a/libc/arch-arm/generic/bionic/strlen.c
+++ b/libc/arch-arm/generic/bionic/strlen.c
@@ -116,8 +116,8 @@ size_t strlen_generic(const char *s)
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF0000 \n"
- "beq 2f \n"
- "add %[l], %[l], #1 \n"
+ "it ne \n"
+ "addne %[l], %[l], #1 \n"
"2: \n"
: [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b)
: "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL)
diff --git a/libc/arch-arm64/bionic/__bionic_clone.S b/libc/arch-arm64/bionic/__bionic_clone.S
index e9932adaf..c3ff0e50c 100644
--- a/libc/arch-arm64/bionic/__bionic_clone.S
+++ b/libc/arch-arm64/bionic/__bionic_clone.S
@@ -57,5 +57,3 @@ ENTRY_PRIVATE(__bionic_clone)
ldp x0, x1, [sp], #16
b __start_thread
END(__bionic_clone)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/bionic/_exit_with_stack_teardown.S b/libc/arch-arm64/bionic/_exit_with_stack_teardown.S
index c53a1f412..6a7b1e561 100644
--- a/libc/arch-arm64/bionic/_exit_with_stack_teardown.S
+++ b/libc/arch-arm64/bionic/_exit_with_stack_teardown.S
@@ -39,5 +39,3 @@ ENTRY_PRIVATE(_exit_with_stack_teardown)
svc #0
// The exit syscall does not return.
END(_exit_with_stack_teardown)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/bionic/note_memtag_heap_async.S b/libc/arch-arm64/bionic/note_memtag_heap_async.S
deleted file mode 100644
index 208115c13..000000000
--- a/libc/arch-arm64/bionic/note_memtag_heap_async.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <private/bionic_asm_note.h>
-
-__bionic_asm_custom_note_gnu_section()
-
- .section ".note.android.memtag", "a", %note
- .p2align 2
- .long 1f - 0f // int32_t namesz
- .long 3f - 2f // int32_t descsz
- .long NT_TYPE_MEMTAG // int32_t type
-0:
- .asciz "Android" // char name[]
-1:
- .p2align 2
-2:
- .long (NT_MEMTAG_LEVEL_ASYNC | NT_MEMTAG_HEAP) // value
-3:
- .p2align 2
diff --git a/libc/arch-arm64/bionic/note_memtag_heap_sync.S b/libc/arch-arm64/bionic/note_memtag_heap_sync.S
deleted file mode 100644
index d71ad020e..000000000
--- a/libc/arch-arm64/bionic/note_memtag_heap_sync.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-#include <private/bionic_asm_note.h>
-
-__bionic_asm_custom_note_gnu_section()
-
- .section ".note.android.memtag", "a", %note
- .p2align 2
- .long 1f - 0f // int32_t namesz
- .long 3f - 2f // int32_t descsz
- .long NT_TYPE_MEMTAG // int32_t type
-0:
- .asciz "Android" // char name[]
-1:
- .p2align 2
-2:
- .long (NT_MEMTAG_LEVEL_SYNC | NT_MEMTAG_HEAP) // value
-3:
- .p2align 2
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index d2fafdbe0..a2b23702a 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -69,8 +69,11 @@
#define _JB_CHECKSUM (_JB_D8_D9 + 2)
#define SCS_MASK (SCS_SIZE - 1)
+#define MANGLE_REGISTERS 1
+#define USE_CHECKSUM 1
.macro m_mangle_registers reg, sp_reg
+#if MANGLE_REGISTERS
eor x3, x3, \reg
eor x19, x19, \reg
eor x20, x20, \reg
@@ -85,6 +88,7 @@
eor x29, x29, \reg
eor x30, x30, \reg
eor \sp_reg, \sp_reg, \reg
+#endif
.endm
.macro m_calculate_checksum dst, src, scratch
@@ -114,8 +118,6 @@ END(_setjmp)
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
- paciasp
- .cfi_negate_ra_state
stp x0, x30, [sp, #-16]!
.cfi_def_cfa_offset 16
.cfi_rel_offset x0, 0
@@ -175,24 +177,27 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
stp d10, d11, [x0, #(_JB_D10_D11 * 8)]
stp d8, d9, [x0, #(_JB_D8_D9 * 8)]
+#if USE_CHECKSUM
// Calculate the checksum.
m_calculate_checksum x12, x0, x2
str x12, [x0, #(_JB_CHECKSUM * 8)]
+#endif
mov w0, #0
- autiasp
- .cfi_negate_ra_state
ret
END(sigsetjmp)
// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
+#if USE_CHECKSUM
// Check the checksum before doing anything.
m_calculate_checksum x12, x0, x2
ldr x2, [x0, #(_JB_CHECKSUM * 8)]
+
cmp x2, x12
bne __bionic_setjmp_checksum_mismatch
+#endif
#if __has_feature(hwaddress_sanitizer)
stp x0, x30, [sp, #-16]!
@@ -245,9 +250,7 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
1:
// Restore core registers.
bic x2, x2, #1
- // x30 was saved with PAC to jmp_buf in sigsetjmp().
ldp x30, x10, [x0, #(_JB_X30_SP * 8)]
- .cfi_negate_ra_state
ldp x28, x29, [x0, #(_JB_X28_X29 * 8)]
ldp x26, x27, [x0, #(_JB_X26_X27 * 8)]
ldp x24, x25, [x0, #(_JB_X24_X25 * 8)]
@@ -287,8 +290,6 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
// Set return value.
cmp w1, wzr
csinc w0, w1, wzr, ne
- autiasp
- .cfi_negate_ra_state
ret
END(siglongjmp)
@@ -296,5 +297,3 @@ ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/bionic/syscall.S b/libc/arch-arm64/bionic/syscall.S
index 9e6f68ac4..8389f9830 100644
--- a/libc/arch-arm64/bionic/syscall.S
+++ b/libc/arch-arm64/bionic/syscall.S
@@ -47,5 +47,3 @@ ENTRY(syscall)
ret
END(syscall)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index df7b063d9..5cfb8b0cc 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -67,8 +67,6 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
// Clean up stack shadow in the parent process.
// https://github.com/google/sanitizers/issues/925
- paciasp
- .cfi_negate_ra_state
stp x0, x30, [sp, #-16]!
.cfi_adjust_cfa_offset 16
.cfi_rel_offset x0, 0
@@ -81,13 +79,9 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
.cfi_adjust_cfa_offset -16
.cfi_restore x0
.cfi_restore x30
- autiasp
- .cfi_negate_ra_state
#endif
.L_exit:
ret
END(vfork)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/default/bionic/memchr.S b/libc/arch-arm64/default/bionic/memchr.S
new file mode 100644
index 000000000..7fbcc8fd4
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/memchr.S
@@ -0,0 +1,164 @@
+/*
+ *
+ Copyright (c) 2014, ARM Limited
+ All rights Reserved.
+ Copyright (c) 2014, Linaro Ltd.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the company nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Neon Available.
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results. */
+#define srcin x0
+#define chrin w1
+#define cntin x2
+
+#define result x0
+
+#define src x3
+#define tmp x4
+#define wtmp2 w5
+#define synd x6
+#define soff x9
+#define cntrem x10
+
+#define vrepchr v0
+#define vdata1 v1
+#define vdata2 v2
+#define vhas_chr1 v3
+#define vhas_chr2 v4
+#define vrepmask v5
+#define vend v6
+
+/*
+ * Core algorithm:
+ *
+ * For each 32-byte chunk we calculate a 64-bit syndrome value, with two bits
+ * per byte. For each tuple, bit 0 is set if the relevant byte matched the
+ * requested character and bit 1 is not used (faster than using a 32bit
+ * syndrome). Since the bits in the syndrome reflect exactly the order in which
+ * things occur in the original string, counting trailing zeros allows to
+ * identify exactly which byte has matched.
+ */
+
+ENTRY(memchr_default)
+ /*
+ * Magic constant 0x40100401 allows us to identify which lane matches
+ * the requested byte.
+ */
+ cbz cntin, .Lzero_length
+ mov wtmp2, #0x0401
+ movk wtmp2, #0x4010, lsl #16
+ dup vrepchr.16b, chrin
+ /* Work with aligned 32-byte chunks */
+ bic src, srcin, #31
+ dup vrepmask.4s, wtmp2
+ ands soff, srcin, #31
+ and cntrem, cntin, #31
+ b.eq .Lloop
+
+ /*
+ * Input string is not 32-byte aligned. We calculate the syndrome
+ * value for the aligned 32 bytes block containing the first bytes
+ * and mask the irrelevant part.
+ */
+
+ ld1 {vdata1.16b, vdata2.16b}, [src], #32
+ sub tmp, soff, #32
+ adds cntin, cntin, tmp
+ cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b
+ cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b
+ and vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
+ and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
+ addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
+ addp vend.16b, vend.16b, vend.16b /* 128->64 */
+ mov synd, vend.d[0]
+ /* Clear the soff*2 lower bits */
+ lsl tmp, soff, #1
+ lsr synd, synd, tmp
+ lsl synd, synd, tmp
+ /* The first block can also be the last */
+ b.ls .Lmasklast
+ /* Have we found something already? */
+ cbnz synd, .Ltail
+
+.Lloop:
+ ld1 {vdata1.16b, vdata2.16b}, [src], #32
+ subs cntin, cntin, #32
+ cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b
+ cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b
+ /* If we're out of data we finish regardless of the result */
+ b.ls .Lend
+ /* Use a fast check for the termination condition */
+ orr vend.16b, vhas_chr1.16b, vhas_chr2.16b
+ addp vend.2d, vend.2d, vend.2d
+ mov synd, vend.d[0]
+ /* We're not out of data, loop if we haven't found the character */
+ cbz synd, .Lloop
+
+.Lend:
+ /* Termination condition found, let's calculate the syndrome value */
+ and vhas_chr1.16b, vhas_chr1.16b, vrepmask.16b
+ and vhas_chr2.16b, vhas_chr2.16b, vrepmask.16b
+ addp vend.16b, vhas_chr1.16b, vhas_chr2.16b /* 256->128 */
+ addp vend.16b, vend.16b, vend.16b /* 128->64 */
+ mov synd, vend.d[0]
+ /* Only do the clear for the last possible block */
+ b.hi .Ltail
+
+.Lmasklast:
+ /* Clear the (32 - ((cntrem + soff) % 32)) * 2 upper bits */
+ add tmp, cntrem, soff
+ and tmp, tmp, #31
+ sub tmp, tmp, #32
+ neg tmp, tmp, lsl #1
+ lsl synd, synd, tmp
+ lsr synd, synd, tmp
+
+.Ltail:
+ /* Count the trailing zeros using bit reversing */
+ rbit synd, synd
+ /* Compensate the last post-increment */
+ sub src, src, #32
+ /* Check that we have found a character */
+ cmp synd, #0
+ /* And count the leading zeros */
+ clz synd, synd
+ /* Compute the potential result */
+ add result, src, synd, lsr #1
+ /* Select result or NULL */
+ csel result, xzr, result, eq
+ ret
+
+.Lzero_length:
+ mov result, xzr
+ ret
+END(memchr_default)
diff --git a/libc/arch-arm64/default/bionic/strchr.S b/libc/arch-arm64/default/bionic/strchr.S
new file mode 100644
index 000000000..f8cb724cc
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/strchr.S
@@ -0,0 +1,153 @@
+/*
+ *
+ Copyright (c) 2014, ARM Limited
+ All rights Reserved.
+ Copyright (c) 2014, Linaro Ltd.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the company nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ * Neon Available.
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results. */
+#define srcin x0
+#define chrin w1
+
+#define result x0
+
+#define src x2
+#define tmp1 x3
+#define wtmp2 w4
+#define tmp3 x5
+
+#define vrepchr v0
+#define vdata1 v1
+#define vdata2 v2
+#define vhas_nul1 v3
+#define vhas_nul2 v4
+#define vhas_chr1 v5
+#define vhas_chr2 v6
+#define vrepmask_0 v7
+#define vrepmask_c v16
+#define vend1 v17
+#define vend2 v18
+
+/* Core algorithm.
+
+ For each 32-byte hunk we calculate a 64-bit syndrome value, with
+ two bits per byte (LSB is always in bits 0 and 1, for both big
+ and little-endian systems). For each tuple, bit 0 is set iff
+ the relevant byte matched the requested character; bit 1 is set
+ iff the relevant byte matched the NUL end of string (we trigger
+ off bit0 for the special case of looking for NUL). Since the bits
+ in the syndrome reflect exactly the order in which things occur
+ in the original string a count_trailing_zeros() operation will
+ identify exactly which byte is causing the termination, and why. */
+
+/* Locals and temporaries. */
+
+ENTRY(strchr_default)
+ /* Magic constant 0x40100401 to allow us to identify which lane
+ matches the requested byte. Magic constant 0x80200802 used
+ similarly for NUL termination. */
+ mov wtmp2, #0x0401
+ movk wtmp2, #0x4010, lsl #16
+ dup vrepchr.16b, chrin
+ bic src, srcin, #31 /* Work with aligned 32-byte hunks. */
+ dup vrepmask_c.4s, wtmp2
+ ands tmp1, srcin, #31
+ add vrepmask_0.4s, vrepmask_c.4s, vrepmask_c.4s /* equiv: lsl #1 */
+ b.eq .Lloop
+
+ /* Input string is not 32-byte aligned. Rather than forcing
+ the padding bytes to a safe value, we calculate the syndrome
+ for all the bytes, but then mask off those bits of the
+ syndrome that are related to the padding. */
+ ld1 {vdata1.16b, vdata2.16b}, [src], #32
+ neg tmp1, tmp1
+ cmeq vhas_nul1.16b, vdata1.16b, #0
+ cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b
+ cmeq vhas_nul2.16b, vdata2.16b, #0
+ cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b
+ and vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
+ and vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
+ and vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
+ and vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
+ orr vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+ orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+ lsl tmp1, tmp1, #1
+ addp vend1.16b, vend1.16b, vend2.16b // 256->128
+ mov tmp3, #~0
+ addp vend1.16b, vend1.16b, vend2.16b // 128->64
+ lsr tmp1, tmp3, tmp1
+
+ mov tmp3, vend1.d[0]
+ bic tmp1, tmp3, tmp1 // Mask padding bits.
+ cbnz tmp1, .Ltail
+
+.Lloop:
+ ld1 {vdata1.16b, vdata2.16b}, [src], #32
+ cmeq vhas_nul1.16b, vdata1.16b, #0
+ cmeq vhas_chr1.16b, vdata1.16b, vrepchr.16b
+ cmeq vhas_nul2.16b, vdata2.16b, #0
+ cmeq vhas_chr2.16b, vdata2.16b, vrepchr.16b
+ /* Use a fast check for the termination condition. */
+ orr vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+ orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+ orr vend1.16b, vend1.16b, vend2.16b
+ addp vend1.2d, vend1.2d, vend1.2d
+ mov tmp1, vend1.d[0]
+ cbz tmp1, .Lloop
+
+ /* Termination condition found. Now need to establish exactly why
+ we terminated. */
+ and vhas_nul1.16b, vhas_nul1.16b, vrepmask_0.16b
+ and vhas_nul2.16b, vhas_nul2.16b, vrepmask_0.16b
+ and vhas_chr1.16b, vhas_chr1.16b, vrepmask_c.16b
+ and vhas_chr2.16b, vhas_chr2.16b, vrepmask_c.16b
+ orr vend1.16b, vhas_nul1.16b, vhas_chr1.16b
+ orr vend2.16b, vhas_nul2.16b, vhas_chr2.16b
+ addp vend1.16b, vend1.16b, vend2.16b // 256->128
+ addp vend1.16b, vend1.16b, vend2.16b // 128->64
+
+ mov tmp1, vend1.d[0]
+.Ltail:
+ /* Count the trailing zeros, by bit reversing... */
+ rbit tmp1, tmp1
+ /* Re-bias source. */
+ sub src, src, #32
+ clz tmp1, tmp1 /* And counting the leading zeros. */
+ /* Tmp1 is even if the target charager was found first. Otherwise
+ we've found the end of string and we weren't looking for NUL. */
+ tst tmp1, #1
+ add result, src, tmp1, lsr #1
+ csel result, result, xzr, eq
+ ret
+END(strchr_default)
diff --git a/libc/arch-arm64/default/bionic/strcmp.S b/libc/arch-arm64/default/bionic/strcmp.S
new file mode 100644
index 000000000..dfac7c42c
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/strcmp.S
@@ -0,0 +1,192 @@
+/* Copyright (c) 2012, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+#define L(label) .L ## label
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+/* Parameters and result. */
+#define src1 x0
+#define src2 x1
+#define result x0
+
+/* Internal variables. */
+#define data1 x2
+#define data1w w2
+#define data2 x3
+#define data2w w3
+#define has_nul x4
+#define diff x5
+#define syndrome x6
+#define tmp1 x7
+#define tmp2 x8
+#define tmp3 x9
+#define zeroones x10
+#define pos x11
+
+ /* Start of performance-critical section -- one 64B cache line. */
+ENTRY(strcmp_default)
+.p2align 6
+ eor tmp1, src1, src2
+ mov zeroones, #REP8_01
+ tst tmp1, #7
+ b.ne L(misaligned8)
+ ands tmp1, src1, #7
+ b.ne L(mutual_align)
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. */
+L(loop_aligned):
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+L(start_realigned):
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ bic has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ orr syndrome, diff, has_nul
+ cbz syndrome, L(loop_aligned)
+ /* End of performance-critical section -- one 64B cache line. */
+
+L(end):
+#ifndef __AARCH64EB__
+ rev syndrome, syndrome
+ rev data1, data1
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ clz pos, syndrome
+ rev data2, data2
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ ret
+#else
+ /* For big-endian we cannot use the trick with the syndrome value
+ as carry-propagation can corrupt the upper bits if the trailing
+ bytes in the string contain 0x01. */
+ /* However, if there is no NUL byte in the dword, we can generate
+ the result directly. We can't just subtract the bytes as the
+ MSB might be significant. */
+ cbnz has_nul, 1f
+ cmp data1, data2
+ cset result, ne
+ cneg result, result, lo
+ ret
+1:
+ /* Re-compute the NUL-byte detection, using a byte-reversed value. */
+ rev tmp3, data1
+ sub tmp1, tmp3, zeroones
+ orr tmp2, tmp3, #REP8_7f
+ bic has_nul, tmp1, tmp2
+ rev has_nul, has_nul
+ orr syndrome, diff, has_nul
+ clz pos, syndrome
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ ret
+#endif
+
+L(mutual_align):
+ /* Sources are mutually aligned, but are not currently at an
+ alignment boundary. Round down the addresses and then mask off
+ the bytes that preceed the start point. */
+ bic src1, src1, #7
+ bic src2, src2, #7
+ lsl tmp1, tmp1, #3 /* Bytes beyond alignment -> bits. */
+ ldr data1, [src1], #8
+ neg tmp1, tmp1 /* Bits to alignment -64. */
+ ldr data2, [src2], #8
+ mov tmp2, #~0
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp1 /* Shift (tmp1 & 63). */
+#endif
+ orr data1, data1, tmp2
+ orr data2, data2, tmp2
+ b L(start_realigned)
+
+L(misaligned8):
+ /* Align SRC1 to 8 bytes and then compare 8 bytes at a time, always
+ checking to make sure that we don't access beyond page boundary in
+ SRC2. */
+ tst src1, #7
+ b.eq L(loop_misaligned)
+L(do_misaligned):
+ ldrb data1w, [src1], #1
+ ldrb data2w, [src2], #1
+ cmp data1w, #1
+ ccmp data1w, data2w, #0, cs /* NZCV = 0b0000. */
+ b.ne L(done)
+ tst src1, #7
+ b.ne L(do_misaligned)
+
+L(loop_misaligned):
+ /* Test if we are within the last dword of the end of a 4K page. If
+ yes then jump back to the misaligned loop to copy a byte at a time. */
+ and tmp1, src2, #0xff8
+ eor tmp1, tmp1, #0xff8
+ cbz tmp1, L(do_misaligned)
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ bic has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ orr syndrome, diff, has_nul
+ cbz syndrome, L(loop_misaligned)
+ b L(end)
+
+L(done):
+ sub result, data1, data2
+ ret
+END(strcmp_default)
diff --git a/libc/arch-arm64/default/bionic/strlen.S b/libc/arch-arm64/default/bionic/strlen.S
new file mode 100644
index 000000000..07c5294c2
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/strlen.S
@@ -0,0 +1,227 @@
+/* Copyright (c) 2013-2015, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64, unaligned accesses, min page size 4k.
+ */
+
+#include <private/bionic_asm.h>
+
+/* To test the page crossing code path more thoroughly, compile with
+ -DTEST_PAGE_CROSS - this will force all calls through the slower
+ entry path. This option is not intended for production use. */
+
+/* Arguments and results. */
+#define srcin x0
+#define len x0
+
+/* Locals and temporaries. */
+#define src x1
+#define data1 x2
+#define data2 x3
+#define has_nul1 x4
+#define has_nul2 x5
+#define tmp1 x4
+#define tmp2 x5
+#define tmp3 x6
+#define tmp4 x7
+#define zeroones x8
+
+#define L(l) .L ## l
+
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. A faster check
+ (X - 1) & 0x80 is zero for non-NUL ASCII characters, but gives
+ false hits for characters 129..255. */
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+#ifdef TEST_PAGE_CROSS
+# define MIN_PAGE_SIZE 15
+#else
+# define MIN_PAGE_SIZE 4096
+#endif
+
+ /* Since strings are short on average, we check the first 16 bytes
+ of the string for a NUL character. In order to do an unaligned ldp
+ safely we have to do a page cross check first. If there is a NUL
+ byte we calculate the length from the 2 8-byte words using
+ conditional select to reduce branch mispredictions (it is unlikely
+ strlen will be repeatedly called on strings with the same length).
+
+ If the string is longer than 16 bytes, we align src so don't need
+ further page cross checks, and process 32 bytes per iteration
+ using the fast NUL check. If we encounter non-ASCII characters,
+ fallback to a second loop using the full NUL check.
+
+ If the page cross check fails, we read 16 bytes from an aligned
+ address, remove any characters before the string, and continue
+ in the main loop using aligned loads. Since strings crossing a
+ page in the first 16 bytes are rare (probability of
+ 16/MIN_PAGE_SIZE ~= 0.4%), this case does not need to be optimized.
+
+ AArch64 systems have a minimum page size of 4k. We don't bother
+ checking for larger page sizes - the cost of setting up the correct
+ page size is just not worth the extra gain from a small reduction in
+ the cases taking the slow path. Note that we only care about
+ whether the first fetch, which may be misaligned, crosses a page
+ boundary. */
+
+ENTRY(strlen_default)
+ and tmp1, srcin, MIN_PAGE_SIZE - 1
+ mov zeroones, REP8_01
+ cmp tmp1, MIN_PAGE_SIZE - 16
+ b.gt L(page_cross)
+ ldp data1, data2, [srcin]
+#ifdef __AARCH64EB__
+ /* For big-endian, carry propagation (if the final byte in the
+ string is 0x01) means we cannot use has_nul1/2 directly.
+ Since we expect strings to be small and early-exit,
+ byte-swap the data now so has_null1/2 will be correct. */
+ rev data1, data1
+ rev data2, data2
+#endif
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(main_loop_entry)
+
+ /* Enter with C = has_nul1 == 0. */
+ csel has_nul1, has_nul1, has_nul2, cc
+ mov len, 8
+ rev has_nul1, has_nul1
+ clz tmp1, has_nul1
+ csel len, xzr, len, cc
+ add len, len, tmp1, lsr 3
+ ret
+
+ /* The inner loop processes 32 bytes per iteration and uses the fast
+ NUL check. If we encounter non-ASCII characters, use a second
+ loop with the accurate NUL check. */
+ .p2align 4
+L(main_loop_entry):
+ bic src, srcin, 15
+ sub src, src, 16
+L(main_loop):
+ ldp data1, data2, [src, 32]!
+.Lpage_cross_entry:
+ sub tmp1, data1, zeroones
+ sub tmp3, data2, zeroones
+ orr tmp2, tmp1, tmp3
+ tst tmp2, zeroones, lsl 7
+ bne 1f
+ ldp data1, data2, [src, 16]
+ sub tmp1, data1, zeroones
+ sub tmp3, data2, zeroones
+ orr tmp2, tmp1, tmp3
+ tst tmp2, zeroones, lsl 7
+ beq L(main_loop)
+ add src, src, 16
+1:
+ /* The fast check failed, so do the slower, accurate NUL check. */
+ orr tmp2, data1, REP8_7f
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(nonascii_loop)
+
+ /* Enter with C = has_nul1 == 0. */
+L(tail):
+#ifdef __AARCH64EB__
+ /* For big-endian, carry propagation (if the final byte in the
+ string is 0x01) means we cannot use has_nul1/2 directly. The
+ easiest way to get the correct byte is to byte-swap the data
+ and calculate the syndrome a second time. */
+ csel data1, data1, data2, cc
+ rev data1, data1
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ bic has_nul1, tmp1, tmp2
+#else
+ csel has_nul1, has_nul1, has_nul2, cc
+#endif
+ sub len, src, srcin
+ rev has_nul1, has_nul1
+ add tmp2, len, 8
+ clz tmp1, has_nul1
+ csel len, len, tmp2, cc
+ add len, len, tmp1, lsr 3
+ ret
+
+L(nonascii_loop):
+ ldp data1, data2, [src, 16]!
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ bne L(tail)
+ ldp data1, data2, [src, 16]!
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, REP8_7f
+ bics has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ ccmp has_nul2, 0, 0, eq
+ beq L(nonascii_loop)
+ b L(tail)
+
+ /* Load 16 bytes from [srcin & ~15] and force the bytes that precede
+ srcin to 0x7f, so we ignore any NUL bytes before the string.
+ Then continue in the aligned loop. */
+L(page_cross):
+ bic src, srcin, 15
+ ldp data1, data2, [src]
+ lsl tmp1, srcin, 3
+ mov tmp4, -1
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsr tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsl tmp1, tmp4, tmp1 /* Shift (tmp1 & 63). */
+#endif
+ orr tmp1, tmp1, REP8_80
+ orn data1, data1, tmp1
+ orn tmp2, data2, tmp1
+ tst srcin, 8
+ csel data1, data1, tmp4, eq
+ csel data2, data2, tmp2, eq
+ b L(page_cross_entry)
+
+END(strlen_default)
diff --git a/libc/arch-arm64/default/bionic/strncmp.S b/libc/arch-arm64/default/bionic/strncmp.S
new file mode 100644
index 000000000..5432b738e
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/strncmp.S
@@ -0,0 +1,280 @@
+/* Copyright (c) 2014, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+/* Parameters and result. */
+#define src1 x0
+#define src2 x1
+#define limit x2
+#define result x0
+
+/* Internal variables. */
+#define data1 x3
+#define data1w w3
+#define data2 x4
+#define data2w w4
+#define has_nul x5
+#define diff x6
+#define syndrome x7
+#define tmp1 x8
+#define tmp2 x9
+#define tmp3 x10
+#define zeroones x11
+#define pos x12
+#define limit_wd x13
+#define mask x14
+#define endloop x15
+#define count mask
+
+ .text
+ .p2align 6
+ .rep 7
+ nop /* Pad so that the loop below fits a cache line. */
+ .endr
+ENTRY(strncmp_default)
+ cbz limit, .Lret0
+ eor tmp1, src1, src2
+ mov zeroones, #REP8_01
+ tst tmp1, #7
+ and count, src1, #7
+ b.ne .Lmisaligned8
+ cbnz count, .Lmutual_align
+ /* Calculate the number of full and partial words -1. */
+ sub limit_wd, limit, #1 /* limit != 0, so no underflow. */
+ lsr limit_wd, limit_wd, #3 /* Convert to Dwords. */
+
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. */
+ /* Start of performance-critical section -- one 64B cache line. */
+.Lloop_aligned:
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+.Lstart_realigned:
+ subs limit_wd, limit_wd, #1
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ csinv endloop, diff, xzr, pl /* Last Dword or differences. */
+ bics has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ ccmp endloop, #0, #0, eq
+ b.eq .Lloop_aligned
+ /* End of performance-critical section -- one 64B cache line. */
+
+ /* Not reached the limit, must have found the end or a diff. */
+ tbz limit_wd, #63, .Lnot_limit
+
+ /* Limit % 8 == 0 => all bytes significant. */
+ ands limit, limit, #7
+ b.eq .Lnot_limit
+
+ lsl limit, limit, #3 /* Bits -> bytes. */
+ mov mask, #~0
+#ifdef __AARCH64EB__
+ lsr mask, mask, limit
+#else
+ lsl mask, mask, limit
+#endif
+ bic data1, data1, mask
+ bic data2, data2, mask
+
+ /* Make sure that the NUL byte is marked in the syndrome. */
+ orr has_nul, has_nul, mask
+
+.Lnot_limit:
+ orr syndrome, diff, has_nul
+
+#ifndef __AARCH64EB__
+ rev syndrome, syndrome
+ rev data1, data1
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ clz pos, syndrome
+ rev data2, data2
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ ret
+#else
+ /* For big-endian we cannot use the trick with the syndrome value
+ as carry-propagation can corrupt the upper bits if the trailing
+ bytes in the string contain 0x01. */
+ /* However, if there is no NUL byte in the dword, we can generate
+ the result directly. We can't just subtract the bytes as the
+ MSB might be significant. */
+ cbnz has_nul, 1f
+ cmp data1, data2
+ cset result, ne
+ cneg result, result, lo
+ ret
+1:
+ /* Re-compute the NUL-byte detection, using a byte-reversed value. */
+ rev tmp3, data1
+ sub tmp1, tmp3, zeroones
+ orr tmp2, tmp3, #REP8_7f
+ bic has_nul, tmp1, tmp2
+ rev has_nul, has_nul
+ orr syndrome, diff, has_nul
+ clz pos, syndrome
+ /* The MS-non-zero bit of the syndrome marks either the first bit
+ that is different, or the top bit of the first zero byte.
+ Shifting left now will bring the critical information into the
+ top bits. */
+ lsl data1, data1, pos
+ lsl data2, data2, pos
+ /* But we need to zero-extend (char is unsigned) the value and then
+ perform a signed 32-bit subtraction. */
+ lsr data1, data1, #56
+ sub result, data1, data2, lsr #56
+ ret
+#endif
+
+.Lmutual_align:
+ /* Sources are mutually aligned, but are not currently at an
+ alignment boundary. Round down the addresses and then mask off
+ the bytes that precede the start point.
+ We also need to adjust the limit calculations, but without
+ overflowing if the limit is near ULONG_MAX. */
+ bic src1, src1, #7
+ bic src2, src2, #7
+ ldr data1, [src1], #8
+ neg tmp3, count, lsl #3 /* 64 - bits(bytes beyond align). */
+ ldr data2, [src2], #8
+ mov tmp2, #~0
+ sub limit_wd, limit, #1 /* limit != 0, so no underflow. */
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp3 /* Shift (count & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp3 /* Shift (count & 63). */
+#endif
+ and tmp3, limit_wd, #7
+ lsr limit_wd, limit_wd, #3
+ /* Adjust the limit. Only low 3 bits used, so overflow irrelevant. */
+ add limit, limit, count
+ add tmp3, tmp3, count
+ orr data1, data1, tmp2
+ orr data2, data2, tmp2
+ add limit_wd, limit_wd, tmp3, lsr #3
+ b .Lstart_realigned
+
+ .p2align 6
+ /* Don't bother with dwords for up to 16 bytes. */
+.Lmisaligned8:
+ cmp limit, #16
+ b.hs .Ltry_misaligned_words
+
+.Lbyte_loop:
+ /* Perhaps we can do better than this. */
+ ldrb data1w, [src1], #1
+ ldrb data2w, [src2], #1
+ subs limit, limit, #1
+ ccmp data1w, #1, #0, hi /* NZCV = 0b0000. */
+ ccmp data1w, data2w, #0, cs /* NZCV = 0b0000. */
+ b.eq .Lbyte_loop
+.Ldone:
+ sub result, data1, data2
+ ret
+ /* Align the SRC1 to a dword by doing a bytewise compare and then do
+ the dword loop. */
+.Ltry_misaligned_words:
+ lsr limit_wd, limit, #3
+ cbz count, .Ldo_misaligned
+
+ neg count, count
+ and count, count, #7
+ sub limit, limit, count
+ lsr limit_wd, limit, #3
+
+.Lpage_end_loop:
+ ldrb data1w, [src1], #1
+ ldrb data2w, [src2], #1
+ cmp data1w, #1
+ ccmp data1w, data2w, #0, cs /* NZCV = 0b0000. */
+ b.ne .Ldone
+ subs count, count, #1
+ b.hi .Lpage_end_loop
+
+.Ldo_misaligned:
+ /* Prepare ourselves for the next page crossing. Unlike the aligned
+ loop, we fetch 1 less dword because we risk crossing bounds on
+ SRC2. */
+ mov count, #8
+ subs limit_wd, limit_wd, #1
+ b.lo .Ldone_loop
+.Lloop_misaligned:
+ and tmp2, src2, #0xff8
+ eor tmp2, tmp2, #0xff8
+ cbz tmp2, .Lpage_end_loop
+
+ ldr data1, [src1], #8
+ ldr data2, [src2], #8
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ bics has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ ccmp diff, #0, #0, eq
+ b.ne .Lnot_limit
+ subs limit_wd, limit_wd, #1
+ b.pl .Lloop_misaligned
+
+.Ldone_loop:
+ /* We found a difference or a NULL before the limit was reached. */
+ and limit, limit, #7
+ cbz limit, .Lnot_limit
+ /* Read the last word. */
+ sub src1, src1, 8
+ sub src2, src2, 8
+ ldr data1, [src1, limit]
+ ldr data2, [src2, limit]
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ eor diff, data1, data2 /* Non-zero if differences found. */
+ bics has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */
+ ccmp diff, #0, #0, eq
+ b.ne .Lnot_limit
+
+.Lret0:
+ mov result, #0
+ ret
+END(strncmp_default)
diff --git a/libc/arch-arm64/default/bionic/strnlen.S b/libc/arch-arm64/default/bionic/strnlen.S
new file mode 100644
index 000000000..169453207
--- /dev/null
+++ b/libc/arch-arm64/default/bionic/strnlen.S
@@ -0,0 +1,174 @@
+/* Copyright (c) 2014, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results. */
+#define srcin x0
+#define len x0
+#define limit x1
+
+/* Locals and temporaries. */
+#define src x2
+#define data1 x3
+#define data2 x4
+#define data2a x5
+#define has_nul1 x6
+#define has_nul2 x7
+#define tmp1 x8
+#define tmp2 x9
+#define tmp3 x10
+#define tmp4 x11
+#define zeroones x12
+#define pos x13
+#define limit_wd x14
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+ .text
+ .p2align 6
+.Lstart:
+ /* Pre-pad to ensure critical loop begins an icache line. */
+ .rep 7
+ nop
+ .endr
+ /* Put this code here to avoid wasting more space with pre-padding. */
+.Lhit_limit:
+ mov len, limit
+ ret
+
+ENTRY(strnlen_default)
+ cbz limit, .Lhit_limit
+ mov zeroones, #REP8_01
+ bic src, srcin, #15
+ ands tmp1, srcin, #15
+ b.ne .Lmisaligned
+ /* Calculate the number of full and partial words -1. */
+ sub limit_wd, limit, #1 /* Limit != 0, so no underflow. */
+ lsr limit_wd, limit_wd, #4 /* Convert to Qwords. */
+
+ /* NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ can be done in parallel across the entire word. */
+ /* The inner loop deals with two Dwords at a time. This has a
+ slightly higher start-up cost, but we should win quite quickly,
+ especially on cores with a high number of issue slots per
+ cycle, as we get much better parallelism out of the operations. */
+
+ /* Start of critial section -- keep to one 64Byte cache line. */
+.Lloop:
+ ldp data1, data2, [src], #16
+.Lrealigned:
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, #REP8_7f
+ bic has_nul1, tmp1, tmp2
+ bic has_nul2, tmp3, tmp4
+ subs limit_wd, limit_wd, #1
+ orr tmp1, has_nul1, has_nul2
+ ccmp tmp1, #0, #0, pl /* NZCV = 0000 */
+ b.eq .Lloop
+ /* End of critical section -- keep to one 64Byte cache line. */
+
+ orr tmp1, has_nul1, has_nul2
+ cbz tmp1, .Lhit_limit /* No null in final Qword. */
+
+ /* We know there's a null in the final Qword. The easiest thing
+ to do now is work out the length of the string and return
+ MIN (len, limit). */
+
+ sub len, src, srcin
+ cbz has_nul1, .Lnul_in_data2
+#ifdef __AARCH64EB__
+ mov data2, data1
+#endif
+ sub len, len, #8
+ mov has_nul2, has_nul1
+.Lnul_in_data2:
+#ifdef __AARCH64EB__
+ /* For big-endian, carry propagation (if the final byte in the
+ string is 0x01) means we cannot use has_nul directly. The
+ easiest way to get the correct byte is to byte-swap the data
+ and calculate the syndrome a second time. */
+ rev data2, data2
+ sub tmp1, data2, zeroones
+ orr tmp2, data2, #REP8_7f
+ bic has_nul2, tmp1, tmp2
+#endif
+ sub len, len, #8
+ rev has_nul2, has_nul2
+ clz pos, has_nul2
+ add len, len, pos, lsr #3 /* Bits to bytes. */
+ cmp len, limit
+ csel len, len, limit, ls /* Return the lower value. */
+ ret
+
+.Lmisaligned:
+ /* Deal with a partial first word.
+ We're doing two things in parallel here;
+ 1) Calculate the number of words (but avoiding overflow if
+ limit is near ULONG_MAX) - to do this we need to work out
+ limit + tmp1 - 1 as a 65-bit value before shifting it;
+ 2) Load and mask the initial data words - we force the bytes
+ before the ones we are interested in to 0xff - this ensures
+ early bytes will not hit any zero detection. */
+ sub limit_wd, limit, #1
+ neg tmp4, tmp1
+ cmp tmp1, #8
+
+ and tmp3, limit_wd, #15
+ lsr limit_wd, limit_wd, #4
+ mov tmp2, #~0
+
+ ldp data1, data2, [src], #16
+ lsl tmp4, tmp4, #3 /* Bytes beyond alignment -> bits. */
+ add tmp3, tmp3, tmp1
+
+#ifdef __AARCH64EB__
+ /* Big-endian. Early bytes are at MSB. */
+ lsl tmp2, tmp2, tmp4 /* Shift (tmp1 & 63). */
+#else
+ /* Little-endian. Early bytes are at LSB. */
+ lsr tmp2, tmp2, tmp4 /* Shift (tmp1 & 63). */
+#endif
+ add limit_wd, limit_wd, tmp3, lsr #4
+
+ orr data1, data1, tmp2
+ orr data2a, data2, tmp2
+
+ csinv data1, data1, xzr, le
+ csel data2, data2, data2a, le
+ b .Lrealigned
+END(strnlen_default)
diff --git a/libc/arch-arm64/dynamic_function_dispatch.cpp b/libc/arch-arm64/dynamic_function_dispatch.cpp
index 83e5ca4da..37abea429 100644
--- a/libc/arch-arm64/dynamic_function_dispatch.cpp
+++ b/libc/arch-arm64/dynamic_function_dispatch.cpp
@@ -26,90 +26,73 @@
* SUCH DAMAGE.
*/
+#include <platform/bionic/mte_kernel.h>
#include <private/bionic_ifuncs.h>
#include <stddef.h>
#include <sys/auxv.h>
extern "C" {
-typedef void* memchr_func(const void*, int, size_t);
-DEFINE_IFUNC_FOR(memchr) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(memchr_func, __memchr_aarch64_mte);
- } else {
- RETURN_FUNC(memchr_func, __memchr_aarch64);
- }
+static bool supports_mte(unsigned long hwcap2) {
+#ifdef ANDROID_EXPERIMENTAL_MTE
+ return hwcap2 & HWCAP2_MTE;
+#else
+ (void)hwcap2;
+ return false;
+#endif
}
-typedef int stpcpy_func(char*, const char*);
-DEFINE_IFUNC_FOR(stpcpy) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(stpcpy_func, __stpcpy_aarch64_mte);
+typedef void* memchr_func(const void*, int, size_t);
+DEFINE_IFUNC_FOR(memchr) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(memchr_func, memchr_mte);
} else {
- RETURN_FUNC(stpcpy_func, __stpcpy_aarch64);
+ RETURN_FUNC(memchr_func, memchr_default);
}
}
typedef char* strchr_func(const char*, int);
DEFINE_IFUNC_FOR(strchr) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strchr_func, __strchr_aarch64_mte);
- } else {
- RETURN_FUNC(strchr_func, __strchr_aarch64);
- }
-}
-
-typedef char* strchrnul_func(const char*, int);
-DEFINE_IFUNC_FOR(strchrnul) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strchrnul_func, __strchrnul_aarch64_mte);
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strchr_func, strchr_mte);
} else {
- RETURN_FUNC(strchrnul_func, __strchrnul_aarch64);
+ RETURN_FUNC(strchr_func, strchr_default);
}
}
typedef int strcmp_func(const char*, const char*);
DEFINE_IFUNC_FOR(strcmp) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strcmp_func, __strcmp_aarch64_mte);
- } else {
- RETURN_FUNC(strcmp_func, __strcmp_aarch64);
- }
-}
-
-typedef int strcpy_func(char*, const char*);
-DEFINE_IFUNC_FOR(strcpy) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strcpy_func, __strcpy_aarch64_mte);
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strcmp_func, strcmp_mte);
} else {
- RETURN_FUNC(strcpy_func, __strcpy_aarch64);
+ RETURN_FUNC(strcmp_func, strcmp_default);
}
}
typedef size_t strlen_func(const char*);
DEFINE_IFUNC_FOR(strlen) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strlen_func, __strlen_aarch64_mte);
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strlen_func, strlen_mte);
} else {
- RETURN_FUNC(strlen_func, __strlen_aarch64);
+ RETURN_FUNC(strlen_func, strlen_default);
}
}
typedef int strncmp_func(const char*, const char*, int);
DEFINE_IFUNC_FOR(strncmp) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strncmp_func, __strncmp_aarch64_mte);
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strncmp_func, strncmp_mte);
} else {
- RETURN_FUNC(strncmp_func, __strncmp_aarch64);
+ RETURN_FUNC(strncmp_func, strncmp_default);
}
}
-typedef char* strrchr_func(const char*, int);
-DEFINE_IFUNC_FOR(strrchr) {
- if (arg->_hwcap2 & HWCAP2_MTE) {
- RETURN_FUNC(strrchr_func, __strrchr_aarch64_mte);
+typedef size_t strnlen_func(const char*, int);
+DEFINE_IFUNC_FOR(strnlen) {
+ if (supports_mte(arg->_hwcap2)) {
+ RETURN_FUNC(strnlen_func, strnlen_mte);
} else {
- RETURN_FUNC(strrchr_func, __strrchr_aarch64);
+ RETURN_FUNC(strnlen_func, strnlen_default);
}
}
diff --git a/libc/arch-arm64/generic/bionic/__memcpy_chk.S b/libc/arch-arm64/generic/bionic/__memcpy_chk.S
index a8e9e83d0..a6eeca477 100644
--- a/libc/arch-arm64/generic/bionic/__memcpy_chk.S
+++ b/libc/arch-arm64/generic/bionic/__memcpy_chk.S
@@ -43,5 +43,3 @@ ENTRY(__memcpy_chk)
bl __memcpy_chk_fail
END(__memcpy_chk)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/memcmp.S b/libc/arch-arm64/generic/bionic/memcmp.S
new file mode 100644
index 000000000..bff54aea3
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/memcmp.S
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2017 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64, unaligned accesses.
+ */
+
+#include <private/bionic_asm.h>
+
+#define L(l) .L ## l
+
+/* Parameters and result. */
+#define src1 x0
+#define src2 x1
+#define limit x2
+#define result w0
+
+/* Internal variables. */
+#define data1 x3
+#define data1w w3
+#define data1h x4
+#define data2 x5
+#define data2w w5
+#define data2h x6
+#define tmp1 x7
+#define tmp2 x8
+
+/* Small inputs of less than 8 bytes are handled separately. This allows the
+ main code to be speed up using unaligned loads since there are now at least
+ 8 bytes to be compared. If the first 8 bytes are equal, align src1.
+ This ensures each iteration does at most one unaligned access even if both
+ src1 and src2 are unaligned, and mutually aligned inputs behave as if
+ aligned. After the main loop, process the last 16 bytes using unaligned
+ accesses. */
+
+ENTRY(memcmp)
+.p2align 6
+ subs limit, limit, 8
+ b.lo L(less8)
+
+ /* Limit >= 8, so check first 8 bytes using unaligned loads. */
+ ldr data1, [src1], 8
+ ldr data2, [src2], 8
+ cmp data1, data2
+ b.ne L(return)
+
+ subs limit, limit, 8
+ b.gt L(more16)
+
+ ldr data1, [src1, limit]
+ ldr data2, [src2, limit]
+ b L(return)
+
+L(more16):
+ ldr data1, [src1], 8
+ ldr data2, [src2], 8
+ cmp data1, data2
+ bne L(return)
+
+ /* Jump directly to comparing the last 16 bytes for 32 byte (or less)
+ strings. */
+ subs limit, limit, 16
+ b.ls L(last_bytes)
+
+ /* We overlap loads between 0-32 bytes at either side of SRC1 when we
+ try to align, so limit it only to strings larger than 128 bytes. */
+ cmp limit, 96
+ b.ls L(loop16)
+
+ /* Align src1 and adjust src2 with bytes not yet done. */
+ and tmp1, src1, 15
+ add limit, limit, tmp1
+ sub src1, src1, tmp1
+ sub src2, src2, tmp1
+
+ /* Loop performing 16 bytes per iteration using aligned src1.
+ Limit is pre-decremented by 16 and must be larger than zero.
+ Exit if <= 16 bytes left to do or if the data is not equal. */
+ .p2align 4
+L(loop16):
+ ldp data1, data1h, [src1], 16
+ ldp data2, data2h, [src2], 16
+ subs limit, limit, 16
+ ccmp data1, data2, 0, hi
+ ccmp data1h, data2h, 0, eq
+ b.eq L(loop16)
+
+ cmp data1, data2
+ bne L(return)
+ mov data1, data1h
+ mov data2, data2h
+ cmp data1, data2
+ bne L(return)
+
+ /* Compare last 1-16 bytes using unaligned access. */
+L(last_bytes):
+ add src1, src1, limit
+ add src2, src2, limit
+ ldp data1, data1h, [src1]
+ ldp data2, data2h, [src2]
+ cmp data1, data2
+ bne L(return)
+ mov data1, data1h
+ mov data2, data2h
+ cmp data1, data2
+
+ /* Compare data bytes and set return value to 0, -1 or 1. */
+L(return):
+#ifndef __AARCH64EB__
+ rev data1, data1
+ rev data2, data2
+#endif
+ cmp data1, data2
+L(ret_eq):
+ cset result, ne
+ cneg result, result, lo
+ ret
+
+ .p2align 4
+ /* Compare up to 8 bytes. Limit is [-8..-1]. */
+L(less8):
+ adds limit, limit, 4
+ b.lo L(less4)
+ ldr data1w, [src1], 4
+ ldr data2w, [src2], 4
+ cmp data1w, data2w
+ b.ne L(return)
+ sub limit, limit, 4
+L(less4):
+ adds limit, limit, 4
+ beq L(ret_eq)
+L(byte_loop):
+ ldrb data1w, [src1], 1
+ ldrb data2w, [src2], 1
+ subs limit, limit, 1
+ ccmp data1w, data2w, 0, ne /* NZCV = 0b0000. */
+ b.eq L(byte_loop)
+ sub result, data1w, data2w
+ ret
+
+END(memcmp)
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-arm64/generic/bionic/memcpy.S
index bc1945c39..baadb9204 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-arm64/generic/bionic/memcpy.S
@@ -33,5 +33,3 @@
ENTRY(__memcpy)
#include "memcpy_base.S"
END(__memcpy)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/memmove.S b/libc/arch-arm64/generic/bionic/memmove.S
index 0f752ea4a..335b7d6ce 100644
--- a/libc/arch-arm64/generic/bionic/memmove.S
+++ b/libc/arch-arm64/generic/bionic/memmove.S
@@ -153,5 +153,3 @@ END(memmove)
ALIAS_SYMBOL(memcpy, memmove)
#endif
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/memset.S b/libc/arch-arm64/generic/bionic/memset.S
index 19d351098..12fc09db8 100644
--- a/libc/arch-arm64/generic/bionic/memset.S
+++ b/libc/arch-arm64/generic/bionic/memset.S
@@ -249,5 +249,3 @@ L(zva_other):
b L(tail64)
END(memset)
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/arch-arm64/generic/bionic/stpcpy.S b/libc/arch-arm64/generic/bionic/stpcpy.S
new file mode 100644
index 000000000..e4a799387
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/stpcpy.S
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#define STPCPY
+#include "string_copy.S"
diff --git a/libc/arch-arm64/generic/bionic/strcpy.S b/libc/arch-arm64/generic/bionic/strcpy.S
new file mode 100644
index 000000000..260c32138
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/strcpy.S
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#define STRCPY
+#include "string_copy.S"
diff --git a/libc/arch-arm64/generic/bionic/string_copy.S b/libc/arch-arm64/generic/bionic/string_copy.S
new file mode 100644
index 000000000..2bf969d60
--- /dev/null
+++ b/libc/arch-arm64/generic/bionic/string_copy.S
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ Copyright (c) 2014, Linaro Limited
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* Assumptions:
+ *
+ * ARMv8-a, AArch64
+ */
+
+#if !defined(STPCPY) && !defined(STRCPY)
+#error "Either STPCPY or STRCPY must be defined."
+#endif
+
+#include <private/bionic_asm.h>
+
+/* Arguments and results. */
+#if defined(STPCPY)
+#define dst x0
+#elif defined(STRCPY)
+#define dstin x0
+#endif
+#define src x1
+
+/* Locals and temporaries. */
+#if defined(STRCPY)
+#define dst x2
+#endif
+#define data1 x3
+#define data1_w w3
+#define data2 x4
+#define data2_w w4
+#define has_nul1 x5
+#define has_nul1_w w5
+#define has_nul2 x6
+#define tmp1 x7
+#define tmp2 x8
+#define tmp3 x9
+#define tmp4 x10
+#define zeroones x11
+#define zeroones_w w11
+#define pos x12
+
+#define REP8_01 0x0101010101010101
+#define REP8_7f 0x7f7f7f7f7f7f7f7f
+#define REP8_80 0x8080808080808080
+
+#if defined(STPCPY)
+ENTRY(stpcpy)
+#elif defined(STRCPY)
+ENTRY(strcpy)
+#endif
+ mov zeroones, #REP8_01
+#if defined(STRCPY)
+ mov dst, dstin
+#endif
+ ands tmp1, src, #15
+ b.ne .Lmisaligned
+ // NUL detection works on the principle that (X - 1) & (~X) & 0x80
+ // (=> (X - 1) & ~(X | 0x7f)) is non-zero iff a byte is zero, and
+ // can be done in parallel across the entire word.
+ // The inner loop deals with two Dwords at a time. This has a
+ // slightly higher start-up cost, but we should win quite quickly,
+ // especially on cores with a high number of issue slots per
+ // cycle, as we get much better parallelism out of the operations.
+.Lloop:
+ ldp data1, data2, [src], #16
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ bic has_nul1, tmp1, tmp2
+ cbnz has_nul1, .Lnul_in_data1
+ sub tmp3, data2, zeroones
+ orr tmp4, data2, #REP8_7f
+ bic has_nul2, tmp3, tmp4
+ cbnz has_nul2, .Lnul_in_data2
+ // No NUL in either register, copy it in a single instruction.
+ stp data1, data2, [dst], #16
+ b .Lloop
+
+.Lnul_in_data1:
+ rev has_nul1, has_nul1
+ clz pos, has_nul1
+ add tmp1, pos, #0x8
+
+ tbz tmp1, #6, 1f
+#if defined(STPCPY)
+ str data1, [dst], #7
+#elif defined(STRCPY)
+ str data1, [dst]
+#endif
+ ret
+1:
+ tbz tmp1, #5, 1f
+ str data1_w, [dst], #4
+ lsr data1, data1, #32
+1:
+ tbz tmp1, #4, 1f
+ strh data1_w, [dst], #2
+ lsr data1, data1, #16
+1:
+ tbz tmp1, #3, 1f
+ strb data1_w, [dst]
+#if defined(STPCPY)
+ ret
+#endif
+1:
+#if defined(STPCPY)
+ // Back up one so that dst points to the '\0' string terminator.
+ sub dst, dst, #1
+#endif
+ ret
+
+.Lnul_in_data2:
+ str data1, [dst], #8
+ rev has_nul2, has_nul2
+ clz pos, has_nul2
+ add tmp1, pos, #0x8
+
+ tbz tmp1, #6, 1f
+#if defined(STPCPY)
+ str data2, [dst], #7
+#elif defined(STRCPY)
+ str data2, [dst]
+#endif
+ ret
+1:
+ tbz tmp1, #5, 1f
+ str data2_w, [dst], #4
+ lsr data2, data2, #32
+1:
+ tbz tmp1, #4, 1f
+ strh data2_w, [dst], #2
+ lsr data2, data2, #16
+1:
+ tbz tmp1, #3, 1f
+ strb data2_w, [dst]
+#if defined(STPCPY)
+ ret
+#endif
+1:
+#if defined(STPCPY)
+ // Back up one so that dst points to the '\0' string terminator.
+ sub dst, dst, #1
+#endif
+ ret
+
+.Lmisaligned:
+ tbz src, #0, 1f
+ ldrb data1_w, [src], #1
+ strb data1_w, [dst], #1
+ cbnz data1_w, 1f
+#if defined(STPCPY)
+ // Back up one so that dst points to the '\0' string terminator.
+ sub dst, dst, #1
+#endif
+ ret
+1:
+ tbz src, #1, 1f
+ ldrb data1_w, [src], #1
+ strb data1_w, [dst], #1
+ cbz data1_w, .Ldone
+ ldrb data2_w, [src], #1
+ strb data2_w, [dst], #1
+ cbnz data2_w, 1f
+.Ldone:
+#if defined(STPCPY)
+ // Back up one so that dst points to the '\0' string terminator.
+ sub dst, dst, #1
+#endif
+ ret
+1:
+ tbz src, #2, 1f
+ ldr data1_w, [src], #4
+ // Check for a zero.
+ sub has_nul1_w, data1_w, zeroones_w
+ bic has_nul1_w, has_nul1_w, data1_w
+ ands has_nul1_w, has_nul1_w, #0x80808080
+ b.ne .Lnul_in_data1
+ str data1_w, [dst], #4
+1:
+ tbz src, #3, .Lloop
+ ldr data1, [src], #8
+ // Check for a zero.
+ sub tmp1, data1, zeroones
+ orr tmp2, data1, #REP8_7f
+ bics has_nul1, tmp1, tmp2
+ b.ne .Lnul_in_data1
+ str data1, [dst], #8
+ b .Lloop
+#if defined(STPCPY)
+END(stpcpy)
+#elif defined(STRCPY)
+END(strcpy)
+#endif
diff --git a/libc/arch-arm64/generic/bionic/wmemmove.S b/libc/arch-arm64/generic/bionic/wmemmove.S
index b1305300a..e4f67f759 100644
--- a/libc/arch-arm64/generic/bionic/wmemmove.S
+++ b/libc/arch-arm64/generic/bionic/wmemmove.S
@@ -28,5 +28,3 @@
#define WMEMMOVE
#include "memmove.S"
#undef WMEMMOVE
-
-NOTE_GNU_PROPERTY()
diff --git a/libc/include/android/legacy_unistd_inlines.h b/libc/arch-arm64/mte/bionic/memchr.c
index 4a5206b88..33b2fc2c6 100644
--- a/libc/include/android/legacy_unistd_inlines.h
+++ b/libc/arch-arm64/mte/bionic/memchr.c
@@ -26,13 +26,7 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-#include <sys/cdefs.h>
-
-#if __ANDROID_API__ < 28
-
-#define __BIONIC_SWAB_INLINE static __inline
-#include <bits/swab.h>
-
-#endif
+#define memchr memchr_mte
+#include <upstream-openbsd/lib/libc/string/memchr.c>
diff --git a/libc/arch-arm64/mte/bionic/strchr.cpp b/libc/arch-arm64/mte/bionic/strchr.cpp
new file mode 100644
index 000000000..7d394df0a
--- /dev/null
+++ b/libc/arch-arm64/mte/bionic/strchr.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define strchr strchr_mte
+#include <bionic/strchr.cpp>
diff --git a/libc/platform/scudo_platform_tls_slot.h b/libc/arch-arm64/mte/bionic/strcmp.c
index 9d017c081..0e134f025 100644
--- a/libc/platform/scudo_platform_tls_slot.h
+++ b/libc/arch-arm64/mte/bionic/strcmp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,10 +26,7 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-#include "bionic/tls.h"
-
-inline uintptr_t *getPlatformAllocatorTlsSlot() {
- return reinterpret_cast<uintptr_t*>(&__get_tls()[TLS_SLOT_SANITIZER]);
-}
+#define strcmp strcmp_mte
+#include <upstream-openbsd/lib/libc/string/strcmp.c>
diff --git a/libc/bionic/heap_zero_init.h b/libc/arch-arm64/mte/bionic/strlen.c
index f78e01fa7..de88320ce 100644
--- a/libc/bionic/heap_zero_init.h
+++ b/libc/arch-arm64/mte/bionic/strlen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2019 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <upstream-openbsd/android/include/openbsd-compat.h>
-// Sets heap zero initialization to on (true) or off (false). Returns false on
-// failure, true otherwise.
-bool SetHeapZeroInitialize(bool zero_init);
+#define strlen strlen_mte
+#include <upstream-openbsd/lib/libc/string/strlen.c>
diff --git a/libc/arch-arm64/mte/bionic/strncmp.c b/libc/arch-arm64/mte/bionic/strncmp.c
new file mode 100644
index 000000000..54d08e98e
--- /dev/null
+++ b/libc/arch-arm64/mte/bionic/strncmp.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <upstream-openbsd/android/include/openbsd-compat.h>
+
+#define strncmp strncmp_mte
+#include <upstream-openbsd/lib/libc/string/strncmp.c>
diff --git a/libc/arch-arm64/mte/bionic/strnlen.c b/libc/arch-arm64/mte/bionic/strnlen.c
new file mode 100644
index 000000000..3dc251db3
--- /dev/null
+++ b/libc/arch-arm64/mte/bionic/strnlen.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define strnlen strnlen_mte
+#include <bionic/strnlen.c>
diff --git a/libc/arch-arm64/static_function_dispatch.S b/libc/arch-arm64/static_function_dispatch.S
index 161ece8ea..8e3a4c131 100644
--- a/libc/arch-arm64/static_function_dispatch.S
+++ b/libc/arch-arm64/static_function_dispatch.S
@@ -33,14 +33,9 @@ ENTRY(name); \
b impl; \
END(name)
-FUNCTION_DELEGATE(memchr, __memchr_aarch64_mte)
-FUNCTION_DELEGATE(stpcpy, __stpcpy_aarch64_mte)
-FUNCTION_DELEGATE(strchr, __strchr_aarch64_mte)
-FUNCTION_DELEGATE(strchrnul, __strchrnul_aarch64_mte)
-FUNCTION_DELEGATE(strcmp, __strcmp_aarch64_mte)
-FUNCTION_DELEGATE(strcpy, __strcpy_aarch64_mte)
-FUNCTION_DELEGATE(strlen, __strlen_aarch64_mte)
-FUNCTION_DELEGATE(strrchr, __strrchr_aarch64_mte)
-FUNCTION_DELEGATE(strncmp, __strncmp_aarch64_mte)
-
-NOTE_GNU_PROPERTY()
+FUNCTION_DELEGATE(memchr, memchr_mte)
+FUNCTION_DELEGATE(strchr, strchr_mte)
+FUNCTION_DELEGATE(strcmp, strcmp_mte)
+FUNCTION_DELEGATE(strlen, strlen_mte)
+FUNCTION_DELEGATE(strncmp, strncmp_mte)
+FUNCTION_DELEGATE(strnlen, strnlen_mte)
diff --git a/libc/arch-common/bionic/crtbegin.c b/libc/arch-common/bionic/crtbegin.c
index 5f681c53c..b7043dcae 100644
--- a/libc/arch-common/bionic/crtbegin.c
+++ b/libc/arch-common/bionic/crtbegin.c
@@ -31,9 +31,9 @@
#include <stdint.h>
#define SECTION(name) __attribute__((__section__(name)))
-SECTION(".preinit_array") init_func_t* __PREINIT_ARRAY__ = (init_func_t*)-1;
-SECTION(".init_array.0") init_func_t* __INIT_ARRAY__ = (init_func_t*)-1;
-SECTION(".fini_array.0") fini_func_t* __FINI_ARRAY__ = (fini_func_t*)-1;
+SECTION(".preinit_array") void (*__PREINIT_ARRAY__)(void) = (void (*)(void)) -1;
+SECTION(".init_array") void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
+SECTION(".fini_array") void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
#undef SECTION
__used static void _start_main(void* raw_args) {
@@ -49,15 +49,13 @@ __used static void _start_main(void* raw_args) {
#define POST "; .size _start, .-_start"
#if defined(__aarch64__)
-__asm__(PRE "bti j; mov x29,#0; mov x30,#0; mov x0,sp; b _start_main" POST);
+__asm__(PRE "mov x0,sp; b _start_main" POST);
#elif defined(__arm__)
-__asm__(PRE "mov fp,#0; mov lr,#0; mov r0,sp; b _start_main" POST);
+__asm__(PRE "mov r0,sp; b _start_main" POST);
#elif defined(__i386__)
-__asm__(PRE
- "xorl %ebp,%ebp; movl %esp,%eax; andl $~0xf,%esp; subl $12,%esp; pushl %eax;"
- "calll _start_main" POST);
+__asm__(PRE "movl %esp,%eax; andl $~0xf,%esp; subl $12,%esp; pushl %eax; calll _start_main" POST);
#elif defined(__x86_64__)
-__asm__(PRE "xorl %ebp, %ebp; movq %rsp,%rdi; andq $~0xf,%rsp; callq _start_main" POST);
+__asm__(PRE "movq %rsp,%rdi; andq $~0xf,%rsp; callq _start_main" POST);
#else
#error unsupported architecture
#endif
@@ -91,3 +89,6 @@ asm(" .section .tdata,\"awT\",@progbits\n"
#include "__dso_handle.h"
#include "atexit.h"
#include "pthread_atfork.h"
+#ifdef __i386__
+# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
+#endif
diff --git a/libc/arch-common/bionic/crtbegin_so.c b/libc/arch-common/bionic/crtbegin_so.c
index 2f3b11890..cf369cc82 100644
--- a/libc/arch-common/bionic/crtbegin_so.c
+++ b/libc/arch-common/bionic/crtbegin_so.c
@@ -73,3 +73,6 @@ static void __on_dlclose_late(void) {
# include "atexit.h"
#endif
#include "pthread_atfork.h"
+#ifdef __i386__
+# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
+#endif
diff --git a/libc/arch-common/bionic/crtbrand.S b/libc/arch-common/bionic/crtbrand.S
index 307ef2e34..34d648062 100644
--- a/libc/arch-common/bionic/crtbrand.S
+++ b/libc/arch-common/bionic/crtbrand.S
@@ -26,21 +26,13 @@
* SUCH DAMAGE.
*/
-#if defined(__aarch64__)
-#include <private/bionic_asm_arm64.h>
-
-__bionic_asm_custom_note_gnu_section()
-#endif
-
-#include <private/bionic_asm_note.h>
-
.section .note.android.ident,"a",%note
.balign 4
.type abitag, %object
abitag:
.long 2f-1f // int32_t namesz
.long 3f-2f // int32_t descsz
- .long NT_TYPE_IDENT // int32_t type
+ .long 1 // int32_t type
#ifdef __ANDROID__
1:.ascii "Android\0" // char name[]
2:.long PLATFORM_SDK_VERSION // int32_t android_api
diff --git a/libc/arch-common/bionic/crtend.S b/libc/arch-common/bionic/crtend.S
index 9676db8d5..87d1120ab 100644
--- a/libc/arch-common/bionic/crtend.S
+++ b/libc/arch-common/bionic/crtend.S
@@ -28,12 +28,6 @@
#include "asm_multiarch.h"
-#if defined(__aarch64__)
-#include <private/bionic_asm_arm64.h>
-
-__bionic_asm_custom_note_gnu_section()
-#endif
-
.section .preinit_array, "aw"
ASM_ALIGN_TO_PTR_SIZE
ASM_PTR_SIZE(0)
@@ -49,9 +43,11 @@ __bionic_asm_custom_note_gnu_section()
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
-#if !defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__)
.section .eh_frame,"a",@progbits
+#if defined(__i386__)
.balign 4
+#endif
.type __FRAME_END__, @object
.size __FRAME_END__, 4
__FRAME_END__:
diff --git a/libc/arch-common/bionic/crtend_so.S b/libc/arch-common/bionic/crtend_so.S
index 5875acb52..e7b8cac3e 100644
--- a/libc/arch-common/bionic/crtend_so.S
+++ b/libc/arch-common/bionic/crtend_so.S
@@ -26,18 +26,14 @@
* SUCH DAMAGE.
*/
-#if defined(__aarch64__)
-#include <private/bionic_asm_arm64.h>
-
-__bionic_asm_custom_note_gnu_section()
-#endif
-
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
-#if !defined(__arm__)
+#if defined(__i386__) || defined(__x86_64__)
.section .eh_frame,"a",@progbits
+#if defined(__i386__)
.balign 4
+#endif
.type __FRAME_END__, @object
.size __FRAME_END__, 4
__FRAME_END__:
diff --git a/libc/arch-x86/atom/string/sse2-memset-atom.S b/libc/arch-x86/atom/string/sse2-memset-atom.S
index e4cd03835..016c49e58 100644
--- a/libc/arch-x86/atom/string/sse2-memset-atom.S
+++ b/libc/arch-x86/atom/string/sse2-memset-atom.S
@@ -77,6 +77,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* We loaded the jump table and adjusted EDX. Go. */ \
jmp *%ebx
+ .section .gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ ALIGN(4)
+ .type __x86.get_pc_thunk.bx,@function
+__x86.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
ENTRY(__memset_chk_atom)
ENTRANCE
diff --git a/libc/arch-x86/bionic/__bionic_clone.S b/libc/arch-x86/bionic/__bionic_clone.S
index f0c58a00d..b682b4863 100644
--- a/libc/arch-x86/bionic/__bionic_clone.S
+++ b/libc/arch-x86/bionic/__bionic_clone.S
@@ -45,7 +45,6 @@ ENTRY_PRIVATE(__bionic_clone)
.L_bc_child:
# We don't want anyone to unwind past this point.
.cfi_undefined %eip
- .cfi_undefined %ebp
call __start_thread
hlt
diff --git a/libc/arch-x86/bionic/__libc_init_sysinfo.cpp b/libc/arch-x86/bionic/__libc_init_sysinfo.cpp
index de099b8b0..5c44b4ea4 100644
--- a/libc/arch-x86/bionic/__libc_init_sysinfo.cpp
+++ b/libc/arch-x86/bionic/__libc_init_sysinfo.cpp
@@ -32,9 +32,13 @@
// This file is compiled without stack protection, because it runs before TLS
// has been set up.
+__LIBC_HIDDEN__ __attribute__((__naked__)) void __libc_int0x80() {
+ __asm__ volatile("int $0x80; ret");
+}
+
__LIBC_HIDDEN__ void __libc_init_sysinfo() {
- bool unused;
- __libc_sysinfo = reinterpret_cast<void*>(__bionic_getauxval(AT_SYSINFO, &unused));
+ bool dummy;
+ __libc_sysinfo = reinterpret_cast<void*>(__bionic_getauxval(AT_SYSINFO, dummy));
}
// TODO: lose this function and just access __libc_sysinfo directly.
diff --git a/libc/arch-x86/bionic/__libc_int0x80.S b/libc/arch-x86/bionic/__libc_int0x80.S
deleted file mode 100644
index 66f0a1a7a..000000000
--- a/libc/arch-x86/bionic/__libc_int0x80.S
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <private/bionic_asm.h>
-
-// void __libc_int0x80();
-ENTRY_PRIVATE(__libc_int0x80)
- int $0x80
- ret
-END(__libc_int0x80)
diff --git a/libc/arch-x86/bionic/__restore.S b/libc/arch-x86/bionic/__restore.S
index 5977eab41..cb18fd027 100644
--- a/libc/arch-x86/bionic/__restore.S
+++ b/libc/arch-x86/bionic/__restore.S
@@ -27,7 +27,14 @@
*/
#include <private/bionic_asm.h>
-#include <private/bionic_asm_dwarf_exprs.h>
+
+// DWARF constants.
+#define DW_CFA_def_cfa_expression 0x0f
+#define DW_CFA_expression 0x10
+#define DW_EH_PE_pcrel 0x10
+#define DW_EH_PE_sdata4 0x0b
+#define DW_OP_breg4 0x74
+#define DW_OP_deref 0x06
// Offsets into struct sigcontext.
#define OFFSET_EDI 16
@@ -45,47 +52,84 @@
#define DW_x86_REG_ECX 1
#define DW_x86_REG_EDX 2
#define DW_x86_REG_EBX 3
-#define DW_x86_REG_ESP 4
#define DW_x86_REG_EBP 5
#define DW_x86_REG_ESI 6
#define DW_x86_REG_EDI 7
#define DW_x86_REG_EIP 8
-#define RESTORE_GPR(reg, extra_offset) \
- m_cfi_breg_offset DW_x86_REG_ ## reg, \
- DW_x86_REG_ESP, \
- (OFFSET_ ## reg + (extra_offset));
+#define cfi_signal_frame_start(f) \
+.section .eh_frame,"a",@progbits; \
+.L ## f ## _START_EH_FRAME: \
+ .long 2f - 1f; /* CIE length. */ \
+1:.long 0; /* CIE ID. */ \
+ .byte 1; /* Version. */ \
+ .string "zRS"; /* Augmentation string. */ \
+ .uleb128 1; /* Code alignment factor. */ \
+ .sleb128 -4; /* Data alignment factor. */ \
+ .uleb128 DW_x86_REG_EIP; /* Return address register. */ \
+ .uleb128 1; /* 1 byte of augmentation data. */ \
+ .byte (DW_EH_PE_pcrel|DW_EH_PE_sdata4); /* FDE encoding. */ \
+ .align 8; \
+2: \
+ .long .L ## f ## _END_FDE - .L ## f ## _START_FDE; /* FDE length. */ \
+.L ## f ## _START_FDE: \
+ .long .L ## f ## _START_FDE - .L ## f ## _START_EH_FRAME; /* CIE location. */ \
+ .long (.L ## f ## _START - 1) - .; /* pcrel start address (see FDE encoding above). */ \
+ .long .L ## f ## _END - (.L ## f ## _START - 1); /* Function this FDE applies to. */ \
+ .uleb128 0; /* FDE augmentation length. */ \
+
+#define cfi_signal_frame_end(f) \
+.L ## f ## _END_FDE: \
-// Restoring ESP is unnecessary as the unwinder simply uses the CFA value.
-#define RESTORE_GPRS(extra_offset) \
- m_cfi_def_cfa_deref DW_x86_REG_ESP, (OFFSET_ESP + (extra_offset)); \
- RESTORE_GPR(EDI, extra_offset) \
- RESTORE_GPR(ESI, extra_offset) \
- RESTORE_GPR(EBP, extra_offset) \
- RESTORE_GPR(EBX, extra_offset) \
- RESTORE_GPR(EDX, extra_offset) \
- RESTORE_GPR(ECX, extra_offset) \
- RESTORE_GPR(EAX, extra_offset) \
- RESTORE_GPR(EIP, extra_offset) \
+#define cfi_def_cfa(offset) \
+ .byte DW_CFA_def_cfa_expression; \
+ .uleb128 2f-1f; \
+1:.byte DW_OP_breg4; \
+ .sleb128 offset; \
+ .byte DW_OP_deref; \
+2: \
- .text
+#define cfi_offset(reg_number,offset) \
+ .byte DW_CFA_expression; \
+ .uleb128 reg_number; \
+ .uleb128 2f-1f; \
+1:.byte DW_OP_breg4; \
+ .sleb128 offset; \
+2: \
- .cfi_startproc
- .cfi_signal_frame
- RESTORE_GPRS(4)
- nop // See comment in libc/arch-x86_64/bionic/__restore_rt.S about this nop.
-ENTRY_PRIVATE_NO_DWARF(__restore)
+ENTRY_PRIVATE(__restore)
+.L__restore_START:
popl %eax
- RESTORE_GPRS(0)
movl $__NR_sigreturn, %eax
int $0x80
+.L__restore_END:
END(__restore)
+cfi_signal_frame_start(__restore)
+ cfi_def_cfa(OFFSET_ESP + 4)
+ cfi_offset(DW_x86_REG_EDI, OFFSET_EDI + 4)
+ cfi_offset(DW_x86_REG_ESI, OFFSET_ESI + 4)
+ cfi_offset(DW_x86_REG_EBP, OFFSET_EBP + 4)
+ cfi_offset(DW_x86_REG_EBX, OFFSET_EBX + 4)
+ cfi_offset(DW_x86_REG_EDX, OFFSET_EDX + 4)
+ cfi_offset(DW_x86_REG_ECX, OFFSET_ECX + 4)
+ cfi_offset(DW_x86_REG_EAX, OFFSET_EAX + 4)
+ cfi_offset(DW_x86_REG_EIP, OFFSET_EIP + 4)
+cfi_signal_frame_end(__restore)
- .cfi_startproc
- .cfi_signal_frame
- RESTORE_GPRS(160)
- nop // See comment in libc/arch-x86_64/bionic/__restore_rt.S about this nop.
-ENTRY_PRIVATE_NO_DWARF(__restore_rt)
+ENTRY_PRIVATE(__restore_rt)
+.L__restore_rt_START:
movl $__NR_rt_sigreturn, %eax
int $0x80
+.L__restore_rt_END:
END(__restore_rt)
+cfi_signal_frame_start(__restore_rt)
+ cfi_def_cfa(OFFSET_ESP + 160)
+ cfi_offset(DW_x86_REG_EDI, OFFSET_EDI + 160)
+ cfi_offset(DW_x86_REG_ESI, OFFSET_ESI + 160)
+ cfi_offset(DW_x86_REG_EBP, OFFSET_EBP + 160)
+ cfi_offset(DW_x86_REG_EBX, OFFSET_EBX + 160)
+ cfi_offset(DW_x86_REG_EDX, OFFSET_EDX + 160)
+ cfi_offset(DW_x86_REG_ECX, OFFSET_ECX + 160)
+ cfi_offset(DW_x86_REG_EAX, OFFSET_EAX + 160)
+ cfi_offset(DW_x86_REG_EIP, OFFSET_EIP + 160)
+cfi_signal_frame_end(__restore_rt)
diff --git a/tests/sys_auxv_test.cpp b/libc/arch-x86/bionic/__stack_chk_fail_local.h
index afd62eabb..0b0fd7f8b 100644
--- a/tests/sys_auxv_test.cpp
+++ b/libc/arch-x86/bionic/__stack_chk_fail_local.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,32 +26,32 @@
* SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
+#include <sys/cdefs.h>
-#include <sys/auxv.h>
+/*
+ __stack_chk_fail routine is runtime part of stack protector compiler
+ feature. It's implemented in libc and represents die routine when stack
+ corruption is detected.
-TEST(sys_auxv, getauxval_HWCAP) {
- __attribute__((__unused__)) unsigned long hwcap = getauxval(AT_HWCAP);
+ Calls are generated by compiler and injected into user functions when
+ -fstack-protector* options are used.
- // Check that the constants for *using* AT_HWCAP are also available.
-#if defined(__arm__)
- ASSERT_NE(0, HWCAP_THUMB);
-#elif defined(__aarch64__)
- ASSERT_NE(0, HWCAP_FP);
-#endif
-}
+ __stack_chk_fail_local is wrapper for __stack_chk_fail. Compiler generates
+ wrapper calls instead for PIC code only and only on IA32 for optimization
+ purpose (see gcc/config/i386/i386.c). Wrapper body is always included into
+ executable or library. This is the idea of optimization.
-TEST(sys_auxv, getauxval_HWCAP2) {
-#if defined(AT_HWCAP2)
- __attribute__((__unused__)) unsigned long hwcap = getauxval(AT_HWCAP2);
+ Glibc is doing this via libc_nonshared.a which is linked automatically
+ everytime with libc.so. In bionic we have to bring it within crtfiles
+ because libc.so is real library and not a link script like libc.so at glibc.
- // Check that the constants for *using* AT_HWCAP2 are also available.
-#if defined(__arm__)
- ASSERT_NE(0, HWCAP2_AES);
-#elif defined(__aarch64__)
- ASSERT_NE(0, HWCAP2_SVE2);
-#endif
-#else
- GTEST_SKIP() << "No AT_HWCAP2 for this architecture.";
-#endif
+ For x86_64 or non-PIC code compiler always generates __stack_chk_fail calls.
+*/
+
+#ifdef __i386__
+extern void __stack_chk_fail();
+
+__LIBC_HIDDEN__ void __stack_chk_fail_local() {
+ __stack_chk_fail();
}
+#endif
diff --git a/libc/arch-x86/bionic/__x86.get_pc_thunk.S b/libc/arch-x86/bionic/__x86.get_pc_thunk.S
deleted file mode 100644
index 58dbb084a..000000000
--- a/libc/arch-x86/bionic/__x86.get_pc_thunk.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-// Typically GCC outputs functions like these into any object file that needs a PIC base register,
-// and one of the copies for each register is used. Clang doesn't use these functions, but some of
-// the quasi-hand-written assembly in the optimized string routines does.
-
- .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
- .globl __x86.get_pc_thunk.bx
- .hidden __x86.get_pc_thunk.bx
- .p2align 4
- .type __x86.get_pc_thunk.bx,@function
-__x86.get_pc_thunk.bx:
- .cfi_startproc
- movl (%esp), %ebx
- ret
- .cfi_endproc
-
- .section .text.__x86.get_pc_thunk.cx,"axG",@progbits,__x86.get_pc_thunk.cx,comdat
- .globl __x86.get_pc_thunk.cx
- .hidden __x86.get_pc_thunk.cx
- .p2align 4
- .type __x86.get_pc_thunk.cx,@function
-__x86.get_pc_thunk.cx:
- .cfi_startproc
- movl (%esp), %ecx
- ret
- .cfi_endproc
diff --git a/libc/arch-x86/bionic/setjmp.S b/libc/arch-x86/bionic/setjmp.S
index 1a3eb4b74..1e1ce58c3 100644
--- a/libc/arch-x86/bionic/setjmp.S
+++ b/libc/arch-x86/bionic/setjmp.S
@@ -57,6 +57,19 @@
#define _JB_SIGFLAG 8
#define _JB_CHECKSUM 9
+.macro m_mangle_registers reg
+ xorl \reg,%edx
+ xorl \reg,%ebx
+ xorl \reg,%esp
+ xorl \reg,%ebp
+ xorl \reg,%esi
+ xorl \reg,%edi
+.endm
+
+.macro m_unmangle_registers reg
+ m_mangle_registers \reg
+.endm
+
.macro m_calculate_checksum dst, src
movl $0, \dst
.irp i,0,1,2,3,4,5
@@ -116,17 +129,14 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
// Save the callee-save registers.
movl 0(%esp),%edx
-
-.macro m_mangle_register reg, offset
- movl \reg,(\offset * 4)(%ecx)
- xorl %eax,(\offset * 4)(%ecx)
-.endm
- m_mangle_register %edx, _JB_EDX
- m_mangle_register %ebx, _JB_EBX
- m_mangle_register %esp, _JB_ESP
- m_mangle_register %ebp, _JB_EBP
- m_mangle_register %esi, _JB_ESI
- m_mangle_register %edi, _JB_EDI
+ m_mangle_registers %eax
+ movl %edx,(_JB_EDX * 4)(%ecx)
+ movl %ebx,(_JB_EBX * 4)(%ecx)
+ movl %esp,(_JB_ESP * 4)(%ecx)
+ movl %ebp,(_JB_EBP * 4)(%ecx)
+ movl %esi,(_JB_ESI * 4)(%ecx)
+ movl %edi,(_JB_EDI * 4)(%ecx)
+ m_unmangle_registers %eax
m_calculate_checksum %eax, %ecx
movl %eax, (_JB_CHECKSUM * 4)(%ecx)
@@ -164,26 +174,18 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
movl 4(%esp),%edx
movl 8(%esp),%eax
- // Fetch the setjmp cookie and clear the signal flag bit.
movl (_JB_SIGFLAG * 4)(%edx),%ecx
andl $-2,%ecx
- // Carefully unmangle esp/ebp without ever having an invalid value in the
- // register (http://b/152210274).
- movl (_JB_ESP * 4)(%edx),%edi
- xorl %ecx,%edi
- movl %edi,%esp
- movl (_JB_EBP * 4)(%edx),%edi
- xorl %ecx,%edi
- movl %edi,%ebp
-
- // The others don't matter as much, but we do need to finish using the cookie
- // from %ecx before we clobber it, so we seed each register with the cookie.
movl %ecx,%ebx
+ movl %ecx,%esp
+ movl %ecx,%ebp
movl %ecx,%esi
movl %ecx,%edi
xorl (_JB_EDX * 4)(%edx),%ecx
xorl (_JB_EBX * 4)(%edx),%ebx
+ xorl (_JB_ESP * 4)(%edx),%esp
+ xorl (_JB_EBP * 4)(%edx),%ebp
xorl (_JB_ESI * 4)(%edx),%esi
xorl (_JB_EDI * 4)(%edx),%edi
diff --git a/libc/arch-x86/silvermont/string/sse2-memset-slm.S b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
index b7633f5c9..adaccae10 100644
--- a/libc/arch-x86/silvermont/string/sse2-memset-slm.S
+++ b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
@@ -77,6 +77,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* We loaded the jump table and adjusted EDX. Go. */ \
jmp *%ebx
+ .section .gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ ALIGN(4)
+ .type __x86.get_pc_thunk.bx,@function
+__x86.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
ENTRY(__memset_chk_generic)
ENTRANCE
diff --git a/libc/arch-x86_64/bionic/__restore_rt.S b/libc/arch-x86_64/bionic/__restore_rt.S
index f3e401251..785b3b378 100644
--- a/libc/arch-x86_64/bionic/__restore_rt.S
+++ b/libc/arch-x86_64/bionic/__restore_rt.S
@@ -27,9 +27,15 @@
*/
#include <private/bionic_asm.h>
-#include <private/bionic_asm_dwarf_exprs.h>
-// In the signal trampoline frame, rsp points to a ucontext_t struct.
+// DWARF constants.
+#define DW_CFA_def_cfa_expression 0x0f
+#define DW_CFA_expression 0x10
+#define DW_EH_PE_pcrel 0x10
+#define DW_EH_PE_sdata4 0x0b
+#define DW_OP_breg4 0x74
+#define DW_OP_breg7 0x77
+#define DW_OP_deref 0x06
// Offsets into struct ucontext_t of uc_mcontext.gregs[x].
#define OFFSET_R8 40
@@ -43,11 +49,11 @@
#define OFFSET_RDI 104
#define OFFSET_RSI 112
#define OFFSET_RBP 120
+#define OFFSET_RSP 160
#define OFFSET_RBX 128
#define OFFSET_RDX 136
#define OFFSET_RAX 144
#define OFFSET_RCX 152
-#define OFFSET_RSP 160
#define OFFSET_RIP 168
// Non-standard DWARF constants for the x86-64 registers.
@@ -69,47 +75,69 @@
#define DW_x86_64_R15 15
#define DW_x86_64_RIP 16
-// Insert a nop between .cfi_startproc and the trampoline symbol so that unwinders can find the FDE.
-// A function's last instruction can be a call instruction (e.g. to __cxa_throw), in which case the
-// return address (e.g. from __cxa_throw to the caller) will be just after the function. This
-// address may also be the start of the next function, so to avoid ambiguity, unwinders assume that
-// a return address PC can refer to the address just after a function, but never to the start of a
-// function. (This is implemented by subtracting 1 from the return address PC before looking it up.)
-// This is fine for ordinary functions, but breaks on trampolines. Inserting a nop fixes it.
-//
-// N.B. Unwinders have two other strategies for recognizing the signal trampoline:
-// - Read the instructions that the return address PC points at and look for a sigreturn syscall.
-// (Hence, the instructions must not change at all.)
-// - Do a symbol table lookup and check that against the PC (e.g. LLDB looks for
-// __kernel_rt_sigreturn and __restore_rt.)
-// Either way, the nop is needed to avoid ambiguity if the function before the trampoline could end
-// with a call.
+#define cfi_signal_frame_start(f) \
+.section .eh_frame,"a",@progbits; \
+.L ## f ## _START_EH_FRAME: \
+ .long 2f - 1f; /* CIE length. */ \
+1:.long 0; /* CIE ID. */ \
+ .byte 1; /* Version. */ \
+ .string "zRS"; /* Augmentation string. */ \
+ .uleb128 1; /* Code alignment factor. */ \
+ .sleb128 -8; /* Data alignment factor. */ \
+ .uleb128 DW_x86_64_RIP; /* Return address register. */ \
+ .uleb128 1; /* 1 byte of augmentation data. */ \
+ .byte (DW_EH_PE_pcrel | DW_EH_PE_sdata4); /* FDE encoding. */ \
+ .align 8; \
+2: \
+ .long .L ## f ## _END_FDE - .L ## f ## _START_FDE; /* FDE length. */ \
+.L ## f ## _START_FDE: \
+ .long .L ## f ## _START_FDE - .L ## f ## _START_EH_FRAME; /* CIE location. */ \
+ .long (.L ## f ## _START - 1) - .; /* pcrel start address (see FDE encoding above). */ \
+ .long .L ## f ## _END - (.L ## f ## _START - 1); /* Function this FDE applies to. */ \
+ .uleb128 0; /* FDE augmentation length. */ \
+
+#define cfi_signal_frame_end(f) \
+.L ## f ## _END_FDE: \
+
+#define cfi_def_cfa(offset) \
+ .byte DW_CFA_def_cfa_expression; \
+ .uleb128 2f-1f; \
+1:.byte DW_OP_breg7; \
+ .sleb128 offset; \
+ .byte DW_OP_deref; \
+2: \
-#define RESTORE_GPR(reg) m_cfi_breg_offset DW_x86_64_ ## reg, DW_x86_64_RSP, OFFSET_ ## reg;
+#define cfi_offset(reg_number,offset) \
+ .byte DW_CFA_expression; \
+ .uleb128 reg_number; \
+ .uleb128 2f-1f; \
+1:.byte DW_OP_breg7; \
+ .sleb128 offset; \
+2: \
- .text
- .cfi_startproc
- .cfi_signal_frame
- m_cfi_def_cfa_deref DW_x86_64_RSP, OFFSET_RSP
- RESTORE_GPR(R8)
- RESTORE_GPR(R9)
- RESTORE_GPR(R10)
- RESTORE_GPR(R11)
- RESTORE_GPR(R12)
- RESTORE_GPR(R13)
- RESTORE_GPR(R14)
- RESTORE_GPR(R15)
- RESTORE_GPR(RDI)
- RESTORE_GPR(RSI)
- RESTORE_GPR(RBP)
- RESTORE_GPR(RBX)
- RESTORE_GPR(RDX)
- RESTORE_GPR(RAX)
- RESTORE_GPR(RCX)
- // Restoring RSP is unnecessary as the unwinder simply uses the CFA value.
- RESTORE_GPR(RIP)
- nop
-ENTRY_PRIVATE_NO_DWARF(__restore_rt)
+ENTRY_PRIVATE(__restore_rt)
+.L__restore_rt_START:
mov $__NR_rt_sigreturn, %rax
syscall
+.L__restore_rt_END:
END(__restore_rt)
+cfi_signal_frame_start(__restore_rt)
+ cfi_def_cfa(OFFSET_RSP)
+ cfi_offset(DW_x86_64_R8, OFFSET_R8)
+ cfi_offset(DW_x86_64_R9, OFFSET_R9)
+ cfi_offset(DW_x86_64_R10, OFFSET_R10)
+ cfi_offset(DW_x86_64_R11, OFFSET_R11)
+ cfi_offset(DW_x86_64_R12, OFFSET_R12)
+ cfi_offset(DW_x86_64_R13, OFFSET_R13)
+ cfi_offset(DW_x86_64_R14, OFFSET_R14)
+ cfi_offset(DW_x86_64_R15, OFFSET_R15)
+ cfi_offset(DW_x86_64_RDI, OFFSET_RDI)
+ cfi_offset(DW_x86_64_RSI, OFFSET_RSI)
+ cfi_offset(DW_x86_64_RBP, OFFSET_RBP)
+ cfi_offset(DW_x86_64_RSP, OFFSET_RSP)
+ cfi_offset(DW_x86_64_RBX, OFFSET_RBX)
+ cfi_offset(DW_x86_64_RDX, OFFSET_RDX)
+ cfi_offset(DW_x86_64_RAX, OFFSET_RAX)
+ cfi_offset(DW_x86_64_RCX, OFFSET_RCX)
+ cfi_offset(DW_x86_64_RIP, OFFSET_RIP)
+cfi_signal_frame_end(__restore_rt)
diff --git a/libc/arch-x86_64/bionic/setjmp.S b/libc/arch-x86_64/bionic/setjmp.S
index ba3f05f81..1d345617d 100644
--- a/libc/arch-x86_64/bionic/setjmp.S
+++ b/libc/arch-x86_64/bionic/setjmp.S
@@ -64,6 +64,25 @@
#define _JB_SIGMASK 9
#define _JB_CHECKSUM 10
+#define MANGLE_REGISTERS 1
+
+.macro m_mangle_registers reg
+#if MANGLE_REGISTERS
+ xorq \reg,%rbx
+ xorq \reg,%rbp
+ xorq \reg,%r12
+ xorq \reg,%r13
+ xorq \reg,%r14
+ xorq \reg,%r15
+ xorq \reg,%rsp
+ xorq \reg,%r11
+#endif
+.endm
+
+.macro m_unmangle_registers reg
+ m_mangle_registers \reg
+.endm
+
.macro m_calculate_checksum dst, src
movq $0, \dst
.irp i,0,1,2,3,4,5,6,7
@@ -108,26 +127,20 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
popq %rdi // Pop 'env'.
2:
- // Fetch the setjmp cookie and clear the signal flag bit.
+ // Save the callee-save registers.
popq %rax
andq $-2,%rax
movq (%rsp),%r11
-
- // Save the callee-save registers.
-
-.macro m_mangle_register reg, offset
- movq \reg, (\offset * 8)(%rdi)
- xorq %rax, (\offset * 8)(%rdi) // %rax contains the cookie.
-.endm
-
- m_mangle_register %rbx, _JB_RBX
- m_mangle_register %rbp, _JB_RBP
- m_mangle_register %r12, _JB_R12
- m_mangle_register %r13, _JB_R13
- m_mangle_register %r14, _JB_R14
- m_mangle_register %r15, _JB_R15
- m_mangle_register %rsp, _JB_RSP
- m_mangle_register %r11, _JB_PC
+ m_mangle_registers %rax
+ movq %rbx,(_JB_RBX * 8)(%rdi)
+ movq %rbp,(_JB_RBP * 8)(%rdi)
+ movq %r12,(_JB_R12 * 8)(%rdi)
+ movq %r13,(_JB_R13 * 8)(%rdi)
+ movq %r14,(_JB_R14 * 8)(%rdi)
+ movq %r15,(_JB_R15 * 8)(%rdi)
+ movq %rsp,(_JB_RSP * 8)(%rdi)
+ movq %r11,(_JB_PC * 8)(%rdi)
+ m_unmangle_registers %rax
m_calculate_checksum %rax, %rdi
movq %rax, (_JB_CHECKSUM * 8)(%rdi)
@@ -166,22 +179,15 @@ __BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
popq %rax // Pop 'value'.
// Restore the callee-save registers.
-
-.macro m_unmangle_register reg, offset
- movq (\offset * 8)(%r12), %rdx // Clobbers rdx.
- xorq %rcx, %rdx // %rcx contains the cookie.
- // Now it's safe to overwrite the register (http://b/152210274).
- movq %rdx, \reg
-.endm
-
- m_unmangle_register %rbx, _JB_RBX
- m_unmangle_register %rbp, _JB_RBP
- m_unmangle_register %r13, _JB_R13
- m_unmangle_register %r14, _JB_R14
- m_unmangle_register %r15, _JB_R15
- m_unmangle_register %rsp, _JB_RSP
- m_unmangle_register %r11, _JB_PC
- m_unmangle_register %r12, _JB_R12
+ movq (_JB_RBX * 8)(%r12),%rbx
+ movq (_JB_RBP * 8)(%r12),%rbp
+ movq (_JB_R13 * 8)(%r12),%r13
+ movq (_JB_R14 * 8)(%r12),%r14
+ movq (_JB_R15 * 8)(%r12),%r15
+ movq (_JB_RSP * 8)(%r12),%rsp
+ movq (_JB_PC * 8)(%r12),%r11
+ movq (_JB_R12 * 8)(%r12),%r12
+ m_unmangle_registers %rcx
// Check the cookie.
pushq %rax
diff --git a/libc/async_safe/Android.bp b/libc/async_safe/Android.bp
index e4a583774..98da2cc36 100644
--- a/libc/async_safe/Android.bp
+++ b/libc/async_safe/Android.bp
@@ -1,15 +1,6 @@
// ========================================================
// libasync_safe.a
// ========================================================
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "bionic_libc_license"
- // to get the below license kinds:
- // SPDX-license-identifier-BSD
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
cc_library_static {
defaults: ["libc_defaults"],
srcs: [
@@ -18,7 +9,6 @@ cc_library_static {
name: "libasync_safe",
vendor_available: true,
- product_available: true,
recovery_available: true,
native_bridge_supported: true,
@@ -32,18 +22,16 @@ cc_library_static {
apex_available: [
"//apex_available:platform",
"com.android.runtime",
- "com.android.art",
"com.android.art.debug",
+ "com.android.art.release",
"com.android.media",
"com.android.media.swcodec",
],
- min_sdk_version: "apex_inherit",
}
cc_library_headers {
name: "libasync_safe_headers",
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
defaults: ["linux_bionic_supported"],
diff --git a/libc/async_safe/async_safe_log.cpp b/libc/async_safe/async_safe_log.cpp
index 8b2a32b14..207035a15 100644
--- a/libc/async_safe/async_safe_log.cpp
+++ b/libc/async_safe/async_safe_log.cpp
@@ -30,7 +30,6 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <linux/net.h>
#include <pthread.h>
#include <stdarg.h>
#include <stddef.h>
@@ -52,22 +51,12 @@
#include "private/ErrnoRestorer.h"
#include "private/ScopedPthreadMutexLocker.h"
-// Don't call libc's close or socket, since it might call back into us as a result of fdsan/fdtrack.
+// Don't call libc's close, since it might call back into us as a result of fdsan.
#pragma GCC poison close
static int __close(int fd) {
return syscall(__NR_close, fd);
}
-static int __socket(int domain, int type, int protocol) {
-#if defined(__i386__)
- unsigned long args[3] = {static_cast<unsigned long>(domain), static_cast<unsigned long>(type),
- static_cast<unsigned long>(protocol)};
- return syscall(__NR_socketcall, SYS_SOCKET, &args);
-#else
- return syscall(__NR_socket, domain, type, protocol);
-#endif
-}
-
// Must be kept in sync with frameworks/base/core/java/android/util/EventLog.java.
enum AndroidEventLogType {
EVENT_TYPE_INT = 0,
@@ -471,7 +460,7 @@ static int open_log_socket() {
// found that all logd crashes thus far have had no problem stuffing
// the UNIX domain socket and moving on so not critical *today*.
- int log_fd = TEMP_FAILURE_RETRY(__socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0));
+ int log_fd = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0));
if (log_fd == -1) {
return -1;
}
diff --git a/libc/async_safe/include/async_safe/CHECK.h b/libc/async_safe/include/async_safe/CHECK.h
index 46d460c4c..bec89a365 100644
--- a/libc/async_safe/include/async_safe/CHECK.h
+++ b/libc/async_safe/include/async_safe/CHECK.h
@@ -36,12 +36,12 @@ __BEGIN_DECLS
// TODO: replace this with something more like <android-base/logging.h>'s family of macros.
-#define CHECK(predicate) \
- do { \
- if (!(predicate)) { \
- async_safe_fatal("%s:%d: %s CHECK '%s' failed", __FILE__, __LINE__, __FUNCTION__, \
- #predicate); \
- } \
- } while (0)
+#define CHECK(predicate) \
+ do { \
+ if (!(predicate)) { \
+ async_safe_fatal("%s:%d: %s CHECK '" #predicate "' failed", \
+ __FILE__, __LINE__, __FUNCTION__); \
+ } \
+ } while(0)
__END_DECLS
diff --git a/libc/bionic/__bionic_get_shell_path.cpp b/libc/bionic/__bionic_get_shell_path.cpp
index c087b3532..7aeed182e 100644
--- a/libc/bionic/__bionic_get_shell_path.cpp
+++ b/libc/bionic/__bionic_get_shell_path.cpp
@@ -36,10 +36,6 @@
#define VENDOR_PREFIX "/vendor/"
static const char* init_sh_path() {
-#if !defined(__ANDROID__)
- // For the host Bionic, use the standard /bin/sh
- return "/bin/sh";
-#else
/* If the device is not treble enabled, return the path to the system shell.
* Vendor code, on non-treble enabled devices could use system() / popen()
* with relative paths for executables on /system. Since /system will not be
@@ -55,7 +51,6 @@ static const char* init_sh_path() {
}
#endif
return "/system/bin/sh";
-#endif // if !defined(__ANDROID__)
}
const char* __bionic_get_shell_path() {
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
index 95f46e9fa..56a848888 100644
--- a/libc/bionic/__libc_init_main_thread.cpp
+++ b/libc/bionic/__libc_init_main_thread.cpp
@@ -101,19 +101,6 @@ void __init_tcb_dtv(bionic_tcb* tcb) {
__set_tcb_dtv(tcb, const_cast<TlsDtv*>(&zero_dtv));
}
-// This is public so that the zygote can call it too. It is not expected
-// to be useful otherwise.
-//
-// Note in particular that it is not possible to return from any existing
-// stack frame with stack protector enabled after this function is called.
-extern "C" void android_reset_stack_guards() {
- // The TLS stack guard is set from the global, so ensure that we've initialized the global
- // before we initialize the TLS. Dynamic executables will initialize their copy of the global
- // stack protector from the one in the main thread's TLS.
- __libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard));
- __init_tcb_stack_guard(__get_bionic_tcb());
-}
-
// Finish initializing the main thread.
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
extern "C" void __libc_init_main_thread_late() {
@@ -132,7 +119,11 @@ extern "C" void __libc_init_main_thread_late() {
// User code should never see this; we'll compute it when asked.
pthread_attr_setstacksize(&main_thread.attr, 0);
- android_reset_stack_guards();
+ // The TLS stack guard is set from the global, so ensure that we've initialized the global
+ // before we initialize the TLS. Dynamic executables will initialize their copy of the global
+ // stack protector from the one in the main thread's TLS.
+ __libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard));
+ __init_tcb_stack_guard(__get_bionic_tcb());
__init_thread(&main_thread);
diff --git a/libc/bionic/android_unsafe_frame_pointer_chase.cpp b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
index a1cb3c697..e25867b0e 100644
--- a/libc/bionic/android_unsafe_frame_pointer_chase.cpp
+++ b/libc/bionic/android_unsafe_frame_pointer_chase.cpp
@@ -28,15 +28,8 @@
#include "platform/bionic/android_unsafe_frame_pointer_chase.h"
-#include "platform/bionic/mte.h"
-#include "platform/bionic/pac.h"
-#include "private/bionic_defs.h"
#include "pthread_internal.h"
-
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-extern "C" __LIBC_HIDDEN__ uintptr_t __get_thread_stack_top() {
- return __get_thread()->stack_top;
-}
+#include "platform/bionic/mte.h"
/*
* Implement fast stack unwinding for stack frames with frame pointers. Stores at most num_entries
@@ -63,7 +56,7 @@ __attribute__((no_sanitize("address", "hwaddress"))) size_t android_unsafe_frame
};
auto begin = reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
- auto end = __get_thread_stack_top();
+ uintptr_t end = __get_thread()->stack_top;
stack_t ss;
if (sigaltstack(nullptr, &ss) == 0 && (ss.ss_flags & SS_ONSTACK)) {
@@ -74,7 +67,7 @@ __attribute__((no_sanitize("address", "hwaddress"))) size_t android_unsafe_frame
while (1) {
auto* frame = reinterpret_cast<frame_record*>(begin);
if (num_frames < num_entries) {
- buf[num_frames] = __bionic_clear_pac_bits(frame->return_addr);
+ buf[num_frames] = frame->return_addr;
}
++num_frames;
if (frame->next_frame < begin + sizeof(frame_record) || frame->next_frame >= end ||
diff --git a/libc/bionic/atexit.cpp b/libc/bionic/atexit.cpp
index 5dbf322e3..df306afe1 100644
--- a/libc/bionic/atexit.cpp
+++ b/libc/bionic/atexit.cpp
@@ -73,42 +73,50 @@ class AtexitArray {
// restart concurrent __cxa_finalize passes.
uint64_t total_appends_;
- static size_t page_start_of_index(size_t idx) { return PAGE_START(idx * sizeof(AtexitEntry)); }
- static size_t page_end_of_index(size_t idx) { return PAGE_END(idx * sizeof(AtexitEntry)); }
+ static size_t round_up_to_page_bytes(size_t capacity) {
+ return PAGE_END(capacity * sizeof(AtexitEntry));
+ }
+
+ static size_t next_capacity(size_t capacity) {
+ // Double the capacity each time.
+ size_t result = round_up_to_page_bytes(MAX(1, capacity * 2)) / sizeof(AtexitEntry);
+ CHECK(result > capacity);
+ return result;
+ }
// Recompact the array if it will save at least one page of memory at the end.
- bool needs_recompaction() const {
- return page_end_of_index(size_ - extracted_count_) < page_end_of_index(size_);
+ bool needs_recompaction() {
+ return round_up_to_page_bytes(size_ - extracted_count_) < round_up_to_page_bytes(size_);
}
- void set_writable(bool writable, size_t start_idx, size_t num_entries);
- static bool next_capacity(size_t capacity, size_t* result);
+ void set_writable(bool writable);
bool expand_capacity();
};
} // anonymous namespace
bool AtexitArray::append_entry(const AtexitEntry& entry) {
- if (size_ >= capacity_ && !expand_capacity()) return false;
-
- size_t idx = size_++;
+ bool result = false;
- set_writable(true, idx, 1);
- array_[idx] = entry;
- ++total_appends_;
- set_writable(false, idx, 1);
+ set_writable(true);
+ if (size_ < capacity_ || expand_capacity()) {
+ array_[size_++] = entry;
+ ++total_appends_;
+ result = true;
+ }
+ set_writable(false);
- return true;
+ return result;
}
// Extract an entry and return it.
AtexitEntry AtexitArray::extract_entry(size_t idx) {
AtexitEntry result = array_[idx];
- set_writable(true, idx, 1);
+ set_writable(true);
array_[idx] = {};
++extracted_count_;
- set_writable(false, idx, 1);
+ set_writable(false);
return result;
}
@@ -116,7 +124,7 @@ AtexitEntry AtexitArray::extract_entry(size_t idx) {
void AtexitArray::recompact() {
if (!needs_recompaction()) return;
- set_writable(true, 0, size_);
+ set_writable(true);
// Optimization: quickly skip over the initial non-null entries.
size_t src = 0, dst = 0;
@@ -135,79 +143,51 @@ void AtexitArray::recompact() {
}
// If the table uses fewer pages, clean the pages at the end.
- size_t old_bytes = page_end_of_index(size_);
- size_t new_bytes = page_end_of_index(dst);
+ size_t old_bytes = round_up_to_page_bytes(size_);
+ size_t new_bytes = round_up_to_page_bytes(dst);
if (new_bytes < old_bytes) {
madvise(reinterpret_cast<char*>(array_) + new_bytes, old_bytes - new_bytes, MADV_DONTNEED);
}
- set_writable(false, 0, size_);
-
size_ = dst;
extracted_count_ = 0;
+
+ set_writable(false);
}
// Use mprotect to make the array writable or read-only. Returns true on success. Making the array
// read-only could protect against either unintentional or malicious corruption of the array.
-void AtexitArray::set_writable(bool writable, size_t start_idx, size_t num_entries) {
+void AtexitArray::set_writable(bool writable) {
if (array_ == nullptr) return;
-
- const size_t start_byte = page_start_of_index(start_idx);
- const size_t stop_byte = page_end_of_index(start_idx + num_entries);
- const size_t byte_len = stop_byte - start_byte;
-
const int prot = PROT_READ | (writable ? PROT_WRITE : 0);
- if (mprotect(reinterpret_cast<char*>(array_) + start_byte, byte_len, prot) != 0) {
+ if (mprotect(array_, round_up_to_page_bytes(capacity_), prot) != 0) {
async_safe_fatal("mprotect failed on atexit array: %s", strerror(errno));
}
}
-// Approximately double the capacity. Returns true if successful (no overflow). AtexitEntry is
-// smaller than a page, but this function should still be correct even if AtexitEntry were larger
-// than one.
-bool AtexitArray::next_capacity(size_t capacity, size_t* result) {
- if (capacity == 0) {
- *result = PAGE_END(sizeof(AtexitEntry)) / sizeof(AtexitEntry);
- return true;
- }
- size_t num_bytes;
- if (__builtin_mul_overflow(page_end_of_index(capacity), 2, &num_bytes)) {
- async_safe_format_log(ANDROID_LOG_WARN, "libc", "__cxa_atexit: capacity calculation overflow");
- return false;
- }
- *result = num_bytes / sizeof(AtexitEntry);
- return true;
-}
-
bool AtexitArray::expand_capacity() {
- size_t new_capacity;
- if (!next_capacity(capacity_, &new_capacity)) return false;
- const size_t new_capacity_bytes = page_end_of_index(new_capacity);
-
- set_writable(true, 0, capacity_);
+ const size_t new_capacity = next_capacity(capacity_);
+ const size_t new_capacity_bytes = round_up_to_page_bytes(new_capacity);
- bool result = false;
void* new_pages;
if (array_ == nullptr) {
new_pages = mmap(nullptr, new_capacity_bytes, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
} else {
- // mremap fails if the source buffer crosses a boundary between two VMAs. When a single array
- // element is modified, the kernel should split then rejoin the buffer's VMA.
- new_pages = mremap(array_, page_end_of_index(capacity_), new_capacity_bytes, MREMAP_MAYMOVE);
+ new_pages =
+ mremap(array_, round_up_to_page_bytes(capacity_), new_capacity_bytes, MREMAP_MAYMOVE);
}
if (new_pages == MAP_FAILED) {
async_safe_format_log(ANDROID_LOG_WARN, "libc",
"__cxa_atexit: mmap/mremap failed to allocate %zu bytes: %s",
new_capacity_bytes, strerror(errno));
- } else {
- result = true;
- prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, new_pages, new_capacity_bytes, "atexit handlers");
- array_ = static_cast<AtexitEntry*>(new_pages);
- capacity_ = new_capacity;
+ return false;
}
- set_writable(false, 0, capacity_);
- return result;
+
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, new_pages, new_capacity_bytes, "atexit handlers");
+ array_ = static_cast<AtexitEntry*>(new_pages);
+ capacity_ = new_capacity;
+ return true;
}
static AtexitArray g_array;
diff --git a/libc/bionic/bionic_allocator.cpp b/libc/bionic/bionic_allocator.cpp
index 98183d415..b6d6ba73f 100644
--- a/libc/bionic/bionic_allocator.cpp
+++ b/libc/bionic/bionic_allocator.cpp
@@ -394,26 +394,6 @@ void BionicAllocator::free(void* ptr) {
}
}
-size_t BionicAllocator::get_chunk_size(void* ptr) {
- if (ptr == nullptr) return 0;
-
- page_info* info = get_page_info_unchecked(ptr);
- if (memcmp(info->signature, kSignature, sizeof(kSignature)) != 0) {
- // Invalid pointer (mismatched signature)
- return 0;
- }
- if (info->type == kLargeObject) {
- return info->allocated_size - (static_cast<char*>(ptr) - reinterpret_cast<char*>(info));
- }
-
- BionicSmallObjectAllocator* allocator = get_small_object_allocator(info->type);
- if (allocator != info->allocator_addr) {
- // Invalid pointer.
- return 0;
- }
- return allocator->get_block_size();
-}
-
BionicSmallObjectAllocator* BionicAllocator::get_small_object_allocator(uint32_t type) {
if (type < kSmallObjectMinSizeLog2 || type > kSmallObjectMaxSizeLog2) {
async_safe_fatal("invalid type: %u", type);
diff --git a/libc/bionic/bionic_elf_tls.cpp b/libc/bionic/bionic_elf_tls.cpp
index d5fb05aa6..61d826c02 100644
--- a/libc/bionic/bionic_elf_tls.cpp
+++ b/libc/bionic/bionic_elf_tls.cpp
@@ -28,7 +28,6 @@
#include "private/bionic_elf_tls.h"
-#include <async_safe/CHECK.h>
#include <async_safe/log.h>
#include <string.h>
#include <sys/param.h>
@@ -270,12 +269,6 @@ static void update_tls_dtv(bionic_tcb* tcb) {
continue;
}
}
- if (modules.on_destruction_cb != nullptr) {
- void* dtls_begin = dtv->modules[i];
- void* dtls_end =
- static_cast<void*>(static_cast<char*>(dtls_begin) + allocator.get_chunk_size(dtls_begin));
- modules.on_destruction_cb(dtls_begin, dtls_end);
- }
allocator.free(dtv->modules[i]);
dtv->modules[i] = nullptr;
}
@@ -304,12 +297,6 @@ __attribute__((noinline)) static void* tls_get_addr_slow_path(const TlsIndex* ti
memcpy(mod_ptr, segment.init_ptr, segment.init_size);
}
dtv->modules[module_idx] = mod_ptr;
-
- // Reports the allocation to the listener, if any.
- if (modules.on_creation_cb != nullptr) {
- modules.on_creation_cb(mod_ptr,
- static_cast<void*>(static_cast<char*>(mod_ptr) + segment.size));
- }
}
return static_cast<char*>(mod_ptr) + ti->offset;
@@ -364,14 +351,6 @@ void __free_dynamic_tls(bionic_tcb* tcb) {
// This module's TLS memory is allocated statically, so don't free it here.
continue;
}
-
- if (modules.on_destruction_cb != nullptr) {
- void* dtls_begin = dtv->modules[i];
- void* dtls_end =
- static_cast<void*>(static_cast<char*>(dtls_begin) + allocator.get_chunk_size(dtls_begin));
- modules.on_destruction_cb(dtls_begin, dtls_end);
- }
-
allocator.free(dtv->modules[i]);
}
@@ -385,22 +364,3 @@ void __free_dynamic_tls(bionic_tcb* tcb) {
// Clear the DTV slot. The DTV must not be used again with this thread.
tcb->tls_slot(TLS_SLOT_DTV) = nullptr;
}
-
-// Invokes all the registered thread_exit callbacks, if any.
-void __notify_thread_exit_callbacks() {
- TlsModules& modules = __libc_shared_globals()->tls_modules;
- if (modules.first_thread_exit_callback == nullptr) {
- // If there is no first_thread_exit_callback, there shouldn't be a tail.
- CHECK(modules.thread_exit_callback_tail_node == nullptr);
- return;
- }
-
- // Callbacks are supposed to be invoked in the reverse order
- // in which they were registered.
- CallbackHolder* node = modules.thread_exit_callback_tail_node;
- while (node != nullptr) {
- node->cb();
- node = node->prev;
- }
- modules.first_thread_exit_callback();
-}
diff --git a/libc/bionic/clock.cpp b/libc/bionic/clock.cpp
index 31e6c3c91..fda070842 100644
--- a/libc/bionic/clock.cpp
+++ b/libc/bionic/clock.cpp
@@ -35,6 +35,8 @@
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock.html
clock_t clock() {
timespec ts;
- clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
+ if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == -1) {
+ return -1;
+ }
return (ts.tv_sec * CLOCKS_PER_SEC) + (ts.tv_nsec / (NS_PER_S / CLOCKS_PER_SEC));
}
diff --git a/libc/private/bionic_asm_note.h b/libc/bionic/eventfd_write.cpp
index 80b8f011c..6d86d8ca9 100644
--- a/libc/private/bionic_asm_note.h
+++ b/libc/bionic/eventfd_write.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,6 @@
* SUCH DAMAGE.
*/
-#pragma once
+#include <sys/eventfd.h>
+#include <unistd.h>
-#define NT_TYPE_IDENT 1
-#define NT_TYPE_KUSER 3
-#define NT_TYPE_MEMTAG 4
diff --git a/libc/bionic/exec.cpp b/libc/bionic/exec.cpp
index fd2c401bb..3309585d5 100644
--- a/libc/bionic/exec.cpp
+++ b/libc/bionic/exec.cpp
@@ -44,10 +44,9 @@
extern "C" char** environ;
-enum { ExecL, ExecLE, ExecLP };
+enum ExecVariant { kIsExecL, kIsExecLE, kIsExecLP };
-template <int variant>
-static int __execl(const char* name, const char* argv0, va_list ap) {
+static int __execl(const char* name, const char* argv0, ExecVariant variant, va_list ap) {
// Count the arguments.
va_list count_ap;
va_copy(count_ap, ap);
@@ -66,17 +65,17 @@ static int __execl(const char* name, const char* argv0, va_list ap) {
}
// Collect the argp too.
- char** argp = (variant == ExecLE) ? va_arg(ap, char**) : environ;
+ char** argp = (variant == kIsExecLE) ? va_arg(ap, char**) : environ;
va_end(ap);
- return (variant == ExecLP) ? execvp(name, argv) : execve(name, argv, argp);
+ return (variant == kIsExecLP) ? execvp(name, argv) : execve(name, argv, argp);
}
int execl(const char* name, const char* arg, ...) {
va_list ap;
va_start(ap, arg);
- int result = __execl<ExecL>(name, arg, ap);
+ int result = __execl(name, arg, kIsExecL, ap);
va_end(ap);
return result;
}
@@ -84,7 +83,7 @@ int execl(const char* name, const char* arg, ...) {
int execle(const char* name, const char* arg, ...) {
va_list ap;
va_start(ap, arg);
- int result = __execl<ExecLE>(name, arg, ap);
+ int result = __execl(name, arg, kIsExecLE, ap);
va_end(ap);
return result;
}
@@ -92,7 +91,7 @@ int execle(const char* name, const char* arg, ...) {
int execlp(const char* name, const char* arg, ...) {
va_list ap;
va_start(ap, arg);
- int result = __execl<ExecLP>(name, arg, ap);
+ int result = __execl(name, arg, kIsExecLP, ap);
va_end(ap);
return result;
}
diff --git a/libc/bionic/exit.cpp b/libc/bionic/exit.cpp
deleted file mode 100644
index a5aed7839..000000000
--- a/libc/bionic/exit.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "private/bionic_defs.h"
-
-extern "C" void __cxa_finalize(void* dso_handle);
-extern "C" void __cxa_thread_finalize();
-
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-void exit(int status) {
- __cxa_thread_finalize();
- __cxa_finalize(nullptr);
- _exit(status);
-}
diff --git a/libc/bionic/fdsan.cpp b/libc/bionic/fdsan.cpp
index 48e8674d6..4b8991872 100644
--- a/libc/bionic/fdsan.cpp
+++ b/libc/bionic/fdsan.cpp
@@ -137,6 +137,14 @@ __printflike(1, 0) static void fdsan_error(const char* fmt, ...) {
return;
}
+ // Lots of code will (sensibly) fork, blindly call close on all of their fds,
+ // and then exec. Compare our cached pid value against the real one to detect
+ // this scenario and permit it.
+ pid_t cached_pid = __get_cached_pid();
+ if (cached_pid == 0 || cached_pid != syscall(__NR_getpid)) {
+ return;
+ }
+
struct {
size_t size;
char buf[512];
diff --git a/libc/bionic/fdtrack.cpp b/libc/bionic/fdtrack.cpp
index 89a208fbe..11235129d 100644
--- a/libc/bionic/fdtrack.cpp
+++ b/libc/bionic/fdtrack.cpp
@@ -37,14 +37,8 @@
_Atomic(android_fdtrack_hook_t) __android_fdtrack_hook;
-bool __android_fdtrack_globally_disabled = false;
-
-void android_fdtrack_set_globally_enabled(bool new_value) {
- __android_fdtrack_globally_disabled = !new_value;
-}
-
bool android_fdtrack_get_enabled() {
- return !__get_bionic_tls().fdtrack_disabled && !__android_fdtrack_globally_disabled;
+ return !__get_bionic_tls().fdtrack_disabled;
}
bool android_fdtrack_set_enabled(bool new_value) {
diff --git a/libc/bionic/ffs.cpp b/libc/bionic/ffs.cpp
index aa7e5043a..b2270e548 100644
--- a/libc/bionic/ffs.cpp
+++ b/libc/bionic/ffs.cpp
@@ -26,5 +26,8 @@
* SUCH DAMAGE.
*/
-#define __BIONIC_STRINGS_INLINE /* Out of line. */
#include <strings.h>
+
+int ffs(int x) {
+ return __builtin_ffs(x);
+}
diff --git a/libc/bionic/fgetxattr.cpp b/libc/bionic/fgetxattr.cpp
index 136d41f0a..c7532355b 100644
--- a/libc/bionic/fgetxattr.cpp
+++ b/libc/bionic/fgetxattr.cpp
@@ -37,7 +37,7 @@
extern "C" ssize_t __fgetxattr(int, const char*, void*, size_t);
-ssize_t fgetxattr(int fd, const char* name, void* value, size_t size) {
+ssize_t fgetxattr(int fd, const char *name, void *value, size_t size) {
int saved_errno = errno;
ssize_t result = __fgetxattr(fd, name, value, size);
diff --git a/libc/bionic/flistxattr.cpp b/libc/bionic/flistxattr.cpp
index e42419f13..3bad3835d 100644
--- a/libc/bionic/flistxattr.cpp
+++ b/libc/bionic/flistxattr.cpp
@@ -37,7 +37,7 @@
extern "C" ssize_t __flistxattr(int, char*, size_t);
-ssize_t flistxattr(int fd, char* list, size_t size) {
+ssize_t flistxattr(int fd, char *list, size_t size) {
int saved_errno = errno;
ssize_t result = __flistxattr(fd, list, size);
if (result != -1 || errno != EBADF) {
@@ -45,7 +45,7 @@ ssize_t flistxattr(int fd, char* list, size_t size) {
}
// fd could be an O_PATH file descriptor, and the kernel
- // may not directly support flistxattr() on such a file descriptor.
+ // may not directly support fgetxattr() on such a file descriptor.
// Use /proc/self/fd instead to emulate this support.
int fd_flag = fcntl(fd, F_GETFL);
if (fd_flag == -1 || (fd_flag & O_PATH) == 0) {
diff --git a/libc/bionic/fork.cpp b/libc/bionic/fork.cpp
index d432c6db7..3814ed0ac 100644
--- a/libc/bionic/fork.cpp
+++ b/libc/bionic/fork.cpp
@@ -31,10 +31,9 @@
#include <android/fdsan.h>
#include "private/bionic_defs.h"
-#include "private/bionic_fdtrack.h"
#include "pthread_internal.h"
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE_INLINE
+__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int __clone_for_fork() {
pthread_internal_t* self = __get_thread();
@@ -56,10 +55,9 @@ int fork() {
int result = __clone_for_fork();
if (result == 0) {
- // Disable fdsan and fdtrack post-fork, so we don't falsely trigger on processes that
- // fork, close all of their fds, and then exec.
+ // Disable fdsan post-fork, so we don't falsely trigger on processes that
+ // fork, close all of their fds blindly, and then exec.
android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
- android_fdtrack_set_globally_enabled(false);
// Reset the stack_and_tls VMA name so it doesn't end with a tid from the
// parent process.
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 88ae4779e..3b804b0b2 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -94,6 +94,9 @@ void __FD_SET_chk(int fd, fd_set* set, size_t set_size) {
}
char* __fgets_chk(char* dst, int supplied_size, FILE* stream, size_t dst_len_from_compiler) {
+ if (supplied_size < 0) {
+ __fortify_fatal("fgets: buffer size %d < 0", supplied_size);
+ }
__check_buffer_access("fgets", "write into", supplied_size, dst_len_from_compiler);
return fgets(dst, supplied_size, stream);
}
diff --git a/libc/bionic/fts.c b/libc/bionic/fts.c
index 77b411762..8888ab18a 100644
--- a/libc/bionic/fts.c
+++ b/libc/bionic/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.60 2021/01/08 16:06:30 tb Exp $ */
+/* $OpenBSD: fts.c,v 1.48 2014/11/20 04:14:15 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -29,9 +29,10 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h> /* ALIGN */
+#include <sys/param.h>
#include <sys/stat.h>
+#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -41,9 +42,7 @@
#include <string.h>
#include <unistd.h>
-#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
-
-static FTSENT *fts_alloc(FTS *, const char *, size_t);
+static FTSENT *fts_alloc(FTS *, char *, size_t);
static FTSENT *fts_build(FTS *, int);
static void fts_lfree(FTSENT *);
static void fts_load(FTS *, FTSENT *);
@@ -52,12 +51,11 @@ static void fts_padjust(FTS *, FTSENT *);
static int fts_palloc(FTS *, size_t);
static FTSENT *fts_sort(FTS *, FTSENT *, int);
static u_short fts_stat(FTS *, FTSENT *, int, int);
-static int fts_safe_changedir(FTS *, FTSENT *, int, const char *);
+static int fts_safe_changedir(FTS *, FTSENT *, int, char *);
-/* Android: OpenBSD source compatibility workarounds. */
-#include "private/bsd_sys_param.h"
-#define DEF_WEAK(s) /* nothing */
-void* recallocarray(void*, size_t, size_t, size_t);
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+void* reallocarray(void*, size_t, size_t);
#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
@@ -72,22 +70,12 @@ void* recallocarray(void*, size_t, size_t, size_t);
#define BNAMES 2 /* fts_children, names only */
#define BREAD 3 /* fts_read */
-FTS *
-__fts_open(char * const *argv, int options,
- int (*compar)(const FTSENT **, const FTSENT **))
-{
+FTS* __fts_open(char* const* argv, int options, int (*compar)(const FTSENT**, const FTSENT**)) {
FTS *sp;
FTSENT *p, *root;
int nitems;
- FTSENT *parent, *prev;
-
- /* Android: options check moved to __fts_open() for ftw(). */
-
- /* At least one path must be specified. */
- if (*argv == NULL) {
- errno = EINVAL;
- return (NULL);
- }
+ FTSENT *parent, *tmp;
+ size_t len;
/* Allocate/initialize the stream */
if ((sp = calloc(1, sizeof(FTS))) == NULL)
@@ -103,7 +91,7 @@ __fts_open(char * const *argv, int options,
* Start out with 1K of path space, and enough, in any case,
* to hold the user's paths.
*/
- if (fts_palloc(sp, MAXIMUM(fts_maxarglen(argv), PATH_MAX)))
+ if (fts_palloc(sp, MAX(fts_maxarglen(argv), PATH_MAX)))
goto mem1;
/* Allocate/initialize root's parent. */
@@ -112,15 +100,21 @@ __fts_open(char * const *argv, int options,
parent->fts_level = FTS_ROOTPARENTLEVEL;
/* Allocate/initialize root(s). */
- for (root = prev = NULL, nitems = 0; *argv; ++argv, ++nitems) {
- if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL)
+ for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
+ /* Don't allow zero-length paths. */
+ if ((len = strlen(*argv)) == 0) {
+ errno = ENOENT;
+ goto mem3;
+ }
+
+ if ((p = fts_alloc(sp, *argv, len)) == NULL)
goto mem3;
p->fts_level = FTS_ROOTLEVEL;
p->fts_parent = parent;
p->fts_accpath = p->fts_name;
p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW), -1);
- // Android: for ftw/nftw we need to fail early: http://b/31152735
+ // For ftw/nftw we need to fail early: http://b/31152735
if ((options & FTS_FOR_FTW) != 0 && p->fts_info == FTS_NS) goto mem3;
/* Command-line "." and ".." are real directories. */
@@ -137,10 +131,11 @@ __fts_open(char * const *argv, int options,
} else {
p->fts_link = NULL;
if (root == NULL)
- root = p;
- else
- prev->fts_link = p;
- prev = p;
+ tmp = root = p;
+ else {
+ tmp->fts_link = p;
+ tmp = p;
+ }
}
}
if (compar && nitems > 1)
@@ -163,8 +158,7 @@ __fts_open(char * const *argv, int options,
* and ".." are all fairly nasty problems. Note, if we can't get the
* descriptor we run anyway, just more slowly.
*/
- if (!ISSET(FTS_NOCHDIR) &&
- (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) == -1)
+ if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY|O_CLOEXEC, 0)) < 0)
SET(FTS_NOCHDIR);
if (nitems == 0)
@@ -178,7 +172,6 @@ mem2: free(sp->fts_path);
mem1: free(sp);
return (NULL);
}
-DEF_WEAK(fts_open);
static void
fts_load(FTS *sp, FTSENT *p)
@@ -228,8 +221,7 @@ fts_close(FTS *sp)
rfd = ISSET(FTS_NOCHDIR) ? -1 : sp->fts_rfd;
/* Free up child linked list, sort array, path buffer, stream ptr.*/
- if (sp->fts_child)
- fts_lfree(sp->fts_child);
+ fts_lfree(sp->fts_child);
free(sp->fts_array);
free(sp->fts_path);
free(sp);
@@ -245,7 +237,6 @@ fts_close(FTS *sp)
return (error);
}
-DEF_WEAK(fts_close);
/*
* Special case of "/" at the end of the path so that slashes aren't
@@ -290,8 +281,7 @@ fts_read(FTS *sp)
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
p->fts_info = fts_stat(sp, p, 1, -1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd =
- open(".", O_RDONLY | O_CLOEXEC)) == -1) {
+ if ((p->fts_symfd = open(".", O_RDONLY|O_CLOEXEC, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@@ -380,8 +370,7 @@ next: tmp = p;
if (p->fts_instr == FTS_FOLLOW) {
p->fts_info = fts_stat(sp, p, 1, -1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
- if ((p->fts_symfd =
- open(".", O_RDONLY | O_CLOEXEC)) == -1) {
+ if ((p->fts_symfd = open(".", O_RDONLY|O_CLOEXEC, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@@ -443,7 +432,6 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
return (sp->fts_cur = p);
}
-DEF_WEAK(fts_read);
/*
* Fts_set takes the stream as an argument although it's not used in this
@@ -451,6 +439,7 @@ DEF_WEAK(fts_read);
* semantics to fts using fts_set. An error return is allowed for similar
* reasons.
*/
+/* ARGSUSED */
int
fts_set(FTS *sp __unused, FTSENT *p, int instr)
{
@@ -462,7 +451,6 @@ fts_set(FTS *sp __unused, FTSENT *p, int instr)
p->fts_instr = instr;
return (0);
}
-DEF_WEAK(fts_set);
FTSENT *
fts_children(FTS *sp, int instr)
@@ -501,8 +489,7 @@ fts_children(FTS *sp, int instr)
return (NULL);
/* Free up any previous child list. */
- if (sp->fts_child)
- fts_lfree(sp->fts_child);
+ fts_lfree(sp->fts_child);
if (instr == FTS_NAMEONLY) {
SET(FTS_NAMEONLY);
@@ -521,7 +508,7 @@ fts_children(FTS *sp, int instr)
ISSET(FTS_NOCHDIR))
return (sp->fts_child = fts_build(sp, instr));
- if ((fd = open(".", O_RDONLY | O_CLOEXEC)) == -1)
+ if ((fd = open(".", O_RDONLY|O_CLOEXEC, 0)) < 0)
return (NULL);
sp->fts_child = fts_build(sp, instr);
if (fchdir(fd)) {
@@ -531,7 +518,6 @@ fts_children(FTS *sp, int instr)
(void)close(fd);
return (sp->fts_child);
}
-DEF_WEAK(fts_children);
/*
* This is the tricky part -- do not casually change *anything* in here. The
@@ -556,9 +542,9 @@ fts_build(FTS *sp, int type)
DIR *dirp;
void *oldaddr;
size_t len, maxlen;
- int nitems, cderrno, descend, level, nlinks, nostat, doadjust;
+ int nitems, cderrno, descend, level, nlinks, nostat = 0, doadjust;
int saved_errno;
- char *cp;
+ char *cp = NULL;
/* Set current node pointer. */
cur = sp->fts_cur;
@@ -723,7 +709,8 @@ mem1: saved_errno = errno;
/* Build a file name for fts_stat to stat. */
if (ISSET(FTS_NOCHDIR)) {
p->fts_accpath = p->fts_path;
- memmove(cp, p->fts_name, p->fts_namelen + 1);
+ assert(cp && "cp should be non-null if FTS_NOCHDIR is set");
+ memmove(cp, p->fts_name, p->fts_namelen + 1); // NOLINT
p->fts_info = fts_stat(sp, p, 0, dirfd(dirp));
} else {
p->fts_accpath = p->fts_name;
@@ -819,9 +806,9 @@ fts_stat(FTS *sp, FTSENT *p, int follow, int dfd)
* fail, set the errno from the stat call.
*/
if (ISSET(FTS_LOGICAL) || follow) {
- if (fstatat(dfd, path, sbp, 0)) {
+ if (fstatat(dfd, path, sbp, 0) == -1) {
saved_errno = errno;
- if (!fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) {
+ if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW) == 0) {
errno = 0;
return (FTS_SLNONE);
}
@@ -885,19 +872,19 @@ fts_sort(FTS *sp, FTSENT *head, int nitems)
if (nitems > sp->fts_nitems) {
struct _ftsent **a;
+ sp->fts_nitems = nitems + 40;
if ((a = reallocarray(sp->fts_array,
- nitems + 40, sizeof(FTSENT *))) == NULL) {
+ sp->fts_nitems, sizeof(FTSENT *))) == NULL) {
free(sp->fts_array);
sp->fts_array = NULL;
sp->fts_nitems = 0;
return (head);
}
- sp->fts_nitems = nitems + 40;
sp->fts_array = a;
}
for (ap = sp->fts_array, p = head; p; p = p->fts_link)
*ap++ = p;
- qsort(sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
+ qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar);
for (head = *(ap = sp->fts_array); --nitems; ++ap)
ap[0]->fts_link = ap[1];
ap[0]->fts_link = NULL;
@@ -905,7 +892,7 @@ fts_sort(FTS *sp, FTSENT *head, int nitems)
}
static FTSENT *
-fts_alloc(FTS *sp, const char *name, size_t namelen)
+fts_alloc(FTS *sp, char *name, size_t namelen)
{
FTSENT *p;
size_t len;
@@ -967,14 +954,13 @@ fts_palloc(FTS *sp, size_t more)
errno = ENAMETOOLONG;
return (1);
}
- p = recallocarray(sp->fts_path, sp->fts_pathlen,
- sp->fts_pathlen + more, 1);
+ sp->fts_pathlen += more;
+ p = realloc(sp->fts_path, sp->fts_pathlen);
if (p == NULL) {
free(sp->fts_path);
sp->fts_path = NULL;
return (1);
}
- sp->fts_pathlen += more;
sp->fts_path = p;
return (0);
}
@@ -1024,7 +1010,7 @@ fts_maxarglen(char * const *argv)
* Assumes p->fts_dev and p->fts_ino are filled in.
*/
static int
-fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
{
int ret, oerrno, newfd;
struct stat sb;
@@ -1032,9 +1018,9 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
newfd = fd;
if (ISSET(FTS_NOCHDIR))
return (0);
- if (fd == -1 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) == -1)
+ if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC, 0)) < 0)
return (-1);
- if (fstat(newfd, &sb) == -1) {
+ if (fstat(newfd, &sb)) {
ret = -1;
goto bail;
}
@@ -1046,21 +1032,17 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
ret = fchdir(newfd);
bail:
oerrno = errno;
- if (fd == -1)
+ if (fd < 0)
(void)close(newfd);
errno = oerrno;
return (ret);
}
-FTS *
-fts_open(char * const *argv, int options,
- int (*compar)(const FTSENT **, const FTSENT **))
-{
- // Android needs to an __fts_open() that doesn't make this check
- // so that FTS_FOR_FTW works.
- if (options & ~FTS_OPTIONMASK) {
- errno = EINVAL;
- return (NULL);
- }
- return __fts_open(argv, options, compar);
+FTS* fts_open(char* const* argv, int options, int (*compar)(const FTSENT**, const FTSENT**)) {
+ // Options check.
+ if ((options & ~FTS_OPTIONMASK) != 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+ return __fts_open(argv, options, compar);
}
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index a3c6b1932..d6f75f83a 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -37,20 +37,20 @@
// This function needs to be safe to call before TLS is set up, so it can't
// access errno or the stack protector.
-__LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool* exists) {
+__LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool& exists) {
for (ElfW(auxv_t)* v = __libc_shared_globals()->auxv; v->a_type != AT_NULL; ++v) {
if (v->a_type == type) {
- *exists = true;
+ exists = true;
return v->a_un.a_val;
}
}
- *exists = false;
+ exists = false;
return 0;
}
extern "C" unsigned long getauxval(unsigned long type) {
bool exists;
- unsigned long result = __bionic_getauxval(type, &exists);
+ unsigned long result = __bionic_getauxval(type, exists);
if (!exists) errno = ENOENT;
return result;
}
diff --git a/libc/bionic/gethostname.cpp b/libc/bionic/gethostname.cpp
index b780a2f54..962fea1b1 100644
--- a/libc/bionic/gethostname.cpp
+++ b/libc/bionic/gethostname.cpp
@@ -32,8 +32,10 @@
#include <unistd.h>
int gethostname(char* buf, size_t n) {
- utsname name = {};
- uname(&name);
+ struct utsname name;
+ if (uname(&name) == -1) {
+ return -1;
+ }
size_t name_length = static_cast<size_t>(strlen(name.nodename) + 1);
if (name_length > n) {
diff --git a/libc/bionic/grp_pwd.cpp b/libc/bionic/grp_pwd.cpp
index 600693c74..dd8df95f2 100644
--- a/libc/bionic/grp_pwd.cpp
+++ b/libc/bionic/grp_pwd.cpp
@@ -46,30 +46,24 @@
#include "private/android_filesystem_config.h"
#include "platform/bionic/macros.h"
-#if defined(__ANDROID__)
// Generated android_ids array
#include "generated_android_ids.h"
-#else
-// Empty array for host; everything is from the database files
-#include "empty_android_ids.h"
-#endif
-
#include "grp_pwd_file.h"
static PasswdFile passwd_files[] = {
- {"/etc/passwd", "system_"}, // symlinks to /system/etc/passwd in Android
- {"/vendor/etc/passwd", "vendor_"},
- {"/odm/etc/passwd", "odm_"},
- {"/product/etc/passwd", "product_"},
- {"/system_ext/etc/passwd", "system_ext_"},
+ { "/system/etc/passwd", "system_" },
+ { "/vendor/etc/passwd", "vendor_" },
+ { "/odm/etc/passwd", "odm_" },
+ { "/product/etc/passwd", "product_" },
+ { "/system_ext/etc/passwd", "system_ext_" },
};
static GroupFile group_files[] = {
- {"/etc/group", "system_"}, // symlinks to /system/etc/group in Android
- {"/vendor/etc/group", "vendor_"},
- {"/odm/etc/group", "odm_"},
- {"/product/etc/group", "product_"},
- {"/system_ext/etc/group", "system_ext_"},
+ { "/system/etc/group", "system_" },
+ { "/vendor/etc/group", "vendor_" },
+ { "/odm/etc/group", "odm_" },
+ { "/product/etc/group", "product_" },
+ { "/system_ext/etc/group", "system_ext_" },
};
// POSIX seems to envisage an implementation where the <pwd.h> functions are
@@ -200,7 +194,6 @@ static bool platform_id_secondary_user_allowed(id_t id) {
return false;
}
-#if defined(__ANDROID__)
static bool is_valid_app_id(id_t id, bool is_group) {
id_t appid = id % AID_USER_OFFSET;
@@ -233,12 +226,6 @@ static bool is_valid_app_id(id_t id, bool is_group) {
return false;
}
-#else
-static bool is_valid_app_id(id_t, bool) {
- // Host doesn't have the concept of app_id
- return false;
-}
-#endif // if defined(__ANDROID__)
// This provides an iterater for app_ids within the first user's app id's.
static id_t get_next_app_id(id_t current_id, bool is_group) {
@@ -399,7 +386,6 @@ static void print_app_name_from_gid(const gid_t gid, char* buffer, const int buf
}
}
-#if defined(__ANDROID__)
static bool device_launched_before_api_29() {
// Check if ro.product.first_api_level is set to a value > 0 and < 29, if so, this device was
// launched before API 29 (Q). Any other value is considered to be either in development or
@@ -434,12 +420,6 @@ static bool is_oem_id(id_t id) {
return (id >= AID_OEM_RESERVED_START && id <= AID_OEM_RESERVED_END) ||
(id >= AID_OEM_RESERVED_2_START && id <= AID_OEM_RESERVED_2_END);
}
-#else
-static bool is_oem_id(id_t) {
- // no OEM ids in host
- return false;
-}
-#endif // if defined(__ANDROID__)
// Translate an OEM name to the corresponding user/group id.
static id_t oem_id_from_name(const char* name) {
@@ -542,7 +522,7 @@ passwd* getpwuid_internal(uid_t uid, passwd_state_t* state) {
return android_iinfo_to_passwd(state, android_id_info);
}
- // Find an entry from the database file
+ // Handle OEM range.
passwd* pw = oem_id_to_passwd(uid, state);
if (pw != nullptr) {
return pw;
@@ -560,7 +540,6 @@ passwd* getpwnam_internal(const char* login, passwd_state_t* state) {
return android_iinfo_to_passwd(state, android_id_info);
}
- // Find an entry from the database file
for (auto& passwd_file : passwd_files) {
if (passwd_file.FindByName(login, state)) {
return &state->passwd_;
@@ -702,7 +681,7 @@ static group* getgrgid_internal(gid_t gid, group_state_t* state) {
return android_iinfo_to_group(state, android_id_info);
}
- // Find an entry from the database file
+ // Handle OEM range.
group* grp = oem_id_to_group(gid, state);
if (grp != nullptr) {
return grp;
@@ -720,7 +699,6 @@ static group* getgrnam_internal(const char* name, group_state_t* state) {
return android_iinfo_to_group(state, android_id_info);
}
- // Find an entry from the database file
for (auto& group_file : group_files) {
if (group_file.FindByName(name, state)) {
return &state->group_;
diff --git a/libc/bionic/grp_pwd_file.cpp b/libc/bionic/grp_pwd_file.cpp
index 1f45e80f2..81cf8936d 100644
--- a/libc/bionic/grp_pwd_file.cpp
+++ b/libc/bionic/grp_pwd_file.cpp
@@ -268,7 +268,6 @@ bool MmapFile::Find(Line* line, Predicate predicate) {
while (line_beginning < end) {
line_beginning = ParseLine(line_beginning, end, line->fields, line->kNumFields);
-#if defined(__ANDROID__)
// To comply with Treble, users/groups from each partition need to be prefixed with
// the partition name.
if (required_prefix_ != nullptr) {
@@ -281,7 +280,6 @@ bool MmapFile::Find(Line* line, Predicate predicate) {
continue;
}
}
-#endif
if (predicate(line)) return true;
}
diff --git a/libc/bionic/grp_pwd_file.h b/libc/bionic/grp_pwd_file.h
index 5fd3d2f82..69c771bc3 100644
--- a/libc/bionic/grp_pwd_file.h
+++ b/libc/bionic/grp_pwd_file.h
@@ -65,10 +65,7 @@ class MmapFile {
const char* filename_ = nullptr;
const char* start_ = nullptr;
const char* end_ = nullptr;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-private-field"
const char* required_prefix_;
-#pragma clang diagnostic pop
};
class PasswdFile {
diff --git a/libc/bionic/gwp_asan_wrappers.cpp b/libc/bionic/gwp_asan_wrappers.cpp
index 6eb17495a..d3e6a14ce 100644
--- a/libc/bionic/gwp_asan_wrappers.cpp
+++ b/libc/bionic/gwp_asan_wrappers.cpp
@@ -40,6 +40,7 @@
#include "bionic/gwp_asan_wrappers.h"
#include "gwp_asan/guarded_pool_allocator.h"
#include "gwp_asan/options.h"
+#include "gwp_asan/random.h"
#include "malloc_common.h"
#ifndef LIBC_STATIC
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp
index 41aa20507..62b5f5cbf 100644
--- a/libc/bionic/heap_tagging.cpp
+++ b/libc/bionic/heap_tagging.cpp
@@ -30,138 +30,84 @@
#include "malloc_common.h"
#include "malloc_tagged_pointers.h"
-#include <bionic/pthread_internal.h>
#include <platform/bionic/malloc.h>
+#include <platform/bionic/mte_kernel.h>
extern "C" void scudo_malloc_disable_memory_tagging();
-extern "C" void scudo_malloc_set_track_allocation_stacks(int);
-// Protected by `g_heap_tagging_lock`.
static HeapTaggingLevel heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
void SetDefaultHeapTaggingLevel() {
#if defined(__aarch64__)
-#if !__has_feature(hwaddress_sanitizer)
- heap_tagging_level = __libc_shared_globals()->initial_heap_tagging_level;
-#endif
- switch (heap_tagging_level) {
- case M_HEAP_TAGGING_LEVEL_TBI:
- __libc_globals.mutate([](libc_globals* globals) {
- // Arrange for us to set pointer tags to POINTER_TAG, check tags on
- // deallocation and untag when passing pointers to the allocator.
- globals->heap_pointer_tag = (reinterpret_cast<uintptr_t>(POINTER_TAG) << TAG_SHIFT) |
- (0xffull << CHECK_SHIFT) | (0xffull << UNTAG_SHIFT);
- });
-#if defined(USE_SCUDO)
- scudo_malloc_disable_memory_tagging();
-#endif // USE_SCUDO
- break;
-#if defined(USE_SCUDO)
- case M_HEAP_TAGGING_LEVEL_SYNC:
- scudo_malloc_set_track_allocation_stacks(1);
- break;
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+#ifdef ANDROID_EXPERIMENTAL_MTE
+ // First, try enabling MTE in asynchronous mode, with tag 0 excluded. This will fail if the kernel
+ // or hardware doesn't support MTE, and we will fall back to just enabling tagged pointers in
+ // syscall arguments.
+ if (prctl(PR_SET_TAGGED_ADDR_CTRL,
+ PR_TAGGED_ADDR_ENABLE | PR_MTE_TCF_ASYNC | (1 << PR_MTE_EXCL_SHIFT), 0, 0, 0) == 0) {
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
+ return;
+ }
+#endif // ANDROID_EXPERIMENTAL_MTE
- case M_HEAP_TAGGING_LEVEL_NONE:
- scudo_malloc_disable_memory_tagging();
- break;
-#endif // USE_SCUDO
- default:
- break;
+ // Allow the kernel to accept tagged pointers in syscall arguments. This is a no-op (kernel
+ // returns -EINVAL) if the kernel doesn't understand the prctl.
+ if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) {
+#if !__has_feature(hwaddress_sanitizer)
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
+ __libc_globals.mutate([](libc_globals* globals) {
+ // Arrange for us to set pointer tags to POINTER_TAG, check tags on
+ // deallocation and untag when passing pointers to the allocator.
+ globals->heap_pointer_tag = (reinterpret_cast<uintptr_t>(POINTER_TAG) << TAG_SHIFT) |
+ (0xffull << CHECK_SHIFT) | (0xffull << UNTAG_SHIFT);
+ });
+#endif // hwaddress_sanitizer
}
#endif // aarch64
}
-static bool set_tcf_on_all_threads(int tcf) {
- static int g_tcf;
- g_tcf = tcf;
-
- return android_run_on_all_threads(
- [](void*) {
- int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
- if (tagged_addr_ctrl < 0) {
- return false;
- }
-
- tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | g_tcf;
- if (prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) < 0) {
- return false;
- }
- return true;
- },
- nullptr);
-}
-
-pthread_mutex_t g_heap_tagging_lock = PTHREAD_MUTEX_INITIALIZER;
-
-// Requires `g_heap_tagging_lock` to be held.
-HeapTaggingLevel GetHeapTaggingLevel() {
- return heap_tagging_level;
-}
+bool SetHeapTaggingLevel(void* arg, size_t arg_size) {
+ if (arg_size != sizeof(HeapTaggingLevel)) {
+ return false;
+ }
-// Requires `g_heap_tagging_lock` to be held.
-bool SetHeapTaggingLevel(HeapTaggingLevel tag_level) {
+ auto tag_level = *reinterpret_cast<HeapTaggingLevel*>(arg);
if (tag_level == heap_tagging_level) {
return true;
}
switch (tag_level) {
case M_HEAP_TAGGING_LEVEL_NONE:
- if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
- __libc_globals.mutate([](libc_globals* globals) {
- // Preserve the untag mask (we still want to untag pointers when passing them to the
- // allocator), but clear the fixed tag and the check mask, so that pointers are no longer
- // tagged and checks no longer happen.
- globals->heap_pointer_tag = static_cast<uintptr_t>(0xffull << UNTAG_SHIFT);
- });
- } else if (!set_tcf_on_all_threads(PR_MTE_TCF_NONE)) {
- error_log("SetHeapTaggingLevel: set_tcf_on_all_threads failed");
- return false;
- }
-#if defined(USE_SCUDO)
- scudo_malloc_disable_memory_tagging();
-#endif
break;
case M_HEAP_TAGGING_LEVEL_TBI:
case M_HEAP_TAGGING_LEVEL_ASYNC:
- case M_HEAP_TAGGING_LEVEL_SYNC:
if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_NONE) {
-#if !__has_feature(hwaddress_sanitizer)
- // Suppress the error message in HWASan builds. Apps can try to enable TBI (or even MTE
- // modes) being unaware of HWASan, fail them silently.
error_log(
"SetHeapTaggingLevel: re-enabling tagging after it was disabled is not supported");
-#endif
- return false;
- } else if (tag_level == M_HEAP_TAGGING_LEVEL_TBI ||
- heap_tagging_level == M_HEAP_TAGGING_LEVEL_TBI) {
- error_log("SetHeapTaggingLevel: switching between TBI and ASYNC/SYNC is not supported");
- return false;
+ } else {
+ error_log("SetHeapTaggingLevel: switching between TBI and ASYNC is not supported");
}
-
- if (tag_level == M_HEAP_TAGGING_LEVEL_ASYNC) {
- // When entering ASYNC mode, specify that we want to allow upgrading to SYNC by OR'ing in
- // the SYNC flag. But if the kernel doesn't support specifying multiple TCF modes, fall back
- // to specifying a single mode.
- if (!set_tcf_on_all_threads(PR_MTE_TCF_ASYNC | PR_MTE_TCF_SYNC)) {
- set_tcf_on_all_threads(PR_MTE_TCF_ASYNC);
- }
-#if defined(USE_SCUDO)
- scudo_malloc_set_track_allocation_stacks(0);
-#endif
- } else if (tag_level == M_HEAP_TAGGING_LEVEL_SYNC) {
- set_tcf_on_all_threads(PR_MTE_TCF_SYNC);
-#if defined(USE_SCUDO)
- scudo_malloc_set_track_allocation_stacks(1);
-#endif
- }
- break;
+ return false;
default:
error_log("SetHeapTaggingLevel: unknown tagging level");
return false;
}
-
heap_tagging_level = tag_level;
info_log("SetHeapTaggingLevel: tag level set to %d", tag_level);
+ if (heap_tagging_level == M_HEAP_TAGGING_LEVEL_NONE) {
+#if defined(USE_SCUDO)
+ scudo_malloc_disable_memory_tagging();
+#endif
+ __libc_globals.mutate([](libc_globals* globals) {
+ // Preserve the untag mask (we still want to untag pointers when passing them to the
+ // allocator if we were doing so before), but clear the fixed tag and the check mask,
+ // so that pointers are no longer tagged and checks no longer happen.
+ globals->heap_pointer_tag &= 0xffull << UNTAG_SHIFT;
+ });
+ }
+
return true;
}
diff --git a/libc/bionic/heap_tagging.h b/libc/bionic/heap_tagging.h
index 110b6ed7a..2aaf6086e 100644
--- a/libc/bionic/heap_tagging.h
+++ b/libc/bionic/heap_tagging.h
@@ -28,19 +28,7 @@
#pragma once
-#include <bionic/pthread_internal.h>
-#include <platform/bionic/malloc.h>
#include <stddef.h>
-// Expected to be called in a single-threaded context during libc init, so no
-// synchronization required.
void SetDefaultHeapTaggingLevel();
-
-// Lock for the heap tagging level. You may find ScopedPthreadMutexLocker
-// useful for RAII on this lock.
-extern pthread_mutex_t g_heap_tagging_lock;
-
-// These functions can be called in a multithreaded context, and thus should
-// only be called when holding the `g_heap_tagging_lock`.
-bool SetHeapTaggingLevel(HeapTaggingLevel level);
-HeapTaggingLevel GetHeapTaggingLevel();
+bool SetHeapTaggingLevel(void* arg, size_t arg_size);
diff --git a/libc/bionic/heap_zero_init.cpp b/libc/bionic/heap_zero_init.cpp
deleted file mode 100644
index f5a05e57b..000000000
--- a/libc/bionic/heap_zero_init.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "heap_zero_init.h"
-
-extern "C" void scudo_malloc_set_zero_contents(int zero_contents);
-
-bool SetHeapZeroInitialize(bool zero_init __attribute__((__unused__))) {
-#ifdef USE_SCUDO
- scudo_malloc_set_zero_contents(zero_init);
- return true;
-#endif
- return false;
-}
diff --git a/libc/bionic/iconv.cpp b/libc/bionic/iconv.cpp
index 79a429cb9..015d70f5e 100644
--- a/libc/bionic/iconv.cpp
+++ b/libc/bionic/iconv.cpp
@@ -356,10 +356,6 @@ size_t iconv(iconv_t __converter,
errno = EBADF;
return -1;
}
-
- // Since none of our encodings are stateful, state flushing is a no-op.
- if (!__src_buf) return 0;
-
return __converter->Convert(__src_buf, __src_bytes_left, __dst_buf, __dst_bytes_left);
}
diff --git a/libc/bionic/icu.cpp b/libc/bionic/icu.cpp
index c11b9d60b..72dac9b5a 100644
--- a/libc/bionic/icu.cpp
+++ b/libc/bionic/icu.cpp
@@ -36,12 +36,12 @@
#include <async_safe/log.h>
-static void* g_libicu_handle = nullptr;
+static void* g_libicuuc_handle = nullptr;
static bool __find_icu() {
- g_libicu_handle = dlopen("libicu.so", RTLD_LOCAL);
- if (g_libicu_handle == nullptr) {
- async_safe_format_log(ANDROID_LOG_ERROR, "bionic-icu", "couldn't open libicu.so: %s",
+ g_libicuuc_handle = dlopen("libandroidicu.so", RTLD_LOCAL);
+ if (g_libicuuc_handle == nullptr) {
+ async_safe_format_log(ANDROID_LOG_ERROR, "bionic-icu", "couldn't open libandroidicu.so: %s",
dlerror());
return false;
}
@@ -53,9 +53,14 @@ void* __find_icu_symbol(const char* symbol_name) {
static bool found_icu = __find_icu();
if (!found_icu) return nullptr;
- void* symbol = dlsym(g_libicu_handle, symbol_name);
+ char versioned_symbol_name[strlen(symbol_name) + strlen("_android") + 1];
+ snprintf(versioned_symbol_name, sizeof(versioned_symbol_name), "%s_android",
+ symbol_name);
+
+ void* symbol = dlsym(g_libicuuc_handle, versioned_symbol_name);
if (symbol == nullptr) {
- async_safe_format_log(ANDROID_LOG_ERROR, "bionic-icu", "couldn't find %s", symbol_name);
+ async_safe_format_log(ANDROID_LOG_ERROR, "bionic-icu", "couldn't find %s",
+ versioned_symbol_name);
}
return symbol;
}
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index dd623a529..a82ca50b6 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -52,13 +52,10 @@
#include "pthread_internal.h"
extern "C" int __system_properties_init(void);
-extern "C" void scudo_malloc_set_zero_contents(int);
-extern "C" void scudo_malloc_set_pattern_fill_contents(int);
__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
// Not public, but well-known in the BSDs.
-__BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE
const char* __progname;
void __libc_init_globals() {
@@ -87,23 +84,6 @@ static void arc4random_fork_handler() {
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
-void __libc_init_scudo() {
- // Heap tagging level *must* be set before interacting with Scudo, otherwise
- // the primary will be mapped with PROT_MTE even if MTE is is not enabled in
- // this process.
- SetDefaultHeapTaggingLevel();
-
-// TODO(b/158870657) make this unconditional when all devices support SCUDO.
-#if defined(USE_SCUDO)
-#if defined(SCUDO_PATTERN_FILL_CONTENTS)
- scudo_malloc_set_pattern_fill_contents(1);
-#elif defined(SCUDO_ZERO_CONTENTS)
- scudo_malloc_set_zero_contents(1);
-#endif
-#endif
-}
-
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
void __libc_add_main_thread() {
// Get the main thread from TLS and add it to the thread list.
pthread_internal_t* main_thread = __get_thread();
@@ -125,6 +105,8 @@ void __libc_init_common() {
__system_properties_init(); // Requires 'environ'.
__libc_init_fdsan(); // Requires system properties (for debug.fdsan).
__libc_init_fdtrack();
+
+ SetDefaultHeapTaggingLevel();
}
void __libc_init_fork_handler() {
@@ -132,14 +114,6 @@ void __libc_init_fork_handler() {
pthread_atfork(arc4random_fork_handler, _thread_arc4_unlock, _thread_arc4_unlock);
}
-extern "C" void scudo_malloc_set_add_large_allocation_slack(int add_slack);
-
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE void __libc_set_target_sdk_version(int target __unused) {
-#if defined(USE_SCUDO)
- scudo_malloc_set_add_large_allocation_slack(target < __ANDROID_API_S__);
-#endif
-}
-
__noreturn static void __early_abort(int line) {
// We can't write to stdout or stderr because we're aborting before we've checked that
// it's safe for us to use those file descriptors. We probably can't strace either, so
@@ -374,8 +348,10 @@ void __libc_fini(void* array) {
Dtor* fini_array = reinterpret_cast<Dtor*>(array);
const Dtor minus1 = reinterpret_cast<Dtor>(static_cast<uintptr_t>(-1));
- // Validity check: the first entry must be -1.
- if (array == nullptr || fini_array[0] != minus1) return;
+ // Sanity check - first entry must be -1.
+ if (array == nullptr || fini_array[0] != minus1) {
+ return;
+ }
// Skip over it.
fini_array += 1;
@@ -386,9 +362,15 @@ void __libc_fini(void* array) {
++count;
}
- // Now call each destructor in reverse order, ignoring any -1s.
+ // Now call each destructor in reverse order.
while (count > 0) {
Dtor dtor = fini_array[--count];
- if (dtor != minus1) dtor();
+
+ // Sanity check, any -1 in the list is ignored.
+ if (dtor == minus1) {
+ continue;
+ }
+
+ dtor();
}
}
diff --git a/libc/bionic/libc_init_common.h b/libc/bionic/libc_init_common.h
index 15c747efe..0c2e78a01 100644
--- a/libc/bionic/libc_init_common.h
+++ b/libc/bionic/libc_init_common.h
@@ -28,16 +28,12 @@
#pragma once
-#include <stdint.h>
#include <sys/cdefs.h>
-typedef void init_func_t(int, char*[], char*[]);
-typedef void fini_func_t(void);
-
typedef struct {
- init_func_t** preinit_array;
- init_func_t** init_array;
- fini_func_t** fini_array;
+ void (**preinit_array)(void);
+ void (**init_array)(void);
+ void (**fini_array)(void);
} structors_array_t;
__BEGIN_DECLS
@@ -58,14 +54,10 @@ __LIBC_HIDDEN__ void __libc_init_globals();
__LIBC_HIDDEN__ void __libc_init_common();
-__LIBC_HIDDEN__ void __libc_init_scudo();
-
__LIBC_HIDDEN__ void __libc_init_AT_SECURE(char** envp);
// The fork handler must be initialised after __libc_init_malloc, as
// pthread_atfork may call malloc() during its once-init.
__LIBC_HIDDEN__ void __libc_init_fork_handler();
-__LIBC_HIDDEN__ void __libc_set_target_sdk_version(int target);
-
#endif
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 4625fa1d4..c9da02eab 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -46,7 +46,6 @@
#include <elf.h>
#include "libc_init_common.h"
-#include "private/bionic_defs.h"
#include "private/bionic_elf_tls.h"
#include "private/bionic_globals.h"
#include "platform/bionic/macros.h"
@@ -91,7 +90,6 @@ static void __libc_preinit_impl() {
__libc_init_globals();
__libc_init_common();
- __libc_init_scudo();
// Hooks for various libraries to let them know that we're starting up.
__libc_globals.mutate(__libc_init_malloc);
@@ -108,8 +106,6 @@ static void __libc_preinit_impl() {
__libc_shared_globals()->unload_hook = __hwasan_library_unloaded;
#endif
- __libc_shared_globals()->set_target_sdk_version_hook = __libc_set_target_sdk_version;
-
netdClientInit();
}
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 3a8513f98..cf5423e00 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -39,17 +39,13 @@
#include "libc_init_common.h"
#include "pthread_internal.h"
-#include "platform/bionic/macros.h"
-#include "platform/bionic/mte.h"
#include "platform/bionic/page.h"
-#include "private/KernelArgumentBlock.h"
-#include "private/bionic_asm.h"
-#include "private/bionic_asm_note.h"
#include "private/bionic_call_ifunc_resolver.h"
#include "private/bionic_elf_tls.h"
#include "private/bionic_globals.h"
+#include "platform/bionic/macros.h"
#include "private/bionic_tls.h"
-#include "sys/system_properties.h"
+#include "private/KernelArgumentBlock.h"
#if __has_feature(hwaddress_sanitizer)
#include <sanitizer/hwasan_interface.h>
@@ -63,12 +59,11 @@ __LIBC_HIDDEN__ void* __libc_sysinfo;
#endif
extern "C" int __cxa_atexit(void (*)(void *), void *, void *);
-extern "C" const char* __gnu_basename(const char* path);
-static void call_array(init_func_t** list, int argc, char* argv[], char* envp[]) {
+static void call_array(void(**list)()) {
// First element is -1, list is null-terminated
while (*++list) {
- (*list)(argc, argv, envp);
+ (*list)();
}
}
@@ -152,7 +147,6 @@ static void layout_static_tls(KernelArgumentBlock& args) {
mod.first_generation = kTlsGenerationFirst;
modules.module_count = 1;
- modules.static_module_count = 1;
modules.module_table = &mod;
} else {
layout.reserve_exe_segment_and_tcb(nullptr, progname);
@@ -163,174 +157,6 @@ static void layout_static_tls(KernelArgumentBlock& args) {
layout.finish_layout();
}
-// Get the presiding config string, in the following order of priority:
-// 1. Environment variables.
-// 2. System properties, in the order they're specified in sys_prop_names.
-// If neither of these options are specified, this function returns false.
-// Otherwise, it returns true, and the presiding options string is written to
-// the `options` buffer of size `size`. If this function returns true, `options`
-// is guaranteed to be null-terminated. `options_size` should be at least
-// PROP_VALUE_MAX.
-bool get_config_from_env_or_sysprops(const char* env_var_name, const char* const* sys_prop_names,
- size_t sys_prop_names_size, char* options,
- size_t options_size) {
- const char* env = getenv(env_var_name);
- if (env && *env != '\0') {
- strncpy(options, env, options_size);
- options[options_size - 1] = '\0'; // Ensure null-termination.
- return true;
- }
-
- for (size_t i = 0; i < sys_prop_names_size; ++i) {
- if (__system_property_get(sys_prop_names[i], options) && *options != '\0') return true;
- }
- return false;
-}
-
-#ifdef __aarch64__
-static bool __read_memtag_note(const ElfW(Nhdr)* note, const char* name, const char* desc,
- unsigned* result) {
- if (note->n_namesz != 8 || strncmp(name, "Android", 8) != 0) {
- return false;
- }
- if (note->n_type != NT_TYPE_MEMTAG) {
- return false;
- }
- if (note->n_descsz != 4) {
- async_safe_fatal("unrecognized android.memtag note: n_descsz = %d, expected 4", note->n_descsz);
- }
- *result = *reinterpret_cast<const ElfW(Word)*>(desc);
- return true;
-}
-
-static unsigned __get_memtag_note(const ElfW(Phdr)* phdr_start, size_t phdr_ct,
- const ElfW(Addr) load_bias) {
- for (size_t i = 0; i < phdr_ct; ++i) {
- const ElfW(Phdr)* phdr = &phdr_start[i];
- if (phdr->p_type != PT_NOTE) {
- continue;
- }
- ElfW(Addr) p = load_bias + phdr->p_vaddr;
- ElfW(Addr) note_end = load_bias + phdr->p_vaddr + phdr->p_memsz;
- while (p + sizeof(ElfW(Nhdr)) <= note_end) {
- const ElfW(Nhdr)* note = reinterpret_cast<const ElfW(Nhdr)*>(p);
- p += sizeof(ElfW(Nhdr));
- const char* name = reinterpret_cast<const char*>(p);
- p += align_up(note->n_namesz, 4);
- const char* desc = reinterpret_cast<const char*>(p);
- p += align_up(note->n_descsz, 4);
- if (p > note_end) {
- break;
- }
- unsigned ret;
- if (__read_memtag_note(note, name, desc, &ret)) {
- return ret;
- }
- }
- }
- return 0;
-}
-
-// Returns true if there's an environment setting (either sysprop or env var)
-// that should overwrite the ELF note, and places the equivalent heap tagging
-// level into *level.
-static bool get_environment_memtag_setting(HeapTaggingLevel* level) {
- static const char kMemtagPrognameSyspropPrefix[] = "arm64.memtag.process.";
-
- const char* progname = __libc_shared_globals()->init_progname;
- if (progname == nullptr) return false;
-
- const char* basename = __gnu_basename(progname);
-
- static constexpr size_t kOptionsSize = PROP_VALUE_MAX;
- char options_str[kOptionsSize];
- size_t sysprop_size = strlen(basename) + strlen(kMemtagPrognameSyspropPrefix) + 1;
- char* sysprop_name = static_cast<char*>(alloca(sysprop_size));
-
- async_safe_format_buffer(sysprop_name, sysprop_size, "%s%s", kMemtagPrognameSyspropPrefix,
- basename);
-
- if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", &sysprop_name,
- /* sys_prop_names_size */ 1, options_str, kOptionsSize)) {
- return false;
- }
-
- if (strcmp("sync", options_str) == 0) {
- *level = M_HEAP_TAGGING_LEVEL_SYNC;
- } else if (strcmp("async", options_str) == 0) {
- *level = M_HEAP_TAGGING_LEVEL_ASYNC;
- } else if (strcmp("off", options_str) == 0) {
- *level = M_HEAP_TAGGING_LEVEL_TBI;
- } else {
- async_safe_format_log(
- ANDROID_LOG_ERROR, "libc",
- "unrecognized memtag level: \"%s\" (options are \"sync\", \"async\", or \"off\").",
- options_str);
- return false;
- }
-
- return true;
-}
-
-// Returns the initial heap tagging level. Note: This function will never return
-// M_HEAP_TAGGING_LEVEL_NONE, if MTE isn't enabled for this process we enable
-// M_HEAP_TAGGING_LEVEL_TBI.
-static HeapTaggingLevel __get_heap_tagging_level(const void* phdr_start, size_t phdr_ct,
- uintptr_t load_bias) {
- HeapTaggingLevel level;
- if (get_environment_memtag_setting(&level)) return level;
-
- unsigned note_val =
- __get_memtag_note(reinterpret_cast<const ElfW(Phdr)*>(phdr_start), phdr_ct, load_bias);
- if (note_val & ~(NT_MEMTAG_LEVEL_MASK | NT_MEMTAG_HEAP)) {
- async_safe_fatal("unrecognized android.memtag note: desc = %d", note_val);
- }
-
- if (!(note_val & NT_MEMTAG_HEAP)) return M_HEAP_TAGGING_LEVEL_TBI;
-
- unsigned memtag_level = note_val & NT_MEMTAG_LEVEL_MASK;
- switch (memtag_level) {
- case NT_MEMTAG_LEVEL_ASYNC:
- return M_HEAP_TAGGING_LEVEL_ASYNC;
- case NT_MEMTAG_LEVEL_DEFAULT:
- case NT_MEMTAG_LEVEL_SYNC:
- return M_HEAP_TAGGING_LEVEL_SYNC;
- default:
- async_safe_fatal("unrecognized android.memtag note: level = %d", memtag_level);
- }
-}
-
-// Figure out the desired memory tagging mode (sync/async, heap/globals/stack) for this executable.
-// This function is called from the linker before the main executable is relocated.
-__attribute__((no_sanitize("hwaddress", "memtag"))) void __libc_init_mte(const void* phdr_start,
- size_t phdr_ct,
- uintptr_t load_bias) {
- HeapTaggingLevel level = __get_heap_tagging_level(phdr_start, phdr_ct, load_bias);
-
- if (level == M_HEAP_TAGGING_LEVEL_SYNC || level == M_HEAP_TAGGING_LEVEL_ASYNC) {
- unsigned long prctl_arg = PR_TAGGED_ADDR_ENABLE | PR_MTE_TAG_SET_NONZERO;
- prctl_arg |= (level == M_HEAP_TAGGING_LEVEL_SYNC) ? PR_MTE_TCF_SYNC : PR_MTE_TCF_ASYNC;
-
- // When entering ASYNC mode, specify that we want to allow upgrading to SYNC by OR'ing in the
- // SYNC flag. But if the kernel doesn't support specifying multiple TCF modes, fall back to
- // specifying a single mode.
- if (prctl(PR_SET_TAGGED_ADDR_CTRL, prctl_arg | PR_MTE_TCF_SYNC, 0, 0, 0) == 0 ||
- prctl(PR_SET_TAGGED_ADDR_CTRL, prctl_arg, 0, 0, 0) == 0) {
- __libc_shared_globals()->initial_heap_tagging_level = level;
- return;
- }
- }
-
- // MTE was either not enabled, or wasn't supported on this device. Try and use
- // TBI.
- if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) {
- __libc_shared_globals()->initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
- }
-}
-#else // __aarch64__
-void __libc_init_mte(const void*, size_t, uintptr_t) {}
-#endif // __aarch64__
-
__noreturn static void __real_libc_init(void *raw_args,
void (*onexit)(void) __unused,
int (*slingshot)(int, char**, char**),
@@ -348,9 +174,6 @@ __noreturn static void __real_libc_init(void *raw_args,
layout_static_tls(args);
__libc_init_main_thread_final();
__libc_init_common();
- __libc_init_mte(reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR)), getauxval(AT_PHNUM),
- /*load_bias = */ 0);
- __libc_init_scudo();
__libc_init_fork_handler();
call_ifunc_resolvers();
@@ -359,8 +182,8 @@ __noreturn static void __real_libc_init(void *raw_args,
// Several Linux ABIs don't pass the onexit pointer, and the ones that
// do never use it. Therefore, we ignore it.
- call_array(structors->preinit_array, args.argc, args.argv, args.envp);
- call_array(structors->init_array, args.argc, args.argv, args.envp);
+ call_array(structors->preinit_array);
+ call_array(structors->init_array);
// The executable may have its own destructors listed in its .fini_array
// so we need to ensure that these are called when the program exits
@@ -404,7 +227,6 @@ extern "C" int android_get_application_target_sdk_version() {
extern "C" void android_set_application_target_sdk_version(int target) {
g_target_sdk_version = target;
- __libc_set_target_sdk_version(target);
}
// This function is called in the dynamic linker before ifunc resolvers have run, so this file is
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
index c91efa0f0..ed5537f5f 100644
--- a/libc/bionic/malloc_common.cpp
+++ b/libc/bionic/malloc_common.cpp
@@ -38,13 +38,11 @@
#include <stdint.h>
#include <stdio.h>
-#include <platform/bionic/malloc.h>
-#include <private/ScopedPthreadMutexLocker.h>
#include <private/bionic_config.h>
+#include <platform/bionic/malloc.h>
#include "gwp_asan_wrappers.h"
#include "heap_tagging.h"
-#include "heap_zero_init.h"
#include "malloc_common.h"
#include "malloc_limit.h"
#include "malloc_tagged_pointers.h"
@@ -102,15 +100,6 @@ extern "C" int malloc_info(int options, FILE* fp) {
}
extern "C" int mallopt(int param, int value) {
- // Some are handled by libc directly rather than by the allocator.
- if (param == M_BIONIC_SET_HEAP_TAGGING_LEVEL) {
- ScopedPthreadMutexLocker locker(&g_heap_tagging_lock);
- return SetHeapTaggingLevel(static_cast<HeapTaggingLevel>(value));
- }
- if (param == M_BIONIC_ZERO_INIT) {
- return SetHeapZeroInitialize(value);
- }
- // The rest we pass on...
auto dispatch_table = GetDispatchTable();
if (__predict_false(dispatch_table != nullptr)) {
return dispatch_table->mallopt(param, value);
@@ -325,6 +314,9 @@ extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size) {
if (opcode == M_SET_ALLOCATION_LIMIT_BYTES) {
return LimitEnable(arg, arg_size);
}
+ if (opcode == M_SET_HEAP_TAGGING_LEVEL) {
+ return SetHeapTaggingLevel(arg, arg_size);
+ }
if (opcode == M_INITIALIZE_GWP_ASAN) {
if (arg == nullptr || arg_size != sizeof(bool)) {
errno = EINVAL;
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
index 31d1e69eb..da87c332e 100644
--- a/libc/bionic/malloc_common_dynamic.cpp
+++ b/libc/bionic/malloc_common_dynamic.cpp
@@ -58,7 +58,6 @@
#include <android/dlext.h>
#include <platform/bionic/malloc.h>
-#include <private/ScopedPthreadMutexLocker.h>
#include <private/bionic_config.h>
#include <private/bionic_defs.h>
#include <private/bionic_malloc_dispatch.h>
@@ -67,7 +66,6 @@
#include "gwp_asan_wrappers.h"
#include "heap_tagging.h"
-#include "heap_zero_init.h"
#include "malloc_common.h"
#include "malloc_common_dynamic.h"
#include "malloc_heapprofd.h"
@@ -368,10 +366,6 @@ static bool InstallHooks(libc_globals* globals, const char* options, const char*
return true;
}
-extern "C" const char* __scudo_get_stack_depot_addr();
-extern "C" const char* __scudo_get_region_info_addr();
-extern "C" const char* __scudo_get_ring_buffer_addr();
-
// Initializes memory allocation framework once per process.
static void MallocInitImpl(libc_globals* globals) {
char prop[PROP_VALUE_MAX];
@@ -379,12 +373,6 @@ static void MallocInitImpl(libc_globals* globals) {
MaybeInitGwpAsanFromLibc(globals);
-#if defined(USE_SCUDO)
- __libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr();
- __libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr();
- __libc_shared_globals()->scudo_ring_buffer = __scudo_get_ring_buffer_addr();
-#endif
-
// Prefer malloc debug since it existed first and is a more complete
// malloc interceptor than the hooks.
bool hook_installed = false;
@@ -525,6 +513,9 @@ extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size) {
}
return FreeMallocLeakInfo(reinterpret_cast<android_mallopt_leak_info_t*>(arg));
}
+ if (opcode == M_SET_HEAP_TAGGING_LEVEL) {
+ return SetHeapTaggingLevel(arg, arg_size);
+ }
if (opcode == M_INITIALIZE_GWP_ASAN) {
if (arg == nullptr || arg_size != sizeof(bool)) {
errno = EINVAL;
diff --git a/libc/bionic/malloc_heapprofd.cpp b/libc/bionic/malloc_heapprofd.cpp
index 741b45e98..51becf067 100644
--- a/libc/bionic/malloc_heapprofd.cpp
+++ b/libc/bionic/malloc_heapprofd.cpp
@@ -56,8 +56,8 @@
// +--->+-------------+------------------+
// | +->+kInitialState+----------------+ | malloc functions are not intercepted in any way.
// | | +-------+-----+ | |
-// | | | HandleHeapprofd | |
-// | | v Signal() | |
+// | | | | |
+// | | v | |
// | | +-------+----------------+ | | currently installing the ephemeral hooks.
// | | |kInstallingEphemeralHook|<--+ | |
// | | +-------+----------------+ | | |
@@ -65,9 +65,9 @@
// | | v | | |
// | | +-------+---------------+ | | | ephemeral hooks are installed. on the first call to
// | | |kEphemeralHookInstalled| | | | malloc these hooks spawn a thread that installs the
-// | | +-------+---------------+ A B C heapprofd hooks.
-// | | | MallocInit | | |
-// | | v HeapprofdHook () | | |
+// | | +-------+---------------+ | | | heapprofd hooks.
+// | | | | | |
+// | | v | | |
// | | +-------+--------------+ | | | first call to malloc happened. the hooks are reset to
// | +--|kRemovingEphemeralHook| | | | kInitialState.
// | +----------------------+ | | |
@@ -81,7 +81,7 @@
// | +-------+------+ | | heapprofd hooks are installed. these forward calls to
// | |kHookInstalled|-------------+ | malloc / free / etc. to heapprofd_client.so.
// | +-------+------+ |
-// | | DispatchReset() |
+// | | |
// | v |
// | +-------+---------+ | currently resetting the hooks to default.
// |----+kUninstallingHook| |
@@ -92,10 +92,6 @@
// |kIncompatibleHooks+<------------+ precendence over heapprofd, so heapprofd will not get
// +------------------+ enabled. this is a terminal state.
//
-//
-// A) HandleHeapprofdSignal()
-// B) HeapprofdInstallHooksAtInit() / InitHeapprofd()
-// C) HeapprofdRememberHookConflict()
enum MallocHeapprofdState : uint8_t {
kInitialState,
kInstallingEphemeralHook,
@@ -325,12 +321,12 @@ void HeapprofdRememberHookConflict() {
static void CommonInstallHooks(libc_globals* globals) {
void* impl_handle = atomic_load(&gHeapprofdHandle);
- if (impl_handle == nullptr) {
+ bool reusing_handle = impl_handle != nullptr;
+ if (!reusing_handle) {
impl_handle = LoadSharedLibrary(kHeapprofdSharedLib, kHeapprofdPrefix, &globals->malloc_dispatch_table);
if (impl_handle == nullptr) {
return;
}
- atomic_store(&gHeapprofdHandle, impl_handle);
} else if (!InitSharedLibrary(impl_handle, kHeapprofdSharedLib, kHeapprofdPrefix, &globals->malloc_dispatch_table)) {
return;
}
@@ -341,7 +337,11 @@ static void CommonInstallHooks(libc_globals* globals) {
// MaybeModifyGlobals locks at this point.
atomic_store(&gPreviousDefaultDispatchTable, GetDefaultDispatchTable());
- FinishInstallHooks(globals, nullptr, kHeapprofdPrefix);
+ if (FinishInstallHooks(globals, nullptr, kHeapprofdPrefix)) {
+ atomic_store(&gHeapprofdHandle, impl_handle);
+ } else if (!reusing_handle) {
+ dlclose(impl_handle);
+ }
}
void HeapprofdInstallHooksAtInit(libc_globals* globals) {
diff --git a/libc/bionic/malloc_tagged_pointers.h b/libc/bionic/malloc_tagged_pointers.h
index 484a0802e..de3cc2ed9 100644
--- a/libc/bionic/malloc_tagged_pointers.h
+++ b/libc/bionic/malloc_tagged_pointers.h
@@ -99,10 +99,9 @@ static inline void* MaybeUntagAndCheckPointer(const volatile void* ptr) {
// check below allows us to turn *off* pointer tagging (by setting PointerCheckMask() and
// FixedPointerTag() to zero) and still allow tagged heap allocations to be freed.
if ((ptr_int & PointerCheckMask()) != FixedPointerTag()) {
- async_safe_fatal(
- "Pointer tag for %p was truncated, see "
- "'https://source.android.com/devices/tech/debug/tagged-pointers'.",
- ptr);
+ // TODO(b/145604058) - Upstream tagged pointers documentation and provide
+ // a link to it in the abort message here.
+ async_safe_fatal("Pointer tag for %p was truncated.", ptr);
}
return reinterpret_cast<void*>(ptr_int & PointerUntagMask());
}
diff --git a/libc/bionic/utmp.cpp b/libc/bionic/memmem.cpp
index aa00cd568..019e7720f 100644
--- a/libc/bionic/utmp.cpp
+++ b/libc/bionic/memmem.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,23 +26,35 @@
* SUCH DAMAGE.
*/
-#include <utmp.h>
+#include <string.h>
-#include <errno.h>
+void* memmem(const void* void_haystack, size_t n, const void* void_needle, size_t m) {
+ const unsigned char* haystack = reinterpret_cast<const unsigned char*>(void_haystack);
+ const unsigned char* needle = reinterpret_cast<const unsigned char*>(void_needle);
-void endutent() {}
+ if (n < m) return nullptr;
-void setutent() {}
+ if (m == 0) return const_cast<void*>(void_haystack);
+ if (m == 1) return const_cast<void*>(memchr(haystack, needle[0], n));
-utmp* getutent() {
- return nullptr;
-}
+ // This uses the "Not So Naive" algorithm, a very simple but usually effective algorithm.
+ // http://www-igm.univ-mlv.fr/~lecroq/string/
+ const unsigned char* y = haystack;
+ const unsigned char* x = needle;
+ size_t j = 0;
+ size_t k = 1, l = 2;
-utmp* pututline(const utmp*) {
+ if (x[0] == x[1]) {
+ k = 2;
+ l = 1;
+ }
+ while (j <= n-m) {
+ if (x[1] != y[j+1]) {
+ j += k;
+ } else {
+ if (!memcmp(x+2, y+j+2, m-2) && x[0] == y[j]) return const_cast<unsigned char*>(&y[j]);
+ j += l;
+ }
+ }
return nullptr;
}
-
-int utmpname(const char*) {
- errno = ENOTSUP;
- return -1;
-}
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index b15a3171f..e9a5b5b79 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -55,9 +55,8 @@ extern "C" {
// By the time any NDK-built code is running, there are plenty of threads.
int __isthreaded = 1;
-// These were accidentally declared in <unistd.h> because we used to inline
-// getpagesize() and __getpageshift(). Needed for backwards compatibility
-// with old NDK apps.
+// These were accidentally declared in <unistd.h> because we stupidly used to inline
+// getpagesize() and __getpageshift(). Needed for backwards compatibility with old NDK apps.
unsigned int __page_size = PAGE_SIZE;
unsigned int __page_shift = 12;
diff --git a/libc/bionic/new.cpp b/libc/bionic/new.cpp
index c9ce163f5..a0da2fb18 100644
--- a/libc/bionic/new.cpp
+++ b/libc/bionic/new.cpp
@@ -21,7 +21,7 @@
#include <async_safe/log.h>
-__attribute__((weak)) const std::nothrow_t std::nothrow = {};
+const std::nothrow_t std::nothrow = {};
void* operator new(std::size_t size) {
void* p = malloc(size);
diff --git a/libc/bionic/pidfd.cpp b/libc/bionic/pidfd.cpp
deleted file mode 100644
index 1dcb1fdb4..000000000
--- a/libc/bionic/pidfd.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/pidfd.h>
-
-#include "private/bionic_fdtrack.h"
-
-extern "C" int __pidfd_open(pid_t pid, unsigned int flags);
-extern "C" int __pidfd_getfd(int pidfd, int targetfd, unsigned int flags);
-
-int pidfd_open(pid_t pid, unsigned int flags) {
- return FDTRACK_CREATE(__pidfd_open(pid, flags));
-}
-
-int pidfd_getfd(int pidfd, int targetfd, unsigned int flags) {
- return FDTRACK_CREATE(__pidfd_getfd(pidfd, targetfd, flags));
-}
diff --git a/libc/bionic/pthread_attr.cpp b/libc/bionic/pthread_attr.cpp
index 89aa28966..3c4b169ee 100644
--- a/libc/bionic/pthread_attr.cpp
+++ b/libc/bionic/pthread_attr.cpp
@@ -30,13 +30,13 @@
#include <inttypes.h>
#include <stdio.h>
-#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
#include <async_safe/log.h>
#include "private/bionic_defs.h"
+#include "private/bionic_string_utils.h"
#include "private/ErrnoRestorer.h"
#include "pthread_internal.h"
@@ -192,8 +192,7 @@ static int __pthread_attr_getstack_main_thread(void** stack_base, size_t* stack_
return errno;
}
- // If the current RLIMIT_STACK is RLIM_INFINITY, only admit to an 8MiB stack
- // in case callers such as ART take infinity too literally.
+ // If the current RLIMIT_STACK is RLIM_INFINITY, only admit to an 8MiB stack for sanity's sake.
if (stack_limit.rlim_cur == RLIM_INFINITY) {
stack_limit.rlim_cur = 8 * 1024 * 1024;
}
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp
index 793dcd942..e85706902 100644
--- a/libc/bionic/pthread_cond.cpp
+++ b/libc/bionic/pthread_cond.cpp
@@ -116,8 +116,7 @@ struct pthread_cond_internal_t {
}
#if defined(__LP64__)
- atomic_uint waiters;
- char __reserved[40];
+ char __reserved[44];
#endif
};
@@ -142,10 +141,6 @@ int pthread_cond_init(pthread_cond_t* cond_interface, const pthread_condattr_t*
}
atomic_init(&cond->state, init_state);
-#if defined(__LP64__)
- atomic_init(&cond->waiters, 0);
-#endif
-
return 0;
}
@@ -168,12 +163,6 @@ static int __pthread_cond_pulse(pthread_cond_internal_t* cond, int thread_count)
// not be called. That's why pthread_wait/signal pair can't be used as a method for memory
// synchronization. And it doesn't help even if we use any fence here.
-#if defined(__LP64__)
- if (atomic_load_explicit(&cond->waiters, memory_order_relaxed) == 0) {
- return 0;
- }
-#endif
-
// The increase of value should leave flags alone, even if the value can overflows.
atomic_fetch_add_explicit(&cond->state, COND_COUNTER_STEP, memory_order_relaxed);
@@ -189,19 +178,9 @@ static int __pthread_cond_timedwait(pthread_cond_internal_t* cond, pthread_mutex
}
unsigned int old_state = atomic_load_explicit(&cond->state, memory_order_relaxed);
-
-#if defined(__LP64__)
- atomic_fetch_add_explicit(&cond->waiters, 1, memory_order_relaxed);
-#endif
-
pthread_mutex_unlock(mutex);
int status = __futex_wait_ex(&cond->state, cond->process_shared(), old_state,
use_realtime_clock, abs_timeout_or_null);
-
-#if defined(__LP64__)
- atomic_fetch_sub_explicit(&cond->waiters, 1, memory_order_relaxed);
-#endif
-
pthread_mutex_lock(mutex);
if (status == -ETIMEDOUT) {
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 121b26f82..d4a8bef26 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -30,7 +30,6 @@
#include <errno.h>
#include <string.h>
-#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <sys/random.h>
@@ -40,7 +39,6 @@
#include <async_safe/log.h>
-#include "private/ScopedRWLock.h"
#include "private/bionic_constants.h"
#include "private/bionic_defs.h"
#include "private/bionic_globals.h"
@@ -331,11 +329,6 @@ void __set_stack_and_tls_vma_name(bool is_main_thread) {
extern "C" int __rt_sigprocmask(int, const sigset64_t*, sigset64_t*, size_t);
__attribute__((no_sanitize("hwaddress")))
-#ifdef __aarch64__
-// This function doesn't return, but it does appear in stack traces. Avoid using return PAC in this
-// function because we may end up resetting IA, which may confuse unwinders due to mismatching keys.
-__attribute__((target("branch-protection=bti")))
-#endif
static int __pthread_start(void* arg) {
pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(arg);
@@ -350,16 +343,6 @@ static int __pthread_start(void* arg) {
__set_stack_and_tls_vma_name(false);
__init_additional_stacks(thread);
__rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
-#ifdef __aarch64__
- // Chrome's sandbox prevents this prctl, so only reset IA if the target SDK level is high enough.
- // Furthermore, processes loaded from vendor partitions may have their own sandboxes that would
- // reject the prctl. Because no devices launched with PAC enabled before S, we can avoid issues on
- // upgrading devices by checking for PAC support before issuing the prctl.
- static const bool pac_supported = getauxval(AT_HWCAP) & HWCAP_PACA;
- if (pac_supported && android_get_application_target_sdk_version() >= __ANDROID_API_S__) {
- prctl(PR_PAC_RESET_KEYS, PR_PAC_APIAKEY, 0, 0, 0);
- }
-#endif
void* result = thread->start_routine(thread->start_routine_arg);
pthread_exit(result);
@@ -367,14 +350,13 @@ static int __pthread_start(void* arg) {
return 0;
}
-// A no-op start routine for pthread_create failures where we've created a thread but aren't
+// A dummy start routine for pthread_create failures where we've created a thread but aren't
// going to run user code on it. We swap out the user's start routine for this and take advantage
// of the regular thread teardown to free up resources.
static void* __do_nothing(void*) {
return nullptr;
}
-pthread_rwlock_t g_thread_creation_lock = PTHREAD_RWLOCK_INITIALIZER;
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
@@ -424,8 +406,6 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
tls = &tls_descriptor;
#endif
- ScopedReadLock locker(&g_thread_creation_lock);
-
sigset64_t block_all_mask;
sigfillset64(&block_all_mask);
__rt_sigprocmask(SIG_SETMASK, &block_all_mask, &thread->start_mask, sizeof(thread->start_mask));
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index bde95ec66..3b873b314 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -35,7 +35,6 @@
#include "private/bionic_constants.h"
#include "private/bionic_defs.h"
-#include "private/ScopedRWLock.h"
#include "private/ScopedSignalBlocker.h"
#include "pthread_internal.h"
@@ -104,24 +103,16 @@ void pthread_exit(void* return_value) {
!atomic_compare_exchange_weak(&thread->join_state, &old_state, THREAD_EXITED_NOT_JOINED)) {
}
- // android_run_on_all_threads() needs to see signals blocked atomically with setting the
- // terminating flag, so take the creation lock while doing these operations.
- {
- ScopedReadLock locker(&g_thread_creation_lock);
- atomic_store(&thread->terminating, true);
-
- // We don't want to take a signal after unmapping the stack, the shadow call stack, or dynamic
- // TLS memory.
- sigset64_t set;
- sigfillset64(&set);
- __rt_sigprocmask(SIG_BLOCK, &set, nullptr, sizeof(sigset64_t));
- }
+ // We don't want to take a signal after unmapping the stack, the shadow call
+ // stack, or dynamic TLS memory.
+ ScopedSignalBlocker ssb;
#ifdef __aarch64__
// Free the shadow call stack and guard pages.
munmap(thread->shadow_call_stack_guard_region, SCS_GUARD_REGION_SIZE);
#endif
+ // Free the ELF TLS DTV and all dynamically-allocated ELF TLS memory.
__free_dynamic_tls(__get_bionic_tcb());
if (old_state == THREAD_DETACHED) {
@@ -137,7 +128,6 @@ void pthread_exit(void* return_value) {
if (thread->mmap_size != 0) {
// We need to free mapped space for detached threads when they exit.
// That's not something we can do in C.
- __notify_thread_exit_callbacks();
__hwasan_thread_exit();
_exit_with_stack_teardown(thread->mmap_base, thread->mmap_size);
}
@@ -145,8 +135,6 @@ void pthread_exit(void* return_value) {
// No need to free mapped space. Either there was no space mapped, or it is left for
// the pthread_join caller to clean up.
- __notify_thread_exit_callbacks();
__hwasan_thread_exit();
-
__exit(0);
}
diff --git a/libc/bionic/pthread_internal.cpp b/libc/bionic/pthread_internal.cpp
index 6a7ee2f5b..e0911581b 100644
--- a/libc/bionic/pthread_internal.cpp
+++ b/libc/bionic/pthread_internal.cpp
@@ -29,15 +29,12 @@
#include "pthread_internal.h"
#include <errno.h>
-#include <semaphore.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <async_safe/log.h>
-#include <bionic/reserved_signals.h>
-#include "private/ErrnoRestorer.h"
#include "private/ScopedRWLock.h"
#include "private/bionic_futex.h"
#include "private/bionic_tls.h"
@@ -118,76 +115,3 @@ pthread_internal_t* __pthread_internal_find(pthread_t thread_id, const char* cal
}
return nullptr;
}
-
-bool android_run_on_all_threads(bool (*func)(void*), void* arg) {
- // Take the locks in this order to avoid inversion (pthread_create ->
- // __pthread_internal_add).
- ScopedWriteLock creation_locker(&g_thread_creation_lock);
- ScopedReadLock list_locker(&g_thread_list_lock);
-
- // Call the function directly for the current thread so that we don't need to worry about
- // the consequences of synchronizing with ourselves.
- if (!func(arg)) {
- return false;
- }
-
- static sem_t g_sem;
- if (sem_init(&g_sem, 0, 0) != 0) {
- return false;
- }
-
- static bool (*g_func)(void*);
- static void *g_arg;
- g_func = func;
- g_arg = arg;
-
- static _Atomic(bool) g_retval;
- atomic_init(&g_retval, true);
-
- auto handler = [](int, siginfo_t*, void*) {
- ErrnoRestorer restorer;
- if (!g_func(g_arg)) {
- atomic_store(&g_retval, false);
- }
- sem_post(&g_sem);
- };
-
- struct sigaction act = {}, oldact;
- act.sa_flags = SA_SIGINFO;
- act.sa_sigaction = handler;
- sigfillset(&act.sa_mask);
- if (sigaction(BIONIC_SIGNAL_RUN_ON_ALL_THREADS, &act, &oldact) != 0) {
- sem_destroy(&g_sem);
- return false;
- }
-
- pid_t my_pid = getpid();
- size_t num_tids = 0;
- for (pthread_internal_t* t = g_thread_list; t != nullptr; t = t->next) {
- // The function is called directly for the current thread above, so no need to send a signal to
- // ourselves to call it here.
- if (t == __get_thread()) continue;
-
- // If a thread is terminating (has blocked signals) or has already terminated, our signal will
- // never be received, so we need to check for that condition and skip the thread if it is the
- // case.
- if (atomic_load(&t->terminating)) continue;
-
- if (tgkill(my_pid, t->tid, BIONIC_SIGNAL_RUN_ON_ALL_THREADS) == 0) {
- ++num_tids;
- } else {
- atomic_store(&g_retval, false);
- }
- }
-
- for (size_t i = 0; i != num_tids; ++i) {
- if (TEMP_FAILURE_RETRY(sem_wait(&g_sem)) != 0) {
- atomic_store(&g_retval, false);
- break;
- }
- }
-
- sigaction(BIONIC_SIGNAL_RUN_ON_ALL_THREADS, &oldact, 0);
- sem_destroy(&g_sem);
- return atomic_load(&g_retval);
-}
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 071a5bcb3..1f055f59e 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -132,11 +132,6 @@ class pthread_internal_t {
// top of the stack quickly, which would otherwise require special logic for the main thread.
uintptr_t stack_top;
- // Whether the thread is in the process of terminating (has blocked signals), or has already
- // terminated. This is used by android_run_on_all_threads() to avoid sending a signal to a thread
- // that will never receive it.
- _Atomic(bool) terminating;
-
Lock startup_handshake_lock;
void* mmap_base;
@@ -247,7 +242,3 @@ __LIBC_HIDDEN__ void pthread_key_clean_all(void);
__LIBC_HIDDEN__ extern void __bionic_atfork_run_prepare();
__LIBC_HIDDEN__ extern void __bionic_atfork_run_child();
__LIBC_HIDDEN__ extern void __bionic_atfork_run_parent();
-
-extern "C" bool android_run_on_all_threads(bool (*func)(void*), void* arg);
-
-extern pthread_rwlock_t g_thread_creation_lock;
diff --git a/libc/bionic/pty.cpp b/libc/bionic/pty.cpp
index c0e2721ac..71e14d9db 100644
--- a/libc/bionic/pty.cpp
+++ b/libc/bionic/pty.cpp
@@ -112,14 +112,14 @@ int unlockpt(int fd) {
return ioctl(fd, TIOCSPTLCK, &unlock);
}
-int openpty(int* pty, int* tty, char* name, const termios* t, const winsize* ws) {
- *pty = getpt();
- if (*pty == -1) {
+int openpty(int* master, int* slave, char* name, const termios* t, const winsize* ws) {
+ *master = getpt();
+ if (*master == -1) {
return -1;
}
- if (grantpt(*pty) == -1 || unlockpt(*pty) == -1) {
- close(*pty);
+ if (grantpt(*master) == -1 || unlockpt(*master) == -1) {
+ close(*master);
return -1;
}
@@ -127,54 +127,54 @@ int openpty(int* pty, int* tty, char* name, const termios* t, const winsize* ws)
if (name == nullptr) {
name = buf;
}
- if (ptsname_r(*pty, name, sizeof(buf)) != 0) {
- close(*pty);
+ if (ptsname_r(*master, name, sizeof(buf)) != 0) {
+ close(*master);
return -1;
}
- *tty = open(name, O_RDWR | O_NOCTTY);
- if (*tty == -1) {
- close(*pty);
+ *slave = open(name, O_RDWR|O_NOCTTY);
+ if (*slave == -1) {
+ close(*master);
return -1;
}
if (t != nullptr) {
- tcsetattr(*tty, TCSAFLUSH, t);
+ tcsetattr(*slave, TCSAFLUSH, t);
}
if (ws != nullptr) {
- ioctl(*tty, TIOCSWINSZ, ws);
+ ioctl(*slave, TIOCSWINSZ, ws);
}
return 0;
}
-int forkpty(int* parent_pty, char* child_tty_name, const termios* t, const winsize* ws) {
- int pty;
- int tty;
- if (openpty(&pty, &tty, child_tty_name, t, ws) == -1) {
+int forkpty(int* amaster, char* name, const termios* t, const winsize* ws) {
+ int master;
+ int slave;
+ if (openpty(&master, &slave, name, t, ws) == -1) {
return -1;
}
pid_t pid = fork();
if (pid == -1) {
- close(pty);
- close(tty);
+ close(master);
+ close(slave);
return -1;
}
if (pid == 0) {
// Child.
- *parent_pty = -1;
- close(pty);
- if (login_tty(tty) == -1) {
+ *amaster = -1;
+ close(master);
+ if (login_tty(slave) == -1) {
_exit(1);
}
return 0;
}
// Parent.
- *parent_pty = pty;
- close(tty);
+ *amaster = master;
+ close(slave);
return pid;
}
diff --git a/libc/bionic/empty_android_ids.h b/libc/bionic/pututline.c
index 2145dd82f..8cbf47057 100644
--- a/libc/bionic/empty_android_ids.h
+++ b/libc/bionic/pututline.c
@@ -25,15 +25,40 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#if defined(__ANDROID__)
-#error "This file is for host only"
-#endif
+#include <string.h>
+#include <stdio.h>
+#include <utmp.h>
-struct android_id_info {
- const char name[17];
- unsigned aid;
-};
-static const struct android_id_info android_ids[] = {};
+void pututline(struct utmp* utmp)
+{
+ FILE* f;
+ struct utmp u;
+ long i;
-#define android_id_count 0
+ if (!(f = fopen(_PATH_UTMP, "w+e")))
+ return;
+
+ while (fread(&u, sizeof(struct utmp), 1, f) == 1)
+ {
+ if (!strncmp(utmp->ut_line, u.ut_line, sizeof(u.ut_line) -1))
+ {
+ if ((i = ftell(f)) < 0)
+ goto ret;
+ if (fseek(f, i - sizeof(struct utmp), SEEK_SET) < 0)
+ goto ret;
+ fwrite(utmp, sizeof(struct utmp), 1, f);
+ goto ret;
+ }
+ }
+
+
+ fclose(f);
+
+ if (!(f = fopen(_PATH_UTMP, "w+e")))
+ return;
+ fwrite(utmp, sizeof(struct utmp), 1, f);
+
+ret:
+ fclose(f);
+}
diff --git a/libc/bionic/recvmsg.cpp b/libc/bionic/recvmsg.cpp
index 4d3f98939..003f43d8a 100644
--- a/libc/bionic/recvmsg.cpp
+++ b/libc/bionic/recvmsg.cpp
@@ -39,7 +39,7 @@ extern "C" int __recvmmsg(int __fd, struct mmsghdr* __msgs, unsigned int __msg_c
static inline __attribute__((artificial)) __attribute__((always_inline)) void track_fds(
struct msghdr* msg, const char* function_name) {
- if (!atomic_load(&__android_fdtrack_hook)) {
+ if (!__android_fdtrack_hook) {
return;
}
diff --git a/libc/bionic/scandir.cpp b/libc/bionic/scandir.cpp
index f52828634..6a7e36874 100644
--- a/libc/bionic/scandir.cpp
+++ b/libc/bionic/scandir.cpp
@@ -16,9 +16,8 @@
#include <dirent.h>
-#include <assert.h>
-#include <errno.h>
#include <fcntl.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -33,8 +32,10 @@ class ScandirResult {
}
~ScandirResult() {
- // We always call release(), so this can't happen.
- if (names_ != nullptr) __assert(__FILE__, __LINE__, "missing call to release()");
+ while (size_ > 0) {
+ free(names_[--size_]);
+ }
+ free(names_);
}
size_t size() {
diff --git a/libc/bionic/scudo/Android.bp b/libc/bionic/scudo/Android.bp
new file mode 100644
index 000000000..9b77c0699
--- /dev/null
+++ b/libc/bionic/scudo/Android.bp
@@ -0,0 +1,63 @@
+//
+// Copyright (C) 2019 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.
+//
+
+cc_library_shared {
+ name: "libscudo_wrapper",
+ vendor_available: true,
+ srcs: ["scudo.cpp"],
+
+ stl: "none",
+ system_shared_libs: [],
+ host_supported: false,
+
+ header_libs: ["libc_headers"],
+ include_dirs: [
+ "bionic/libc",
+ "bionic/libc/bionic",
+ ],
+
+ whole_static_libs: ["libasync_safe"],
+
+ arch: {
+ arm: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-arm-android.static"],
+ },
+ arm64: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-aarch64-android.static"],
+ },
+ x86: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-i686-android.static"],
+ },
+ x86_64: {
+ whole_static_libs: ["libclang_rt.scudo_minimal-x86_64-android.static"],
+ },
+ },
+
+ // Will be referencing other libc code that won't be defined here.
+ allow_undefined_symbols: true,
+
+ multilib: {
+ lib32: {
+ version_script: "exported32.map",
+ },
+ lib64: {
+ version_script: "exported64.map",
+ },
+ },
+
+ // Like libc, disable native coverage for libscudo_wrapper.
+ native_coverage: false,
+}
diff --git a/libc/bionic/scudo/exported32.map b/libc/bionic/scudo/exported32.map
new file mode 100644
index 000000000..4b6791d26
--- /dev/null
+++ b/libc/bionic/scudo/exported32.map
@@ -0,0 +1,16 @@
+LIBC_SCUDO {
+ global:
+ scudo_aligned_alloc;
+ scudo_calloc;
+ scudo_free;
+ scudo_mallinfo;
+ scudo_malloc;
+ scudo_malloc_usable_size;
+ scudo_memalign;
+ scudo_posix_memalign;
+ scudo_pvalloc;
+ scudo_realloc;
+ scudo_valloc;
+ local:
+ *;
+};
diff --git a/libc/bionic/scudo/exported64.map b/libc/bionic/scudo/exported64.map
new file mode 100644
index 000000000..1346b4b59
--- /dev/null
+++ b/libc/bionic/scudo/exported64.map
@@ -0,0 +1,14 @@
+LIBC_SCUDO {
+ global:
+ scudo_aligned_alloc;
+ scudo_calloc;
+ scudo_free;
+ scudo_mallinfo;
+ scudo_malloc;
+ scudo_malloc_usable_size;
+ scudo_memalign;
+ scudo_posix_memalign;
+ scudo_realloc;
+ local:
+ *;
+};
diff --git a/libc/bionic/scudo/scudo.cpp b/libc/bionic/scudo/scudo.cpp
new file mode 100644
index 000000000..2cd36b1b0
--- /dev/null
+++ b/libc/bionic/scudo/scudo.cpp
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/prctl.h>
+
+#include "platform/bionic/macros.h"
+
+#include "scudo.h"
+
+// Disable Scudo's mismatch allocation check, as it is being triggered
+// by some third party code.
+extern "C" const char *__scudo_default_options() {
+ return "DeallocationTypeMismatch=false";
+}
+
+static inline bool AllocTooBig(size_t bytes) {
+#if defined(__LP64__)
+ if (__predict_false(bytes > 0x10000000000ULL)) {
+#else
+ if (__predict_false(bytes > 0x80000000ULL)) {
+#endif
+ return true;
+ }
+ return false;
+}
+
+void* scudo_aligned_alloc(size_t alignment, size_t size) {
+ if (alignment == 0 || !powerof2(alignment) || (size % alignment) != 0) {
+ errno = EINVAL;
+ return nullptr;
+ }
+ if (AllocTooBig(size)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+
+ return aligned_alloc(alignment, size);
+}
+
+void* scudo_calloc(size_t item_count, size_t item_size) {
+ size_t total;
+ if (__builtin_mul_overflow(item_count, item_size, &total) || AllocTooBig(total)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ return calloc(item_count, item_size);
+}
+
+void scudo_free(void* ptr) {
+ free(ptr);
+}
+
+extern "C" size_t __sanitizer_get_current_allocated_bytes();
+extern "C" size_t __sanitizer_get_heap_size();
+
+struct mallinfo scudo_mallinfo() {
+ struct mallinfo info {};
+ info.uordblks = __sanitizer_get_current_allocated_bytes();
+ info.hblkhd = __sanitizer_get_heap_size();
+ info.usmblks = info.hblkhd;
+ return info;
+}
+
+void* scudo_malloc(size_t byte_count) {
+ if (AllocTooBig(byte_count)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ return malloc(byte_count);
+}
+
+size_t scudo_malloc_usable_size(const void* ptr) {
+ return malloc_usable_size(ptr);
+}
+
+void* scudo_memalign(size_t alignment, size_t byte_count) {
+ if (AllocTooBig(byte_count)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ if (alignment != 0) {
+ if (!powerof2(alignment)) {
+ alignment = BIONIC_ROUND_UP_POWER_OF_2(alignment);
+ }
+ } else {
+ alignment = 1;
+ }
+ return memalign(alignment, byte_count);
+}
+
+void* scudo_realloc(void* ptr, size_t byte_count) {
+ if (AllocTooBig(byte_count)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ return realloc(ptr, byte_count);
+}
+
+int scudo_posix_memalign(void** memptr, size_t alignment, size_t size) {
+ if (alignment < sizeof(void*) || !powerof2(alignment)) {
+ return EINVAL;
+ }
+ if (AllocTooBig(size)) {
+ return ENOMEM;
+ }
+ return posix_memalign(memptr, alignment, size);
+}
+
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
+extern "C" void* pvalloc(size_t);
+
+void* scudo_pvalloc(size_t size) {
+ if (AllocTooBig(size)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ return pvalloc(size);
+}
+
+extern "C" void* valloc(size_t);
+
+void* scudo_valloc(size_t size) {
+ if (AllocTooBig(size)) {
+ errno = ENOMEM;
+ return nullptr;
+ }
+ return valloc(size);
+}
+#endif
+
+// Do not try and name the scudo maps by overriding __sanitizer::internal_mmap.
+// There is already a function called MmapNamed that names the maps.
+// Unfortunately, there is no easy way to override MmapNamed because
+// too much of the code is not compiled into functions available in the
+// library, and the code is complicated.
diff --git a/tests/libs/thread_exit_cb_helper.cpp b/libc/bionic/scudo_wrapper.cpp
index 8ec1398f1..162432778 100644
--- a/tests/libs/thread_exit_cb_helper.cpp
+++ b/libc/bionic/scudo_wrapper.cpp
@@ -26,41 +26,47 @@
* SUCH DAMAGE.
*/
-// Prevent tests from being compiled with glibc because thread_properties.h
-// only exists in Bionic.
-#if defined(__BIONIC__)
-
+#include <errno.h>
#include <stdio.h>
-#include <sys/thread_properties.h>
-// Helper binary for testing thread_exit_cb registration.
+#include "scudo.h"
+#include "private/bionic_globals.h"
+#include "private/WriteProtected.h"
+
+__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
-void exit_cb_1() {
- printf("exit_cb_1 called ");
+// Call the libc malloc initialisers.
+__attribute__((constructor(1))) static void __scudo_preinit() {
+ __libc_globals.mutate(__libc_init_malloc);
}
-void exit_cb_2() {
- printf("exit_cb_2 called ");
+extern "C" libc_shared_globals* __loader_shared_globals();
+
+__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals() {
+ return __loader_shared_globals();
}
-void exit_cb_3() {
- printf("exit_cb_3 called");
+#if defined(__i386__)
+__LIBC_HIDDEN__ void* __libc_sysinfo = reinterpret_cast<void*>(__libc_int0x80);
+#endif
+
+extern "C" void scudo_malloc_disable_memory_tagging() {}
+
+int scudo_mallopt(int /*param*/, int /*value*/) {
+ return 0;
}
-void test_register_thread_exit_cb() {
- // Register the exit-cb in reverse order (3,2,1)
- // so that they'd be called in 1,2,3 order.
- __libc_register_thread_exit_callback(&exit_cb_3);
- __libc_register_thread_exit_callback(&exit_cb_2);
- __libc_register_thread_exit_callback(&exit_cb_1);
+int scudo_malloc_info(int /*options*/, FILE* /*fp*/) {
+ errno = ENOTSUP;
+ return -1;
}
-int main() {
- test_register_thread_exit_cb();
+int scudo_malloc_iterate(uintptr_t, size_t, void (*)(uintptr_t, size_t, void*), void*) {
return 0;
}
-#else
-int main() {
- return 0;
+
+void scudo_malloc_disable() {
+}
+
+void scudo_malloc_enable() {
}
-#endif // __BIONIC__
diff --git a/libc/bionic/sigaction.cpp b/libc/bionic/sigaction.cpp
index 1cdb02156..583bf32ce 100644
--- a/libc/bionic/sigaction.cpp
+++ b/libc/bionic/sigaction.cpp
@@ -85,28 +85,6 @@ __strong_alias(sigaction64, sigaction);
extern "C" int __rt_sigaction(int, const struct sigaction64*, struct sigaction64*, size_t);
-// sigaction and sigaction64 get interposed in ART: ensure that we don't end up calling
-// sigchain sigaction -> bionic sigaction -> sigchain sigaction64 -> bionic sigaction64
-// by extracting the implementation of sigaction64 to a static function.
-static int __sigaction64(int signal, const struct sigaction64* bionic_new,
- struct sigaction64* bionic_old) {
- struct sigaction64 kernel_new;
- if (bionic_new) {
- kernel_new = *bionic_new;
-#if defined(SA_RESTORER)
- if (!(kernel_new.sa_flags & SA_RESTORER)) {
- kernel_new.sa_flags |= SA_RESTORER;
- kernel_new.sa_restorer = (kernel_new.sa_flags & SA_SIGINFO) ? &__restore_rt : &__restore;
- }
-#endif
- // Don't filter signals here; if the caller asked for everything to be blocked, we should obey.
- kernel_new.sa_mask = kernel_new.sa_mask;
- }
-
- return __rt_sigaction(signal, bionic_new ? &kernel_new : nullptr, bionic_old,
- sizeof(kernel_new.sa_mask));
-}
-
int sigaction(int signal, const struct sigaction* bionic_new, struct sigaction* bionic_old) {
// The 32-bit ABI is broken. struct sigaction includes a too-small sigset_t,
// so we have to translate to struct sigaction64 first.
@@ -123,7 +101,7 @@ int sigaction(int signal, const struct sigaction* bionic_new, struct sigaction*
}
struct sigaction64 kernel_old;
- int result = __sigaction64(signal, bionic_new ? &kernel_new : nullptr, &kernel_old);
+ int result = sigaction64(signal, bionic_new ? &kernel_new : nullptr, &kernel_old);
if (bionic_old) {
*bionic_old = {};
bionic_old->sa_flags = kernel_old.sa_flags;
@@ -137,7 +115,23 @@ int sigaction(int signal, const struct sigaction* bionic_new, struct sigaction*
}
int sigaction64(int signal, const struct sigaction64* bionic_new, struct sigaction64* bionic_old) {
- return __sigaction64(signal, bionic_new, bionic_old);
+ struct sigaction64 kernel_new;
+ if (bionic_new) {
+ kernel_new = *bionic_new;
+#if defined(SA_RESTORER)
+ if (!(kernel_new.sa_flags & SA_RESTORER)) {
+ kernel_new.sa_flags |= SA_RESTORER;
+ kernel_new.sa_restorer = (kernel_new.sa_flags & SA_SIGINFO) ? &__restore_rt : &__restore;
+ }
+#endif
+ // Don't filter signals here; if the caller asked for everything to be blocked, we should obey.
+ kernel_new.sa_mask = kernel_new.sa_mask;
+ }
+
+ return __rt_sigaction(signal,
+ bionic_new ? &kernel_new : nullptr,
+ bionic_old,
+ sizeof(kernel_new.sa_mask));
}
#endif
diff --git a/libc/bionic/strtol.cpp b/libc/bionic/strtol.cpp
index 77f1d9229..63ac102b5 100644
--- a/libc/bionic/strtol.cpp
+++ b/libc/bionic/strtol.cpp
@@ -184,7 +184,9 @@ long long strtoll(const char* s, char** end, int base) {
}
// Public API since L, but not in any header.
-__strong_alias(strtoq, strtoll);
+extern "C" long long strtoq(const char* s, char** end, int base) {
+ return strtoll(s, end, base);
+}
unsigned long strtoul(const char* s, char** end, int base) {
return StrToU<unsigned long, ULONG_MAX>(s, end, base);
@@ -199,4 +201,6 @@ uintmax_t strtoumax(const char* s, char** end, int base) {
}
// Public API since L, but not in any header.
-__strong_alias(strtouq, strtoull);
+extern "C" unsigned long long strtouq(const char* s, char** end, int base) {
+ return strtoull(s, end, base);
+}
diff --git a/libc/bionic/swab.cpp b/libc/bionic/swab.cpp
index 59e1c0ff4..bc53ba446 100644
--- a/libc/bionic/swab.cpp
+++ b/libc/bionic/swab.cpp
@@ -28,5 +28,14 @@
#include <unistd.h>
-#define __BIONIC_SWAB_INLINE /* Out of line. */
-#include <bits/swab.h>
+void swab(const void* void_src, void* void_dst, ssize_t byte_count) {
+ const uint8_t* src = static_cast<const uint8_t*>(void_src);
+ uint8_t* dst = static_cast<uint8_t*>(void_dst);
+ while (byte_count > 1) {
+ uint8_t x = *src++;
+ uint8_t y = *src++;
+ *dst++ = y;
+ *dst++ = x;
+ byte_count -= 2;
+ }
+}
diff --git a/libc/bionic/sys_thread_properties.cpp b/libc/bionic/sys_thread_properties.cpp
deleted file mode 100644
index d1a73b7f9..000000000
--- a/libc/bionic/sys_thread_properties.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/thread_properties.h>
-
-#include <async_safe/CHECK.h>
-#include <async_safe/log.h>
-
-#include <elf.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#include <sys/ptrace.h>
-#include <sys/uio.h>
-#include <sys/user.h>
-
-#if defined(__i386__)
-#include <asm/ldt.h>
-#endif
-
-#include "private/ErrnoRestorer.h"
-#include "private/bionic_elf_tls.h"
-#include "private/bionic_globals.h"
-#include "private/bionic_tls.h"
-#include "pthread_internal.h"
-
-void __libc_get_static_tls_bounds(void** stls_begin, void** stls_end) {
- const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
- *stls_begin = reinterpret_cast<char*>(__get_bionic_tcb()) - layout.offset_bionic_tcb();
- *stls_end = reinterpret_cast<char*>(*stls_begin) + layout.size();
-}
-
-void __libc_register_thread_exit_callback(thread_exit_cb_t cb) {
- TlsModules& modules = __libc_shared_globals()->tls_modules;
-
- if (modules.first_thread_exit_callback == nullptr) {
- modules.first_thread_exit_callback = cb;
- return;
- };
-
- BionicAllocator& allocator = __libc_shared_globals()->tls_allocator;
- CallbackHolder* new_node =
- reinterpret_cast<CallbackHolder*>(allocator.alloc(sizeof(CallbackHolder)));
- new_node->cb = cb;
- new_node->prev = modules.thread_exit_callback_tail_node;
- modules.thread_exit_callback_tail_node = new_node;
-}
-
-static inline __always_inline bionic_tcb* __get_bionic_tcb_for_thread(pid_t tid) {
- // If tid is same as self, then we don't need ptrace.
- if (gettid() == tid) return __get_bionic_tcb();
-
- // Find the thread-pointer register for the given thread.
- void** tp_reg = nullptr;
-#if defined(__x86_64__)
- {
- ErrnoRestorer errno_restorer;
- errno = 0;
- uintptr_t fs_base = ptrace(PTRACE_PEEKUSER, tid, offsetof(user_regs_struct, fs_base), nullptr);
- if (errno == 0) {
- tp_reg = reinterpret_cast<void**>(fs_base);
- }
- }
-#elif defined(__i386__)
- struct user_regs_struct regs;
- struct iovec pt_iov = {
- .iov_base = &regs,
- .iov_len = sizeof(regs),
- };
-
- if (ptrace(PTRACE_GETREGSET, tid, NT_PRSTATUS, &pt_iov) == 0) {
- struct user_desc u_info;
- u_info.entry_number = regs.xgs >> 3;
- if (ptrace(PTRACE_GET_THREAD_AREA, tid, u_info.entry_number, &u_info) == 0) {
- tp_reg = reinterpret_cast<void**>(u_info.base_addr);
- }
- }
-#elif defined(__aarch64__)
- uint64_t reg;
- struct iovec pt_iov {
- .iov_base = &reg, .iov_len = sizeof(reg),
- };
-
- if (ptrace(PTRACE_GETREGSET, tid, NT_ARM_TLS, &pt_iov) == 0) {
- tp_reg = reinterpret_cast<void**>(reg);
- }
-#elif defined(__arm__)
- if (ptrace(PTRACE_GET_THREAD_AREA, tid, nullptr, &tp_reg) != 0) {
- // Reset the tp_reg if ptrace was unsuccessful.
- tp_reg = nullptr;
- }
-#endif
-
- if (tp_reg == nullptr) {
- async_safe_write_log(ANDROID_LOG_FATAL, "libc",
- "__get_bionic_tcb_for_thread failed to read thread register.");
- }
-
- return reinterpret_cast<bionic_tcb*>(&tp_reg[MIN_TLS_SLOT]);
-}
-
-void __libc_iterate_dynamic_tls(pid_t tid,
- void (*cb)(void* __dynamic_tls_begin, void* __dynamic_tls_end,
- size_t __dso_id, void* __arg),
- void* arg) {
- TlsModules& modules = __libc_shared_globals()->tls_modules;
- bionic_tcb* const tcb = __get_bionic_tcb_for_thread(tid);
- TlsDtv* const dtv = __get_tcb_dtv(tcb);
- BionicAllocator& allocator = __libc_shared_globals()->tls_allocator;
-
- for (size_t i = modules.static_module_count; i < dtv->count; ++i) {
- void* dtls_begin = dtv->modules[i];
- if (dtls_begin == nullptr) continue;
- void* dtls_end =
- static_cast<void*>(static_cast<char*>(dtls_begin) + allocator.get_chunk_size(dtls_begin));
- size_t dso_id = __tls_module_idx_to_id(i);
-
- cb(dtls_begin, dtls_end, dso_id, arg);
- }
-}
-
-void __libc_register_dynamic_tls_listeners(dtls_listener_t on_creation,
- dtls_listener_t on_destruction) {
- TlsModules& tls_modules = __libc_shared_globals()->tls_modules;
- tls_modules.on_creation_cb = on_creation;
- tls_modules.on_destruction_cb = on_destruction;
-}
diff --git a/libc/bionic/sysinfo.cpp b/libc/bionic/sysinfo.cpp
index 7ab8e9eda..1d1070e2b 100644
--- a/libc/bionic/sysinfo.cpp
+++ b/libc/bionic/sysinfo.cpp
@@ -38,10 +38,9 @@
static bool __matches_cpuN(const char* s) {
// The %c trick is to ensure that we have the anchored match "^cpu[0-9]+$".
- // We can't use %*c because the return value is how many were *assigned*.
unsigned cpu;
- char unused;
- return (sscanf(s, "cpu%u%c", &cpu, &unused) == 1);
+ char dummy;
+ return (sscanf(s, "cpu%u%c", &cpu, &dummy) == 1);
}
int get_nprocs_conf() {
diff --git a/libc/bionic/system_property_set.cpp b/libc/bionic/system_property_set.cpp
index 212aafcc1..56822acbd 100644
--- a/libc/bionic/system_property_set.cpp
+++ b/libc/bionic/system_property_set.cpp
@@ -209,6 +209,7 @@ static int send_prop_msg(const prop_msg* msg) {
// mostly for ctl.* properties, but we do try and wait 250
// ms so callers who do read-after-write can reliably see
// what they've written. Most of the time.
+ // TODO: fix the system properties design.
async_safe_format_log(ANDROID_LOG_WARN, "libc",
"Property service has timed out while trying to set \"%s\" to \"%s\"",
msg->name, msg->value);
diff --git a/libc/bionic/tmpfile.cpp b/libc/bionic/tmpfile.cpp
index 3d04610a4..4378e84ab 100644
--- a/libc/bionic/tmpfile.cpp
+++ b/libc/bionic/tmpfile.cpp
@@ -31,58 +31,56 @@
*/
#include <errno.h>
-#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "private/ErrnoRestorer.h"
+#include "private/ScopedSignalBlocker.h"
-static FILE* __fd_to_fp(int fd) {
- FILE* fp = fdopen(fd, "w+");
- if (fp != nullptr) return fp;
-
- ErrnoRestorer errno_restorer;
- close(fd);
- return nullptr;
-}
-
-static FILE* __tmpfile_dir_legacy(const char* tmp_dir) {
+static FILE* __tmpfile_dir(const char* tmp_dir) {
char* path = nullptr;
if (asprintf(&path, "%s/tmp.XXXXXXXXXX", tmp_dir) == -1) {
return nullptr;
}
- int fd = mkstemp(path);
- if (fd == -1) {
+ int fd;
+ {
+ ScopedSignalBlocker ssb;
+ fd = mkstemp(path);
+ if (fd == -1) {
+ free(path);
+ return nullptr;
+ }
+
+ // Unlink the file now so that it's removed when closed.
+ unlink(path);
free(path);
- return nullptr;
- }
-
- // Unlink the file now so that it's removed when closed.
- unlink(path);
- free(path);
- // Can we still use the file now it's unlinked?
- // File systems without hard link support won't have the usual Unix semantics.
- struct stat sb;
- if (fstat(fd, &sb) == -1) {
- ErrnoRestorer errno_restorer;
- close(fd);
- return nullptr;
+ // Can we still use the file now it's unlinked?
+ // File systems without hard link support won't have the usual Unix semantics.
+ struct stat sb;
+ int rc = fstat(fd, &sb);
+ if (rc == -1) {
+ ErrnoRestorer errno_restorer;
+ close(fd);
+ return nullptr;
+ }
}
- return __fd_to_fp(fd);
-}
+ // Turn the file descriptor into a FILE*.
+ FILE* fp = fdopen(fd, "w+");
+ if (fp != nullptr) {
+ return fp;
+ }
-static FILE* __tmpfile_dir(const char* tmp_dir) {
- int fd = open(tmp_dir, O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
- if (fd == -1) return __tmpfile_dir_legacy(tmp_dir);
- return __fd_to_fp(fd);
+ // Failure. Clean up. We already unlinked, so we just need to close.
+ ErrnoRestorer errno_restorer;
+ close(fd);
+ return nullptr;
}
FILE* tmpfile() {
@@ -100,48 +98,3 @@ FILE* tmpfile() {
return fp;
}
__strong_alias(tmpfile64, tmpfile);
-
-char* tempnam(const char* dir, const char* prefix) {
- // This function is a terrible idea, marked deprecated in our headers,
- // and marked obsolescent by POSIX.1-2008, but we make some effort anyway
- // since we can't easily remove it...
-
- // $TMPDIR overrides any directory passed in.
- char* tmpdir = getenv("TMPDIR");
- if (tmpdir != nullptr) dir = tmpdir;
-
- // If we still have no directory, we'll give you a default.
- // It's useless for apps, but good enough for the shell.
- if (dir == nullptr) dir = "/data/local/tmp";
-
- // Default prefix?
- if (prefix == nullptr) prefix = "tempnam.";
-
- // Make up a mktemp(3) template and defer to it for the real work.
- char* path = nullptr;
- if (asprintf(&path, "%s/%sXXXXXXXXXX", dir, prefix) == -1) return nullptr;
- if (mktemp(path) == nullptr) {
- free(path);
- return nullptr;
- }
- return path;
-}
-
-char* tmpnam(char* s) {
- // This function is a terrible idea, marked deprecated in our headers,
- // and marked obsolescent by POSIX-1.2008, but we make some effort anyway
- // since we can't easily remove it...
-
- // Default buffer?
- static char buf[L_tmpnam];
- if (s == nullptr) s = buf;
-
- // Use $TMPDIR if set, or fall back to /data/local/tmp otherwise.
- // Useless for apps, but good enough for the shell.
- const char* dir = getenv("TMPDIR");
- if (dir == nullptr) dir = "/data/local/tmp";
-
- // Make up a mktemp(3) template and defer to it for the real work.
- snprintf(s, L_tmpnam, "%s/tmpnam.XXXXXXXXXX", dir);
- return mktemp(s);
-}
diff --git a/libc/dns/include/resolv_private.h b/libc/dns/include/resolv_private.h
index 305455597..77b03bfe0 100644
--- a/libc/dns/include/resolv_private.h
+++ b/libc/dns/include/resolv_private.h
@@ -51,7 +51,8 @@
* Id: resolv.h,v 1.7.2.11.4.2 2004/06/25 00:41:05 marka Exp
*/
-#pragma once
+#ifndef _RESOLV_PRIVATE_H_
+#define _RESOLV_PRIVATE_H_
#include <sys/cdefs.h>
@@ -62,8 +63,6 @@
#include <net/if.h>
#include <time.h>
-__BEGIN_DECLS
-
// Linux defines MAXHOSTNAMELEN as 64, while the domain name limit in
// RFC 1034 and RFC 1035 is 255 octets.
#ifdef MAXHOSTNAMELEN
@@ -294,6 +293,8 @@ union res_sockaddr_union {
/* 0x00010000 */
/* Things involving an internal (static) resolver context. */
+__BEGIN_DECLS
+
__LIBC_HIDDEN__ extern struct __res_state *__res_get_state(void);
__LIBC_HIDDEN__ extern void __res_put_state(struct __res_state *);
@@ -306,6 +307,8 @@ extern struct __res_state *__res_state(void);
#define _res (*__res_state())
#endif
+__END_DECLS
+
#ifndef __BIND_NOSTATIC
#define fp_nquery __fp_nquery
#define fp_query __fp_query
@@ -316,6 +319,7 @@ extern struct __res_state *__res_state(void);
#define res_isourserver __res_isourserver
#define res_querydomain __res_querydomain
#define res_send __res_send
+#define res_sendsigned __res_sendsigned
#ifdef BIND_RES_POSIX3
#define dn_expand __dn_expand
@@ -325,6 +329,7 @@ extern struct __res_state *__res_state(void);
#define res_mkquery __res_mkquery
#endif
+__BEGIN_DECLS
void fp_nquery(const u_char *, int, FILE *);
void fp_query(const u_char *, FILE *);
const char * hostalias(const char *);
@@ -338,6 +343,8 @@ int res_query(const char *, int, int, u_char *, int);
int res_querydomain(const char *, const char *, int, int, u_char *, int);
int res_search(const char *, int, int, u_char *, int);
int res_send(const u_char *, int, u_char *, int);
+int res_sendsigned(const u_char *, int, ns_tsig_key *, u_char *, int);
+__END_DECLS
#endif
#if !defined(SHARED_LIBBIND) || defined(LIB)
@@ -417,6 +424,7 @@ __LIBC_HIDDEN__ extern const struct res_sym __p_rcode_syms[];
#define res_send_setrhook __res_send_setrhook
#define res_servicename __res_servicename
#define res_servicenumber __res_servicenumber
+__BEGIN_DECLS
int res_hnok(const char *);
int res_ownok(const char *);
int res_mailok(const char *);
@@ -524,3 +532,5 @@ int ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
int ns_name_labels(ns_nname_ct, size_t);
__END_DECLS
+
+#endif /* !_RESOLV_PRIVATE_H_ */
diff --git a/libc/dns/include/resolv_static.h b/libc/dns/include/resolv_static.h
index 83a435a7c..8f2a095c5 100644
--- a/libc/dns/include/resolv_static.h
+++ b/libc/dns/include/resolv_static.h
@@ -1,7 +1,7 @@
-#pragma once
+#ifndef _RESOLV_STATIC_H
+#define _RESOLV_STATIC_H
#include <netdb.h>
-#include <sys/cdefs.h>
/* this structure contains all the variables that were declared
* 'static' in the original NetBSD resolver code.
@@ -15,20 +15,18 @@
#define MAXALIASES 35
#define MAXADDRS 35
-__BEGIN_DECLS
+typedef struct res_static {
+ char* h_addr_ptrs[MAXADDRS + 1];
+ char* host_aliases[MAXALIASES];
+ char hostbuf[8*1024];
+ u_int32_t host_addr[16 / sizeof(u_int32_t)]; /* IPv4 or IPv6 */
+ FILE* hostf;
+ int stayopen;
+ const char* servent_ptr;
+ struct servent servent;
+ struct hostent host;
+} *res_static;
-struct res_static {
- char* h_addr_ptrs[MAXADDRS + 1];
- char* host_aliases[MAXALIASES];
- char hostbuf[8 * 1024];
- u_int32_t host_addr[16 / sizeof(u_int32_t)]; /* IPv4 or IPv6 */
- FILE* hostf;
- int stayopen;
- const char* servent_ptr;
- struct servent servent;
- struct hostent host;
-};
+extern res_static __res_get_static(void);
-struct res_static* __res_get_static(void);
-
-__END_DECLS
+#endif /* _RESOLV_STATIC_H */
diff --git a/libc/dns/net/gethnamaddr.c b/libc/dns/net/gethnamaddr.c
index add124f52..7e18840d4 100644
--- a/libc/dns/net/gethnamaddr.c
+++ b/libc/dns/net/gethnamaddr.c
@@ -75,6 +75,9 @@
#include <syslog.h>
#include <unistd.h>
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
#ifndef LOG_AUTH
# define LOG_AUTH 0
#endif
@@ -87,8 +90,6 @@
#include "hostent.h"
-#include "private/bionic_defs.h"
-
#define maybe_ok(res, nm, ok) (((res)->options & RES_NOCHECKNAME) != 0U || \
(ok)(nm) != 0)
#define maybe_hnok(res, hn) maybe_ok((res), (hn), res_hnok)
@@ -1532,12 +1533,11 @@ _yp_gethtbyname(void *rv, void *cb_data, va_list ap)
* Non-reentrant versions.
*/
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
struct hostent *
gethostbyname(const char *name)
{
struct hostent *result = NULL;
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static(); /* Use res_static to provide thread-safety. */
gethostbyname_r(name, &rs->host, rs->hostbuf, sizeof(rs->hostbuf), &result, &h_errno);
return result;
@@ -1547,7 +1547,7 @@ struct hostent *
gethostbyname2(const char *name, int af)
{
struct hostent *result = NULL;
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static(); /* Use res_static to provide thread-safety. */
gethostbyname2_r(name, af, &rs->host, rs->hostbuf, sizeof(rs->hostbuf), &result, &h_errno);
return result;
@@ -1583,14 +1583,13 @@ android_gethostbynamefornetcontext(const char *name, int af,
res_state res = __res_get_state();
if (res == NULL)
return NULL;
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static(); /* Use res_static to provide thread-safety. */
hp = gethostbyname_internal(name, af, res, &rs->host, rs->hostbuf, sizeof(rs->hostbuf),
&h_errno, netcontext);
__res_put_state(res);
return hp;
}
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
struct hostent *
gethostbyaddr(const void *addr, socklen_t len, int af)
{
@@ -1615,7 +1614,7 @@ __LIBC_HIDDEN__ struct hostent*
android_gethostbyaddrfornetcontext_proxy(const void* addr, socklen_t len, int af,
const struct android_net_context *netcontext)
{
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static(); /* Use res_static to provide thread-safety. */
return android_gethostbyaddrfornetcontext_proxy_internal(addr, len, af, &rs->host, rs->hostbuf,
sizeof(rs->hostbuf), &h_errno, netcontext);
}
@@ -1623,7 +1622,7 @@ android_gethostbyaddrfornetcontext_proxy(const void* addr, socklen_t len, int af
struct hostent *
gethostent(void)
{
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (!rs->hostf) {
sethostent_r(&rs->hostf);
if (!rs->hostf) {
diff --git a/libc/dns/net/getnameinfo.c b/libc/dns/net/getnameinfo.c
index 413b37e85..31d07c59d 100644
--- a/libc/dns/net/getnameinfo.c
+++ b/libc/dns/net/getnameinfo.c
@@ -68,8 +68,6 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $");
#include <stddef.h>
#include <string.h>
-#include "private/bionic_defs.h"
-
/* This macro is modelled after the ones in <netinet/in6.h>. */
/* RFC 6052, section 2.1 */
#define IN6_IS_ADDR_WKP(a) \
@@ -112,7 +110,6 @@ static int getnameinfo_local(const struct sockaddr *, socklen_t, char *,
* Top-level getnameinfo() code. Look at the address family, and pick an
* appropriate function to call.
*/
-__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int getnameinfo(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen,
char* serv, size_t servlen, int flags)
{
diff --git a/libc/dns/net/getservent.c b/libc/dns/net/getservent.c
index 6a50d23ce..03add59eb 100644
--- a/libc/dns/net/getservent.c
+++ b/libc/dns/net/getservent.c
@@ -35,7 +35,7 @@
#include "resolv_static.h"
#include "services.h"
-struct servent* getservent_r(struct res_static* rs) {
+struct servent* getservent_r(res_static rs) {
const char* p;
const char* q;
int namelen;
@@ -109,17 +109,17 @@ void setservent(int stayopen) {
}
void endservent(void) {
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (rs) rs->servent_ptr = NULL;
}
struct servent* getservent(void) {
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
return rs ? getservent_r(rs) : NULL;
}
struct servent* getservbyname(const char* name, const char* proto) {
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (rs == NULL) return NULL;
const char* old_servent_ptr = rs->servent_ptr;
@@ -135,7 +135,7 @@ struct servent* getservbyname(const char* name, const char* proto) {
}
struct servent* getservbyport(int port, const char* proto) {
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (rs == NULL) return NULL;
const char* old_servent_ptr = rs->servent_ptr;
diff --git a/libc/dns/net/sethostent.c b/libc/dns/net/sethostent.c
index 483105a95..a743a543e 100644
--- a/libc/dns/net/sethostent.c
+++ b/libc/dns/net/sethostent.c
@@ -55,6 +55,9 @@ __RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
#include "hostent.h"
#include "resolv_private.h"
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
#ifndef _REENTRANT
void res_close(void);
#endif
@@ -65,14 +68,14 @@ void
/*ARGSUSED*/
sethostent(int stayopen)
{
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (rs) sethostent_r(&rs->hostf);
}
void
endhostent(void)
{
- struct res_static* rs = __res_get_static();
+ res_static rs = __res_get_static();
if (rs) endhostent_r(&rs->hostf);
}
diff --git a/libc/dns/resolv/res_data.c b/libc/dns/resolv/res_data.c
new file mode 100644
index 000000000..9bc02e786
--- /dev/null
+++ b/libc/dns/resolv/res_data.c
@@ -0,0 +1,327 @@
+/* $NetBSD: res_data.c,v 1.8 2004/06/09 18:07:03 christos Exp $ */
+
+/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 1995-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#ifdef notdef
+static const char rcsid[] = "Id: res_data.c,v 1.1.206.2 2004/03/16 12:34:18 marka Exp";
+#else
+__RCSID("$NetBSD: res_data.c,v 1.8 2004/06/09 18:07:03 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <netdb.h>
+#include "resolv_private.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+__LIBC_HIDDEN__
+const char * const _res_opcodes[] = {
+ "QUERY",
+ "IQUERY",
+ "CQUERYM",
+ "CQUERYU", /* experimental */
+ "NOTIFY", /* experimental */
+ "UPDATE",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10",
+ "11",
+ "12",
+ "13",
+ "ZONEINIT",
+ "ZONEREF",
+};
+
+#ifdef BIND_UPDATE
+const char * const _res_sectioncodes[] = {
+ "ZONE",
+ "PREREQUISITES",
+ "UPDATE",
+ "ADDITIONAL",
+};
+#endif
+
+#ifndef __BIND_NOSTATIC
+extern struct __res_state _nres;
+
+/* Proto. */
+
+int res_ourserver_p(const res_state, const struct sockaddr *);
+
+#define res_need_init() ((_nres.options & RES_INIT) == 0U)
+
+int
+res_init(void) {
+ int rv;
+ extern int __res_vinit(res_state, int);
+#ifdef COMPAT__RES
+ /*
+ * Compatibility with program that were accessing _res directly
+ * to set options. We keep another struct res that is the same
+ * size as the original res structure, and then copy fields to
+ * it so that we achieve the same initialization
+ */
+ extern void *__res_get_old_state(void);
+ extern void __res_put_old_state(void *);
+ res_state ores = __res_get_old_state();
+
+ if (ores->options != 0)
+ _nres.options = ores->options;
+ if (ores->retrans != 0)
+ _nres.retrans = ores->retrans;
+ if (ores->retry != 0)
+ _nres.retry = ores->retry;
+#endif
+
+ /*
+ * These three fields used to be statically initialized. This made
+ * it hard to use this code in a shared library. It is necessary,
+ * now that we're doing dynamic initialization here, that we preserve
+ * the old semantics: if an application modifies one of these three
+ * fields of _res before res_init() is called, res_init() will not
+ * alter them. Of course, if an application is setting them to
+ * _zero_ before calling res_init(), hoping to override what used
+ * to be the static default, we can't detect it and unexpected results
+ * will follow. Zero for any of these fields would make no sense,
+ * so one can safely assume that the applications were already getting
+ * unexpected results.
+ *
+ * _nres.options is tricky since some apps were known to diddle the bits
+ * before res_init() was first called. We can't replicate that semantic
+ * with dynamic initialization (they may have turned bits off that are
+ * set in RES_DEFAULT). Our solution is to declare such applications
+ * "broken". They could fool us by setting RES_INIT but none do (yet).
+ */
+ if (!_nres.retrans)
+ _nres.retrans = RES_TIMEOUT;
+ if (!_nres.retry)
+ _nres.retry = 4;
+ if (!(_nres.options & RES_INIT))
+ _nres.options = RES_DEFAULT;
+
+ /*
+ * This one used to initialize implicitly to zero, so unless the app
+ * has set it to something in particular, we can randomize it now.
+ */
+ if (!_nres.id)
+ _nres.id = res_randomid();
+
+ rv = __res_vinit(&_nres, 1);
+#ifdef COMPAT__RES
+ __res_put_old_state(&_nres);
+#endif
+ return rv;
+}
+
+void
+p_query(const u_char *msg) {
+ fp_query(msg, stdout);
+}
+
+void
+fp_query(const u_char *msg, FILE *file) {
+ fp_nquery(msg, PACKETSZ, file);
+}
+
+void
+fp_nquery(const u_char *msg, int len, FILE *file) {
+ if (res_need_init() && res_init() == -1)
+ return;
+
+ res_pquery(&_nres, msg, len, file);
+}
+
+int
+res_mkquery(int op, /* opcode of query */
+ const char *dname, /* domain name */
+ int class, int type, /* class and type of query */
+ const u_char *data, /* resource record data */
+ int datalen, /* length of data */
+ const u_char *newrr_in, /* new rr for modify or append */
+ u_char *buf, /* buffer to put query */
+ int buflen) /* size of buffer */
+{
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+ return (res_nmkquery(&_nres, op, dname, class, type,
+ data, datalen,
+ newrr_in, buf, buflen));
+}
+
+#ifdef _LIBRESOLV
+int
+res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nmkupdate(&_nres, rrecp_in, buf, buflen));
+}
+#endif
+
+int
+res_query(const char *name, /* domain name */
+ int class, int type, /* class and type of query */
+ u_char *answer, /* buffer to put answer */
+ int anslen) /* size of answer buffer */
+{
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+ return (res_nquery(&_nres, name, class, type, answer, anslen));
+}
+
+void
+res_send_setqhook(res_send_qhook hook) {
+ _nres.qhook = hook;
+}
+
+void
+res_send_setrhook(res_send_rhook hook) {
+ _nres.rhook = hook;
+}
+
+int
+res_isourserver(const struct sockaddr_in *inp) {
+ return (res_ourserver_p(&_nres, (const struct sockaddr *)(const void *)inp));
+}
+
+int
+res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
+ if (res_need_init() && res_init() == -1) {
+ /* errno should have been set by res_init() in this case. */
+ return (-1);
+ }
+
+ return (res_nsend(&_nres, buf, buflen, ans, anssiz));
+}
+
+#ifdef _LIBRESOLV
+int
+res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key,
+ u_char *ans, int anssiz)
+{
+ if (res_need_init() && res_init() == -1) {
+ /* errno should have been set by res_init() in this case. */
+ return (-1);
+ }
+
+ return (res_nsendsigned(&_nres, buf, buflen, key, ans, anssiz));
+}
+#endif
+
+void
+res_close(void) {
+ res_nclose(&_nres);
+}
+
+#ifdef _LIBRESOLV
+int
+res_update(ns_updrec *rrecp_in) {
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nupdate(&_nres, rrecp_in, NULL));
+}
+#endif
+
+int
+res_search(const char *name, /* domain name */
+ int class, int type, /* class and type of query */
+ u_char *answer, /* buffer to put answer */
+ int anslen) /* size of answer */
+{
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nsearch(&_nres, name, class, type, answer, anslen));
+}
+
+int
+res_querydomain(const char *name,
+ const char *domain,
+ int class, int type, /* class and type of query */
+ u_char *answer, /* buffer to put answer */
+ int anslen) /* size of answer */
+{
+ if (res_need_init() && res_init() == -1) {
+ RES_SET_H_ERRNO(&_nres, NETDB_INTERNAL);
+ return (-1);
+ }
+
+ return (res_nquerydomain(&_nres, name, domain,
+ class, type,
+ answer, anslen));
+}
+
+int
+res_opt(int a, u_char *b, int c, int d)
+{
+ return res_nopt(&_nres, a, b, c, d);
+}
+
+const char *
+hostalias(const char *name) {
+ return NULL;
+}
+
+#ifdef ultrix
+int
+local_hostname_length(const char *hostname) {
+ int len_host, len_domain;
+
+ if (!*_nres.defdname)
+ res_init();
+ len_host = strlen(hostname);
+ len_domain = strlen(_nres.defdname);
+ if (len_host > len_domain &&
+ !strcasecmp(hostname + len_host - len_domain, _nres.defdname) &&
+ hostname[len_host - len_domain - 1] == '.')
+ return (len_host - len_domain - 1);
+ return (0);
+}
+#endif /*ultrix*/
+
+#endif
diff --git a/libc/dns/resolv/res_data.cpp b/libc/dns/resolv/res_data.cpp
deleted file mode 100644
index 22d9f7b16..000000000
--- a/libc/dns/resolv/res_data.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $NetBSD: res_data.c,v 1.8 2004/06/09 18:07:03 christos Exp $ */
-
-/*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
- * Copyright (c) 1995-1999 by Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "resolv_private.h"
-
-#include <pthread.h>
-
-extern "C" int res_ourserver_p(const res_state, const struct sockaddr*);
-extern "C" int __res_vinit(res_state, int);
-
-class GlobalStateAccessor {
- public:
- GlobalStateAccessor() {
- pthread_mutex_lock(&mutex);
- if (!initialized) {
- init();
- initialized = true;
- }
- }
-
- ~GlobalStateAccessor() {
- pthread_mutex_unlock(&mutex);
- }
-
- __res_state* get() {
- return &state;
- }
-
- int init();
-
- private:
- static __res_state state;
- static bool initialized;
- static pthread_mutex_t mutex;
-};
-__res_state GlobalStateAccessor::state;
-bool GlobalStateAccessor::initialized = false;
-pthread_mutex_t GlobalStateAccessor::mutex = PTHREAD_MUTEX_INITIALIZER;
-
-int GlobalStateAccessor::init() {
- // These three fields used to be statically initialized. This made
- // it hard to use this code in a shared library. It is necessary,
- // now that we're doing dynamic initialization here, that we preserve
- // the old semantics: if an application modifies one of these three
- // fields of _res before res_init() is called, res_init() will not
- // alter them. Of course, if an application is setting them to
- // _zero_ before calling res_init(), hoping to override what used
- // to be the static default, we can't detect it and unexpected results
- // will follow. Zero for any of these fields would make no sense,
- // so one can safely assume that the applications were already getting
- // unexpected results.
- // g_nres.options is tricky since some apps were known to diddle the bits
- // before res_init() was first called. We can't replicate that semantic
- // with dynamic initialization (they may have turned bits off that are
- // set in RES_DEFAULT). Our solution is to declare such applications
- // "broken". They could fool us by setting RES_INIT but none do (yet).
- if (!state.retrans) state.retrans = RES_TIMEOUT;
- if (!state.retry) state.retry = 4;
- if (!(state.options & RES_INIT)) state.options = RES_DEFAULT;
-
- // This one used to initialize implicitly to zero, so unless the app
- // has set it to something in particular, we can randomize it now.
- if (!state.id) state.id = res_randomid();
-
- return __res_vinit(&state, 1);
-}
-
-int res_init(void) {
- GlobalStateAccessor gsa;
- return gsa.init();
-}
-
-void p_query(const u_char* msg) {
- fp_query(msg, stdout);
-}
-
-void fp_query(const u_char* msg, FILE* file) {
- fp_nquery(msg, PACKETSZ, file);
-}
-
-void fp_nquery(const u_char* msg, int len, FILE* file) {
- GlobalStateAccessor gsa;
- res_pquery(gsa.get(), msg, len, file);
-}
-
-int
-res_mkquery(int op, const char* dname, int klass, int type, const u_char* data,
- int datalen, const u_char* newrr_in, u_char* buf, int buflen) {
- GlobalStateAccessor gsa;
- return res_nmkquery(gsa.get(), op, dname, klass, type, data, datalen, newrr_in, buf, buflen);
-}
-
-int res_query(const char* name, int klass, int type, u_char* answer, int anslen) {
- GlobalStateAccessor gsa;
- return res_nquery(gsa.get(), name, klass, type, answer, anslen);
-}
-
-void res_send_setqhook(res_send_qhook hook) {
- GlobalStateAccessor gsa;
- gsa.get()->qhook = hook;
-}
-
-void res_send_setrhook(res_send_rhook hook) {
- GlobalStateAccessor gsa;
- gsa.get()->rhook = hook;
-}
-
-int res_isourserver(const struct sockaddr_in* inp) {
- GlobalStateAccessor gsa;
- return res_ourserver_p(gsa.get(), reinterpret_cast<const sockaddr*>(inp));
-}
-
-int res_send(const u_char* buf, int buflen, u_char* ans, int anssiz) {
- GlobalStateAccessor gsa;
- return res_nsend(gsa.get(), buf, buflen, ans, anssiz);
-}
-
-void res_close(void) {
- GlobalStateAccessor gsa;
- res_nclose(gsa.get());
-}
-
-int res_search(const char* name, int klass, int type, u_char* answer, int anslen) {
- GlobalStateAccessor gsa;
- return res_nsearch(gsa.get(), name, klass, type, answer, anslen);
-}
-
-int res_querydomain(const char* name, const char* domain, int klass, int type, u_char* answer,
- int anslen) {
- GlobalStateAccessor gsa;
- return res_nquerydomain(gsa.get(), name, domain, klass, type, answer, anslen);
-}
-
-int res_opt(int a, u_char* b, int c, int d) {
- GlobalStateAccessor gsa;
- return res_nopt(gsa.get(), a, b, c, d);
-}
-
-const char* hostalias(const char* name) {
- return NULL;
-}
diff --git a/libc/dns/resolv/res_debug.c b/libc/dns/resolv/res_debug.c
index 4fe75534d..5f889cb23 100644
--- a/libc/dns/resolv/res_debug.c
+++ b/libc/dns/resolv/res_debug.c
@@ -126,27 +126,9 @@ __RCSID("$NetBSD: res_debug.c,v 1.13 2012/06/25 22:32:45 abs Exp $");
#include <strings.h>
#include <time.h>
+extern const char * const _res_opcodes[];
extern const char * const _res_sectioncodes[];
-__LIBC_HIDDEN__ const char* const _res_opcodes[] = {
- "QUERY",
- "IQUERY",
- "CQUERYM",
- "CQUERYU", /* experimental */
- "NOTIFY", /* experimental */
- "UPDATE",
- "6",
- "7",
- "8",
- "9",
- "10",
- "11",
- "12",
- "13",
- "ZONEINIT",
- "ZONEREF",
-};
-
#ifndef _LIBC
/*
* Print the current options.
diff --git a/libc/dns/resolv/res_state.c b/libc/dns/resolv/res_state.c
index d1f5c248f..94124ff9b 100644
--- a/libc/dns/resolv/res_state.c
+++ b/libc/dns/resolv/res_state.c
@@ -68,7 +68,7 @@ _res_thread_alloc(void)
}
static void
-_res_static_done(struct res_static* rs)
+_res_static_done( res_static rs )
{
/* fortunately, there is nothing to do here, since the
* points in h_addr_ptrs and host_aliases should all
@@ -135,6 +135,25 @@ _res_thread_get(void)
return rt;
}
+__LIBC_HIDDEN__
+struct __res_state _nres;
+
+#if 0
+struct resolv_cache*
+__get_res_cache(void)
+{
+ _res_thread* rt = _res_thread_get();
+
+ if (!rt)
+ return NULL;
+
+ if (!rt->_cache) {
+ rt->_cache = _resolv_cache_create();
+ }
+ return rt->_cache;
+}
+#endif
+
int*
__get_h_errno(void)
{
@@ -158,7 +177,9 @@ __res_put_state(res_state res __unused)
/* nothing to do */
}
-struct res_static* __res_get_static(void) {
+res_static
+__res_get_static(void)
+{
_res_thread* rt = _res_thread_get();
return rt ? rt->_rstatic : NULL;
diff --git a/libc/include/android/api-level.h b/libc/include/android/api-level.h
index 40846fb8b..1b8af78cd 100644
--- a/libc/include/android/api-level.h
+++ b/libc/include/android/api-level.h
@@ -29,13 +29,6 @@
#pragma once
/**
- * @defgroup apilevels API Levels
- *
- * Defines functions and constants for working with Android API levels.
- * @{
- */
-
-/**
* @file android/api-level.h
* @brief Functions and constants for dealing with multiple API levels.
*
@@ -57,40 +50,9 @@ __BEGIN_DECLS
/* This #ifndef should never be true except when doxygen is generating docs. */
#ifndef __ANDROID_API__
/**
- * `__ANDROID_API__` is the [API
- * level](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)
- * this code is being built for. The resulting binaries are only guaranteed to
- * be compatible with devices which have an API level greater than or equal to
- * `__ANDROID_API__`.
- *
- * For NDK and APEX builds, this macro will always be defined. It is set
- * automatically by Clang using the version suffix that is a part of the target
- * name. For example, `__ANDROID_API__` will be 24 when Clang is given the
- * argument `-target aarch64-linux-android24`.
- *
- * For non-APEX OS code, this defaults to __ANDROID_API_FUTURE__.
- *
- * The value of `__ANDROID_API__` can be compared to the named constants in
- * `<android/api-level.h>`.
- *
- * The interpretation of `__ANDROID_API__` is similar to the AndroidManifest.xml
- * `minSdkVersion`. In most cases `__ANDROID_API__` will be identical to
- * `minSdkVersion`, but as it is a build time constant it is possible for
- * library code to use a different value than the app it will be included in.
- * When libraries and applications build for different API levels, the
- * `minSdkVersion` of the application must be at least as high as the highest
- * API level used by any of its libraries which are loaded unconditionally.
- *
- * Note that in some cases the resulting binaries may load successfully on
- * devices with an older API level. That behavior should not be relied upon,
- * even if you are careful to avoid using new APIs, as the toolchain may make
- * use of new features by default. For example, additional FORTIFY features may
- * implicitly make use of new APIs, SysV hashes may be omitted in favor of GNU
- * hashes to improve library load times, or relocation packing may be enabled to
- * reduce binary size.
- *
- * See android_get_device_api_level(),
- * android_get_application_target_sdk_version() and
+ * `__ANDROID_API__` is the API level being targeted. For the OS,
+ * this is `__ANDROID_API_FUTURE__`. For the NDK, this is set by the
+ * compiler system based on the API level you claimed to target. See
* https://android.googlesource.com/platform/bionic/+/master/docs/defines.md.
*/
#define __ANDROID_API__ __ANDROID_API_FUTURE__
@@ -148,16 +110,10 @@ __BEGIN_DECLS
/** Names the "R" API level (30), for comparison against `__ANDROID_API__`. */
#define __ANDROID_API_R__ 30
-/** Names the "S" API level (31), for comparison against `__ANDROID_API__`. */
-#define __ANDROID_API_S__ 31
-
-/* This file is included in <features.h>, and might be used from .S files. */
-#if !defined(__ASSEMBLY__)
-
/**
- * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__` if
- * there is no known target SDK version (for code not running in the context of
- * an app).
+ * Returns the `targetSdkVersion` of the caller, or `__ANDROID_API_FUTURE__`
+ * if there is no known target SDK version (for code not running in the
+ * context of an app).
*
* The returned values correspond to the named constants in `<android/api-level.h>`,
* and is equivalent to the AndroidManifest.xml `targetSdkVersion`.
@@ -170,7 +126,7 @@ int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
#if __ANDROID_API__ < 29
-/* android_get_device_api_level is a static inline before API level 29. */
+// android_get_device_api_level is a static inline before API level 29.
#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
#include <bits/get_device_api_level_inlines.h>
#undef __BIONIC_GET_DEVICE_API_LEVEL_INLINE
@@ -188,8 +144,4 @@ int android_get_device_api_level() __INTRODUCED_IN(29);
#endif
-#endif /* defined(__ASSEMBLY__) */
-
__END_DECLS
-
-/** @} */
diff --git a/libc/include/android/fdsan.h b/libc/include/android/fdsan.h
index e23de85d3..83b9318ba 100644
--- a/libc/include/android/fdsan.h
+++ b/libc/include/android/fdsan.h
@@ -186,8 +186,7 @@ enum android_fdsan_error_level android_fdsan_get_error_level() __INTRODUCED_IN(2
* Set the error level and return the previous state.
*
* Error checking is automatically disabled in the child of a fork, to maintain
- * compatibility with code that forks, closes all file descriptors, and then
- * execs.
+ * compatibility with code that forks, blindly closes FDs, and then execs.
*
* In cases such as the zygote, where the child has no intention of calling
* exec, call this function to reenable fdsan checks.
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
index 95c2320db..90eda7dc1 100644
--- a/libc/include/android/legacy_signal_inlines.h
+++ b/libc/include/android/legacy_signal_inlines.h
@@ -45,34 +45,12 @@ int __libc_current_sigrtmax() __attribute__((__weak__)) __VERSIONER_NO_GUARD;
int __libc_current_sigrtmin() __attribute__((__weak__)) __VERSIONER_NO_GUARD;
static __inline int __ndk_legacy___libc_current_sigrtmax() {
- /*
- * The NDK doesn't use libclang_rt.builtins yet (https://github.com/android/ndk/issues/1231) so it
- * can't use __builtin_available, but the platform builds with -Werror=unguarded-availability so
- * it requires __builtin_available.
- */
-#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
- if (__builtin_available(android 21, *)) {
-#else
- if (__libc_current_sigrtmax) {
-#endif
- return __libc_current_sigrtmax();
- }
+ if (__libc_current_sigrtmax) return __libc_current_sigrtmax();
return __SIGRTMAX; /* Should match __libc_current_sigrtmax. */
}
static __inline int __ndk_legacy___libc_current_sigrtmin() {
- /*
- * The NDK doesn't use libclang_rt.builtins yet (https://github.com/android/ndk/issues/1231) so it
- * can't use __builtin_available, but the platform builds with -Werror=unguarded-availability so
- * it requires __builtin_available.
- */
-#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
- if (__builtin_available(android 21, *)) {
-#else
- if (__libc_current_sigrtmin) {
-#endif
- return __libc_current_sigrtmin();
- }
+ if (__libc_current_sigrtmin) return __libc_current_sigrtmin();
return __SIGRTMIN + 7; /* Should match __libc_current_sigrtmin. */
}
diff --git a/libc/include/android/legacy_strings_inlines.h b/libc/include/android/legacy_strings_inlines.h
new file mode 100644
index 000000000..2cc2da272
--- /dev/null
+++ b/libc/include/android/legacy_strings_inlines.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <sys/cdefs.h>
+
+#if defined(__i386__) && __ANDROID_API__ < 18
+
+#include <strings.h>
+
+__BEGIN_DECLS
+
+/* Everyone except x86 had ffs since the beginning. */
+static __inline int ffs(int __n) { return __builtin_ffs(__n); }
+
+__END_DECLS
+
+#endif
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index 214acf2e1..3ea414a45 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -21,78 +21,25 @@
#if defined(__BIONIC_VERSIONER)
#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
-#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __attribute__((annotate("introduced_in=" #api_level))) __VERSIONER_NO_GUARD
#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
#define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
#define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
#define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
#define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
-#define __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(api_level) __attribute__((annotate("introduced_in_x86=" #api_level))) __VERSIONER_NO_GUARD
#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
#define __VERSIONER_FORTIFY_INLINE __attribute__((annotate("versioner_fortify_inline")))
#else
-// When headers are not processed by the versioner (i.e. compiled into object files),
-// the availability attributed is emitted instead. The clang compiler will make the symbol weak
-// when targeting old api_level and enforce the reference to the symbol to be guarded with
-// __builtin_available(android api_level, *).
-
-// The 'strict' flag is required for NDK clients where the use of "-Wunguarded-availability" cannot
-// be enforced. In the case, the absence of 'strict' makes it possible to call an unavailable API
-// without the __builtin_available check, which will cause a link error at runtime.
-// Android platform build system defines this macro along with -Wunguarded-availability
-//
-// The _NO_GUARD_FOR_NDK variants keep the __VERSIONER_NO_GUARD behavior working for the NDK. This
-// allows libc++ to refer to these functions in inlines without needing to guard them, needed since
-// libc++ doesn't currently guard these calls. There's no risk to the apps though because using
-// those APIs will still cause a link error.
-#if defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
-#define __BIONIC_AVAILABILITY(__what) __attribute__((__availability__(android,__what)))
-#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level) __INTRODUCED_IN_X86(api_level)
-#define __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(api_level) __INTRODUCED_IN_X86(api_level)
-#else
-#define __BIONIC_AVAILABILITY(__what) __attribute__((__availability__(android,strict,__what)))
-#define __INTRODUCED_IN_NO_GUARD_FOR_NDK(api_level)
-#define __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(api_level)
-#endif
-
-#define __INTRODUCED_IN(api_level) __BIONIC_AVAILABILITY(introduced=api_level)
-#define __DEPRECATED_IN(api_level) __BIONIC_AVAILABILITY(deprecated=api_level)
-#define __REMOVED_IN(api_level) __BIONIC_AVAILABILITY(obsoleted=api_level)
-
-// The same availability attribute can't be annotated multiple times. Therefore, the macros are
-// defined for the configuration that it is valid for so that declarations like the below doesn't
-// cause inconsistent availability values which is an error with -Wavailability:
-//
-// void foo() __INTRODUCED_IN_32(30) __INTRODUCED_IN_64(31);
-//
-// This also takes the advantage of the fact that we never use bitness-specific macro with
-// arch-specific macro. In other words,
-//
-// void foo() __INTRODUCED_IN_ARM(30) __INTRODUCED_IN_64(31);
-//
-// hasn't been supported and won't be.
-#if !defined(__LP64__)
-#define __INTRODUCED_IN_32(api_level) __BIONIC_AVAILABILITY(introduced=api_level)
-#define __INTRODUCED_IN_64(api_level)
-#else
+#define __INTRODUCED_IN(api_level)
+#define __DEPRECATED_IN(api_level)
+#define __REMOVED_IN(api_level)
#define __INTRODUCED_IN_32(api_level)
-#define __INTRODUCED_IN_64(api_level) __BIONIC_AVAILABILITY(introduced=api_level)
-#endif
-
-#if defined(__arm__) || defined(__aarch64__)
-#define __INTRODUCED_IN_ARM(api_level) __BIONIC_AVAILABILITY(introduced=api_level)
-#define __INTRODUCED_IN_X86(api_level)
-#elif defined(__i386__) || defined(__x86_64__)
-#define __INTRODUCED_IN_ARM(api_level)
-#define __INTRODUCED_IN_X86(api_level) __BIONIC_AVAILABILITY(introduced=api_level)
-#else
+#define __INTRODUCED_IN_64(api_level)
#define __INTRODUCED_IN_ARM(api_level)
#define __INTRODUCED_IN_X86(api_level)
-#endif
#define __VERSIONER_NO_GUARD
#define __VERSIONER_FORTIFY_INLINE
diff --git a/libc/include/bits/auxvec.h b/libc/include/bits/auxvec.h
index 2d6522a80..4d394776a 100644
--- a/libc/include/bits/auxvec.h
+++ b/libc/include/bits/auxvec.h
@@ -37,14 +37,6 @@
#include <linux/auxvec.h>
-// AT_HWCAP isn't useful without these constants.
-#if __has_include(<asm/hwcap.h>)
-#include <asm/hwcap.h>
-#endif
-#if __has_include(<asm/hwcap2.h>)
-#include <asm/hwcap2.h>
-#endif
-
/** Historical SuperH cruft. Irrelevant on Android. */
#define AT_FPUCW 18
/** Historical PowerPC cruft. Irrelevant on Android. */
diff --git a/libc/include/bits/elf_arm64.h b/libc/include/bits/elf_arm64.h
index 9330d7bdb..6bb8384e4 100644
--- a/libc/include/bits/elf_arm64.h
+++ b/libc/include/bits/elf_arm64.h
@@ -89,9 +89,4 @@
#define R_AARCH64_TLSDESC 1031 /* 16-byte descriptor: resolver func + arg. */
#define R_AARCH64_IRELATIVE 1032
-/* Dynamic array tags */
-#define DT_AARCH64_BTI_PLT 0x70000001
-#define DT_AARCH64_PAC_PLT 0x70000003
-#define DT_AARCH64_VARIANT_PCS 0x70000005
-
#endif /* _AARCH64_ELF_MACHDEP_H_ */
diff --git a/libc/include/bits/glibc-syscalls.h b/libc/include/bits/glibc-syscalls.h
index fbda7fe21..aabcaabe5 100644
--- a/libc/include/bits/glibc-syscalls.h
+++ b/libc/include/bits/glibc-syscalls.h
@@ -120,9 +120,6 @@
#if defined(__NR_close)
#define SYS_close __NR_close
#endif
-#if defined(__NR_close_range)
- #define SYS_close_range __NR_close_range
-#endif
#if defined(__NR_connect)
#define SYS_connect __NR_connect
#endif
@@ -162,9 +159,6 @@
#if defined(__NR_epoll_pwait)
#define SYS_epoll_pwait __NR_epoll_pwait
#endif
-#if defined(__NR_epoll_pwait2)
- #define SYS_epoll_pwait2 __NR_epoll_pwait2
-#endif
#if defined(__NR_epoll_wait)
#define SYS_epoll_wait __NR_epoll_wait
#endif
@@ -192,9 +186,6 @@
#if defined(__NR_faccessat)
#define SYS_faccessat __NR_faccessat
#endif
-#if defined(__NR_faccessat2)
- #define SYS_faccessat2 __NR_faccessat2
-#endif
#if defined(__NR_fadvise64)
#define SYS_fadvise64 __NR_fadvise64
#endif
@@ -606,9 +597,6 @@
#if defined(__NR_mount)
#define SYS_mount __NR_mount
#endif
-#if defined(__NR_mount_setattr)
- #define SYS_mount_setattr __NR_mount_setattr
-#endif
#if defined(__NR_move_mount)
#define SYS_move_mount __NR_move_mount
#endif
@@ -714,9 +702,6 @@
#if defined(__NR_openat)
#define SYS_openat __NR_openat
#endif
-#if defined(__NR_openat2)
- #define SYS_openat2 __NR_openat2
-#endif
#if defined(__NR_pause)
#define SYS_pause __NR_pause
#endif
@@ -735,9 +720,6 @@
#if defined(__NR_personality)
#define SYS_personality __NR_personality
#endif
-#if defined(__NR_pidfd_getfd)
- #define SYS_pidfd_getfd __NR_pidfd_getfd
-#endif
#if defined(__NR_pidfd_open)
#define SYS_pidfd_open __NR_pidfd_open
#endif
@@ -786,9 +768,6 @@
#if defined(__NR_prlimit64)
#define SYS_prlimit64 __NR_prlimit64
#endif
-#if defined(__NR_process_madvise)
- #define SYS_process_madvise __NR_process_madvise
-#endif
#if defined(__NR_process_vm_readv)
#define SYS_process_vm_readv __NR_process_vm_readv
#endif
diff --git a/libc/include/bits/stdatomic.h b/libc/include/bits/stdatomic.h
index 2ce6ee655..633cb8665 100644
--- a/libc/include/bits/stdatomic.h
+++ b/libc/include/bits/stdatomic.h
@@ -41,7 +41,7 @@
*/
#include <stddef.h> /* For ptrdiff_t. */
-#include <stdint.h>
+#include <stdint.h> /* TODO: don't drag in all the macros, just the types. */
// Include uchar.h only when available. Bionic's stdatomic.h is also used for
// the host (via a copy in prebuilts/clang) and uchar.h is not available in the
// glibc used for the host.
diff --git a/libc/include/bits/wctype.h b/libc/include/bits/wctype.h
index 0015261e9..a51eca2fa 100644
--- a/libc/include/bits/wctype.h
+++ b/libc/include/bits/wctype.h
@@ -58,8 +58,8 @@ wctype_t wctype(const char* __name);
int iswctype(wint_t __wc, wctype_t __type);
typedef const void* wctrans_t;
-wint_t towctrans(wint_t __wc, wctrans_t __transform) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
-wctrans_t wctrans(const char* __name) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
+wint_t towctrans(wint_t __wc, wctrans_t __transform) __INTRODUCED_IN(26) __VERSIONER_NO_GUARD;
+wctrans_t wctrans(const char* __name) __INTRODUCED_IN(26) __VERSIONER_NO_GUARD;
__END_DECLS
diff --git a/libc/include/dirent.h b/libc/include/dirent.h
index 2328b1a8a..d6819f2e1 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -26,12 +26,8 @@
* SUCH DAMAGE.
*/
-#pragma once
-
-/**
- * @file dirent.h
- * @brief Directory entry iteration.
- */
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
#include <stdint.h>
#include <sys/cdefs.h>
@@ -39,23 +35,17 @@
__BEGIN_DECLS
-/** d_type value when the type is not known. */
+#ifndef DT_UNKNOWN
#define DT_UNKNOWN 0
-/** d_type value for a FIFO. */
#define DT_FIFO 1
-/** d_type value for a character device. */
#define DT_CHR 2
-/** d_type value for a directory. */
#define DT_DIR 4
-/** d_type value for a block device. */
#define DT_BLK 6
-/** d_type value for a regular file. */
#define DT_REG 8
-/** d_type value for a symbolic link. */
#define DT_LNK 10
-/** d_type value for a socket. */
#define DT_SOCK 12
#define DT_WHT 14
+#endif
#if defined(__LP64__)
#define __DIRENT64_INO_T ino_t
@@ -70,9 +60,7 @@ __BEGIN_DECLS
unsigned char d_type; \
char d_name[256]; \
-/** The structure returned by readdir(). Identical to dirent64 on Android. */
struct dirent { __DIRENT64_BODY };
-/** The structure returned by readdir64(). Identical to dirent on Android. */
struct dirent64 { __DIRENT64_BODY };
#undef __DIRENT64_BODY
@@ -86,158 +74,29 @@ struct dirent64 { __DIRENT64_BODY };
#define d_fileno d_ino
-/** The structure returned by opendir()/fopendir(). */
typedef struct DIR DIR;
-/**
- * [opendir(3)](http://man7.org/linux/man-pages/man3/opendir.3.html)
- * opens a directory stream for the directory at `__path`.
- *
- * Returns null and sets `errno` on failure.
- */
DIR* opendir(const char* __path);
-
-/**
- * [fopendir(3)](http://man7.org/linux/man-pages/man3/opendir.3.html)
- * opens a directory stream for the directory at `__dir_fd`.
- *
- * Returns null and sets `errno` on failure.
- */
DIR* fdopendir(int __dir_fd);
-
-/**
- * [readdir(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
- * returns the next directory entry in the given directory.
- *
- * Returns a pointer to a directory entry on success,
- * or returns null and leaves `errno` unchanged at the end of the directory,
- * or returns null and sets `errno` on failure.
- */
struct dirent* readdir(DIR* __dir);
-
-/**
- * [readdir64(3)](http://man7.org/linux/man-pages/man3/readdir.3.html)
- * returns the next directory entry in the given directory.
- *
- * Returns a pointer to a directory entry on success,
- * or returns null and leaves `errno` unchanged at the end of the directory,
- * or returns null and sets `errno` on failure.
- */
struct dirent64* readdir64(DIR* __dir) __INTRODUCED_IN(21);
-
int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
int readdir64_r(DIR* __dir, struct dirent64* __entry, struct dirent64** __buffer) __INTRODUCED_IN(21) __attribute__((__deprecated__("readdir64_r is deprecated; use readdir64 instead")));
-
-/**
- * [closedir(3)](http://man7.org/linux/man-pages/man3/closedir.3.html)
- * closes a directory stream.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- */
int closedir(DIR* __dir);
-
-/**
- * [rewinddir(3)](http://man7.org/linux/man-pages/man3/rewinddir.3.html)
- * rewinds a directory stream to the first entry.
- */
void rewinddir(DIR* __dir);
-
-/**
- * [seekdir(3)](http://man7.org/linux/man-pages/man3/seekdir.3.html)
- * seeks a directory stream to the given entry, which must be a value returned
- * by telldir().
- *
- * Available since API level 23.
- */
void seekdir(DIR* __dir, long __location) __INTRODUCED_IN(23);
-
-/**
- * [telldir(3)](http://man7.org/linux/man-pages/man3/telldir.3.html)
- * returns a value representing the current position in the directory
- * for use with seekdir().
- *
- * Returns the current position on success and returns -1 and sets `errno` on failure.
- *
- * Available since API level 23.
- */
long telldir(DIR* __dir) __INTRODUCED_IN(23);
-
-/**
- * [dirfd(3)](http://man7.org/linux/man-pages/man3/dirfd.3.html)
- * returns the file descriptor backing the given directory stream.
- *
- * Returns a file descriptor on success and returns -1 and sets `errno` on failure.
- */
int dirfd(DIR* __dir);
-
-/**
- * [alphasort](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
- * comparator for use with scandir() that uses strcoll().
- */
int alphasort(const struct dirent** __lhs, const struct dirent** __rhs);
-
-/**
- * [alphasort64](http://man7.org/linux/man-pages/man3/alphasort.3.html) is a
- * comparator for use with scandir64() that uses strcmp().
- *
- * Available since API level 21.
- */
int alphasort64(const struct dirent64** __lhs, const struct dirent64** __rhs) __INTRODUCED_IN(21);
-
-/**
- * [scandir(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
- * scans all the directory `__path`, filtering entries with `__filter` and
- * sorting them with qsort() using the given `__comparator`, and storing them
- * into `__name_list`. Passing NULL as the filter accepts all entries.
- *
- * Returns the number of entries returned in the list on success,
- * and returns -1 and sets `errno` on failure.
- */
-int scandir(const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**));
-
-/**
- * [scandir64(3)](http://man7.org/linux/man-pages/man3/scandir.3.html)
- * scans all the directory `__path`, filtering entries with `__filter` and
- * sorting them with qsort() using the given `__comparator`, and storing them
- * into `__name_list`. Passing NULL as the filter accepts all entries.
- *
- * Returns the number of entries returned in the list on success,
- * and returns -1 and sets `errno` on failure.
- *
- * Available since API level 21.
- */
int scandir64(const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
+int scandir(const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**));
#if defined(__USE_GNU)
-
-/**
- * [scandirat64(3)](http://man7.org/linux/man-pages/man3/scandirat.3.html)
- * scans all the directory referenced by the pair of `__dir_fd` and `__path`,
- * filtering entries with `__filter` and sorting them with qsort() using the
- * given `__comparator`, and storing them into `__name_list`. Passing NULL as
- * the filter accepts all entries.
- *
- * Returns the number of entries returned in the list on success,
- * and returns -1 and sets `errno` on failure.
- *
- * Available since API level 24.
- */
int scandirat64(int __dir_fd, const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(24);
-
-/**
- * [scandirat(3)](http://man7.org/linux/man-pages/man3/scandirat.3.html)
- * scans all the directory referenced by the pair of `__dir_fd` and `__path`,
- * filtering entries with `__filter` and sorting them with qsort() using the
- * given `__comparator`, and storing them into `__name_list`. Passing NULL as
- * the filter accepts all entries.
- *
- * Returns the number of entries returned in the list on success,
- * and returns -1 and sets `errno` on failure.
- *
- * Available since API level 24.
- */
int scandirat(int __dir_fd, const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**)) __INTRODUCED_IN(24);
-
#endif
__END_DECLS
+
+#endif
diff --git a/libc/include/locale.h b/libc/include/locale.h
index 8785b24b9..429099263 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
@@ -96,7 +96,7 @@ struct lconv {
char int_n_sign_posn;
};
-struct lconv* localeconv(void) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+struct lconv* localeconv(void) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
locale_t duplocale(locale_t __l) __INTRODUCED_IN(21);
void freelocale(locale_t __l) __INTRODUCED_IN(21);
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index f7beb2c10..ba0af3ca3 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -171,132 +171,6 @@ int malloc_info(int __must_be_zero, FILE* __fp) __INTRODUCED_IN(23);
*/
#define M_PURGE (-101)
-
-/**
- * mallopt() option to tune the allocator's choice of memory tags to
- * make it more likely that a certain class of memory errors will be
- * detected. This is only relevant if MTE is enabled in this process
- * and ignored otherwise. The value argument should be one of the
- * M_MEMTAG_TUNING_* flags.
- * NOTE: This is only available in scudo.
- *
- * Available since API level 31.
- */
-#define M_MEMTAG_TUNING (-102)
-
-/**
- * When passed as a value of M_MEMTAG_TUNING mallopt() call, enables
- * deterministic detection of linear buffer overflow and underflow
- * bugs by assigning distinct tag values to adjacent allocations. This
- * mode has a slightly reduced chance to detect use-after-free bugs
- * because only half of the possible tag values are available for each
- * memory location.
- *
- * Please keep in mind that MTE can not detect overflow within the
- * same tag granule (16-byte aligned chunk), and can miss small
- * overflows even in this mode. Such overflow can not be the cause of
- * a memory corruption, because the memory within one granule is never
- * used for multiple allocations.
- */
-#define M_MEMTAG_TUNING_BUFFER_OVERFLOW 0
-
-/**
- * When passed as a value of M_MEMTAG_TUNING mallopt() call, enables
- * independently randomized tags for uniform ~93% probability of
- * detecting both spatial (buffer overflow) and temporal (use after
- * free) bugs.
- */
-#define M_MEMTAG_TUNING_UAF 1
-
-/**
- * mallopt() option for per-thread memory initialization tuning.
- * The value argument should be one of:
- * 1: Disable automatic heap initialization and, where possible, memory tagging,
- * on this thread.
- * 0: Normal behavior.
- *
- * Available since API level 31.
- */
-#define M_THREAD_DISABLE_MEM_INIT (-103)
-/**
- * mallopt() option to set the maximum number of items in the secondary
- * cache of the scudo allocator.
- *
- * Available since API level 31.
- */
-#define M_CACHE_COUNT_MAX (-200)
-/**
- * mallopt() option to set the maximum size in bytes of a cacheable item in
- * the secondary cache of the scudo allocator.
- *
- * Available since API level 31.
- */
-#define M_CACHE_SIZE_MAX (-201)
-/**
- * mallopt() option to increase the maximum number of shared thread-specific
- * data structures that can be created. This number cannot be decreased,
- * only increased and only applies to the scudo allocator.
- *
- * Available since API level 31.
- */
-#define M_TSDS_COUNT_MAX (-202)
-
-/**
- * mallopt() option to decide whether heap memory is zero-initialized on
- * allocation across the whole process. May be called at any time, including
- * when multiple threads are running. An argument of zero indicates memory
- * should not be zero-initialized, any other value indicates to initialize heap
- * memory to zero.
- *
- * Note that this memory mitigation is only implemented in scudo and therefore
- * this will have no effect when using another allocator (such as jemalloc on
- * Android Go devices).
- *
- * Available since API level 31.
- */
-#define M_BIONIC_ZERO_INIT (-203)
-
-/**
- * mallopt() option to change the heap tagging state. May be called at any
- * time, including when multiple threads are running.
- * The value must be one of the M_HEAP_TAGGING_LEVEL_ constants.
- * NOTE: This is only available in scudo.
- *
- * Available since API level 31.
- */
-#define M_BIONIC_SET_HEAP_TAGGING_LEVEL (-204)
-
-/**
- * Constants for use with the M_BIONIC_SET_HEAP_TAGGING_LEVEL mallopt() option.
- */
-enum HeapTaggingLevel {
- /**
- * Disable heap tagging and memory tag checks (if supported).
- * Heap tagging may not be re-enabled after being disabled.
- */
- M_HEAP_TAGGING_LEVEL_NONE = 0,
-#define M_HEAP_TAGGING_LEVEL_NONE M_HEAP_TAGGING_LEVEL_NONE
- /**
- * Address-only tagging. Heap pointers have a non-zero tag in the
- * most significant ("top") byte which is checked in free(). Memory
- * accesses ignore the tag using arm64's Top Byte Ignore (TBI) feature.
- */
- M_HEAP_TAGGING_LEVEL_TBI = 1,
-#define M_HEAP_TAGGING_LEVEL_TBI M_HEAP_TAGGING_LEVEL_TBI
- /**
- * Enable heap tagging and asynchronous memory tag checks (if supported).
- * Disable stack trace collection.
- */
- M_HEAP_TAGGING_LEVEL_ASYNC = 2,
-#define M_HEAP_TAGGING_LEVEL_ASYNC M_HEAP_TAGGING_LEVEL_ASYNC
- /**
- * Enable heap tagging and synchronous memory tag checks (if supported).
- * Enable stack trace collection.
- */
- M_HEAP_TAGGING_LEVEL_SYNC = 3,
-#define M_HEAP_TAGGING_LEVEL_SYNC M_HEAP_TAGGING_LEVEL_SYNC
-};
-
/**
* [mallopt(3)](http://man7.org/linux/man-pages/man3/mallopt.3.html) modifies
* heap behavior. Values of `__option` are the `M_` constants from this header.
diff --git a/libc/include/math.h b/libc/include/math.h
index 040dc96af..7efc83a31 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -10,10 +10,12 @@
*/
/*
- * Originally based on fdlibm.h 5.1 via FreeBSD.
+ * from: @(#)fdlibm.h 5.1 93/09/24
+ * $FreeBSD$
*/
-#pragma once
+#ifndef _MATH_H_
+#define _MATH_H_
#include <sys/cdefs.h>
#include <limits.h>
@@ -178,9 +180,9 @@ float scalbnf(float __x, int __exponent);
long double scalbnl(long double __x, int __exponent) __RENAME_LDBL(scalbn, 3, 3);
/* TODO: once the NDK only supports >= 18, use __RENAME_LDBL here too. */
-double scalbln(double __x, long __exponent) __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(18);
-float scalblnf(float __x, long __exponent) __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(18);
-long double scalblnl(long double __x, long __exponent) __INTRODUCED_IN_X86_NO_GUARD_FOR_NDK(18);
+double scalbln(double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
+float scalblnf(float __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
+long double scalblnl(long double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
double cbrt(double __x);
float cbrtf(float __x);
@@ -280,11 +282,11 @@ long double nanl(const char* __kind) __RENAME_LDBL(nan, 13, 13) __attribute_cons
double nextafter(double __x, double __y);
float nextafterf(float __x, float __y);
-long double nextafterl(long double __x, long double __y) __RENAME_LDBL_NO_GUARD_FOR_NDK(nextafter, 3, 21);
+long double nextafterl(long double __x, long double __y) __RENAME_LDBL(nextafter, 3, 21) __VERSIONER_NO_GUARD;
-double nexttoward(double __x, long double __y) __INTRODUCED_IN_NO_GUARD_FOR_NDK(18);
+double nexttoward(double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
float nexttowardf(float __x, long double __y);
-long double nexttowardl(long double __x, long double __y) __RENAME_LDBL_NO_GUARD_FOR_NDK(nexttoward, 18, 18);
+long double nexttowardl(long double __x, long double __y) __RENAME_LDBL(nexttoward, 18, 18) __VERSIONER_NO_GUARD;
double fdim(double __x, double __y);
float fdimf(float __x, float __y);
@@ -300,7 +302,7 @@ long double fminl(long double __x, long double __y) __RENAME_LDBL(fmin, 3, 3) __
double fma(double __x, double __y, double __z);
float fmaf(float __x, float __y, float __z);
-long double fmal(long double __x, long double __y, long double __z) __RENAME_LDBL_NO_GUARD_FOR_NDK(fma, 3, 21);
+long double fmal(long double __x, long double __y, long double __z) __RENAME_LDBL(fma, 3, 21) __VERSIONER_NO_GUARD;
#define isgreater(x, y) __builtin_isgreater((x), (y))
#define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y))
@@ -406,3 +408,5 @@ void sincosl(long double __x, long double* __sin, long double* __cos);
#endif
__END_DECLS
+
+#endif
diff --git a/libc/include/nl_types.h b/libc/include/nl_types.h
index 1c80e4e4c..622880ac9 100644
--- a/libc/include/nl_types.h
+++ b/libc/include/nl_types.h
@@ -32,7 +32,7 @@
* @file nl_types.h
* @brief Message catalogs.
*
- * Android offers a no-op implementation of these functions to ease porting of historical software.
+ * Android offers a dummy implementation of these functions to ease porting of historical software.
*/
#include <sys/cdefs.h>
diff --git a/libc/include/pty.h b/libc/include/pty.h
index be447d6f8..90d6686c1 100644
--- a/libc/include/pty.h
+++ b/libc/include/pty.h
@@ -49,17 +49,16 @@ __BEGIN_DECLS
*
* Available since API level 23.
*/
-int openpty(int* _Nonnull __pty_fd, int* _Nonnull __tty_fd, char* _Nullable __tty_name, const struct termios* _Nullable __termios_ptr, const struct winsize* _Nullable __winsize_ptr) __INTRODUCED_IN(23);
+int openpty(int* _Nonnull __master_fd, int* _Nonnull __slave_fd, char* _Nullable __slave_name, const struct termios* _Nullable __termios_ptr, const struct winsize* _Nullable __winsize_ptr) __INTRODUCED_IN(23);
/**
* [forkpty(3)](http://man7.org/linux/man-pages/man3/forkpty.3.html) creates
* a new process connected to a pseudoterminal from openpty().
*
- * Returns 0 in the child/the pid of the child in the parent on success,
- * and returns -1 and sets `errno` on failure.
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
*
* Available since API level 23.
*/
-int forkpty(int* _Nonnull __parent_pty_fd, char* _Nullable __child_tty_name, const struct termios* _Nullable __termios_ptr, const struct winsize* _Nullable __winsize_ptr) __INTRODUCED_IN(23);
+int forkpty(int* _Nonnull __master_fd, char* _Nullable __slave_name, const struct termios* _Nullable __termios_ptr, const struct winsize* _Nullable __winsize_ptr) __INTRODUCED_IN(23);
__END_DECLS
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 9de12a47f..1bf578c1d 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -160,7 +160,7 @@ int sprintf(char* __s, const char* __fmt, ...)
int vsprintf(char* __s, const char* __fmt, va_list __args)
__printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf");
char* tmpnam(char* __s)
- __warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead");
+ __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
#define P_tmpdir "/tmp/" /* deprecated */
char* tempnam(const char* __dir, const char* __prefix)
__warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index d7fdb4a52..dc7b69421 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -160,10 +160,10 @@ int getloadavg(double __averages[], int __n) __INTRODUCED_IN(29);
const char* getprogname(void) __INTRODUCED_IN(21);
void setprogname(const char* __name) __INTRODUCED_IN(21);
-int mblen(const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(26);
+int mblen(const char* __s, size_t __n) __INTRODUCED_IN(26) __VERSIONER_NO_GUARD;
size_t mbstowcs(wchar_t* __dst, const char* __src, size_t __n);
-int mbtowc(wchar_t* __wc_ptr, const char* __s, size_t __n) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
-int wctomb(char* __dst, wchar_t __wc) __INTRODUCED_IN_NO_GUARD_FOR_NDK(21);
+int mbtowc(wchar_t* __wc_ptr, const char* __s, size_t __n) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
+int wctomb(char* __dst, wchar_t __wc) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n);
diff --git a/libc/include/strings.h b/libc/include/strings.h
index ff6b925c5..08c2326bf 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -49,14 +49,6 @@
#include <bits/strcasecmp.h>
-#if !defined(__BIONIC_STRINGS_INLINE)
-#define __BIONIC_STRINGS_INLINE static __inline
-#endif
-
-#undef ffs
-#undef ffsl
-#undef ffsll
-
__BEGIN_DECLS
/** Deprecated. Use memmove() instead. */
@@ -71,41 +63,19 @@ static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
__builtin_memset(b, 0, len);
}
+#if !defined(__i386__) || __ANDROID_API__ >= 18
/**
- * [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the
- * first set bit in `__n`.
- *
- * Returns 0 if no bit is set, or the index of the lowest set bit (counting
- * from 1) otherwise.
- */
-__BIONIC_STRINGS_INLINE int ffs(int __n) {
- return __builtin_ffs(__n);
-}
-
-/**
- * [ffsl(3)](http://man7.org/linux/man-pages/man3/ffsl.3.html) finds the
- * first set bit in `__n`.
+ * [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the first set bit in `__i`.
*
- * Returns 0 if no bit is set, or the index of the lowest set bit (counting
- * from 1) otherwise.
+ * Returns 0 if no bit is set, or the index of the lowest set bit (counting from 1) otherwise.
*/
-__BIONIC_STRINGS_INLINE int ffsl(long __n) {
- return __builtin_ffsl(__n);
-}
-
-/**
- * [ffsll(3)](http://man7.org/linux/man-pages/man3/ffsll.3.html) finds the
- * first set bit in `__n`.
- *
- * Returns 0 if no bit is set, or the index of the lowest set bit (counting
- * from 1) otherwise.
- */
-__BIONIC_STRINGS_INLINE int ffsll(long long __n) {
- return __builtin_ffsll(__n);
-}
+int ffs(int __i) __INTRODUCED_IN_X86(18);
+#endif
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#include <bits/fortify/strings.h>
#endif
__END_DECLS
+
+#include <android/legacy_strings_inlines.h>
diff --git a/libc/include/sys/auxv.h b/libc/include/sys/auxv.h
index bf70ddaac..c6519400d 100644
--- a/libc/include/sys/auxv.h
+++ b/libc/include/sys/auxv.h
@@ -40,7 +40,7 @@
__BEGIN_DECLS
/**
- * [getauxval(3)](http://man7.org/linux/man-pages/man3/getauxval.3.html) returns values from
+ * [getauxval(3)](http://man7.org/linux/man-pages/man2/personality.2.html) returns values from
* the ELF auxiliary vector passed by the kernel.
*
* Returns the corresponding value on success,
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 2556d1183..b4556a74e 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -202,18 +202,11 @@
* Note that some functions have their __RENAME_LDBL commented out as a sign that although we could
* use __RENAME_LDBL it would actually cause the function to be introduced later because the
* `long double` variant appeared before the `double` variant.
- *
- * The _NO_GUARD_FOR_NDK variants keep the __VERSIONER_NO_GUARD behavior working for the NDK. This
- * allows libc++ to refer to these functions in inlines without needing to guard them, needed since
- * libc++ doesn't currently guard these calls. There's no risk to the apps though because using
- * those APIs will still cause a link error.
*/
#if defined(__LP64__) || defined(__BIONIC_LP32_USE_LONG_DOUBLE)
#define __RENAME_LDBL(rewrite,rewrite_api_level,regular_api_level) __INTRODUCED_IN(regular_api_level)
-#define __RENAME_LDBL_NO_GUARD_FOR_NDK(rewrite,rewrite_api_level,regular_api_level) __INTRODUCED_IN_NO_GUARD_FOR_NDK(regular_api_level)
#else
#define __RENAME_LDBL(rewrite,rewrite_api_level,regular_api_level) __RENAME(rewrite) __INTRODUCED_IN(rewrite_api_level)
-#define __RENAME_LDBL_NO_GUARD_FOR_NDK(rewrite,rewrite_api_level,regular_api_level) __RENAME(rewrite) __INTRODUCED_IN_NO_GUARD_FOR_NDK(rewrite_api_level)
#endif
/*
@@ -281,12 +274,10 @@
*/
# define __call_bypassing_fortify(fn) (&fn)
/*
- * Because clang-FORTIFY uses overloads, we can't mark functions as `extern inline` without making
- * them available externally. FORTIFY'ed functions try to be as close to possible as 'invisible';
- * having stack protectors detracts from that (b/182948263).
+ * Because clang-FORTIFY uses overloads, we can't mark functions as `extern
+ * inline` without making them available externally.
*/
-# define __BIONIC_FORTIFY_INLINE static __inline__ __attribute__((no_stack_protector)) \
- __always_inline __VERSIONER_FORTIFY_INLINE
+# define __BIONIC_FORTIFY_INLINE static __inline__ __always_inline __VERSIONER_FORTIFY_INLINE
/*
* We should use __BIONIC_FORTIFY_VARIADIC instead of __BIONIC_FORTIFY_INLINE
* for variadic functions because compilers cannot inline them.
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 6ef0c1214..fe4ea7f5a 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -32,7 +32,6 @@
#include <sys/types.h>
#include <linux/memfd.h>
#include <linux/mman.h>
-#include <linux/uio.h>
__BEGIN_DECLS
@@ -162,15 +161,6 @@ int mincore(void* __addr, size_t __size, unsigned char* __vector);
*/
int madvise(void* __addr, size_t __size, int __advice);
-/**
- * [process_madvise(2)](http://man7.org/linux/man-pages/man2/process_madvise.2.html)
- * works just like madvise(2) but applies to the process specified by the given
- * PID file descriptor.
- *
- * Returns the number of bytes advised on success, and returns -1 and sets `errno` on failure.
- */
-ssize_t process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned __flags);
-
#if defined(__USE_GNU)
/**
diff --git a/libc/include/sys/pidfd.h b/libc/include/sys/pidfd.h
deleted file mode 100644
index 6d0e809bd..000000000
--- a/libc/include/sys/pidfd.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#pragma once
-
-/**
- * @file sys/pidfd.h
- * @brief File descriptors representing processes.
- */
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <bits/signal_types.h>
-
-__BEGIN_DECLS
-
-/**
- * [pidfd_open(2)](https://man7.org/linux/man-pages/man2/pidfd_open.2.html)
- * opens a file descriptor that refers to a process. This file descriptor will
- * have the close-on-exec flag set by default.
- *
- * Returns a new file descriptor on success and returns -1 and sets `errno` on
- * failure.
- *
- * Available since API level 31.
- */
-int pidfd_open(pid_t __pid, unsigned int __flags) __INTRODUCED_IN(31);
-
-/**
- * [pidfd_getfd(2)](https://man7.org/linux/man-pages/man2/pidfd_open.2.html)
- * dups a file descriptor from another process. This file descriptor will have
- * the close-on-exec flag set by default.
- *
- * Returns a new file descriptor on success and returns -1 and sets `errno` on
- * failure.
- *
- * Available since API level 31.
- */
-int pidfd_getfd(int __pidfd, int __targetfd, unsigned int __flags) __INTRODUCED_IN(31);
-
-/**
- * [pidfd_send_signal(2)](https://man7.org/linux/man-pages/man2/pidfd_send_signal.2.html)
- * sends a signal to another process.
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- *
- * Available since API level 31.
- */
-int pidfd_send_signal(int __pidfd, int __sig, siginfo_t *__info, unsigned int __flags) __INTRODUCED_IN(31);
-
-__END_DECLS
diff --git a/libc/include/sys/procfs.h b/libc/include/sys/procfs.h
index a082e97e0..75a1e986e 100644
--- a/libc/include/sys/procfs.h
+++ b/libc/include/sys/procfs.h
@@ -26,24 +26,16 @@
* SUCH DAMAGE.
*/
-#pragma once
+#ifndef _SYS_PROCFS_H_
+#define _SYS_PROCFS_H_
#include <sys/cdefs.h>
-#include <sys/ptrace.h>
#include <sys/ucontext.h>
__BEGIN_DECLS
-#if defined(__arm__)
-#define ELF_NGREG (sizeof(struct user_regs) / sizeof(elf_greg_t))
-#elif defined(__aarch64__)
-#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
-#else
-#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
-#endif
-
typedef unsigned long elf_greg_t;
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+typedef elf_greg_t elf_gregset_t[NGREG];
typedef fpregset_t elf_fpregset_t;
@@ -66,3 +58,5 @@ struct elf_siginfo {
#define ELF_PRARGSZ 80
__END_DECLS
+
+#endif
diff --git a/libc/include/sys/thread_properties.h b/libc/include/sys/thread_properties.h
deleted file mode 100644
index b5d30c77e..000000000
--- a/libc/include/sys/thread_properties.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-/**
- * @file thread_properties.h
- * @brief Thread properties API.
- *
- * https://sourceware.org/glibc/wiki/ThreadPropertiesAPI
- * API for querying various properties of the current thread, used mostly by
- * the sanitizers.
- *
- * Available since API level 31.
- *
- */
-
-#include <sys/cdefs.h>
-#include <unistd.h>
-
-__BEGIN_DECLS
-
-/**
- * Gets the bounds of static TLS for the current thread.
- *
- * Available since API level 31.
- */
-void __libc_get_static_tls_bounds(void** __static_tls_begin,
- void** __static_tls_end) __INTRODUCED_IN(31);
-
-
-/**
- * Registers callback to be called right before the thread is dead.
- * The callbacks are chained, they are called in the order opposite to the order
- * they were registered.
- *
- * The callbacks must be registered only before any threads were created.
- * No signals may arrive during the calls to these callbacks.
- * The callbacks may not access the thread's dynamic TLS because they will have
- * been freed by the time these callbacks are invoked.
- *
- * Available since API level 31.
- */
-void __libc_register_thread_exit_callback(void (*__cb)(void)) __INTRODUCED_IN(31);
-
-/**
- * Iterates over all dynamic TLS chunks for the given thread.
- * The thread should have been suspended. It is undefined-behaviour if there is concurrent
- * modification of the target thread's dynamic TLS.
- *
- * Available since API level 31.
- */
-void __libc_iterate_dynamic_tls(pid_t __tid,
- void (*__cb)(void* __dynamic_tls_begin,
- void* __dynamic_tls_end,
- size_t __dso_id,
- void* __arg),
- void* __arg) __INTRODUCED_IN(31);
-
-/**
- * Register on_creation and on_destruction callbacks, which will be called after a dynamic
- * TLS creation and before a dynamic TLS destruction, respectively.
- *
- * Available since API level 31.
- */
-void __libc_register_dynamic_tls_listeners(
- void (*__on_creation)(void* __dynamic_tls_begin,
- void* __dynamic_tls_end),
- void (*__on_destruction)(void* __dynamic_tls_begin,
- void* __dynamic_tls_end)) __INTRODUCED_IN(31);
-
-__END_DECLS
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index e36042187..aaa8f221a 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -313,9 +313,7 @@ int tcsetpgrp(int __fd, pid_t __pid);
int getdomainname(char* __buf, size_t __buf_size) __INTRODUCED_IN(26);
int setdomainname(const char* __name, size_t __n) __INTRODUCED_IN(26);
-#if __ANDROID_API__ >= 28
void swab(const void* __src, void* __dst, ssize_t __byte_count) __INTRODUCED_IN(28);
-#endif
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#define _UNISTD_H_
@@ -324,5 +322,3 @@ void swab(const void* __src, void* __dst, ssize_t __byte_count) __INTRODUCED_IN(
#endif
__END_DECLS
-
-#include <android/legacy_unistd_inlines.h>
diff --git a/libc/include/utmp.h b/libc/include/utmp.h
index cb72ce235..6a5251153 100644
--- a/libc/include/utmp.h
+++ b/libc/include/utmp.h
@@ -25,13 +25,8 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
-#pragma once
-
-/**
- * @file utmp.h
- * @brief POSIX login records.
- */
+#ifndef _UTMP_H_
+#define _UTMP_H_
#include <sys/cdefs.h>
#include <sys/types.h>
@@ -62,71 +57,52 @@
#define DEAD_PROCESS 8
#define ACCOUNTING 9
-struct lastlog {
- time_t ll_time;
- char ll_line[UT_LINESIZE];
- char ll_host[UT_HOSTSIZE];
+struct lastlog
+{
+ time_t ll_time;
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
};
-struct exit_status {
- short int e_termination;
- short int e_exit;
+struct exit_status
+{
+ short int e_termination;
+ short int e_exit;
};
-struct utmp {
- short int ut_type;
- pid_t ut_pid;
- char ut_line[UT_LINESIZE];
- char ut_id[4];
- char ut_user[UT_NAMESIZE];
- char ut_host[UT_HOSTSIZE];
- struct exit_status ut_exit;
+struct utmp
+{
+ short int ut_type;
+ pid_t ut_pid;
+ char ut_line[UT_LINESIZE];
+ char ut_id[4];
+ char ut_user[UT_NAMESIZE];
+ char ut_host[UT_HOSTSIZE];
+
+ struct exit_status ut_exit;
- long int ut_session;
- struct timeval ut_tv;
+ long int ut_session;
+ struct timeval ut_tv;
- int32_t ut_addr_v6[4];
- char unused[20];
+ int32_t ut_addr_v6[4];
+ char unsed[20];
};
+
#define ut_name ut_user
#define ut_time ut_tv.tv_sec
#define ut_addr ut_addr_v6[0]
__BEGIN_DECLS
-/**
- * Does nothing.
- */
int utmpname(const char* __path);
-/**
- * Does nothing.
- */
void setutent(void);
-/**
- * Does nothing.
- */
struct utmp* getutent(void);
-/**
- * Does nothing.
- */
-struct utmp* pututline(const struct utmp* __entry);
-/**
- * Does nothing.
- */
void endutent(void);
-/**
- * [login_tty(3)](https://www.man7.org/linux/man-pages/man3/login_tty.3.html)
- * prepares for login on the given file descriptor.
- *
- * See also forkpty() which combines openpty(), fork(), and login_tty().
- *
- * Returns 0 on success and returns -1 and sets `errno` on failure.
- *
- * Available since API level 23.
- */
int login_tty(int __fd) __INTRODUCED_IN(23);
__END_DECLS
+
+#endif /* _UTMP_H_ */
diff --git a/libc/kernel/README.md b/libc/kernel/README.md
index 5f1c81dae..6db08d646 100644
--- a/libc/kernel/README.md
+++ b/libc/kernel/README.md
@@ -17,23 +17,11 @@ They can be also included before or after any Bionic C library header.
Description of the directories involved in generating the parsed kernel headers:
- * `external/kernel-headers/original/uapi/`
- Contains the uapi kernel headers found in the Android kernel. Note this
+ * `external/kernel-headers/original/`
+ Contains the uapi kernel headers found in the android kernel. Note this
also includes the header files that are generated by building the kernel
sources.
- * `external/kernel-headers/original/scsi/`
- Contains copies of the kernel scsi header files. These where never
- made into uapi files, but some user space code expects that these
- headers are available.
-
- * `external/kernel-headers/modified/scsi/`
- Contains hand-modified versions of a few files from `original/scsi/`
- that removes the kernel specific code from these files so they can
- be used as uapi headers. The tools to process the kernel headers will
- warn if any scsi header files have changed and require new versions
- to be hand-modified.
-
* `bionic/libc/kernel/uapi/`
Contains the cleaned kernel headers and mirrors the directory structure
in `external/kernel-headers/original/uapi/`.
@@ -45,7 +33,7 @@ Description of the directories involved in generating the parsed kernel headers:
The tools to get/parse the headers:
* `tools/generate_uapi_headers.sh`
- Checks out the Android kernel and generates all uapi header files.
+ Checks out the android kernel and generates all uapi header files.
copies all the changed files into external/kernel-headers.
* `tools/clean_header.py`
@@ -72,25 +60,19 @@ Download the Android mainline kernel source code:
kernel_src> git clone https://android.googlesource.com/kernel/common/ -b android-mainline
```
-The Android mainline kernel source has tags that indicate the kernel
-version to which they correspond. The format of a tag is
-android-mainline-XXX, where XXX is the kernel version. For example,
-android-mainline-5.10 corresponds to linux stable kernel 5.10. To check out
-a particular tag:
+For now, there are no tags, take the top of tree version. To find the
+version of the linux stable kernel headers the mainline source code is
+tracking, read the uapi/linux/version.h that is generated.
```
- kernel_src> cd common
- kernel_src/common> git checkout tags/android-mainline-XXX
+ kernel_src> cd linux-stable
+ kernel_src/linux-stable> git checkout tags/vXXX
```
-It is expected that a kernel update should only be performed on a valid tag.
-For testing purposes, it is possible that you can use the top of tree
-version, but never use that as the basis for importing new kernel headers.
-
Before running the command to import the headers, make sure that you have
done a lunch TARGET. The script uses a variable set by the lunch command
to determine which directory to use as the destination directory.
-After running lunch, run this command to import the headers into the Android
+After running lunch, run this command to import the headers into the android
source tree if there is a kernel source tree already checked out:
```
bionic/libc/kernel/tools/generate_uapi_headers.sh --use-kernel-dir kernel_src
diff --git a/libc/kernel/android/scsi/scsi/scsi.h b/libc/kernel/android/scsi/scsi/scsi.h
index 2ea16a39f..1e125d157 100644
--- a/libc/kernel/android/scsi/scsi/scsi.h
+++ b/libc/kernel/android/scsi/scsi/scsi.h
@@ -57,7 +57,6 @@ struct ccs_modesel_head {
#define CLEAR_TASK_SET 0x0e
#define INITIATE_RECOVERY 0x0f
#define RELEASE_RECOVERY 0x10
-#define TERMINATE_IO_PROC 0x11
#define CLEAR_ACA 0x16
#define LOGICAL_UNIT_RESET 0x17
#define SIMPLE_QUEUE_TAG 0x20
diff --git a/libc/kernel/tools/clean_header.py b/libc/kernel/tools/clean_header.py
index cfd301ad2..92a213920 100755
--- a/libc/kernel/tools/clean_header.py
+++ b/libc/kernel/tools/clean_header.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
#------------------------------------------------------------------------------
# Description of the header clean process
@@ -112,7 +112,6 @@ def cleanupFile(dst_file, src_file, rel_path, no_update = True):
if arch and arch in kernel_arch_token_replacements:
blocks.replaceTokens(kernel_arch_token_replacements[arch])
- blocks.removeStructs(kernel_structs_to_remove)
blocks.optimizeMacros(macros)
blocks.optimizeIf01()
blocks.removeVarsAndFuncs(kernel_known_generic_statics)
@@ -127,7 +126,7 @@ def cleanupFile(dst_file, src_file, rel_path, no_update = True):
if __name__ == "__main__":
def usage():
- print("""\
+ print """\
usage: %s [options] <header_path>
options:
@@ -142,7 +141,7 @@ if __name__ == "__main__":
-d<path> specify path of cleaned kernel headers
<header_path> must be in a subdirectory of 'original'
- """ % os.path.basename(sys.argv[0]))
+ """ % os.path.basename(sys.argv[0])
sys.exit(1)
try:
@@ -211,8 +210,9 @@ if __name__ == "__main__":
else:
r = "added"
- print("cleaning: %-*s -> %-*s (%s)" % (35, path, 35, path, r))
+ print "cleaning: %-*s -> %-*s (%s)" % (35, path, 35, path, r)
- b.updateFiles()
+
+ b.updateGitFiles()
sys.exit(0)
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py
index 54886413e..1ada59e09 100755
--- a/libc/kernel/tools/cpp.py
+++ b/libc/kernel/tools/cpp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
"""A glorified C pre-processor parser."""
import ctypes
@@ -14,7 +14,7 @@ if top is None:
utils.panic('ANDROID_BUILD_TOP not set.\n')
# Set up the env vars for libclang.
-site.addsitedir(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/python3/site-packages/'))
+site.addsitedir(os.path.join(top, 'external/clang/bindings/python'))
import clang.cindex
from clang.cindex import conf
@@ -28,9 +28,12 @@ from clang.cindex import TranslationUnit
# Set up LD_LIBRARY_PATH to include libclang.so, libLLVM.so, and etc.
# Note that setting LD_LIBRARY_PATH with os.putenv() sometimes doesn't help.
-clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/libclang.so'))
+clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/sdk/tools/linux/lib64/libclang_android.so'))
-from defaults import *
+from defaults import kCppUndefinedMacro
+from defaults import kernel_remove_config_macros
+from defaults import kernel_struct_replacements
+from defaults import kernel_token_replacements
debugBlockParser = False
@@ -254,7 +257,7 @@ class CppTokenizer(object):
token_group = TokenGroup(self._tu, tokens_memory, tokens_count)
tokens = []
- for i in range(0, count):
+ for i in xrange(0, count):
token = Token(self._tu, token_group,
int_data=tokens_array[i].int_data,
ptr_data=tokens_array[i].ptr_data,
@@ -267,7 +270,7 @@ class CppTokenizer(object):
def parseString(self, lines):
"""Parse a list of text lines into a BlockList object."""
- file_ = 'no-filename-available.c'
+ file_ = 'dummy.c'
self._tu = self._indexer.parse(file_, self.clang_flags,
unsaved_files=[(file_, lines)],
options=self.options)
@@ -394,10 +397,10 @@ class CppExpr(object):
self._index = 0
if debugCppExpr:
- print("CppExpr: trying to parse %s" % repr(tokens))
+ print "CppExpr: trying to parse %s" % repr(tokens)
self.expr = self.parseExpression(0)
if debugCppExpr:
- print("CppExpr: got " + repr(self.expr))
+ print "CppExpr: got " + repr(self.expr)
if self._index != self._num_tokens:
self.throw(BadExpectedToken, "crap at end of input (%d != %d): %s"
% (self._index, self._num_tokens, repr(tokens)))
@@ -405,9 +408,9 @@ class CppExpr(object):
def throw(self, exception, msg):
if self._index < self._num_tokens:
tok = self.tokens[self._index]
- print("%d:%d: %s" % (tok.location.line, tok.location.column, msg))
+ print "%d:%d: %s" % (tok.location.line, tok.location.column, msg)
else:
- print("EOF: %s" % msg)
+ print "EOF: %s" % msg
raise exception(msg)
def expectId(self, id):
@@ -722,7 +725,7 @@ class CppExpr(object):
if op == "defined":
op, name = e
- if name in macros:
+ if macros.has_key(name):
if macros[name] == kCppUndefinedMacro:
return ("int", 0)
else:
@@ -739,7 +742,7 @@ class CppExpr(object):
elif op == "ident":
op, name = e
- if name in macros:
+ if macros.has_key(name):
try:
value = int(macros[name])
expanded = ("int", value)
@@ -1179,11 +1182,11 @@ class BlockList(object):
def dump(self):
"""Dump all the blocks in current BlockList."""
- print('##### BEGIN #####')
+ print '##### BEGIN #####'
for i, b in enumerate(self.blocks):
- print('### BLOCK %d ###' % i)
- print(b)
- print('##### END #####')
+ print '### BLOCK %d ###' % i
+ print b
+ print '##### END #####'
def optimizeIf01(self):
"""Remove the code between #if 0 .. #endif in a BlockList."""
@@ -1195,52 +1198,6 @@ class BlockList(object):
if b.isIf():
b.expr.optimize(macros)
- def removeStructs(self, structs):
- """Remove structs."""
- for b in self.blocks:
- # Have to look in each block for a top-level struct definition.
- if b.directive:
- continue
- num_tokens = len(b.tokens)
- # A struct definition has at least 5 tokens:
- # struct
- # ident
- # {
- # }
- # ;
- if num_tokens < 5:
- continue
- # This is a simple struct finder, it might fail if a top-level
- # structure has an #if type directives that confuses the algorithm
- # for finding th end of the structure. Or if there is another
- # structure definition embedded in the structure.
- i = 0
- while i < num_tokens - 2:
- if (b.tokens[i].kind != TokenKind.KEYWORD or
- b.tokens[i].id != "struct"):
- i += 1
- continue
- if (b.tokens[i + 1].kind == TokenKind.IDENTIFIER and
- b.tokens[i + 2].kind == TokenKind.PUNCTUATION and
- b.tokens[i + 2].id == "{" and b.tokens[i + 1].id in structs):
- # Search forward for the end of the structure.
- # Very simple search, look for } and ; tokens. If something
- # more complicated is needed we can add it later.
- j = i + 3
- while j < num_tokens - 1:
- if (b.tokens[j].kind == TokenKind.PUNCTUATION and
- b.tokens[j].id == "}" and
- b.tokens[j + 1].kind == TokenKind.PUNCTUATION and
- b.tokens[j + 1].id == ";"):
- b.tokens = b.tokens[0:i] + b.tokens[j + 2:num_tokens]
- num_tokens = len(b.tokens)
- j = i
- break
- j += 1
- i = j
- continue
- i += 1
-
def optimizeAll(self, macros):
self.optimizeMacros(macros)
self.optimizeIf01()
@@ -1510,7 +1467,7 @@ class BlockParser(object):
while i < len(tokens) and tokens[i].location in extent:
t = tokens[i]
if debugBlockParser:
- print(' ' * 2, t.id, t.kind, t.cursor.kind)
+ print ' ' * 2, t.id, t.kind, t.cursor.kind
if (detect_change and t.cursor.extent != extent and
t.cursor.kind == CursorKind.PREPROCESSING_DIRECTIVE):
break
@@ -1798,6 +1755,7 @@ class OptimizerTests(unittest.TestCase):
def parse(self, text, macros=None):
out = utils.StringOutput()
blocks = BlockParser().parse(CppStringTokenizer(text))
+ blocks.replaceTokens(kernel_token_replacements)
blocks.optimizeAll(macros)
blocks.write(out)
return out.get()
@@ -1973,8 +1931,8 @@ class OptimizerTests(unittest.TestCase):
#endif /* SIGRTMAX */
"""
expected = """\
-#ifndef SIGRTMAX
-#define SIGRTMAX 123
+#ifndef __SIGRTMAX
+#define __SIGRTMAX 123
#endif
"""
self.assertEqual(self.parse(text), expected)
@@ -1990,146 +1948,6 @@ class OptimizerTests(unittest.TestCase):
expected = ""
self.assertEqual(self.parse(text), expected)
-class RemoveStructsTests(unittest.TestCase):
- def parse(self, text, structs):
- out = utils.StringOutput()
- blocks = BlockParser().parse(CppStringTokenizer(text))
- blocks.removeStructs(structs)
- blocks.write(out)
- return out.get()
-
- def test_remove_struct_from_start(self):
- text = """\
-struct remove {
- int val1;
- int val2;
-};
-struct something {
- struct timeval val1;
- struct timeval val2;
-};
-"""
- expected = """\
-struct something {
- struct timeval val1;
- struct timeval val2;
-};
-"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
-
- def test_remove_struct_from_end(self):
- text = """\
-struct something {
- struct timeval val1;
- struct timeval val2;
-};
-struct remove {
- int val1;
- int val2;
-};
-"""
- expected = """\
-struct something {
- struct timeval val1;
- struct timeval val2;
-};
-"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
-
- def test_remove_minimal_struct(self):
- text = """\
-struct remove {
-};
-"""
- expected = "";
- self.assertEqual(self.parse(text, set(["remove"])), expected)
-
- def test_remove_struct_with_struct_fields(self):
- text = """\
-struct something {
- struct remove val1;
- struct remove val2;
-};
-struct remove {
- int val1;
- struct something val3;
- int val2;
-};
-"""
- expected = """\
-struct something {
- struct remove val1;
- struct remove val2;
-};
-"""
- self.assertEqual(self.parse(text, set(["remove"])), expected)
-
- def test_remove_consecutive_structs(self):
- text = """\
-struct keep1 {
- struct timeval val1;
- struct timeval val2;
-};
-struct remove1 {
- int val1;
- int val2;
-};
-struct remove2 {
- int val1;
- int val2;
- int val3;
-};
-struct keep2 {
- struct timeval val1;
- struct timeval val2;
-};
-"""
- expected = """\
-struct keep1 {
- struct timeval val1;
- struct timeval val2;
-};
-struct keep2 {
- struct timeval val1;
- struct timeval val2;
-};
-"""
- self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
-
- def test_remove_multiple_structs(self):
- text = """\
-struct keep1 {
- int val;
-};
-struct remove1 {
- int val1;
- int val2;
-};
-struct keep2 {
- int val;
-};
-struct remove2 {
- struct timeval val1;
- struct timeval val2;
-};
-struct keep3 {
- int val;
-};
-"""
- expected = """\
-struct keep1 {
- int val;
-};
-struct keep2 {
- int val;
-};
-struct keep3 {
- int val;
-};
-"""
- self.assertEqual(self.parse(text, set(["remove1", "remove2"])), expected)
-
-
class FullPathTest(unittest.TestCase):
"""Test of the full path parsing."""
@@ -2138,12 +1956,9 @@ class FullPathTest(unittest.TestCase):
keep = set()
out = utils.StringOutput()
blocks = BlockParser().parse(CppStringTokenizer(text))
-
- blocks.removeStructs(kernel_structs_to_remove)
blocks.removeVarsAndFuncs(keep)
blocks.replaceTokens(kernel_token_replacements)
blocks.optimizeAll(None)
-
blocks.write(out)
return out.get()
@@ -2426,38 +2241,6 @@ something that should still be kept
"""
self.assertEqual(self.parse(text), expected)
- def test_verify_timeval_itemerval(self):
- text = """\
-struct __kernel_old_timeval {
- struct something val;
-};
-struct __kernel_old_itimerval {
- struct __kernel_old_timeval val;
-};
-struct fields {
- struct __kernel_old_timeval timeval;
- struct __kernel_old_itimerval itimerval;
-};
-"""
- expected = """\
-struct fields {
- struct timeval timeval;
- struct itimerval itimerval;
-};
-"""
- self.assertEqual(self.parse(text), expected)
-
- def test_token_replacement(self):
- text = """\
-#define SIGRTMIN 32
-#define SIGRTMAX _NSIG
-"""
- expected = """\
-#define __SIGRTMIN 32
-#define __SIGRTMAX _KERNEL__NSIG
-"""
- self.assertEqual(self.parse(text), expected)
-
if __name__ == '__main__':
unittest.main()
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 04eb5f111..90b56f5a4 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -35,17 +35,6 @@ kernel_known_macros = {
"__kernel_old_timeval": "1",
}
-# this is the set of known kernel data structures we want to remove from
-# the final headers
-kernel_structs_to_remove = set(
- [
- # Remove the structures since they are still the same as
- # timeval, itimerval.
- "__kernel_old_timeval",
- "__kernel_old_itimerval",
- ]
- )
-
# define to true if you want to remove all defined(CONFIG_FOO) tests
# from the clean headers. testing shows that this is not strictly necessary
# but just generates cleaner results
@@ -97,8 +86,6 @@ kernel_token_replacements = {
# If struct __kernel_old_timeval and struct timeval become different,
# then a different solution needs to be implemented.
"__kernel_old_timeval": "timeval",
- # Do the same for __kernel_old_itimerval as for timeval.
- "__kernel_old_itimerval": "itimerval",
}
diff --git a/libc/kernel/tools/generate_uapi_headers.sh b/libc/kernel/tools/generate_uapi_headers.sh
index 7e49cdeb0..088c12e7e 100755
--- a/libc/kernel/tools/generate_uapi_headers.sh
+++ b/libc/kernel/tools/generate_uapi_headers.sh
@@ -218,11 +218,12 @@ if [[ ${VERIFY_HEADERS_ONLY} -eq 1 ]]; then
fi
if [[ ${SKIP_GENERATION} -eq 0 ]]; then
+ # Clean up any leftover headers.
+ make distclean
+
# Build all of the generated headers.
for arch in "${ARCH_LIST[@]}"; do
echo "Generating headers for arch ${arch}"
- # Clean up any leftover headers.
- make ARCH=${arch} distclean
make ARCH=${arch} headers_install
done
fi
@@ -263,17 +264,13 @@ for arch in "${ARCH_LIST[@]}"; do
"${ANDROID_KERNEL_DIR}/uapi/asm-${arch}/asm"
done
+# The arm types.h uapi header is not properly being generated, so copy it
+# directly.
+cp "${KERNEL_DIR}/include/uapi/asm-generic/types.h" \
+ "${ANDROID_KERNEL_DIR}/uapi/asm-arm/asm"
+
# Verify if modified headers have changed.
verify_modified_hdrs "${KERNEL_DIR}/include/scsi" \
"${ANDROID_KERNEL_DIR}/scsi" \
"${KERNEL_DIR}"
echo "Headers updated."
-
-if [[ ${SKIP_GENERATION} -eq 0 ]]; then
- cd "${KERNEL_DIR}"
- # Clean all of the generated headers.
- for arch in "${ARCH_LIST[@]}"; do
- echo "Cleaning kernel files for arch ${arch}"
- make ARCH=${arch} distclean
- done
-fi
diff --git a/libc/kernel/tools/kernel.py b/libc/kernel/tools/kernel.py
index 69d516b4f..b6418a8c6 100644
--- a/libc/kernel/tools/kernel.py
+++ b/libc/kernel/tools/kernel.py
@@ -4,7 +4,7 @@
# list here the macros that you know are always defined/undefined when including
# the kernel headers
#
-import sys, cpp, re, os.path, time
+import sys, cpp, re, os.path, string, time
from defaults import *
verboseSearch = 0
@@ -56,7 +56,7 @@ class HeaderScanner:
# <mtd/*>
#
re_combined_str=\
- r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % "|".join(kernel_dirs)
+ r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % string.join(kernel_dirs,"|")
re_combined = re.compile(re_combined_str)
@@ -100,7 +100,7 @@ class HeaderScanner:
if from_file:
if verboseFind:
- print("=== %s uses %s" % (from_file, header))
+ print "=== %s uses %s" % (from_file, header)
self.headers[header].add(from_file)
def parseFile(self, path, arch=None, kernel_root=None):
@@ -114,7 +114,7 @@ class HeaderScanner:
try:
f = open(path, "rt")
except:
- print("!!! can't read '%s'" % path)
+ print "!!! can't read '%s'" % path
return
hasIncludes = False
@@ -125,10 +125,10 @@ class HeaderScanner:
break
if not hasIncludes:
- if verboseSearch: print("::: " + path)
+ if verboseSearch: print "::: " + path
return
- if verboseSearch: print("*** " + path)
+ if verboseSearch: print "*** " + path
list = cpp.BlockParser().parseFile(path)
if list:
@@ -205,6 +205,7 @@ class KernelHeaderFinder:
if len(kernel_root) > 0 and kernel_root[-1] != "/":
kernel_root += "/"
+ #print "using kernel_root %s" % kernel_root
self.archs = archs
self.searched = set(headers)
self.kernel_root = kernel_root
@@ -299,8 +300,8 @@ class ConfigParser:
self.items = {}
self.duplicates = False
- def parseLine(self, line):
- line = line.strip()
+ def parseLine(self,line):
+ line = string.strip(line)
# skip empty and comment lines
if len(line) == 0 or line[0] == "#":
diff --git a/libc/kernel/tools/update_all.py b/libc/kernel/tools/update_all.py
index 620624808..cef24dd4c 100755
--- a/libc/kernel/tools/update_all.py
+++ b/libc/kernel/tools/update_all.py
@@ -1,11 +1,11 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
#
-import sys, cpp, kernel, glob, os, re, getopt, clean_header, shutil
+import sys, cpp, kernel, glob, os, re, getopt, clean_header, subprocess, shutil
from defaults import *
from utils import *
def Usage():
- print("""\
+ print """\
usage: %(progname)s [kernel-original-path] [kernel-modified-path]
this program is used to update all the auto-generated clean headers
@@ -21,14 +21,14 @@ def Usage():
- the clean headers will be placed in 'bionic/libc/kernel/arch-<arch>/asm',
'bionic/libc/kernel/android', etc..
-""" % { "progname" : os.path.basename(sys.argv[0]) })
+""" % { "progname" : os.path.basename(sys.argv[0]) }
sys.exit(0)
def ProcessFiles(updater, original_dir, modified_dir, src_rel_dir, update_rel_dir):
# Delete the old headers before updating to the new headers.
update_dir = os.path.join(get_kernel_dir(), update_rel_dir)
shutil.rmtree(update_dir)
- os.mkdir(update_dir, 0o755)
+ os.mkdir(update_dir, 0755)
src_dir = os.path.normpath(os.path.join(original_dir, src_rel_dir))
src_dir_len = len(src_dir) + 1
@@ -62,7 +62,7 @@ def ProcessFiles(updater, original_dir, modified_dir, src_rel_dir, update_rel_di
else:
state = "added"
update_path = os.path.join(update_rel_dir, rel_path)
- print("cleaning %s -> %s (%s)" % (src_str, update_path, state))
+ print "cleaning %s -> %s (%s)" % (src_str, update_path, state)
# This lets us support regular system calls like __NR_write and also weird
@@ -149,10 +149,9 @@ ProcessFiles(updater, original_dir, modified_dir, "uapi", "uapi"),
# Now process the special files.
ProcessFiles(updater, original_dir, modified_dir, "scsi", os.path.join("android", "scsi", "scsi"))
-# Copy all of the files.
-updater.updateFiles()
+updater.updateGitFiles()
# Now re-generate the <bits/glibc-syscalls.h> from the new uapi headers.
updater = BatchFileUpdater()
GenerateGlibcSyscallsHeader(updater)
-updater.updateFiles()
+updater.updateGitFiles()
diff --git a/libc/kernel/tools/utils.py b/libc/kernel/tools/utils.py
index 3b4828b5a..1b06b1b48 100644
--- a/libc/kernel/tools/utils.py
+++ b/libc/kernel/tools/utils.py
@@ -1,5 +1,6 @@
# common python utility routines for the Bionic tool scripts
+import commands
import logging
import os
import string
@@ -145,3 +146,19 @@ class BatchFileUpdater:
for dst in sorted(deletes):
os.remove(dst)
+
+ def updateGitFiles(self):
+ adds, deletes, edits = self.getChanges()
+
+ if adds:
+ for dst in sorted(adds):
+ self._writeFile(dst)
+ commands.getoutput("git add " + " ".join(adds))
+
+ if deletes:
+ commands.getoutput("git rm " + " ".join(deletes))
+
+ if edits:
+ for dst in sorted(edits):
+ self._writeFile(dst)
+ commands.getoutput("git add " + " ".join(edits))
diff --git a/libc/kernel/uapi/asm-arm/asm/kvm.h b/libc/kernel/uapi/asm-arm/asm/kvm.h
new file mode 100644
index 000000000..6a6d96398
--- /dev/null
+++ b/libc/kernel/uapi/asm-arm/asm/kvm.h
@@ -0,0 +1,216 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ARM_KVM_H__
+#define __ARM_KVM_H__
+#include <linux/types.h>
+#include <linux/psci.h>
+#include <asm/ptrace.h>
+#define __KVM_HAVE_GUEST_DEBUG
+#define __KVM_HAVE_IRQ_LINE
+#define __KVM_HAVE_READONLY_MEM
+#define __KVM_HAVE_VCPU_EVENTS
+#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
+#define KVM_REG_SIZE(id) (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
+#define KVM_ARM_SVC_sp svc_regs[0]
+#define KVM_ARM_SVC_lr svc_regs[1]
+#define KVM_ARM_SVC_spsr svc_regs[2]
+#define KVM_ARM_ABT_sp abt_regs[0]
+#define KVM_ARM_ABT_lr abt_regs[1]
+#define KVM_ARM_ABT_spsr abt_regs[2]
+#define KVM_ARM_UND_sp und_regs[0]
+#define KVM_ARM_UND_lr und_regs[1]
+#define KVM_ARM_UND_spsr und_regs[2]
+#define KVM_ARM_IRQ_sp irq_regs[0]
+#define KVM_ARM_IRQ_lr irq_regs[1]
+#define KVM_ARM_IRQ_spsr irq_regs[2]
+#define KVM_ARM_FIQ_r8 fiq_regs[0]
+#define KVM_ARM_FIQ_r9 fiq_regs[1]
+#define KVM_ARM_FIQ_r10 fiq_regs[2]
+#define KVM_ARM_FIQ_fp fiq_regs[3]
+#define KVM_ARM_FIQ_ip fiq_regs[4]
+#define KVM_ARM_FIQ_sp fiq_regs[5]
+#define KVM_ARM_FIQ_lr fiq_regs[6]
+#define KVM_ARM_FIQ_spsr fiq_regs[7]
+struct kvm_regs {
+ struct pt_regs usr_regs;
+ unsigned long svc_regs[3];
+ unsigned long abt_regs[3];
+ unsigned long und_regs[3];
+ unsigned long irq_regs[3];
+ unsigned long fiq_regs[8];
+};
+#define KVM_ARM_TARGET_CORTEX_A15 0
+#define KVM_ARM_TARGET_CORTEX_A7 1
+#define KVM_ARM_NUM_TARGETS 2
+#define KVM_ARM_DEVICE_TYPE_SHIFT 0
+#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
+#define KVM_ARM_DEVICE_ID_SHIFT 16
+#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
+#define KVM_ARM_DEVICE_VGIC_V2 0
+#define KVM_VGIC_V2_ADDR_TYPE_DIST 0
+#define KVM_VGIC_V2_ADDR_TYPE_CPU 1
+#define KVM_VGIC_V2_DIST_SIZE 0x1000
+#define KVM_VGIC_V2_CPU_SIZE 0x2000
+#define KVM_VGIC_V3_ADDR_TYPE_DIST 2
+#define KVM_VGIC_V3_ADDR_TYPE_REDIST 3
+#define KVM_VGIC_ITS_ADDR_TYPE 4
+#define KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION 5
+#define KVM_VGIC_V3_DIST_SIZE SZ_64K
+#define KVM_VGIC_V3_REDIST_SIZE (2 * SZ_64K)
+#define KVM_VGIC_V3_ITS_SIZE (2 * SZ_64K)
+#define KVM_ARM_VCPU_POWER_OFF 0
+#define KVM_ARM_VCPU_PSCI_0_2 1
+struct kvm_vcpu_init {
+ __u32 target;
+ __u32 features[7];
+};
+struct kvm_sregs {
+};
+struct kvm_fpu {
+};
+struct kvm_guest_debug_arch {
+};
+struct kvm_debug_exit_arch {
+};
+struct kvm_sync_regs {
+ __u64 device_irq_level;
+};
+struct kvm_arch_memory_slot {
+};
+struct kvm_vcpu_events {
+ struct {
+ __u8 serror_pending;
+ __u8 serror_has_esr;
+ __u8 ext_dabt_pending;
+ __u8 pad[5];
+ __u64 serror_esr;
+ } exception;
+ __u32 reserved[12];
+};
+#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000
+#define KVM_REG_ARM_COPROC_SHIFT 16
+#define KVM_REG_ARM_32_OPC2_MASK 0x0000000000000007
+#define KVM_REG_ARM_32_OPC2_SHIFT 0
+#define KVM_REG_ARM_OPC1_MASK 0x0000000000000078
+#define KVM_REG_ARM_OPC1_SHIFT 3
+#define KVM_REG_ARM_CRM_MASK 0x0000000000000780
+#define KVM_REG_ARM_CRM_SHIFT 7
+#define KVM_REG_ARM_32_CRN_MASK 0x0000000000007800
+#define KVM_REG_ARM_32_CRN_SHIFT 11
+#define KVM_REG_ARM_SECURE_MASK 0x0000000010000000
+#define KVM_REG_ARM_SECURE_SHIFT 28
+#define ARM_CP15_REG_SHIFT_MASK(x,n) (((x) << KVM_REG_ARM_ ##n ##_SHIFT) & KVM_REG_ARM_ ##n ##_MASK)
+#define __ARM_CP15_REG(op1,crn,crm,op2) (KVM_REG_ARM | (15 << KVM_REG_ARM_COPROC_SHIFT) | ARM_CP15_REG_SHIFT_MASK(op1, OPC1) | ARM_CP15_REG_SHIFT_MASK(crn, 32_CRN) | ARM_CP15_REG_SHIFT_MASK(crm, CRM) | ARM_CP15_REG_SHIFT_MASK(op2, 32_OPC2))
+#define ARM_CP15_REG32(...) (__ARM_CP15_REG(__VA_ARGS__) | KVM_REG_SIZE_U32)
+#define __ARM_CP15_REG64(op1,crm) (__ARM_CP15_REG(op1, 0, crm, 0) | KVM_REG_SIZE_U64)
+#define ARM_CP15_REG64(...) __ARM_CP15_REG64(__VA_ARGS__)
+#define KVM_REG_ARM_PTIMER_CTL ARM_CP15_REG32(0, 14, 2, 1)
+#define KVM_REG_ARM_PTIMER_CNT ARM_CP15_REG64(0, 14)
+#define KVM_REG_ARM_PTIMER_CVAL ARM_CP15_REG64(2, 14)
+#define KVM_REG_ARM_TIMER_CTL ARM_CP15_REG32(0, 14, 3, 1)
+#define KVM_REG_ARM_TIMER_CNT ARM_CP15_REG64(1, 14)
+#define KVM_REG_ARM_TIMER_CVAL ARM_CP15_REG64(3, 14)
+#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
+#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / 4)
+#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT)
+#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00
+#define KVM_REG_ARM_DEMUX_ID_SHIFT 8
+#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT)
+#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF
+#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0
+#define KVM_REG_ARM_VFP (0x0012 << KVM_REG_ARM_COPROC_SHIFT)
+#define KVM_REG_ARM_VFP_MASK 0x000000000000FFFF
+#define KVM_REG_ARM_VFP_BASE_REG 0x0
+#define KVM_REG_ARM_VFP_FPSID 0x1000
+#define KVM_REG_ARM_VFP_FPSCR 0x1001
+#define KVM_REG_ARM_VFP_MVFR1 0x1006
+#define KVM_REG_ARM_VFP_MVFR0 0x1007
+#define KVM_REG_ARM_VFP_FPEXC 0x1008
+#define KVM_REG_ARM_VFP_FPINST 0x1009
+#define KVM_REG_ARM_VFP_FPINST2 0x100A
+#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
+#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
+#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1 KVM_REG_ARM_FW_REG(1)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_AVAIL 2
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
+#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
+#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
+#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
+#define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2
+#define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32
+#define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT)
+#define KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT 32
+#define KVM_DEV_ARM_VGIC_V3_MPIDR_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_V3_MPIDR_SHIFT)
+#define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0
+#define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT)
+#define KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK (0xffff)
+#define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3
+#define KVM_DEV_ARM_VGIC_GRP_CTRL 4
+#define KVM_DEV_ARM_VGIC_GRP_REDIST_REGS 5
+#define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6
+#define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7
+#define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8
+#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10
+#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT)
+#define KVM_DEV_ARM_VGIC_LINE_LEVEL_INTID_MASK 0x3ff
+#define VGIC_LEVEL_INFO_LINE_LEVEL 0
+#define KVM_ARM_VCPU_PMU_V3_CTRL 0
+#define KVM_ARM_VCPU_PMU_V3_IRQ 0
+#define KVM_ARM_VCPU_PMU_V3_INIT 1
+#define KVM_ARM_VCPU_TIMER_CTRL 1
+#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
+#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
+#define KVM_DEV_ARM_VGIC_CTRL_INIT 0
+#define KVM_DEV_ARM_ITS_SAVE_TABLES 1
+#define KVM_DEV_ARM_ITS_RESTORE_TABLES 2
+#define KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES 3
+#define KVM_DEV_ARM_ITS_CTRL_RESET 4
+#define KVM_ARM_IRQ_VCPU2_SHIFT 28
+#define KVM_ARM_IRQ_VCPU2_MASK 0xf
+#define KVM_ARM_IRQ_TYPE_SHIFT 24
+#define KVM_ARM_IRQ_TYPE_MASK 0xf
+#define KVM_ARM_IRQ_VCPU_SHIFT 16
+#define KVM_ARM_IRQ_VCPU_MASK 0xff
+#define KVM_ARM_IRQ_NUM_SHIFT 0
+#define KVM_ARM_IRQ_NUM_MASK 0xffff
+#define KVM_ARM_IRQ_TYPE_CPU 0
+#define KVM_ARM_IRQ_TYPE_SPI 1
+#define KVM_ARM_IRQ_TYPE_PPI 2
+#define KVM_ARM_IRQ_CPU_IRQ 0
+#define KVM_ARM_IRQ_CPU_FIQ 1
+#define KVM_ARM_IRQ_GIC_MAX 127
+#define KVM_NR_IRQCHIPS 1
+#define KVM_PSCI_FN_BASE 0x95c1ba5e
+#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n))
+#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0)
+#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1)
+#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2)
+#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3)
+#define KVM_PSCI_RET_SUCCESS PSCI_RET_SUCCESS
+#define KVM_PSCI_RET_NI PSCI_RET_NOT_SUPPORTED
+#define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS
+#define KVM_PSCI_RET_DENIED PSCI_RET_DENIED
+#endif
diff --git a/libc/kernel/uapi/asm-arm/asm/setup.h b/libc/kernel/uapi/asm-arm/asm/setup.h
index b4da2d146..672a72a2d 100644
--- a/libc/kernel/uapi/asm-arm/asm/setup.h
+++ b/libc/kernel/uapi/asm-arm/asm/setup.h
@@ -19,7 +19,7 @@
#ifndef _UAPI__ASMARM_SETUP_H
#define _UAPI__ASMARM_SETUP_H
#include <linux/types.h>
-#define COMMAND_LINE_SIZE 2048
+#define COMMAND_LINE_SIZE 1024
#define ATAG_NONE 0x00000000
struct tag_header {
__u32 size;
diff --git a/libc/kernel/uapi/asm-arm/asm/signal.h b/libc/kernel/uapi/asm-arm/asm/signal.h
index 5f7e0c582..51a302223 100644
--- a/libc/kernel/uapi/asm-arm/asm/signal.h
+++ b/libc/kernel/uapi/asm-arm/asm/signal.h
@@ -59,8 +59,17 @@ typedef unsigned long sigset_t;
#define __SIGRTMIN 32
#define __SIGRTMAX _KERNEL__NSIG
#define SIGSWI 32
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOCLDWAIT 0x00000002
+#define SA_SIGINFO 0x00000004
#define SA_THIRTYTWO 0x02000000
#define SA_RESTORER 0x04000000
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#include <asm-generic/signal-defs.h>
diff --git a/libc/kernel/uapi/asm-arm/asm/types.h b/libc/kernel/uapi/asm-arm/asm/types.h
index 461e48561..ea6e7df9e 100644
--- a/libc/kernel/uapi/asm-arm/asm/types.h
+++ b/libc/kernel/uapi/asm-arm/asm/types.h
@@ -16,19 +16,7 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_ASM_TYPES_H
-#define _UAPI_ASM_TYPES_H
+#ifndef _ASM_GENERIC_TYPES_H
+#define _ASM_GENERIC_TYPES_H
#include <asm-generic/int-ll64.h>
-#ifdef __INT32_TYPE__
-#undef __INT32_TYPE__
-#define __INT32_TYPE__ int
-#endif
-#ifdef __UINT32_TYPE__
-#undef __UINT32_TYPE__
-#define __UINT32_TYPE__ unsigned int
-#endif
-#ifdef __UINTPTR_TYPE__
-#undef __UINTPTR_TYPE__
-#define __UINTPTR_TYPE__ unsigned long
-#endif
#endif
diff --git a/libc/kernel/uapi/asm-arm/asm/unistd-common.h b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
index 070c77bfd..091bd740e 100644
--- a/libc/kernel/uapi/asm-arm/asm/unistd-common.h
+++ b/libc/kernel/uapi/asm-arm/asm/unistd-common.h
@@ -407,11 +407,4 @@
#define __NR_fspick (__NR_SYSCALL_BASE + 433)
#define __NR_pidfd_open (__NR_SYSCALL_BASE + 434)
#define __NR_clone3 (__NR_SYSCALL_BASE + 435)
-#define __NR_close_range (__NR_SYSCALL_BASE + 436)
-#define __NR_openat2 (__NR_SYSCALL_BASE + 437)
-#define __NR_pidfd_getfd (__NR_SYSCALL_BASE + 438)
-#define __NR_faccessat2 (__NR_SYSCALL_BASE + 439)
-#define __NR_process_madvise (__NR_SYSCALL_BASE + 440)
-#define __NR_epoll_pwait2 (__NR_SYSCALL_BASE + 441)
-#define __NR_mount_setattr (__NR_SYSCALL_BASE + 442)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/hwcap.h b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
index 8a70a522c..8a38ab712 100644
--- a/libc/kernel/uapi/asm-arm64/asm/hwcap.h
+++ b/libc/kernel/uapi/asm-arm64/asm/hwcap.h
@@ -59,14 +59,4 @@
#define HWCAP2_SVESM4 (1 << 6)
#define HWCAP2_FLAGM2 (1 << 7)
#define HWCAP2_FRINT (1 << 8)
-#define HWCAP2_SVEI8MM (1 << 9)
-#define HWCAP2_SVEF32MM (1 << 10)
-#define HWCAP2_SVEF64MM (1 << 11)
-#define HWCAP2_SVEBF16 (1 << 12)
-#define HWCAP2_I8MM (1 << 13)
-#define HWCAP2_BF16 (1 << 14)
-#define HWCAP2_DGH (1 << 15)
-#define HWCAP2_RNG (1 << 16)
-#define HWCAP2_BTI (1 << 17)
-#define HWCAP2_MTE (1 << 18)
#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/kvm.h b/libc/kernel/uapi/asm-arm64/asm/kvm.h
index 014504a0b..efe1a9c1b 100644
--- a/libc/kernel/uapi/asm-arm64/asm/kvm.h
+++ b/libc/kernel/uapi/asm-arm64/asm/kvm.h
@@ -97,13 +97,7 @@ struct kvm_debug_exit_arch {
struct kvm_sync_regs {
__u64 device_irq_level;
};
-struct kvm_pmu_event_filter {
- __u16 base_event;
- __u16 nevents;
-#define KVM_PMU_EVENT_ALLOW 0
-#define KVM_PMU_EVENT_DENY 1
- __u8 action;
- __u8 pad[3];
+struct kvm_arch_memory_slot {
};
struct kvm_vcpu_events {
struct {
@@ -143,8 +137,8 @@ struct kvm_vcpu_events {
#define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2)
#define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1)
#define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)
-#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
+#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
#define KVM_REG_ARM_FW_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_FW | ((r) & 0xffff))
#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
@@ -200,7 +194,6 @@ struct kvm_vcpu_events {
#define KVM_ARM_VCPU_PMU_V3_CTRL 0
#define KVM_ARM_VCPU_PMU_V3_IRQ 0
#define KVM_ARM_VCPU_PMU_V3_INIT 1
-#define KVM_ARM_VCPU_PMU_V3_FILTER 2
#define KVM_ARM_VCPU_TIMER_CTRL 1
#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
diff --git a/libc/kernel/uapi/asm-arm64/asm/mman.h b/libc/kernel/uapi/asm-arm64/asm/mman.h
index 98f72cf8e..6c23fb647 100644
--- a/libc/kernel/uapi/asm-arm64/asm/mman.h
+++ b/libc/kernel/uapi/asm-arm64/asm/mman.h
@@ -16,9 +16,4 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI__ASM_MMAN_H
-#define _UAPI__ASM_MMAN_H
#include <asm-generic/mman.h>
-#define PROT_BTI 0x10
-#define PROT_MTE 0x20
-#endif
diff --git a/libc/kernel/uapi/asm-arm64/asm/ptrace.h b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
index 480efcfe1..b3e0aea55 100644
--- a/libc/kernel/uapi/asm-arm64/asm/ptrace.h
+++ b/libc/kernel/uapi/asm-arm64/asm/ptrace.h
@@ -34,29 +34,19 @@
#define PSR_I_BIT 0x00000080
#define PSR_A_BIT 0x00000100
#define PSR_D_BIT 0x00000200
-#define PSR_BTYPE_MASK 0x00000c00
#define PSR_SSBS_BIT 0x00001000
#define PSR_PAN_BIT 0x00400000
#define PSR_UAO_BIT 0x00800000
-#define PSR_DIT_BIT 0x01000000
-#define PSR_TCO_BIT 0x02000000
#define PSR_V_BIT 0x10000000
#define PSR_C_BIT 0x20000000
#define PSR_Z_BIT 0x40000000
#define PSR_N_BIT 0x80000000
-#define PSR_BTYPE_SHIFT 10
#define PSR_f 0xff000000
#define PSR_s 0x00ff0000
#define PSR_x 0x0000ff00
#define PSR_c 0x000000ff
-#define PSR_BTYPE_NONE (0b00 << PSR_BTYPE_SHIFT)
-#define PSR_BTYPE_JC (0b01 << PSR_BTYPE_SHIFT)
-#define PSR_BTYPE_C (0b10 << PSR_BTYPE_SHIFT)
-#define PSR_BTYPE_J (0b11 << PSR_BTYPE_SHIFT)
#define PTRACE_SYSEMU 31
#define PTRACE_SYSEMU_SINGLESTEP 32
-#define PTRACE_PEEKMTETAGS 33
-#define PTRACE_POKEMTETAGS 34
#ifndef __ASSEMBLY__
struct user_pt_regs {
__u64 regs[31];
diff --git a/libc/kernel/uapi/asm-generic/hugetlb_encode.h b/libc/kernel/uapi/asm-generic/hugetlb_encode.h
index 73d818050..01a10ce5e 100644
--- a/libc/kernel/uapi/asm-generic/hugetlb_encode.h
+++ b/libc/kernel/uapi/asm-generic/hugetlb_encode.h
@@ -20,7 +20,6 @@
#define _ASM_GENERIC_HUGETLB_ENCODE_H_
#define HUGETLB_FLAG_ENCODE_SHIFT 26
#define HUGETLB_FLAG_ENCODE_MASK 0x3f
-#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT)
#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT)
diff --git a/libc/kernel/uapi/asm-generic/siginfo.h b/libc/kernel/uapi/asm-generic/siginfo.h
index 8bcbabbc4..829ffad4f 100644
--- a/libc/kernel/uapi/asm-generic/siginfo.h
+++ b/libc/kernel/uapi/asm-generic/siginfo.h
@@ -179,9 +179,7 @@ typedef struct siginfo {
#define SEGV_ACCADI 5
#define SEGV_ADIDERR 6
#define SEGV_ADIPERR 7
-#define SEGV_MTEAERR 8
-#define SEGV_MTESERR 9
-#define NSIGSEGV 9
+#define NSIGSEGV 7
#define BUS_ADRALN 1
#define BUS_ADRERR 2
#define BUS_OBJERR 3
@@ -209,8 +207,7 @@ typedef struct siginfo {
#define POLL_HUP 6
#define NSIGPOLL 6
#define SYS_SECCOMP 1
-#define SYS_USER_DISPATCH 2
-#define NSIGSYS 2
+#define NSIGSYS 1
#define EMT_TAGOVF 1
#define NSIGEMT 1
#define SIGEV_SIGNAL 0
diff --git a/libc/kernel/uapi/asm-generic/signal-defs.h b/libc/kernel/uapi/asm-generic/signal-defs.h
index c7e95040a..a6de2e403 100644
--- a/libc/kernel/uapi/asm-generic/signal-defs.h
+++ b/libc/kernel/uapi/asm-generic/signal-defs.h
@@ -19,31 +19,6 @@
#ifndef __ASM_GENERIC_SIGNAL_DEFS_H
#define __ASM_GENERIC_SIGNAL_DEFS_H
#include <linux/compiler.h>
-#ifndef SA_NOCLDSTOP
-#define SA_NOCLDSTOP 0x00000001
-#endif
-#ifndef SA_NOCLDWAIT
-#define SA_NOCLDWAIT 0x00000002
-#endif
-#ifndef SA_SIGINFO
-#define SA_SIGINFO 0x00000004
-#endif
-#define SA_UNSUPPORTED 0x00000400
-#define SA_EXPOSE_TAGBITS 0x00000800
-#ifndef SA_ONSTACK
-#define SA_ONSTACK 0x08000000
-#endif
-#ifndef SA_RESTART
-#define SA_RESTART 0x10000000
-#endif
-#ifndef SA_NODEFER
-#define SA_NODEFER 0x40000000
-#endif
-#ifndef SA_RESETHAND
-#define SA_RESETHAND 0x80000000
-#endif
-#define SA_NOMASK SA_NODEFER
-#define SA_ONESHOT SA_RESETHAND
#ifndef SIG_BLOCK
#define SIG_BLOCK 0
#endif
diff --git a/libc/kernel/uapi/asm-generic/signal.h b/libc/kernel/uapi/asm-generic/signal.h
index 874fece71..1210cbc31 100644
--- a/libc/kernel/uapi/asm-generic/signal.h
+++ b/libc/kernel/uapi/asm-generic/signal.h
@@ -60,6 +60,15 @@
#ifndef __SIGRTMAX
#define __SIGRTMAX _KERNEL__NSIG
#endif
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOCLDWAIT 0x00000002
+#define SA_SIGINFO 0x00000004
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
#if !defined(MINSIGSTKSZ) || !defined(SIGSTKSZ)
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
diff --git a/libc/kernel/uapi/asm-generic/socket.h b/libc/kernel/uapi/asm-generic/socket.h
index 7372be80f..11557aa91 100644
--- a/libc/kernel/uapi/asm-generic/socket.h
+++ b/libc/kernel/uapi/asm-generic/socket.h
@@ -95,8 +95,6 @@
#define SO_RCVTIMEO_NEW 66
#define SO_SNDTIMEO_NEW 67
#define SO_DETACH_REUSEPORT_BPF 68
-#define SO_PREFER_BUSY_POLL 69
-#define SO_BUSY_POLL_BUDGET 70
#if __BITS_PER_LONG == 64 || defined(__x86_64__) && defined(__ILP32__)
#define SO_TIMESTAMP SO_TIMESTAMP_OLD
#define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
diff --git a/libc/kernel/uapi/asm-generic/unistd.h b/libc/kernel/uapi/asm-generic/unistd.h
index 140970150..2128ff5cd 100644
--- a/libc/kernel/uapi/asm-generic/unistd.h
+++ b/libc/kernel/uapi/asm-generic/unistd.h
@@ -396,15 +396,8 @@
#ifdef __ARCH_WANT_SYS_CLONE3
#define __NR_clone3 435
#endif
-#define __NR_close_range 436
-#define __NR_openat2 437
-#define __NR_pidfd_getfd 438
-#define __NR_faccessat2 439
-#define __NR_process_madvise 440
-#define __NR_epoll_pwait2 441
-#define __NR_mount_setattr 442
#undef __NR_syscalls
-#define __NR_syscalls 443
+#define __NR_syscalls 436
#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
#define __NR_fcntl __NR3264_fcntl
#define __NR_statfs __NR3264_statfs
diff --git a/libc/kernel/uapi/asm-x86/asm/hwcap2.h b/libc/kernel/uapi/asm-x86/asm/hwcap2.h
index a6dbfb974..9015dee7d 100644
--- a/libc/kernel/uapi/asm-x86/asm/hwcap2.h
+++ b/libc/kernel/uapi/asm-x86/asm/hwcap2.h
@@ -19,5 +19,4 @@
#ifndef _ASM_X86_HWCAP2_H
#define _ASM_X86_HWCAP2_H
#define HWCAP2_RING3MWAIT (1 << 0)
-#define HWCAP2_FSGSBASE BIT(1)
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm.h b/libc/kernel/uapi/asm-x86/asm/kvm.h
index 0d82c5d58..d4865fb1c 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm.h
@@ -22,7 +22,6 @@
#include <linux/ioctl.h>
#define KVM_PIO_PAGE_OFFSET 1
#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
-#define KVM_DIRTY_LOG_PAGE_OFFSET 64
#define DE_VECTOR 0
#define DB_VECTOR 1
#define BP_VECTOR 3
@@ -111,7 +110,6 @@ struct kvm_ioapic_state {
#define KVM_IRQCHIP_IOAPIC 2
#define KVM_NR_IRQCHIPS 3
#define KVM_RUN_X86_SMM (1 << 0)
-#define KVM_RUN_X86_BUS_LOCK (1 << 1)
struct kvm_regs {
__u64 rax, rbx, rcx, rdx;
__u64 rsi, rdi, rsp, rbp;
@@ -173,22 +171,6 @@ struct kvm_msr_list {
__u32 nmsrs;
__u32 indices[0];
};
-#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
-struct kvm_msr_filter_range {
-#define KVM_MSR_FILTER_READ (1 << 0)
-#define KVM_MSR_FILTER_WRITE (1 << 1)
- __u32 flags;
- __u32 nmsrs;
- __u32 base;
- __u8 * bitmap;
-};
-#define KVM_MSR_FILTER_MAX_RANGES 16
-struct kvm_msr_filter {
-#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
-#define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
- __u32 flags;
- struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
-};
struct kvm_cpuid_entry {
__u32 function;
__u32 eax;
@@ -342,13 +324,9 @@ struct kvm_sync_regs {
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
#define KVM_STATE_NESTED_RUN_PENDING 0x00000002
#define KVM_STATE_NESTED_EVMCS 0x00000004
-#define KVM_STATE_NESTED_MTF_PENDING 0x00000008
-#define KVM_STATE_NESTED_GIF_SET 0x00000100
#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
#define KVM_STATE_NESTED_SMM_VMXON 0x00000002
#define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000
-#define KVM_STATE_NESTED_SVM_VMCB_SIZE 0x1000
-#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
struct kvm_vmx_nested_state_data {
__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
__u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
@@ -359,14 +337,6 @@ struct kvm_vmx_nested_state_hdr {
struct {
__u16 flags;
} smm;
- __u32 flags;
- __u64 preemption_timer_deadline;
-};
-struct kvm_svm_nested_state_data {
- __u8 vmcb12[KVM_STATE_NESTED_SVM_VMCB_SIZE];
-};
-struct kvm_svm_nested_state_hdr {
- __u64 vmcb_pa;
};
struct kvm_nested_state {
__u16 flags;
@@ -374,12 +344,10 @@ struct kvm_nested_state {
__u32 size;
union {
struct kvm_vmx_nested_state_hdr vmx;
- struct kvm_svm_nested_state_hdr svm;
__u8 pad[120];
} hdr;
union {
struct kvm_vmx_nested_state_data vmx[0];
- struct kvm_svm_nested_state_data svm[0];
} data;
};
struct kvm_pmu_event_filter {
diff --git a/libc/kernel/uapi/asm-x86/asm/kvm_para.h b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
index 091fb27f4..ad8fe0b05 100644
--- a/libc/kernel/uapi/asm-x86/asm/kvm_para.h
+++ b/libc/kernel/uapi/asm-x86/asm/kvm_para.h
@@ -34,8 +34,6 @@
#define KVM_FEATURE_PV_SEND_IPI 11
#define KVM_FEATURE_POLL_CONTROL 12
#define KVM_FEATURE_PV_SCHED_YIELD 13
-#define KVM_FEATURE_ASYNC_PF_INT 14
-#define KVM_FEATURE_MSI_EXT_DEST_ID 15
#define KVM_HINTS_REALTIME 0
#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24
#define MSR_KVM_WALL_CLOCK 0x11
@@ -47,8 +45,6 @@
#define MSR_KVM_STEAL_TIME 0x4b564d03
#define MSR_KVM_PV_EOI_EN 0x4b564d04
#define MSR_KVM_POLL_CONTROL 0x4b564d05
-#define MSR_KVM_ASYNC_PF_INT 0x4b564d06
-#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07
struct kvm_steal_time {
__u64 steal;
__u32 version;
@@ -74,8 +70,6 @@ struct kvm_clock_pairing {
#define KVM_ASYNC_PF_ENABLED (1 << 0)
#define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1)
#define KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT (1 << 2)
-#define KVM_ASYNC_PF_DELIVERY_AS_INT (1 << 3)
-#define KVM_ASYNC_PF_VEC_MASK GENMASK(7, 0)
#define KVM_MMU_OP_WRITE_PTE 1
#define KVM_MMU_OP_FLUSH_TLB 2
#define KVM_MMU_OP_RELEASE_PT 3
@@ -98,9 +92,8 @@ struct kvm_mmu_op_release_pt {
#define KVM_PV_REASON_PAGE_NOT_PRESENT 1
#define KVM_PV_REASON_PAGE_READY 2
struct kvm_vcpu_pv_apf_data {
- __u32 flags;
- __u32 token;
- __u8 pad[56];
+ __u32 reason;
+ __u8 pad[60];
__u32 enabled;
};
#define KVM_PV_EOI_BIT 0
diff --git a/libc/kernel/uapi/asm-x86/asm/mce.h b/libc/kernel/uapi/asm-x86/asm/mce.h
index 359af5710..4a3230c4a 100644
--- a/libc/kernel/uapi/asm-x86/asm/mce.h
+++ b/libc/kernel/uapi/asm-x86/asm/mce.h
@@ -45,7 +45,6 @@ struct mce {
__u64 ipid;
__u64 ppin;
__u32 microcode;
- __u64 kflags;
};
#define MCE_GET_RECORD_LEN _IOR('M', 1, int)
#define MCE_GET_LOG_LEN _IOR('M', 2, int)
diff --git a/libc/kernel/uapi/asm-x86/asm/sgx.h b/libc/kernel/uapi/asm-x86/asm/sgx.h
deleted file mode 100644
index 349791ae3..000000000
--- a/libc/kernel/uapi/asm-x86/asm/sgx.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_ASM_X86_SGX_H
-#define _UAPI_ASM_X86_SGX_H
-#include <linux/types.h>
-#include <linux/ioctl.h>
-enum sgx_page_flags {
- SGX_PAGE_MEASURE = 0x01,
-};
-#define SGX_MAGIC 0xA4
-#define SGX_IOC_ENCLAVE_CREATE _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create)
-#define SGX_IOC_ENCLAVE_ADD_PAGES _IOWR(SGX_MAGIC, 0x01, struct sgx_enclave_add_pages)
-#define SGX_IOC_ENCLAVE_INIT _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init)
-#define SGX_IOC_ENCLAVE_PROVISION _IOW(SGX_MAGIC, 0x03, struct sgx_enclave_provision)
-struct sgx_enclave_create {
- __u64 src;
-};
-struct sgx_enclave_add_pages {
- __u64 src;
- __u64 offset;
- __u64 length;
- __u64 secinfo;
- __u64 flags;
- __u64 count;
-};
-struct sgx_enclave_init {
- __u64 sigstruct;
-};
-struct sgx_enclave_provision {
- __u64 fd;
-};
-struct sgx_enclave_run;
-typedef int(* sgx_enclave_user_handler_t) (long rdi, long rsi, long rdx, long rsp, long r8, long r9, struct sgx_enclave_run * run);
-struct sgx_enclave_run {
- __u64 tcs;
- __u32 function;
- __u16 exception_vector;
- __u16 exception_error_code;
- __u64 exception_addr;
- __u64 user_handler;
- __u64 user_data;
- __u8 reserved[216];
-};
-typedef int(* vdso_sgx_enter_enclave_t) (unsigned long rdi, unsigned long rsi, unsigned long rdx, unsigned int function, unsigned long r8, unsigned long r9, struct sgx_enclave_run * run);
-#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/signal.h b/libc/kernel/uapi/asm-x86/asm/signal.h
index 8226da8f7..c7caa9727 100644
--- a/libc/kernel/uapi/asm-x86/asm/signal.h
+++ b/libc/kernel/uapi/asm-x86/asm/signal.h
@@ -62,6 +62,15 @@ typedef unsigned long sigset_t;
#define SIGUNUSED 31
#define __SIGRTMIN 32
#define __SIGRTMAX _KERNEL__NSIG
+#define SA_NOCLDSTOP 0x00000001u
+#define SA_NOCLDWAIT 0x00000002u
+#define SA_SIGINFO 0x00000004u
+#define SA_ONSTACK 0x08000000u
+#define SA_RESTART 0x10000000u
+#define SA_NODEFER 0x40000000u
+#define SA_RESETHAND 0x80000000u
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
#define SA_RESTORER 0x04000000
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
diff --git a/libc/kernel/uapi/asm-x86/asm/svm.h b/libc/kernel/uapi/asm-x86/asm/svm.h
index db9918b9b..4929c13f3 100644
--- a/libc/kernel/uapi/asm-x86/asm/svm.h
+++ b/libc/kernel/uapi/asm-x86/asm/svm.h
@@ -45,7 +45,6 @@
#define SVM_EXIT_WRITE_DR6 0x036
#define SVM_EXIT_WRITE_DR7 0x037
#define SVM_EXIT_EXCP_BASE 0x040
-#define SVM_EXIT_LAST_EXCP 0x05f
#define SVM_EXIT_INTR 0x060
#define SVM_EXIT_NMI 0x061
#define SVM_EXIT_SMI 0x062
@@ -93,36 +92,9 @@
#define SVM_EXIT_MWAIT_COND 0x08c
#define SVM_EXIT_XSETBV 0x08d
#define SVM_EXIT_RDPRU 0x08e
-#define SVM_EXIT_EFER_WRITE_TRAP 0x08f
-#define SVM_EXIT_CR0_WRITE_TRAP 0x090
-#define SVM_EXIT_CR1_WRITE_TRAP 0x091
-#define SVM_EXIT_CR2_WRITE_TRAP 0x092
-#define SVM_EXIT_CR3_WRITE_TRAP 0x093
-#define SVM_EXIT_CR4_WRITE_TRAP 0x094
-#define SVM_EXIT_CR5_WRITE_TRAP 0x095
-#define SVM_EXIT_CR6_WRITE_TRAP 0x096
-#define SVM_EXIT_CR7_WRITE_TRAP 0x097
-#define SVM_EXIT_CR8_WRITE_TRAP 0x098
-#define SVM_EXIT_CR9_WRITE_TRAP 0x099
-#define SVM_EXIT_CR10_WRITE_TRAP 0x09a
-#define SVM_EXIT_CR11_WRITE_TRAP 0x09b
-#define SVM_EXIT_CR12_WRITE_TRAP 0x09c
-#define SVM_EXIT_CR13_WRITE_TRAP 0x09d
-#define SVM_EXIT_CR14_WRITE_TRAP 0x09e
-#define SVM_EXIT_CR15_WRITE_TRAP 0x09f
-#define SVM_EXIT_INVPCID 0x0a2
#define SVM_EXIT_NPF 0x400
#define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401
#define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402
-#define SVM_EXIT_VMGEXIT 0x403
-#define SVM_VMGEXIT_MMIO_READ 0x80000001
-#define SVM_VMGEXIT_MMIO_WRITE 0x80000002
-#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003
-#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004
-#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005
-#define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0
-#define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1
-#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff
#define SVM_EXIT_ERR - 1
-#define SVM_EXIT_REASONS { SVM_EXIT_READ_CR0, "read_cr0" }, { SVM_EXIT_READ_CR2, "read_cr2" }, { SVM_EXIT_READ_CR3, "read_cr3" }, { SVM_EXIT_READ_CR4, "read_cr4" }, { SVM_EXIT_READ_CR8, "read_cr8" }, { SVM_EXIT_WRITE_CR0, "write_cr0" }, { SVM_EXIT_WRITE_CR2, "write_cr2" }, { SVM_EXIT_WRITE_CR3, "write_cr3" }, { SVM_EXIT_WRITE_CR4, "write_cr4" }, { SVM_EXIT_WRITE_CR8, "write_cr8" }, { SVM_EXIT_READ_DR0, "read_dr0" }, { SVM_EXIT_READ_DR1, "read_dr1" }, { SVM_EXIT_READ_DR2, "read_dr2" }, { SVM_EXIT_READ_DR3, "read_dr3" }, { SVM_EXIT_READ_DR4, "read_dr4" }, { SVM_EXIT_READ_DR5, "read_dr5" }, { SVM_EXIT_READ_DR6, "read_dr6" }, { SVM_EXIT_READ_DR7, "read_dr7" }, { SVM_EXIT_WRITE_DR0, "write_dr0" }, { SVM_EXIT_WRITE_DR1, "write_dr1" }, { SVM_EXIT_WRITE_DR2, "write_dr2" }, { SVM_EXIT_WRITE_DR3, "write_dr3" }, { SVM_EXIT_WRITE_DR4, "write_dr4" }, { SVM_EXIT_WRITE_DR5, "write_dr5" }, { SVM_EXIT_WRITE_DR6, "write_dr6" }, { SVM_EXIT_WRITE_DR7, "write_dr7" }, { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, { SVM_EXIT_INTR, "interrupt" }, { SVM_EXIT_NMI, "nmi" }, { SVM_EXIT_SMI, "smi" }, { SVM_EXIT_INIT, "init" }, { SVM_EXIT_VINTR, "vintr" }, { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, { SVM_EXIT_IDTR_READ, "read_idtr" }, { SVM_EXIT_GDTR_READ, "read_gdtr" }, { SVM_EXIT_LDTR_READ, "read_ldtr" }, { SVM_EXIT_TR_READ, "read_rt" }, { SVM_EXIT_IDTR_WRITE, "write_idtr" }, { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, { SVM_EXIT_TR_WRITE, "write_rt" }, { SVM_EXIT_RDTSC, "rdtsc" }, { SVM_EXIT_RDPMC, "rdpmc" }, { SVM_EXIT_PUSHF, "pushf" }, { SVM_EXIT_POPF, "popf" }, { SVM_EXIT_CPUID, "cpuid" }, { SVM_EXIT_RSM, "rsm" }, { SVM_EXIT_IRET, "iret" }, { SVM_EXIT_SWINT, "swint" }, { SVM_EXIT_INVD, "invd" }, { SVM_EXIT_PAUSE, "pause" }, { SVM_EXIT_HLT, "hlt" }, { SVM_EXIT_INVLPG, "invlpg" }, { SVM_EXIT_INVLPGA, "invlpga" }, { SVM_EXIT_IOIO, "io" }, { SVM_EXIT_MSR, "msr" }, { SVM_EXIT_TASK_SWITCH, "task_switch" }, { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, { SVM_EXIT_SHUTDOWN, "shutdown" }, { SVM_EXIT_VMRUN, "vmrun" }, { SVM_EXIT_VMMCALL, "hypercall" }, { SVM_EXIT_VMLOAD, "vmload" }, { SVM_EXIT_VMSAVE, "vmsave" }, { SVM_EXIT_STGI, "stgi" }, { SVM_EXIT_CLGI, "clgi" }, { SVM_EXIT_SKINIT, "skinit" }, { SVM_EXIT_RDTSCP, "rdtscp" }, { SVM_EXIT_ICEBP, "icebp" }, { SVM_EXIT_WBINVD, "wbinvd" }, { SVM_EXIT_MONITOR, "monitor" }, { SVM_EXIT_MWAIT, "mwait" }, { SVM_EXIT_XSETBV, "xsetbv" }, { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, { SVM_EXIT_INVPCID, "invpcid" }, { SVM_EXIT_NPF, "npf" }, { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, { SVM_EXIT_VMGEXIT, "vmgexit" }, { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, { SVM_EXIT_ERR, "invalid_guest_state" }
+#define SVM_EXIT_REASONS { SVM_EXIT_READ_CR0, "read_cr0" }, { SVM_EXIT_READ_CR2, "read_cr2" }, { SVM_EXIT_READ_CR3, "read_cr3" }, { SVM_EXIT_READ_CR4, "read_cr4" }, { SVM_EXIT_READ_CR8, "read_cr8" }, { SVM_EXIT_WRITE_CR0, "write_cr0" }, { SVM_EXIT_WRITE_CR2, "write_cr2" }, { SVM_EXIT_WRITE_CR3, "write_cr3" }, { SVM_EXIT_WRITE_CR4, "write_cr4" }, { SVM_EXIT_WRITE_CR8, "write_cr8" }, { SVM_EXIT_READ_DR0, "read_dr0" }, { SVM_EXIT_READ_DR1, "read_dr1" }, { SVM_EXIT_READ_DR2, "read_dr2" }, { SVM_EXIT_READ_DR3, "read_dr3" }, { SVM_EXIT_READ_DR4, "read_dr4" }, { SVM_EXIT_READ_DR5, "read_dr5" }, { SVM_EXIT_READ_DR6, "read_dr6" }, { SVM_EXIT_READ_DR7, "read_dr7" }, { SVM_EXIT_WRITE_DR0, "write_dr0" }, { SVM_EXIT_WRITE_DR1, "write_dr1" }, { SVM_EXIT_WRITE_DR2, "write_dr2" }, { SVM_EXIT_WRITE_DR3, "write_dr3" }, { SVM_EXIT_WRITE_DR4, "write_dr4" }, { SVM_EXIT_WRITE_DR5, "write_dr5" }, { SVM_EXIT_WRITE_DR6, "write_dr6" }, { SVM_EXIT_WRITE_DR7, "write_dr7" }, { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, { SVM_EXIT_INTR, "interrupt" }, { SVM_EXIT_NMI, "nmi" }, { SVM_EXIT_SMI, "smi" }, { SVM_EXIT_INIT, "init" }, { SVM_EXIT_VINTR, "vintr" }, { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, { SVM_EXIT_IDTR_READ, "read_idtr" }, { SVM_EXIT_GDTR_READ, "read_gdtr" }, { SVM_EXIT_LDTR_READ, "read_ldtr" }, { SVM_EXIT_TR_READ, "read_rt" }, { SVM_EXIT_IDTR_WRITE, "write_idtr" }, { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, { SVM_EXIT_TR_WRITE, "write_rt" }, { SVM_EXIT_RDTSC, "rdtsc" }, { SVM_EXIT_RDPMC, "rdpmc" }, { SVM_EXIT_PUSHF, "pushf" }, { SVM_EXIT_POPF, "popf" }, { SVM_EXIT_CPUID, "cpuid" }, { SVM_EXIT_RSM, "rsm" }, { SVM_EXIT_IRET, "iret" }, { SVM_EXIT_SWINT, "swint" }, { SVM_EXIT_INVD, "invd" }, { SVM_EXIT_PAUSE, "pause" }, { SVM_EXIT_HLT, "hlt" }, { SVM_EXIT_INVLPG, "invlpg" }, { SVM_EXIT_INVLPGA, "invlpga" }, { SVM_EXIT_IOIO, "io" }, { SVM_EXIT_MSR, "msr" }, { SVM_EXIT_TASK_SWITCH, "task_switch" }, { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, { SVM_EXIT_SHUTDOWN, "shutdown" }, { SVM_EXIT_VMRUN, "vmrun" }, { SVM_EXIT_VMMCALL, "hypercall" }, { SVM_EXIT_VMLOAD, "vmload" }, { SVM_EXIT_VMSAVE, "vmsave" }, { SVM_EXIT_STGI, "stgi" }, { SVM_EXIT_CLGI, "clgi" }, { SVM_EXIT_SKINIT, "skinit" }, { SVM_EXIT_RDTSCP, "rdtscp" }, { SVM_EXIT_ICEBP, "icebp" }, { SVM_EXIT_WBINVD, "wbinvd" }, { SVM_EXIT_MONITOR, "monitor" }, { SVM_EXIT_MWAIT, "mwait" }, { SVM_EXIT_XSETBV, "xsetbv" }, { SVM_EXIT_NPF, "npf" }, { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, { SVM_EXIT_ERR, "invalid_guest_state" }
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd.h b/libc/kernel/uapi/asm-x86/asm/unistd.h
index 8cab383ed..4bb90cf03 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI_ASM_X86_UNISTD_H
#define _UAPI_ASM_X86_UNISTD_H
-#define __X32_SYSCALL_BIT 0x40000000
+#define __X32_SYSCALL_BIT 0x40000000UL
#ifdef __i386__
#include <asm/unistd_32.h>
#elif defined(__ILP32__)
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_32.h b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
index 7fe242169..06e4a01f6 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_32.h
@@ -443,11 +443,4 @@
#define __NR_fspick 433
#define __NR_pidfd_open 434
#define __NR_clone3 435
-#define __NR_close_range 436
-#define __NR_openat2 437
-#define __NR_pidfd_getfd 438
-#define __NR_faccessat2 439
-#define __NR_process_madvise 440
-#define __NR_epoll_pwait2 441
-#define __NR_mount_setattr 442
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_64.h b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
index 7e3c92417..bcb6eaec1 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_64.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_64.h
@@ -365,11 +365,4 @@
#define __NR_fspick 433
#define __NR_pidfd_open 434
#define __NR_clone3 435
-#define __NR_close_range 436
-#define __NR_openat2 437
-#define __NR_pidfd_getfd 438
-#define __NR_faccessat2 439
-#define __NR_process_madvise 440
-#define __NR_epoll_pwait2 441
-#define __NR_mount_setattr 442
#endif
diff --git a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
index 529ded322..3357bd10d 100644
--- a/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
+++ b/libc/kernel/uapi/asm-x86/asm/unistd_x32.h
@@ -318,13 +318,6 @@
#define __NR_fspick (__X32_SYSCALL_BIT + 433)
#define __NR_pidfd_open (__X32_SYSCALL_BIT + 434)
#define __NR_clone3 (__X32_SYSCALL_BIT + 435)
-#define __NR_close_range (__X32_SYSCALL_BIT + 436)
-#define __NR_openat2 (__X32_SYSCALL_BIT + 437)
-#define __NR_pidfd_getfd (__X32_SYSCALL_BIT + 438)
-#define __NR_faccessat2 (__X32_SYSCALL_BIT + 439)
-#define __NR_process_madvise (__X32_SYSCALL_BIT + 440)
-#define __NR_epoll_pwait2 (__X32_SYSCALL_BIT + 441)
-#define __NR_mount_setattr (__X32_SYSCALL_BIT + 442)
#define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
#define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
#define __NR_ioctl (__X32_SYSCALL_BIT + 514)
diff --git a/libc/kernel/uapi/asm-x86/asm/vmx.h b/libc/kernel/uapi/asm-x86/asm/vmx.h
index 1771faa8e..e218d0d14 100644
--- a/libc/kernel/uapi/asm-x86/asm/vmx.h
+++ b/libc/kernel/uapi/asm-x86/asm/vmx.h
@@ -23,8 +23,7 @@
#define EXIT_REASON_EXTERNAL_INTERRUPT 1
#define EXIT_REASON_TRIPLE_FAULT 2
#define EXIT_REASON_INIT_SIGNAL 3
-#define EXIT_REASON_SIPI_SIGNAL 4
-#define EXIT_REASON_INTERRUPT_WINDOW 7
+#define EXIT_REASON_PENDING_INTERRUPT 7
#define EXIT_REASON_NMI_WINDOW 8
#define EXIT_REASON_TASK_SWITCH 9
#define EXIT_REASON_CPUID 10
@@ -79,9 +78,7 @@
#define EXIT_REASON_XRSTORS 64
#define EXIT_REASON_UMWAIT 67
#define EXIT_REASON_TPAUSE 68
-#define EXIT_REASON_BUS_LOCK 74
-#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_SIPI_SIGNAL, "SIPI_SIGNAL" }, { EXIT_REASON_INTERRUPT_WINDOW, "INTERRUPT_WINDOW" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }, { EXIT_REASON_BUS_LOCK, "BUS_LOCK" }
-#define VMX_EXIT_REASON_FLAGS { VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" }
+#define VMX_EXIT_REASONS { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, { EXIT_REASON_CPUID, "CPUID" }, { EXIT_REASON_HLT, "HLT" }, { EXIT_REASON_INVD, "INVD" }, { EXIT_REASON_INVLPG, "INVLPG" }, { EXIT_REASON_RDPMC, "RDPMC" }, { EXIT_REASON_RDTSC, "RDTSC" }, { EXIT_REASON_VMCALL, "VMCALL" }, { EXIT_REASON_VMCLEAR, "VMCLEAR" }, { EXIT_REASON_VMLAUNCH, "VMLAUNCH" }, { EXIT_REASON_VMPTRLD, "VMPTRLD" }, { EXIT_REASON_VMPTRST, "VMPTRST" }, { EXIT_REASON_VMREAD, "VMREAD" }, { EXIT_REASON_VMRESUME, "VMRESUME" }, { EXIT_REASON_VMWRITE, "VMWRITE" }, { EXIT_REASON_VMOFF, "VMOFF" }, { EXIT_REASON_VMON, "VMON" }, { EXIT_REASON_CR_ACCESS, "CR_ACCESS" }, { EXIT_REASON_DR_ACCESS, "DR_ACCESS" }, { EXIT_REASON_IO_INSTRUCTION, "IO_INSTRUCTION" }, { EXIT_REASON_MSR_READ, "MSR_READ" }, { EXIT_REASON_MSR_WRITE, "MSR_WRITE" }, { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, { EXIT_REASON_MSR_LOAD_FAIL, "MSR_LOAD_FAIL" }, { EXIT_REASON_MWAIT_INSTRUCTION, "MWAIT_INSTRUCTION" }, { EXIT_REASON_MONITOR_TRAP_FLAG, "MONITOR_TRAP_FLAG" }, { EXIT_REASON_MONITOR_INSTRUCTION, "MONITOR_INSTRUCTION" }, { EXIT_REASON_PAUSE_INSTRUCTION, "PAUSE_INSTRUCTION" }, { EXIT_REASON_MCE_DURING_VMENTRY, "MCE_DURING_VMENTRY" }, { EXIT_REASON_TPR_BELOW_THRESHOLD, "TPR_BELOW_THRESHOLD" }, { EXIT_REASON_APIC_ACCESS, "APIC_ACCESS" }, { EXIT_REASON_EOI_INDUCED, "EOI_INDUCED" }, { EXIT_REASON_GDTR_IDTR, "GDTR_IDTR" }, { EXIT_REASON_LDTR_TR, "LDTR_TR" }, { EXIT_REASON_EPT_VIOLATION, "EPT_VIOLATION" }, { EXIT_REASON_EPT_MISCONFIG, "EPT_MISCONFIG" }, { EXIT_REASON_INVEPT, "INVEPT" }, { EXIT_REASON_RDTSCP, "RDTSCP" }, { EXIT_REASON_PREEMPTION_TIMER, "PREEMPTION_TIMER" }, { EXIT_REASON_INVVPID, "INVVPID" }, { EXIT_REASON_WBINVD, "WBINVD" }, { EXIT_REASON_XSETBV, "XSETBV" }, { EXIT_REASON_APIC_WRITE, "APIC_WRITE" }, { EXIT_REASON_RDRAND, "RDRAND" }, { EXIT_REASON_INVPCID, "INVPCID" }, { EXIT_REASON_VMFUNC, "VMFUNC" }, { EXIT_REASON_ENCLS, "ENCLS" }, { EXIT_REASON_RDSEED, "RDSEED" }, { EXIT_REASON_PML_FULL, "PML_FULL" }, { EXIT_REASON_XSAVES, "XSAVES" }, { EXIT_REASON_XRSTORS, "XRSTORS" }, { EXIT_REASON_UMWAIT, "UMWAIT" }, { EXIT_REASON_TPAUSE, "TPAUSE" }
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
diff --git a/libc/kernel/uapi/drm/amdgpu_drm.h b/libc/kernel/uapi/drm/amdgpu_drm.h
index f8eb023d8..b986d3034 100644
--- a/libc/kernel/uapi/drm/amdgpu_drm.h
+++ b/libc/kernel/uapi/drm/amdgpu_drm.h
@@ -69,9 +69,8 @@ extern "C" {
#define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
#define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
#define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
-#define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8)
+#define AMDGPU_GEM_CREATE_MQD_GFX9 (1 << 8)
#define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9)
-#define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10)
struct drm_amdgpu_gem_create_in {
__u64 bo_size;
__u64 alignment;
@@ -206,10 +205,6 @@ struct drm_amdgpu_gem_userptr {
#define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
#define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
#define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
-#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
-#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
-#define AMDGPU_TILING_SCANOUT_SHIFT 63
-#define AMDGPU_TILING_SCANOUT_MASK 0x1
#define AMDGPU_TILING_SET(field,value) (((__u64) (value) & AMDGPU_TILING_ ##field ##_MASK) << AMDGPU_TILING_ ##field ##_SHIFT)
#define AMDGPU_TILING_GET(value,field) (((__u64) (value) >> AMDGPU_TILING_ ##field ##_SHIFT) & AMDGPU_TILING_ ##field ##_MASK)
#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
@@ -345,7 +340,7 @@ struct drm_amdgpu_cs_in {
__u32 ctx_id;
__u32 bo_list_handle;
__u32 num_chunks;
- __u32 flags;
+ __u32 _pad;
__u64 chunks;
};
struct drm_amdgpu_cs_out {
@@ -360,8 +355,6 @@ union drm_amdgpu_cs {
#define AMDGPU_IB_FLAG_PREEMPT (1 << 2)
#define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
#define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4)
-#define AMDGPU_IB_FLAGS_SECURE (1 << 5)
-#define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6)
struct drm_amdgpu_cs_chunk_ib {
__u32 _pad;
__u32 flags;
@@ -411,7 +404,6 @@ struct drm_amdgpu_cs_chunk_data {
};
#define AMDGPU_IDS_FLAGS_FUSION 0x1
#define AMDGPU_IDS_FLAGS_PREEMPTION 0x2
-#define AMDGPU_IDS_FLAGS_TMZ 0x4
#define AMDGPU_INFO_ACCEL_WORKING 0x00
#define AMDGPU_INFO_CRTC_FROM_ID 0x01
#define AMDGPU_INFO_HW_IP_INFO 0x02
@@ -436,8 +428,6 @@ struct drm_amdgpu_cs_chunk_data {
#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
#define AMDGPU_INFO_FW_DMCU 0x12
#define AMDGPU_INFO_FW_TA 0x13
-#define AMDGPU_INFO_FW_DMCUB 0x14
-#define AMDGPU_INFO_FW_TOC 0x15
#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
#define AMDGPU_INFO_VRAM_USAGE 0x10
#define AMDGPU_INFO_GTT_USAGE 0x11
@@ -559,7 +549,6 @@ struct drm_amdgpu_info_firmware {
#define AMDGPU_VRAM_TYPE_DDR3 7
#define AMDGPU_VRAM_TYPE_DDR4 8
#define AMDGPU_VRAM_TYPE_GDDR6 9
-#define AMDGPU_VRAM_TYPE_DDR5 10
struct drm_amdgpu_info_device {
__u32 device_id;
__u32 chip_rev;
@@ -645,7 +634,6 @@ struct drm_amdgpu_info_vce_clock_table {
#define AMDGPU_FAMILY_AI 141
#define AMDGPU_FAMILY_RV 142
#define AMDGPU_FAMILY_NV 143
-#define AMDGPU_FAMILY_VGH 144
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/drm.h b/libc/kernel/uapi/drm/drm.h
index 878e899e0..c78966c9a 100644
--- a/libc/kernel/uapi/drm/drm.h
+++ b/libc/kernel/uapi/drm/drm.h
@@ -573,7 +573,6 @@ extern "C" {
#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)
#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
-#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
#define DRM_COMMAND_BASE 0x40
#define DRM_COMMAND_END 0xA0
struct drm_event {
diff --git a/libc/kernel/uapi/drm/drm_fourcc.h b/libc/kernel/uapi/drm/drm_fourcc.h
index 4574c1c0f..a316269da 100644
--- a/libc/kernel/uapi/drm/drm_fourcc.h
+++ b/libc/kernel/uapi/drm/drm_fourcc.h
@@ -74,7 +74,6 @@ extern "C" {
#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H')
#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H')
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H')
-#define DRM_FORMAT_AXBXGXRX106106106106 fourcc_code('A', 'B', '1', '0')
#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V')
#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U')
#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y')
@@ -112,13 +111,10 @@ extern "C" {
#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1')
#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4')
#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2')
-#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5')
#define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0')
#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2')
#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6')
-#define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0')
-#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1')
#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9')
#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9')
#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1')
@@ -129,6 +125,7 @@ extern "C" {
#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6')
#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4')
#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4')
+#define DRM_FORMAT_MOD_NONE 0
#define DRM_FORMAT_MOD_VENDOR_NONE 0
#define DRM_FORMAT_MOD_VENDOR_INTEL 0x01
#define DRM_FORMAT_MOD_VENDOR_AMD 0x02
@@ -139,37 +136,33 @@ extern "C" {
#define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07
#define DRM_FORMAT_MOD_VENDOR_ARM 0x08
#define DRM_FORMAT_MOD_VENDOR_ALLWINNER 0x09
-#define DRM_FORMAT_MOD_VENDOR_AMLOGIC 0x0a
#define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
#define fourcc_mod_code(vendor,val) ((((__u64) DRM_FORMAT_MOD_VENDOR_ ##vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
-#define DRM_FORMAT_MOD_GENERIC_16_16_TILE DRM_FORMAT_MOD_SAMSUNG_16_16_TILE
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED)
#define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
-#define DRM_FORMAT_MOD_NONE 0
#define I915_FORMAT_MOD_X_TILED fourcc_mod_code(INTEL, 1)
#define I915_FORMAT_MOD_Y_TILED fourcc_mod_code(INTEL, 2)
#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
#define I915_FORMAT_MOD_Y_TILED_CCS fourcc_mod_code(INTEL, 4)
#define I915_FORMAT_MOD_Yf_TILED_CCS fourcc_mod_code(INTEL, 5)
-#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS fourcc_mod_code(INTEL, 6)
-#define I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS fourcc_mod_code(INTEL, 7)
-#define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8)
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2)
#define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
+#define DRM_FORMAT_MOD_QCOM_DX fourcc_mod_code(QCOM, 0x2)
+#define DRM_FORMAT_MOD_QCOM_TIGHT fourcc_mod_code(QCOM, 0x4)
+#define DRM_FORMAT_MOD_QCOM_TILE fourcc_mod_code(QCOM, 0x8)
#define DRM_FORMAT_MOD_VIVANTE_TILED fourcc_mod_code(VIVANTE, 1)
#define DRM_FORMAT_MOD_VIVANTE_SUPER_TILED fourcc_mod_code(VIVANTE, 2)
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED fourcc_mod_code(VIVANTE, 3)
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)
#define DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED fourcc_mod_code(NVIDIA, 1)
-#define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c,s,g,k,h) fourcc_mod_code(NVIDIA, (0x10 | ((h) & 0xf) | (((k) & 0xff) << 12) | (((g) & 0x3) << 20) | (((s) & 0x1) << 22) | (((c) & 0x7) << 23)))
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(0, 0, 0, 0, (v))
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(0)
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(1)
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(2)
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(3)
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(4)
-#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(5)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK(v) fourcc_mod_code(NVIDIA, 0x10 | ((v) & 0xf))
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB fourcc_mod_code(NVIDIA, 0x10)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB fourcc_mod_code(NVIDIA, 0x11)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB fourcc_mod_code(NVIDIA, 0x12)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB fourcc_mod_code(NVIDIA, 0x13)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB fourcc_mod_code(NVIDIA, 0x14)
+#define DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB fourcc_mod_code(NVIDIA, 0x15)
#define __fourcc_mod_broadcom_param_shift 8
#define __fourcc_mod_broadcom_param_bits 48
#define fourcc_mod_broadcom_code(val,params) fourcc_mod_code(BROADCOM, ((((__u64) params) << __fourcc_mod_broadcom_param_shift) | val))
@@ -202,60 +195,8 @@ extern "C" {
#define AFBC_FORMAT_MOD_SC (1ULL << 9)
#define AFBC_FORMAT_MOD_DB (1ULL << 10)
#define AFBC_FORMAT_MOD_BCH (1ULL << 11)
-#define AFBC_FORMAT_MOD_USM (1ULL << 12)
#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL)
#define DRM_FORMAT_MOD_ALLWINNER_TILED fourcc_mod_code(ALLWINNER, 1)
-#define __fourcc_mod_amlogic_layout_mask 0xff
-#define __fourcc_mod_amlogic_options_shift 8
-#define __fourcc_mod_amlogic_options_mask 0xff
-#define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout,__options) fourcc_mod_code(AMLOGIC, ((__layout) & __fourcc_mod_amlogic_layout_mask) | (((__options) & __fourcc_mod_amlogic_options_mask) << __fourcc_mod_amlogic_options_shift))
-#define AMLOGIC_FBC_LAYOUT_BASIC (1ULL)
-#define AMLOGIC_FBC_LAYOUT_SCATTER (2ULL)
-#define AMLOGIC_FBC_OPTION_MEM_SAVING (1ULL << 0)
-#define AMD_FMT_MOD fourcc_mod_code(AMD, 0)
-#define IS_AMD_FMT_MOD(val) (((val) >> 56) == DRM_FORMAT_MOD_VENDOR_AMD)
-#define AMD_FMT_MOD_TILE_VER_GFX9 1
-#define AMD_FMT_MOD_TILE_VER_GFX10 2
-#define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3
-#define AMD_FMT_MOD_TILE_GFX9_64K_S 9
-#define AMD_FMT_MOD_TILE_GFX9_64K_D 10
-#define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
-#define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26
-#define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27
-#define AMD_FMT_MOD_DCC_BLOCK_64B 0
-#define AMD_FMT_MOD_DCC_BLOCK_128B 1
-#define AMD_FMT_MOD_DCC_BLOCK_256B 2
-#define AMD_FMT_MOD_TILE_VERSION_SHIFT 0
-#define AMD_FMT_MOD_TILE_VERSION_MASK 0xFF
-#define AMD_FMT_MOD_TILE_SHIFT 8
-#define AMD_FMT_MOD_TILE_MASK 0x1F
-#define AMD_FMT_MOD_DCC_SHIFT 13
-#define AMD_FMT_MOD_DCC_MASK 0x1
-#define AMD_FMT_MOD_DCC_RETILE_SHIFT 14
-#define AMD_FMT_MOD_DCC_RETILE_MASK 0x1
-#define AMD_FMT_MOD_DCC_PIPE_ALIGN_SHIFT 15
-#define AMD_FMT_MOD_DCC_PIPE_ALIGN_MASK 0x1
-#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_SHIFT 16
-#define AMD_FMT_MOD_DCC_INDEPENDENT_64B_MASK 0x1
-#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_SHIFT 17
-#define AMD_FMT_MOD_DCC_INDEPENDENT_128B_MASK 0x1
-#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_SHIFT 18
-#define AMD_FMT_MOD_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3
-#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_SHIFT 20
-#define AMD_FMT_MOD_DCC_CONSTANT_ENCODE_MASK 0x1
-#define AMD_FMT_MOD_PIPE_XOR_BITS_SHIFT 21
-#define AMD_FMT_MOD_PIPE_XOR_BITS_MASK 0x7
-#define AMD_FMT_MOD_BANK_XOR_BITS_SHIFT 24
-#define AMD_FMT_MOD_BANK_XOR_BITS_MASK 0x7
-#define AMD_FMT_MOD_PACKERS_SHIFT 27
-#define AMD_FMT_MOD_PACKERS_MASK 0x7
-#define AMD_FMT_MOD_RB_SHIFT 30
-#define AMD_FMT_MOD_RB_MASK 0x7
-#define AMD_FMT_MOD_PIPE_SHIFT 33
-#define AMD_FMT_MOD_PIPE_MASK 0x7
-#define AMD_FMT_MOD_SET(field,value) ((uint64_t) (value) << AMD_FMT_MOD_ ##field ##_SHIFT)
-#define AMD_FMT_MOD_GET(field,value) (((value) >> AMD_FMT_MOD_ ##field ##_SHIFT) & AMD_FMT_MOD_ ##field ##_MASK)
-#define AMD_FMT_MOD_CLEAR(field) (~((uint64_t) AMD_FMT_MOD_ ##field ##_MASK << AMD_FMT_MOD_ ##field ##_SHIFT))
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/drm_mode.h b/libc/kernel/uapi/drm/drm_mode.h
index 643ae984f..be5cbad26 100644
--- a/libc/kernel/uapi/drm/drm_mode.h
+++ b/libc/kernel/uapi/drm/drm_mode.h
@@ -73,7 +73,12 @@ extern "C" {
#define DRM_MODE_FLAG_PIC_AR_16_9 (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
#define DRM_MODE_FLAG_PIC_AR_64_27 (DRM_MODE_PICTURE_ASPECT_64_27 << 19)
#define DRM_MODE_FLAG_PIC_AR_256_135 (DRM_MODE_PICTURE_ASPECT_256_135 << 19)
-#define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_CSYNC | DRM_MODE_FLAG_PCSYNC | DRM_MODE_FLAG_NCSYNC | DRM_MODE_FLAG_HSKEW | DRM_MODE_FLAG_DBLCLK | DRM_MODE_FLAG_CLKDIV2 | DRM_MODE_FLAG_3D_MASK)
+#define DRM_MODE_FLAG_SUPPORTS_RGB (1 << 27)
+#define DRM_MODE_FLAG_SUPPORTS_YUV (1 << 28)
+#define DRM_MODE_FLAG_VID_MODE_PANEL (1 << 29)
+#define DRM_MODE_FLAG_CMD_MODE_PANEL (1 << 30)
+#define DRM_MODE_FLAG_SEAMLESS (1 << 31)
+#define DRM_MODE_FLAG_ALL (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_CSYNC | DRM_MODE_FLAG_PCSYNC | DRM_MODE_FLAG_NCSYNC | DRM_MODE_FLAG_HSKEW | DRM_MODE_FLAG_DBLCLK | DRM_MODE_FLAG_CLKDIV2 | DRM_MODE_FLAG_SUPPORTS_RGB | DRM_MODE_FLAG_SUPPORTS_YUV | DRM_MODE_FLAG_VID_MODE_PANEL | DRM_MODE_FLAG_CMD_MODE_PANEL | DRM_MODE_FLAG_3D_MASK)
#define DRM_MODE_DPMS_ON 0
#define DRM_MODE_DPMS_STANDBY 1
#define DRM_MODE_DPMS_SUSPEND 2
@@ -191,17 +196,12 @@ struct drm_mode_get_encoder {
enum drm_mode_subconnector {
DRM_MODE_SUBCONNECTOR_Automatic = 0,
DRM_MODE_SUBCONNECTOR_Unknown = 0,
- DRM_MODE_SUBCONNECTOR_VGA = 1,
DRM_MODE_SUBCONNECTOR_DVID = 3,
DRM_MODE_SUBCONNECTOR_DVIA = 4,
DRM_MODE_SUBCONNECTOR_Composite = 5,
DRM_MODE_SUBCONNECTOR_SVIDEO = 6,
DRM_MODE_SUBCONNECTOR_Component = 8,
DRM_MODE_SUBCONNECTOR_SCART = 9,
- DRM_MODE_SUBCONNECTOR_DisplayPort = 10,
- DRM_MODE_SUBCONNECTOR_HDMIA = 11,
- DRM_MODE_SUBCONNECTOR_Native = 15,
- DRM_MODE_SUBCONNECTOR_Wireless = 18,
};
#define DRM_MODE_CONNECTOR_Unknown 0
#define DRM_MODE_CONNECTOR_VGA 1
@@ -309,6 +309,7 @@ struct drm_mode_fb_cmd {
};
#define DRM_MODE_FB_INTERLACED (1 << 0)
#define DRM_MODE_FB_MODIFIERS (1 << 1)
+#define DRM_MODE_FB_SECURE (1 << 2)
struct drm_mode_fb_cmd2 {
__u32 fb_id;
__u32 width;
diff --git a/libc/kernel/uapi/drm/i915_drm.h b/libc/kernel/uapi/drm/i915_drm.h
index f265d9237..2e6127525 100644
--- a/libc/kernel/uapi/drm/i915_drm.h
+++ b/libc/kernel/uapi/drm/i915_drm.h
@@ -67,7 +67,6 @@ enum drm_i915_pmu_engine_sample {
#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)
#define I915_PMU_INTERRUPTS __I915_PMU_OTHER(2)
#define I915_PMU_RC6_RESIDENCY __I915_PMU_OTHER(3)
-#define I915_PMU_SOFTWARE_GT_AWAKE_TIME __I915_PMU_OTHER(4)
#define I915_PMU_LAST I915_PMU_RC6_RESIDENCY
#define I915_NR_TEX_REGIONS 255
#define I915_LOG_MIN_TEX_REGION_SIZE 14
@@ -251,7 +250,6 @@ typedef struct _drm_i915_sarea {
#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
-#define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset)
#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
@@ -362,7 +360,6 @@ typedef struct drm_i915_irq_wait {
#define I915_PARAM_MMAP_GTT_COHERENT 52
#define I915_PARAM_HAS_EXEC_SUBMIT_FENCE 53
#define I915_PARAM_PERF_REVISION 54
-#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
typedef struct drm_i915_getparam {
__s32 param;
int __user * value;
@@ -444,17 +441,6 @@ struct drm_i915_gem_mmap_gtt {
__u32 pad;
__u64 offset;
};
-struct drm_i915_gem_mmap_offset {
- __u32 handle;
- __u32 pad;
- __u64 offset;
- __u64 flags;
-#define I915_MMAP_OFFSET_GTT 0
-#define I915_MMAP_OFFSET_WC 1
-#define I915_MMAP_OFFSET_WB 2
-#define I915_MMAP_OFFSET_UC 3
- __u64 extensions;
-};
struct drm_i915_gem_set_domain {
__u32 handle;
__u32 read_domains;
@@ -525,13 +511,6 @@ struct drm_i915_gem_exec_fence {
#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SIGNAL << 1))
__u32 flags;
};
-#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
-struct drm_i915_gem_execbuffer_ext_timeline_fences {
- struct i915_user_extension base;
- __u64 fence_count;
- __u64 handles_ptr;
- __u64 values_ptr;
-};
struct drm_i915_gem_execbuffer2 {
__u64 buffers_ptr;
__u32 buffer_count;
@@ -571,8 +550,7 @@ struct drm_i915_gem_execbuffer2 {
#define I915_EXEC_BATCH_FIRST (1 << 18)
#define I915_EXEC_FENCE_ARRAY (1 << 19)
#define I915_EXEC_FENCE_SUBMIT (1 << 20)
-#define I915_EXEC_USE_EXTENSIONS (1 << 21)
-#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_USE_EXTENSIONS << 1))
+#define __I915_EXEC_UNKNOWN_FLAGS (- (I915_EXEC_FENCE_SUBMIT << 1))
#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
#define i915_execbuffer2_set_context_id(eb2,context) (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
#define i915_execbuffer2_get_context_id(eb2) ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
@@ -735,7 +713,6 @@ struct drm_i915_gem_context_param {
#define I915_CONTEXT_PARAM_VM 0x9
#define I915_CONTEXT_PARAM_ENGINES 0xa
#define I915_CONTEXT_PARAM_PERSISTENCE 0xb
-#define I915_CONTEXT_PARAM_RINGSIZE 0xc
__u64 value;
};
struct drm_i915_gem_context_param_sseu {
@@ -846,8 +823,6 @@ enum drm_i915_perf_property_id {
DRM_I915_PERF_PROP_OA_FORMAT,
DRM_I915_PERF_PROP_OA_EXPONENT,
DRM_I915_PERF_PROP_HOLD_PREEMPTION,
- DRM_I915_PERF_PROP_GLOBAL_SSEU,
- DRM_I915_PERF_PROP_POLL_OA_PERIOD,
DRM_I915_PERF_PROP_MAX
};
struct drm_i915_perf_open_param {
diff --git a/libc/kernel/uapi/drm/lima_drm.h b/libc/kernel/uapi/drm/lima_drm.h
index bd8ba9ce0..bb70cf79d 100644
--- a/libc/kernel/uapi/drm/lima_drm.h
+++ b/libc/kernel/uapi/drm/lima_drm.h
@@ -38,7 +38,6 @@ struct drm_lima_get_param {
__u32 pad;
__u64 value;
};
-#define LIMA_BO_FLAG_HEAP (1 << 0)
struct drm_lima_gem_create {
__u32 size;
__u32 flags;
diff --git a/libc/kernel/uapi/drm/msm_drm.h b/libc/kernel/uapi/drm/msm_drm.h
index fcfcc20f9..3c1b734b2 100644
--- a/libc/kernel/uapi/drm/msm_drm.h
+++ b/libc/kernel/uapi/drm/msm_drm.h
@@ -114,16 +114,7 @@ struct drm_msm_gem_submit_bo {
#define MSM_SUBMIT_FENCE_FD_IN 0x40000000
#define MSM_SUBMIT_FENCE_FD_OUT 0x20000000
#define MSM_SUBMIT_SUDO 0x10000000
-#define MSM_SUBMIT_SYNCOBJ_IN 0x08000000
-#define MSM_SUBMIT_SYNCOBJ_OUT 0x04000000
-#define MSM_SUBMIT_FLAGS (MSM_SUBMIT_NO_IMPLICIT | MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_FENCE_FD_OUT | MSM_SUBMIT_SUDO | MSM_SUBMIT_SYNCOBJ_IN | MSM_SUBMIT_SYNCOBJ_OUT | 0)
-#define MSM_SUBMIT_SYNCOBJ_RESET 0x00000001
-#define MSM_SUBMIT_SYNCOBJ_FLAGS (MSM_SUBMIT_SYNCOBJ_RESET | 0)
-struct drm_msm_gem_submit_syncobj {
- __u32 handle;
- __u32 flags;
- __u64 point;
-};
+#define MSM_SUBMIT_FLAGS (MSM_SUBMIT_NO_IMPLICIT | MSM_SUBMIT_FENCE_FD_IN | MSM_SUBMIT_FENCE_FD_OUT | MSM_SUBMIT_SUDO | 0)
struct drm_msm_gem_submit {
__u32 flags;
__u32 fence;
@@ -133,12 +124,6 @@ struct drm_msm_gem_submit {
__u64 cmds;
__s32 fence_fd;
__u32 queueid;
- __u64 in_syncobjs;
- __u64 out_syncobjs;
- __u32 nr_in_syncobjs;
- __u32 nr_out_syncobjs;
- __u32 syncobj_stride;
- __u32 pad;
};
struct drm_msm_wait_fence {
__u32 fence;
diff --git a/libc/kernel/uapi/drm/nouveau_drm.h b/libc/kernel/uapi/drm/nouveau_drm.h
index 150f72982..186ffcc58 100644
--- a/libc/kernel/uapi/drm/nouveau_drm.h
+++ b/libc/kernel/uapi/drm/nouveau_drm.h
@@ -92,7 +92,6 @@ struct drm_nouveau_gem_pushbuf {
__u64 push;
__u32 suffix0;
__u32 suffix1;
-#define NOUVEAU_GEM_PUSHBUF_SYNC (1ULL << 0)
__u64 vram_available;
__u64 gart_available;
};
diff --git a/libc/kernel/uapi/drm/virtgpu_drm.h b/libc/kernel/uapi/drm/virtgpu_drm.h
index 842c1fd7a..bc4aad495 100644
--- a/libc/kernel/uapi/drm/virtgpu_drm.h
+++ b/libc/kernel/uapi/drm/virtgpu_drm.h
@@ -31,7 +31,6 @@ extern "C" {
#define DRM_VIRTGPU_TRANSFER_TO_HOST 0x07
#define DRM_VIRTGPU_WAIT 0x08
#define DRM_VIRTGPU_GET_CAPS 0x09
-#define DRM_VIRTGPU_RESOURCE_CREATE_BLOB 0x0a
#define VIRTGPU_EXECBUF_FENCE_FD_IN 0x01
#define VIRTGPU_EXECBUF_FENCE_FD_OUT 0x02
#define VIRTGPU_EXECBUF_FLAGS (VIRTGPU_EXECBUF_FENCE_FD_IN | VIRTGPU_EXECBUF_FENCE_FD_OUT | 0)
@@ -50,9 +49,6 @@ struct drm_virtgpu_execbuffer {
};
#define VIRTGPU_PARAM_3D_FEATURES 1
#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2
-#define VIRTGPU_PARAM_RESOURCE_BLOB 3
-#define VIRTGPU_PARAM_HOST_VISIBLE 4
-#define VIRTGPU_PARAM_CROSS_DEVICE 5
struct drm_virtgpu_getparam {
__u64 param;
__u64 value;
@@ -77,7 +73,7 @@ struct drm_virtgpu_resource_info {
__u32 bo_handle;
__u32 res_handle;
__u32 size;
- __u32 blob_mem;
+ __u32 stride;
};
struct drm_virtgpu_3d_box {
__u32 x;
@@ -92,16 +88,12 @@ struct drm_virtgpu_3d_transfer_to_host {
struct drm_virtgpu_3d_box box;
__u32 level;
__u32 offset;
- __u32 stride;
- __u32 layer_stride;
};
struct drm_virtgpu_3d_transfer_from_host {
__u32 bo_handle;
struct drm_virtgpu_3d_box box;
__u32 level;
__u32 offset;
- __u32 stride;
- __u32 layer_stride;
};
#define VIRTGPU_WAIT_NOWAIT 1
struct drm_virtgpu_3d_wait {
@@ -115,23 +107,6 @@ struct drm_virtgpu_get_caps {
__u32 size;
__u32 pad;
};
-struct drm_virtgpu_resource_create_blob {
-#define VIRTGPU_BLOB_MEM_GUEST 0x0001
-#define VIRTGPU_BLOB_MEM_HOST3D 0x0002
-#define VIRTGPU_BLOB_MEM_HOST3D_GUEST 0x0003
-#define VIRTGPU_BLOB_FLAG_USE_MAPPABLE 0x0001
-#define VIRTGPU_BLOB_FLAG_USE_SHAREABLE 0x0002
-#define VIRTGPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004
- __u32 blob_mem;
- __u32 blob_flags;
- __u32 bo_handle;
- __u32 res_handle;
- __u64 size;
- __u32 pad;
- __u32 cmd_size;
- __u64 cmd;
- __u64 blob_id;
-};
#define DRM_IOCTL_VIRTGPU_MAP DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_MAP, struct drm_virtgpu_map)
#define DRM_IOCTL_VIRTGPU_EXECBUFFER DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_EXECBUFFER, struct drm_virtgpu_execbuffer)
#define DRM_IOCTL_VIRTGPU_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GETPARAM, struct drm_virtgpu_getparam)
@@ -141,7 +116,6 @@ struct drm_virtgpu_resource_create_blob {
#define DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_TRANSFER_TO_HOST, struct drm_virtgpu_3d_transfer_to_host)
#define DRM_IOCTL_VIRTGPU_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_WAIT, struct drm_virtgpu_3d_wait)
#define DRM_IOCTL_VIRTGPU_GET_CAPS DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_GET_CAPS, struct drm_virtgpu_get_caps)
-#define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_BLOB, struct drm_virtgpu_resource_create_blob)
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/drm/vmwgfx_drm.h b/libc/kernel/uapi/drm/vmwgfx_drm.h
index 982b64f72..753192bcf 100644
--- a/libc/kernel/uapi/drm/vmwgfx_drm.h
+++ b/libc/kernel/uapi/drm/vmwgfx_drm.h
@@ -55,7 +55,6 @@ extern "C" {
#define DRM_VMW_CREATE_EXTENDED_CONTEXT 26
#define DRM_VMW_GB_SURFACE_CREATE_EXT 27
#define DRM_VMW_GB_SURFACE_REF_EXT 28
-#define DRM_VMW_MSG 29
#define DRM_VMW_PARAM_NUM_STREAMS 0
#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
#define DRM_VMW_PARAM_3D 2
@@ -71,7 +70,6 @@ extern "C" {
#define DRM_VMW_PARAM_DX 12
#define DRM_VMW_PARAM_HW_CAPS2 13
#define DRM_VMW_PARAM_SM4_1 14
-#define DRM_VMW_PARAM_SM5 15
enum drm_vmw_handle_type {
DRM_VMW_HANDLE_LEGACY = 0,
DRM_VMW_HANDLE_PRIME = 1
@@ -331,16 +329,15 @@ struct drm_vmw_handle_close_arg {
};
#define drm_vmw_unref_dmabuf_arg drm_vmw_handle_close_arg
enum drm_vmw_surface_version {
- drm_vmw_gb_surface_v1,
+ drm_vmw_gb_surface_v1
};
struct drm_vmw_gb_surface_create_ext_req {
struct drm_vmw_gb_surface_create_req base;
enum drm_vmw_surface_version version;
- __u32 svga3d_flags_upper_32_bits;
- __u32 multisample_pattern;
- __u32 quality_level;
- __u32 buffer_byte_stride;
- __u32 must_be_zero;
+ uint32_t svga3d_flags_upper_32_bits;
+ SVGA3dMSPattern multisample_pattern;
+ SVGA3dMSQualityLevel quality_level;
+ uint64_t must_be_zero;
};
union drm_vmw_gb_surface_create_ext_arg {
struct drm_vmw_gb_surface_create_rep rep;
@@ -354,12 +351,6 @@ union drm_vmw_gb_surface_reference_ext_arg {
struct drm_vmw_gb_surface_ref_ext_rep rep;
struct drm_vmw_surface_arg req;
};
-struct drm_vmw_msg_arg {
- __u64 send;
- __u64 receive;
- __s32 send_only;
- __u32 receive_len;
-};
#ifdef __cplusplus
}
#endif
diff --git a/libc/kernel/uapi/linux/acrn.h b/libc/kernel/uapi/linux/acrn.h
deleted file mode 100644
index 74b719a97..000000000
--- a/libc/kernel/uapi/linux/acrn.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_ACRN_H
-#define _UAPI_ACRN_H
-#include <linux/types.h>
-#include <linux/uuid.h>
-#define ACRN_IO_REQUEST_MAX 16
-#define ACRN_IOREQ_STATE_PENDING 0
-#define ACRN_IOREQ_STATE_COMPLETE 1
-#define ACRN_IOREQ_STATE_PROCESSING 2
-#define ACRN_IOREQ_STATE_FREE 3
-#define ACRN_IOREQ_TYPE_PORTIO 0
-#define ACRN_IOREQ_TYPE_MMIO 1
-#define ACRN_IOREQ_TYPE_PCICFG 2
-#define ACRN_IOREQ_DIR_READ 0
-#define ACRN_IOREQ_DIR_WRITE 1
-struct acrn_mmio_request {
- __u32 direction;
- __u32 reserved;
- __u64 address;
- __u64 size;
- __u64 value;
-};
-struct acrn_pio_request {
- __u32 direction;
- __u32 reserved;
- __u64 address;
- __u64 size;
- __u32 value;
-};
-struct acrn_pci_request {
- __u32 direction;
- __u32 reserved[3];
- __u64 size;
- __u32 value;
- __u32 bus;
- __u32 dev;
- __u32 func;
- __u32 reg;
-};
-struct acrn_io_request {
- __u32 type;
- __u32 completion_polling;
- __u32 reserved0[14];
- union {
- struct acrn_pio_request pio_request;
- struct acrn_pci_request pci_request;
- struct acrn_mmio_request mmio_request;
- __u64 data[8];
- } reqs;
- __u32 reserved1;
- __u32 kernel_handled;
- __u32 processed;
-} __attribute__((aligned(256)));
-struct acrn_io_request_buffer {
- union {
- struct acrn_io_request req_slot[ACRN_IO_REQUEST_MAX];
- __u8 reserved[4096];
- };
-};
-struct acrn_ioreq_notify {
- __u16 vmid;
- __u16 reserved;
- __u32 vcpu;
-};
-struct acrn_vm_creation {
- __u16 vmid;
- __u16 reserved0;
- __u16 vcpu_num;
- __u16 reserved1;
- guid_t uuid;
- __u64 vm_flag;
- __u64 ioreq_buf;
- __u64 cpu_affinity;
-};
-struct acrn_gp_regs {
- __le64 rax;
- __le64 rcx;
- __le64 rdx;
- __le64 rbx;
- __le64 rsp;
- __le64 rbp;
- __le64 rsi;
- __le64 rdi;
- __le64 r8;
- __le64 r9;
- __le64 r10;
- __le64 r11;
- __le64 r12;
- __le64 r13;
- __le64 r14;
- __le64 r15;
-};
-struct acrn_descriptor_ptr {
- __le16 limit;
- __le64 base;
- __le16 reserved[3];
-} __attribute__((__packed__));
-struct acrn_regs {
- struct acrn_gp_regs gprs;
- struct acrn_descriptor_ptr gdt;
- struct acrn_descriptor_ptr idt;
- __le64 rip;
- __le64 cs_base;
- __le64 cr0;
- __le64 cr4;
- __le64 cr3;
- __le64 ia32_efer;
- __le64 rflags;
- __le64 reserved_64[4];
- __le32 cs_ar;
- __le32 cs_limit;
- __le32 reserved_32[3];
- __le16 cs_sel;
- __le16 ss_sel;
- __le16 ds_sel;
- __le16 es_sel;
- __le16 fs_sel;
- __le16 gs_sel;
- __le16 ldt_sel;
- __le16 tr_sel;
-};
-struct acrn_vcpu_regs {
- __u16 vcpu_id;
- __u16 reserved[3];
- struct acrn_regs vcpu_regs;
-};
-#define ACRN_MEM_ACCESS_RIGHT_MASK 0x00000007U
-#define ACRN_MEM_ACCESS_READ 0x00000001U
-#define ACRN_MEM_ACCESS_WRITE 0x00000002U
-#define ACRN_MEM_ACCESS_EXEC 0x00000004U
-#define ACRN_MEM_ACCESS_RWX (ACRN_MEM_ACCESS_READ | ACRN_MEM_ACCESS_WRITE | ACRN_MEM_ACCESS_EXEC)
-#define ACRN_MEM_TYPE_MASK 0x000007C0U
-#define ACRN_MEM_TYPE_WB 0x00000040U
-#define ACRN_MEM_TYPE_WT 0x00000080U
-#define ACRN_MEM_TYPE_UC 0x00000100U
-#define ACRN_MEM_TYPE_WC 0x00000200U
-#define ACRN_MEM_TYPE_WP 0x00000400U
-#define ACRN_MEMMAP_RAM 0
-#define ACRN_MEMMAP_MMIO 1
-struct acrn_vm_memmap {
- __u32 type;
- __u32 attr;
- __u64 user_vm_pa;
- union {
- __u64 service_vm_pa;
- __u64 vma_base;
- };
- __u64 len;
-};
-#define ACRN_PTDEV_IRQ_INTX 0
-#define ACRN_PTDEV_IRQ_MSI 1
-#define ACRN_PTDEV_IRQ_MSIX 2
-struct acrn_ptdev_irq {
- __u32 type;
- __u16 virt_bdf;
- __u16 phys_bdf;
- struct {
- __u32 virt_pin;
- __u32 phys_pin;
- __u32 is_pic_pin;
- } intx;
-};
-#define ACRN_PTDEV_QUIRK_ASSIGN (1U << 0)
-#define ACRN_PCI_NUM_BARS 6
-struct acrn_pcidev {
- __u32 type;
- __u16 virt_bdf;
- __u16 phys_bdf;
- __u8 intr_line;
- __u8 intr_pin;
- __u32 bar[ACRN_PCI_NUM_BARS];
-};
-struct acrn_msi_entry {
- __u64 msi_addr;
- __u64 msi_data;
-};
-struct acrn_acpi_generic_address {
- __u8 space_id;
- __u8 bit_width;
- __u8 bit_offset;
- __u8 access_size;
- __u64 address;
-} __attribute__((__packed__));
-struct acrn_cstate_data {
- struct acrn_acpi_generic_address cx_reg;
- __u8 type;
- __u32 latency;
- __u64 power;
-};
-struct acrn_pstate_data {
- __u64 core_frequency;
- __u64 power;
- __u64 transition_latency;
- __u64 bus_master_latency;
- __u64 control;
- __u64 status;
-};
-#define PMCMD_TYPE_MASK 0x000000ff
-enum acrn_pm_cmd_type {
- ACRN_PMCMD_GET_PX_CNT,
- ACRN_PMCMD_GET_PX_DATA,
- ACRN_PMCMD_GET_CX_CNT,
- ACRN_PMCMD_GET_CX_DATA,
-};
-#define ACRN_IOEVENTFD_FLAG_PIO 0x01
-#define ACRN_IOEVENTFD_FLAG_DATAMATCH 0x02
-#define ACRN_IOEVENTFD_FLAG_DEASSIGN 0x04
-struct acrn_ioeventfd {
- __u32 fd;
- __u32 flags;
- __u64 addr;
- __u32 len;
- __u32 reserved;
- __u64 data;
-};
-#define ACRN_IRQFD_FLAG_DEASSIGN 0x01
-struct acrn_irqfd {
- __s32 fd;
- __u32 flags;
- struct acrn_msi_entry msi;
-};
-#define ACRN_IOCTL_TYPE 0xA2
-#define ACRN_IOCTL_CREATE_VM _IOWR(ACRN_IOCTL_TYPE, 0x10, struct acrn_vm_creation)
-#define ACRN_IOCTL_DESTROY_VM _IO(ACRN_IOCTL_TYPE, 0x11)
-#define ACRN_IOCTL_START_VM _IO(ACRN_IOCTL_TYPE, 0x12)
-#define ACRN_IOCTL_PAUSE_VM _IO(ACRN_IOCTL_TYPE, 0x13)
-#define ACRN_IOCTL_RESET_VM _IO(ACRN_IOCTL_TYPE, 0x15)
-#define ACRN_IOCTL_SET_VCPU_REGS _IOW(ACRN_IOCTL_TYPE, 0x16, struct acrn_vcpu_regs)
-#define ACRN_IOCTL_INJECT_MSI _IOW(ACRN_IOCTL_TYPE, 0x23, struct acrn_msi_entry)
-#define ACRN_IOCTL_VM_INTR_MONITOR _IOW(ACRN_IOCTL_TYPE, 0x24, unsigned long)
-#define ACRN_IOCTL_SET_IRQLINE _IOW(ACRN_IOCTL_TYPE, 0x25, __u64)
-#define ACRN_IOCTL_NOTIFY_REQUEST_FINISH _IOW(ACRN_IOCTL_TYPE, 0x31, struct acrn_ioreq_notify)
-#define ACRN_IOCTL_CREATE_IOREQ_CLIENT _IO(ACRN_IOCTL_TYPE, 0x32)
-#define ACRN_IOCTL_ATTACH_IOREQ_CLIENT _IO(ACRN_IOCTL_TYPE, 0x33)
-#define ACRN_IOCTL_DESTROY_IOREQ_CLIENT _IO(ACRN_IOCTL_TYPE, 0x34)
-#define ACRN_IOCTL_CLEAR_VM_IOREQ _IO(ACRN_IOCTL_TYPE, 0x35)
-#define ACRN_IOCTL_SET_MEMSEG _IOW(ACRN_IOCTL_TYPE, 0x41, struct acrn_vm_memmap)
-#define ACRN_IOCTL_UNSET_MEMSEG _IOW(ACRN_IOCTL_TYPE, 0x42, struct acrn_vm_memmap)
-#define ACRN_IOCTL_SET_PTDEV_INTR _IOW(ACRN_IOCTL_TYPE, 0x53, struct acrn_ptdev_irq)
-#define ACRN_IOCTL_RESET_PTDEV_INTR _IOW(ACRN_IOCTL_TYPE, 0x54, struct acrn_ptdev_irq)
-#define ACRN_IOCTL_ASSIGN_PCIDEV _IOW(ACRN_IOCTL_TYPE, 0x55, struct acrn_pcidev)
-#define ACRN_IOCTL_DEASSIGN_PCIDEV _IOW(ACRN_IOCTL_TYPE, 0x56, struct acrn_pcidev)
-#define ACRN_IOCTL_PM_GET_CPU_STATE _IOWR(ACRN_IOCTL_TYPE, 0x60, __u64)
-#define ACRN_IOCTL_IOEVENTFD _IOW(ACRN_IOCTL_TYPE, 0x70, struct acrn_ioeventfd)
-#define ACRN_IOCTL_IRQFD _IOW(ACRN_IOCTL_TYPE, 0x71, struct acrn_irqfd)
-#endif
diff --git a/libc/kernel/uapi/linux/android/binder.h b/libc/kernel/uapi/linux/android/binder.h
index 541634495..067400820 100644
--- a/libc/kernel/uapi/linux/android/binder.h
+++ b/libc/kernel/uapi/linux/android/binder.h
@@ -132,7 +132,6 @@ enum transaction_flags {
TF_ROOT_OBJECT = 0x04,
TF_STATUS_CODE = 0x08,
TF_ACCEPT_FDS = 0x10,
- TF_CLEAR_BUF = 0x20,
};
struct binder_transaction_data {
union {
diff --git a/libc/kernel/uapi/linux/audit.h b/libc/kernel/uapi/linux/audit.h
index 2c18e0795..d14f018d1 100644
--- a/libc/kernel/uapi/linux/audit.h
+++ b/libc/kernel/uapi/linux/audit.h
@@ -81,8 +81,6 @@
#define AUDIT_FANOTIFY 1331
#define AUDIT_TIME_INJOFFSET 1332
#define AUDIT_TIME_ADJNTPVAL 1333
-#define AUDIT_BPF 1334
-#define AUDIT_EVENT_LISTENER 1335
#define AUDIT_AVC 1400
#define AUDIT_SELINUX_ERR 1401
#define AUDIT_AVC_PATH 1402
@@ -248,7 +246,6 @@ enum {
#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
#define AUDIT_STATUS_BACKLOG_WAIT_TIME 0x0020
#define AUDIT_STATUS_LOST 0x0040
-#define AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL 0x0080
#define AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT 0x00000001
#define AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME 0x00000002
#define AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH 0x00000004
@@ -343,7 +340,6 @@ struct audit_status {
__u32 feature_bitmap;
};
__u32 backlog_wait_time;
- __u32 backlog_wait_time_actual;
};
struct audit_features {
#define AUDIT_FEATURE_VERSION 1
diff --git a/libc/kernel/uapi/linux/b1lli.h b/libc/kernel/uapi/linux/b1lli.h
new file mode 100644
index 000000000..29c7fe844
--- /dev/null
+++ b/libc/kernel/uapi/linux/b1lli.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _B1LLI_H_
+#define _B1LLI_H_
+typedef struct avmb1_t4file {
+ int len;
+ unsigned char * data;
+} avmb1_t4file;
+typedef struct avmb1_loaddef {
+ int contr;
+ avmb1_t4file t4file;
+} avmb1_loaddef;
+typedef struct avmb1_loadandconfigdef {
+ int contr;
+ avmb1_t4file t4file;
+ avmb1_t4file t4config;
+} avmb1_loadandconfigdef;
+typedef struct avmb1_resetdef {
+ int contr;
+} avmb1_resetdef;
+typedef struct avmb1_getdef {
+ int contr;
+ int cardtype;
+ int cardstate;
+} avmb1_getdef;
+typedef struct avmb1_carddef {
+ int port;
+ int irq;
+} avmb1_carddef;
+#define AVM_CARDTYPE_B1 0
+#define AVM_CARDTYPE_T1 1
+#define AVM_CARDTYPE_M1 2
+#define AVM_CARDTYPE_M2 3
+typedef struct avmb1_extcarddef {
+ int port;
+ int irq;
+ int cardtype;
+ int cardnr;
+} avmb1_extcarddef;
+#define AVMB1_LOAD 0
+#define AVMB1_ADDCARD 1
+#define AVMB1_RESETCARD 2
+#define AVMB1_LOAD_AND_CONFIG 3
+#define AVMB1_ADDCARD_WITH_TYPE 4
+#define AVMB1_GET_CARDINFO 5
+#define AVMB1_REMOVECARD 6
+#define AVMB1_REGISTERCARD_IS_OBSOLETE
+#endif
diff --git a/libc/kernel/uapi/linux/batman_adv.h b/libc/kernel/uapi/linux/batman_adv.h
index 9f48dacef..96b259b23 100644
--- a/libc/kernel/uapi/linux/batman_adv.h
+++ b/libc/kernel/uapi/linux/batman_adv.h
@@ -144,10 +144,4 @@ enum batadv_tp_meter_reason {
BATADV_TP_REASON_CANT_SEND = 132,
BATADV_TP_REASON_TOO_MANY = 133,
};
-enum batadv_ifla_attrs {
- IFLA_BATADV_UNSPEC,
- IFLA_BATADV_ALGO_NAME,
- __IFLA_BATADV_MAX,
-};
-#define IFLA_BATADV_MAX (__IFLA_BATADV_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/bcache.h b/libc/kernel/uapi/linux/bcache.h
index 25b69875b..1bee0a30a 100644
--- a/libc/kernel/uapi/linux/bcache.h
+++ b/libc/kernel/uapi/linux/bcache.h
@@ -54,55 +54,15 @@ struct bkey {
#define BCACHE_SB_VERSION_BDEV 1
#define BCACHE_SB_VERSION_CDEV_WITH_UUID 3
#define BCACHE_SB_VERSION_BDEV_WITH_OFFSET 4
-#define BCACHE_SB_VERSION_CDEV_WITH_FEATURES 5
-#define BCACHE_SB_VERSION_BDEV_WITH_FEATURES 6
-#define BCACHE_SB_MAX_VERSION 6
+#define BCACHE_SB_MAX_VERSION 4
#define SB_SECTOR 8
-#define SB_OFFSET (SB_SECTOR << SECTOR_SHIFT)
#define SB_SIZE 4096
#define SB_LABEL_SIZE 32
#define SB_JOURNAL_BUCKETS 256U
#define MAX_CACHES_PER_SET 8
#define BDEV_DATA_START_DEFAULT 16
-struct cache_sb_disk {
- __le64 csum;
- __le64 offset;
- __le64 version;
- __u8 magic[16];
- __u8 uuid[16];
- union {
- __u8 set_uuid[16];
- __le64 set_magic;
- };
- __u8 label[SB_LABEL_SIZE];
- __le64 flags;
- __le64 seq;
- __le64 feature_compat;
- __le64 feature_incompat;
- __le64 feature_ro_compat;
- __le64 pad[5];
- union {
- struct {
- __le64 nbuckets;
- __le16 block_size;
- __le16 bucket_size;
- __le16 nr_in_set;
- __le16 nr_this_dev;
- };
- struct {
- __le64 data_offset;
- };
- };
- __le32 last_mount;
- __le16 first_bucket;
- union {
- __le16 njournal_buckets;
- __le16 keys;
- };
- __le64 d[SB_JOURNAL_BUCKETS];
- __le16 obso_bucket_size_hi;
-};
struct cache_sb {
+ __u64 csum;
__u64 offset;
__u64 version;
__u8 magic[16];
@@ -114,16 +74,14 @@ struct cache_sb {
__u8 label[SB_LABEL_SIZE];
__u64 flags;
__u64 seq;
- __u64 feature_compat;
- __u64 feature_incompat;
- __u64 feature_ro_compat;
+ __u64 pad[8];
union {
struct {
__u64 nbuckets;
__u16 block_size;
+ __u16 bucket_size;
__u16 nr_in_set;
__u16 nr_this_dev;
- __u32 bucket_size;
};
struct {
__u64 data_offset;
diff --git a/libc/kernel/uapi/linux/binfmts.h b/libc/kernel/uapi/linux/binfmts.h
index 053be3cff..8c4fed03f 100644
--- a/libc/kernel/uapi/linux/binfmts.h
+++ b/libc/kernel/uapi/linux/binfmts.h
@@ -23,6 +23,4 @@ struct pt_regs;
#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
#define MAX_ARG_STRINGS 0x7FFFFFFF
#define BINPRM_BUF_SIZE 256
-#define AT_FLAGS_PRESERVE_ARGV0_BIT 0
-#define AT_FLAGS_PRESERVE_ARGV0 (1 << AT_FLAGS_PRESERVE_ARGV0_BIT)
#endif
diff --git a/libc/kernel/uapi/linux/blkzoned.h b/libc/kernel/uapi/linux/blkzoned.h
index b551e8b80..0b8ddd669 100644
--- a/libc/kernel/uapi/linux/blkzoned.h
+++ b/libc/kernel/uapi/linux/blkzoned.h
@@ -35,9 +35,6 @@ enum blk_zone_cond {
BLK_ZONE_COND_FULL = 0xE,
BLK_ZONE_COND_OFFLINE = 0xF,
};
-enum blk_zone_report_flags {
- BLK_ZONE_REP_CAPACITY = (1 << 0),
-};
struct blk_zone {
__u64 start;
__u64 len;
@@ -46,14 +43,12 @@ struct blk_zone {
__u8 cond;
__u8 non_seq;
__u8 reset;
- __u8 resv[4];
- __u64 capacity;
- __u8 reserved[24];
+ __u8 reserved[36];
};
struct blk_zone_report {
__u64 sector;
__u32 nr_zones;
- __u32 flags;
+ __u8 reserved[4];
struct blk_zone zones[0];
};
struct blk_zone_range {
diff --git a/libc/kernel/uapi/linux/bpf.h b/libc/kernel/uapi/linux/bpf.h
index c643ffa60..80a9febde 100644
--- a/libc/kernel/uapi/linux/bpf.h
+++ b/libc/kernel/uapi/linux/bpf.h
@@ -23,7 +23,6 @@
#define BPF_JMP32 0x06
#define BPF_ALU64 0x07
#define BPF_DW 0x18
-#define BPF_ATOMIC 0xc0
#define BPF_XADD 0xc0
#define BPF_MOV 0xb0
#define BPF_ARSH 0xc0
@@ -41,9 +40,6 @@
#define BPF_JSLE 0xd0
#define BPF_CALL 0x80
#define BPF_EXIT 0x90
-#define BPF_FETCH 0x01
-#define BPF_XCHG (0xe0 | BPF_FETCH)
-#define BPF_CMPXCHG (0xf0 | BPF_FETCH)
enum {
BPF_REG_0 = 0,
BPF_REG_1,
@@ -74,11 +70,6 @@ struct bpf_cgroup_storage_key {
__u64 cgroup_inode_id;
__u32 attach_type;
};
-union bpf_iter_link_info {
- struct {
- __u32 map_fd;
- } map;
-};
enum bpf_cmd {
BPF_MAP_CREATE,
BPF_MAP_LOOKUP_ELEM,
@@ -104,18 +95,6 @@ enum bpf_cmd {
BPF_MAP_LOOKUP_AND_DELETE_ELEM,
BPF_MAP_FREEZE,
BPF_BTF_GET_NEXT_ID,
- BPF_MAP_LOOKUP_BATCH,
- BPF_MAP_LOOKUP_AND_DELETE_BATCH,
- BPF_MAP_UPDATE_BATCH,
- BPF_MAP_DELETE_BATCH,
- BPF_LINK_CREATE,
- BPF_LINK_UPDATE,
- BPF_LINK_GET_FD_BY_ID,
- BPF_LINK_GET_NEXT_ID,
- BPF_ENABLE_STATS,
- BPF_ITER_CREATE,
- BPF_LINK_DETACH,
- BPF_PROG_BIND_MAP,
};
enum bpf_map_type {
BPF_MAP_TYPE_UNSPEC,
@@ -144,10 +123,6 @@ enum bpf_map_type {
BPF_MAP_TYPE_STACK,
BPF_MAP_TYPE_SK_STORAGE,
BPF_MAP_TYPE_DEVMAP_HASH,
- BPF_MAP_TYPE_STRUCT_OPS,
- BPF_MAP_TYPE_RINGBUF,
- BPF_MAP_TYPE_INODE_STORAGE,
- BPF_MAP_TYPE_TASK_STORAGE,
};
enum bpf_prog_type {
BPF_PROG_TYPE_UNSPEC,
@@ -177,10 +152,6 @@ enum bpf_prog_type {
BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
BPF_PROG_TYPE_CGROUP_SOCKOPT,
BPF_PROG_TYPE_TRACING,
- BPF_PROG_TYPE_STRUCT_OPS,
- BPF_PROG_TYPE_EXT,
- BPF_PROG_TYPE_LSM,
- BPF_PROG_TYPE_SK_LOOKUP,
};
enum bpf_attach_type {
BPF_CGROUP_INET_INGRESS,
@@ -209,69 +180,35 @@ enum bpf_attach_type {
BPF_TRACE_RAW_TP,
BPF_TRACE_FENTRY,
BPF_TRACE_FEXIT,
- BPF_MODIFY_RETURN,
- BPF_LSM_MAC,
- BPF_TRACE_ITER,
- BPF_CGROUP_INET4_GETPEERNAME,
- BPF_CGROUP_INET6_GETPEERNAME,
- BPF_CGROUP_INET4_GETSOCKNAME,
- BPF_CGROUP_INET6_GETSOCKNAME,
- BPF_XDP_DEVMAP,
- BPF_CGROUP_INET_SOCK_RELEASE,
- BPF_XDP_CPUMAP,
- BPF_SK_LOOKUP,
- BPF_XDP,
__MAX_BPF_ATTACH_TYPE
};
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
-enum bpf_link_type {
- BPF_LINK_TYPE_UNSPEC = 0,
- BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
- BPF_LINK_TYPE_TRACING = 2,
- BPF_LINK_TYPE_CGROUP = 3,
- BPF_LINK_TYPE_ITER = 4,
- BPF_LINK_TYPE_NETNS = 5,
- BPF_LINK_TYPE_XDP = 6,
- MAX_BPF_LINK_TYPE,
-};
#define BPF_F_ALLOW_OVERRIDE (1U << 0)
#define BPF_F_ALLOW_MULTI (1U << 1)
-#define BPF_F_REPLACE (1U << 2)
#define BPF_F_STRICT_ALIGNMENT (1U << 0)
#define BPF_F_ANY_ALIGNMENT (1U << 1)
#define BPF_F_TEST_RND_HI32 (1U << 2)
#define BPF_F_TEST_STATE_FREQ (1U << 3)
-#define BPF_F_SLEEPABLE (1U << 4)
#define BPF_PSEUDO_MAP_FD 1
#define BPF_PSEUDO_MAP_VALUE 2
-#define BPF_PSEUDO_BTF_ID 3
#define BPF_PSEUDO_CALL 1
-enum {
- BPF_ANY = 0,
- BPF_NOEXIST = 1,
- BPF_EXIST = 2,
- BPF_F_LOCK = 4,
-};
-enum {
- BPF_F_NO_PREALLOC = (1U << 0),
- BPF_F_NO_COMMON_LRU = (1U << 1),
- BPF_F_NUMA_NODE = (1U << 2),
- BPF_F_RDONLY = (1U << 3),
- BPF_F_WRONLY = (1U << 4),
- BPF_F_STACK_BUILD_ID = (1U << 5),
- BPF_F_ZERO_SEED = (1U << 6),
- BPF_F_RDONLY_PROG = (1U << 7),
- BPF_F_WRONLY_PROG = (1U << 8),
- BPF_F_CLONE = (1U << 9),
- BPF_F_MMAPABLE = (1U << 10),
- BPF_F_PRESERVE_ELEMS = (1U << 11),
- BPF_F_INNER_MAP = (1U << 12),
-};
+#define BPF_ANY 0
+#define BPF_NOEXIST 1
+#define BPF_EXIST 2
+#define BPF_F_LOCK 4
+#define BPF_F_NO_PREALLOC (1U << 0)
+#define BPF_F_NO_COMMON_LRU (1U << 1)
+#define BPF_F_NUMA_NODE (1U << 2)
+#define BPF_OBJ_NAME_LEN 16U
+#define BPF_F_RDONLY (1U << 3)
+#define BPF_F_WRONLY (1U << 4)
+#define BPF_F_STACK_BUILD_ID (1U << 5)
+#define BPF_F_ZERO_SEED (1U << 6)
+#define BPF_F_RDONLY_PROG (1U << 7)
+#define BPF_F_WRONLY_PROG (1U << 8)
+#define BPF_F_CLONE (1U << 9)
+#define BPF_F_MMAPABLE (1U << 10)
#define BPF_F_QUERY_EFFECTIVE (1U << 0)
-#define BPF_F_TEST_RUN_ON_CPU (1U << 0)
-enum bpf_stats_type {
- BPF_STATS_RUN_TIME = 0,
-};
enum bpf_stack_build_id_status {
BPF_STACK_BUILD_ID_EMPTY = 0,
BPF_STACK_BUILD_ID_VALID = 1,
@@ -286,7 +223,6 @@ struct bpf_stack_build_id {
__u64 ip;
};
};
-#define BPF_OBJ_NAME_LEN 16U
union bpf_attr {
struct {
__u32 map_type;
@@ -301,7 +237,6 @@ union bpf_attr {
__u32 btf_fd;
__u32 btf_key_type_id;
__u32 btf_value_type_id;
- __u32 btf_vmlinux_value_type_id;
};
struct {
__u32 map_fd;
@@ -313,16 +248,6 @@ union bpf_attr {
__u64 flags;
};
struct {
- __aligned_u64 in_batch;
- __aligned_u64 out_batch;
- __aligned_u64 keys;
- __aligned_u64 values;
- __u32 count;
- __u32 map_fd;
- __u64 elem_flags;
- __u64 flags;
- } batch;
- struct {
__u32 prog_type;
__u32 insn_cnt;
__aligned_u64 insns;
@@ -343,10 +268,7 @@ union bpf_attr {
__aligned_u64 line_info;
__u32 line_info_cnt;
__u32 attach_btf_id;
- union {
- __u32 attach_prog_fd;
- __u32 attach_btf_obj_fd;
- };
+ __u32 attach_prog_fd;
};
struct {
__aligned_u64 pathname;
@@ -358,7 +280,6 @@ union bpf_attr {
__u32 attach_bpf_fd;
__u32 attach_type;
__u32 attach_flags;
- __u32 replace_bpf_fd;
};
struct {
__u32 prog_fd;
@@ -373,8 +294,6 @@ union bpf_attr {
__u32 ctx_size_out;
__aligned_u64 ctx_in;
__aligned_u64 ctx_out;
- __u32 flags;
- __u32 cpu;
} test;
struct {
union {
@@ -382,7 +301,6 @@ union bpf_attr {
__u32 prog_id;
__u32 map_id;
__u32 btf_id;
- __u32 link_id;
};
__u32 next_id;
__u32 open_flags;
@@ -422,136 +340,43 @@ union bpf_attr {
__u64 probe_offset;
__u64 probe_addr;
} task_fd_query;
- struct {
- __u32 prog_fd;
- union {
- __u32 target_fd;
- __u32 target_ifindex;
- };
- __u32 attach_type;
- __u32 flags;
- union {
- __u32 target_btf_id;
- struct {
- __aligned_u64 iter_info;
- __u32 iter_info_len;
- };
- };
- } link_create;
- struct {
- __u32 link_fd;
- __u32 new_prog_fd;
- __u32 flags;
- __u32 old_prog_fd;
- } link_update;
- struct {
- __u32 link_fd;
- } link_detach;
- struct {
- __u32 type;
- } enable_stats;
- struct {
- __u32 link_fd;
- __u32 flags;
- } iter_create;
- struct {
- __u32 prog_fd;
- __u32 map_fd;
- __u32 flags;
- } prog_bind_map;
} __attribute__((aligned(8)));
-#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str), FN(tcp_send_ack), FN(send_signal_thread), FN(jiffies64), FN(read_branch_records), FN(get_ns_current_pid_tgid), FN(xdp_output), FN(get_netns_cookie), FN(get_current_ancestor_cgroup_id), FN(sk_assign), FN(ktime_get_boot_ns), FN(seq_printf), FN(seq_write), FN(sk_cgroup_id), FN(sk_ancestor_cgroup_id), FN(ringbuf_output), FN(ringbuf_reserve), FN(ringbuf_submit), FN(ringbuf_discard), FN(ringbuf_query), FN(csum_level), FN(skc_to_tcp6_sock), FN(skc_to_tcp_sock), FN(skc_to_tcp_timewait_sock), FN(skc_to_tcp_request_sock), FN(skc_to_udp6_sock), FN(get_task_stack), FN(load_hdr_opt), FN(store_hdr_opt), FN(reserve_hdr_opt), FN(inode_storage_get), FN(inode_storage_delete), FN(d_path), FN(copy_from_user), FN(snprintf_btf), FN(seq_printf_btf), FN(skb_cgroup_classid), FN(redirect_neigh), FN(per_cpu_ptr), FN(this_cpu_ptr), FN(redirect_peer), FN(task_storage_get), FN(task_storage_delete), FN(get_current_task_btf), FN(bprm_opts_set), FN(ktime_get_coarse_ns), FN(ima_inode_hash), FN(sock_from_file), FN(check_mtu),
+#define __BPF_FUNC_MAPPER(FN) FN(unspec), FN(map_lookup_elem), FN(map_update_elem), FN(map_delete_elem), FN(probe_read), FN(ktime_get_ns), FN(trace_printk), FN(get_prandom_u32), FN(get_smp_processor_id), FN(skb_store_bytes), FN(l3_csum_replace), FN(l4_csum_replace), FN(tail_call), FN(clone_redirect), FN(get_current_pid_tgid), FN(get_current_uid_gid), FN(get_current_comm), FN(get_cgroup_classid), FN(skb_vlan_push), FN(skb_vlan_pop), FN(skb_get_tunnel_key), FN(skb_set_tunnel_key), FN(perf_event_read), FN(redirect), FN(get_route_realm), FN(perf_event_output), FN(skb_load_bytes), FN(get_stackid), FN(csum_diff), FN(skb_get_tunnel_opt), FN(skb_set_tunnel_opt), FN(skb_change_proto), FN(skb_change_type), FN(skb_under_cgroup), FN(get_hash_recalc), FN(get_current_task), FN(probe_write_user), FN(current_task_under_cgroup), FN(skb_change_tail), FN(skb_pull_data), FN(csum_update), FN(set_hash_invalid), FN(get_numa_node_id), FN(skb_change_head), FN(xdp_adjust_head), FN(probe_read_str), FN(get_socket_cookie), FN(get_socket_uid), FN(set_hash), FN(setsockopt), FN(skb_adjust_room), FN(redirect_map), FN(sk_redirect_map), FN(sock_map_update), FN(xdp_adjust_meta), FN(perf_event_read_value), FN(perf_prog_read_value), FN(getsockopt), FN(override_return), FN(sock_ops_cb_flags_set), FN(msg_redirect_map), FN(msg_apply_bytes), FN(msg_cork_bytes), FN(msg_pull_data), FN(bind), FN(xdp_adjust_tail), FN(skb_get_xfrm_state), FN(get_stack), FN(skb_load_bytes_relative), FN(fib_lookup), FN(sock_hash_update), FN(msg_redirect_hash), FN(sk_redirect_hash), FN(lwt_push_encap), FN(lwt_seg6_store_bytes), FN(lwt_seg6_adjust_srh), FN(lwt_seg6_action), FN(rc_repeat), FN(rc_keydown), FN(skb_cgroup_id), FN(get_current_cgroup_id), FN(get_local_storage), FN(sk_select_reuseport), FN(skb_ancestor_cgroup_id), FN(sk_lookup_tcp), FN(sk_lookup_udp), FN(sk_release), FN(map_push_elem), FN(map_pop_elem), FN(map_peek_elem), FN(msg_push_data), FN(msg_pop_data), FN(rc_pointer_rel), FN(spin_lock), FN(spin_unlock), FN(sk_fullsock), FN(tcp_sock), FN(skb_ecn_set_ce), FN(get_listener_sock), FN(skc_lookup_tcp), FN(tcp_check_syncookie), FN(sysctl_get_name), FN(sysctl_get_current_value), FN(sysctl_get_new_value), FN(sysctl_set_new_value), FN(strtol), FN(strtoul), FN(sk_storage_get), FN(sk_storage_delete), FN(send_signal), FN(tcp_gen_syncookie), FN(skb_output), FN(probe_read_user), FN(probe_read_kernel), FN(probe_read_user_str), FN(probe_read_kernel_str),
#define __BPF_ENUM_FN(x) BPF_FUNC_ ##x
enum bpf_func_id {
__BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID,
};
#undef __BPF_ENUM_FN
-enum {
- BPF_F_RECOMPUTE_CSUM = (1ULL << 0),
- BPF_F_INVALIDATE_HASH = (1ULL << 1),
-};
-enum {
- BPF_F_HDR_FIELD_MASK = 0xfULL,
-};
-enum {
- BPF_F_PSEUDO_HDR = (1ULL << 4),
- BPF_F_MARK_MANGLED_0 = (1ULL << 5),
- BPF_F_MARK_ENFORCE = (1ULL << 6),
-};
-enum {
- BPF_F_INGRESS = (1ULL << 0),
-};
-enum {
- BPF_F_TUNINFO_IPV6 = (1ULL << 0),
-};
-enum {
- BPF_F_SKIP_FIELD_MASK = 0xffULL,
- BPF_F_USER_STACK = (1ULL << 8),
- BPF_F_FAST_STACK_CMP = (1ULL << 9),
- BPF_F_REUSE_STACKID = (1ULL << 10),
- BPF_F_USER_BUILD_ID = (1ULL << 11),
-};
-enum {
- BPF_F_ZERO_CSUM_TX = (1ULL << 1),
- BPF_F_DONT_FRAGMENT = (1ULL << 2),
- BPF_F_SEQ_NUMBER = (1ULL << 3),
-};
-enum {
- BPF_F_INDEX_MASK = 0xffffffffULL,
- BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK,
- BPF_F_CTXLEN_MASK = (0xfffffULL << 32),
-};
-enum {
- BPF_F_CURRENT_NETNS = (- 1L),
-};
-enum {
- BPF_CSUM_LEVEL_QUERY,
- BPF_CSUM_LEVEL_INC,
- BPF_CSUM_LEVEL_DEC,
- BPF_CSUM_LEVEL_RESET,
-};
-enum {
- BPF_F_ADJ_ROOM_FIXED_GSO = (1ULL << 0),
- BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = (1ULL << 1),
- BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = (1ULL << 2),
- BPF_F_ADJ_ROOM_ENCAP_L4_GRE = (1ULL << 3),
- BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4),
- BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5),
-};
-enum {
- BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff,
- BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56,
-};
+#define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
+#define BPF_F_INVALIDATE_HASH (1ULL << 1)
+#define BPF_F_HDR_FIELD_MASK 0xfULL
+#define BPF_F_PSEUDO_HDR (1ULL << 4)
+#define BPF_F_MARK_MANGLED_0 (1ULL << 5)
+#define BPF_F_MARK_ENFORCE (1ULL << 6)
+#define BPF_F_INGRESS (1ULL << 0)
+#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
+#define BPF_F_SKIP_FIELD_MASK 0xffULL
+#define BPF_F_USER_STACK (1ULL << 8)
+#define BPF_F_FAST_STACK_CMP (1ULL << 9)
+#define BPF_F_REUSE_STACKID (1ULL << 10)
+#define BPF_F_USER_BUILD_ID (1ULL << 11)
+#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
+#define BPF_F_DONT_FRAGMENT (1ULL << 2)
+#define BPF_F_SEQ_NUMBER (1ULL << 3)
+#define BPF_F_INDEX_MASK 0xffffffffULL
+#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
+#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)
+#define BPF_F_CURRENT_NETNS (- 1L)
+#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)
+#define BPF_ADJ_ROOM_ENCAP_L2_MASK 0xff
+#define BPF_ADJ_ROOM_ENCAP_L2_SHIFT 56
+#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1)
+#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2)
+#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3)
+#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4)
#define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64) len & BPF_ADJ_ROOM_ENCAP_L2_MASK) << BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
-enum {
- BPF_F_SYSCTL_BASE_NAME = (1ULL << 0),
-};
-enum {
- BPF_LOCAL_STORAGE_GET_F_CREATE = (1ULL << 0),
- BPF_SK_STORAGE_GET_F_CREATE = BPF_LOCAL_STORAGE_GET_F_CREATE,
-};
-enum {
- BPF_F_GET_BRANCH_RECORDS_SIZE = (1ULL << 0),
-};
-enum {
- BPF_RB_NO_WAKEUP = (1ULL << 0),
- BPF_RB_FORCE_WAKEUP = (1ULL << 1),
-};
-enum {
- BPF_RB_AVAIL_DATA = 0,
- BPF_RB_RING_SIZE = 1,
- BPF_RB_CONS_POS = 2,
- BPF_RB_PROD_POS = 3,
-};
-enum {
- BPF_RINGBUF_BUSY_BIT = (1U << 31),
- BPF_RINGBUF_DISCARD_BIT = (1U << 30),
- BPF_RINGBUF_HDR_SZ = 8,
-};
-enum {
- BPF_SK_LOOKUP_F_REPLACE = (1ULL << 0),
- BPF_SK_LOOKUP_F_NO_REUSEPORT = (1ULL << 1),
-};
+#define BPF_F_SYSCTL_BASE_NAME (1ULL << 0)
+#define BPF_SK_STORAGE_GET_F_CREATE (1ULL << 0)
enum bpf_adj_room_mode {
BPF_ADJ_ROOM_NET,
BPF_ADJ_ROOM_MAC,
@@ -565,9 +390,6 @@ enum bpf_lwt_encap_mode {
BPF_LWT_ENCAP_SEG6_INLINE,
BPF_LWT_ENCAP_IP,
};
-enum {
- BPF_F_BPRM_SECUREEXEC = (1ULL << 0),
-};
#define __bpf_md_ptr(type,name) union { type name; __u64 : 64; \
} __attribute__((aligned(8)))
struct __sk_buff {
@@ -602,7 +424,6 @@ struct __sk_buff {
__u32 wire_len;
__u32 gso_segs;
__bpf_md_ptr(struct bpf_sock *, sk);
- __u32 gso_size;
};
struct bpf_tunnel_key {
__u32 tunnel_id;
@@ -645,7 +466,6 @@ struct bpf_sock {
__u32 dst_ip4;
__u32 dst_ip6[4];
__u32 state;
- __s32 rx_queue_mapping;
};
struct bpf_tcp_sock {
__u32 snd_cwnd;
@@ -708,21 +528,6 @@ struct xdp_md {
__u32 data_meta;
__u32 ingress_ifindex;
__u32 rx_queue_index;
- __u32 egress_ifindex;
-};
-struct bpf_devmap_val {
- __u32 ifindex;
- union {
- int fd;
- __u32 id;
- } bpf_prog;
-};
-struct bpf_cpumap_val {
- __u32 qsize;
- union {
- int fd;
- __u32 id;
- } bpf_prog;
};
enum sk_action {
SK_DROP = 0,
@@ -739,7 +544,6 @@ struct sk_msg_md {
__u32 remote_port;
__u32 local_port;
__u32 size;
- __bpf_md_ptr(struct bpf_sock *, sk);
};
struct sk_reuseport_md {
__bpf_md_ptr(void *, data);
@@ -787,7 +591,6 @@ struct bpf_prog_info {
__aligned_u64 prog_tags;
__u64 run_time_ns;
__u64 run_cnt;
- __u64 recursion_misses;
} __attribute__((aligned(8)));
struct bpf_map_info {
__u32 type;
@@ -798,7 +601,7 @@ struct bpf_map_info {
__u32 map_flags;
char name[BPF_OBJ_NAME_LEN];
__u32 ifindex;
- __u32 btf_vmlinux_value_type_id;
+ __u32 : 32;
__u64 netns_dev;
__u64 netns_ino;
__u32 btf_id;
@@ -809,43 +612,6 @@ struct bpf_btf_info {
__aligned_u64 btf;
__u32 btf_size;
__u32 id;
- __aligned_u64 name;
- __u32 name_len;
- __u32 kernel_btf;
-} __attribute__((aligned(8)));
-struct bpf_link_info {
- __u32 type;
- __u32 id;
- __u32 prog_id;
- union {
- struct {
- __aligned_u64 tp_name;
- __u32 tp_name_len;
- } raw_tracepoint;
- struct {
- __u32 attach_type;
- } tracing;
- struct {
- __u64 cgroup_id;
- __u32 attach_type;
- } cgroup;
- struct {
- __aligned_u64 target_name;
- __u32 target_name_len;
- union {
- struct {
- __u32 map_id;
- } map;
- };
- } iter;
- struct {
- __u32 netns_ino;
- __u32 attach_type;
- } netns;
- struct {
- __u32 ifindex;
- } xdp;
- };
} __attribute__((aligned(8)));
struct bpf_sock_addr {
__u32 user_family;
@@ -900,21 +666,12 @@ struct bpf_sock_ops {
__u64 bytes_received;
__u64 bytes_acked;
__bpf_md_ptr(struct bpf_sock *, sk);
- __bpf_md_ptr(void *, skb_data);
- __bpf_md_ptr(void *, skb_data_end);
- __u32 skb_len;
- __u32 skb_tcp_flags;
-};
-enum {
- BPF_SOCK_OPS_RTO_CB_FLAG = (1 << 0),
- BPF_SOCK_OPS_RETRANS_CB_FLAG = (1 << 1),
- BPF_SOCK_OPS_STATE_CB_FLAG = (1 << 2),
- BPF_SOCK_OPS_RTT_CB_FLAG = (1 << 3),
- BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = (1 << 4),
- BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = (1 << 5),
- BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = (1 << 6),
- BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7F,
};
+#define BPF_SOCK_OPS_RTO_CB_FLAG (1 << 0)
+#define BPF_SOCK_OPS_RETRANS_CB_FLAG (1 << 1)
+#define BPF_SOCK_OPS_STATE_CB_FLAG (1 << 2)
+#define BPF_SOCK_OPS_RTT_CB_FLAG (1 << 3)
+#define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF
enum {
BPF_SOCK_OPS_VOID,
BPF_SOCK_OPS_TIMEOUT_INIT,
@@ -929,9 +686,6 @@ enum {
BPF_SOCK_OPS_STATE_CB,
BPF_SOCK_OPS_TCP_LISTEN_CB,
BPF_SOCK_OPS_RTT_CB,
- BPF_SOCK_OPS_PARSE_HDR_OPT_CB,
- BPF_SOCK_OPS_HDR_OPT_LEN_CB,
- BPF_SOCK_OPS_WRITE_HDR_OPT_CB,
};
enum {
BPF_TCP_ESTABLISHED = 1,
@@ -948,36 +702,18 @@ enum {
BPF_TCP_NEW_SYN_RECV,
BPF_TCP_MAX_STATES
};
-enum {
- TCP_BPF_IW = 1001,
- TCP_BPF_SNDCWND_CLAMP = 1002,
- TCP_BPF_DELACK_MAX = 1003,
- TCP_BPF_RTO_MIN = 1004,
- TCP_BPF_SYN = 1005,
- TCP_BPF_SYN_IP = 1006,
- TCP_BPF_SYN_MAC = 1007,
-};
-enum {
- BPF_LOAD_HDR_OPT_TCP_SYN = (1ULL << 0),
-};
-enum {
- BPF_WRITE_HDR_TCP_CURRENT_MSS = 1,
- BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 2,
-};
+#define TCP_BPF_IW 1001
+#define TCP_BPF_SNDCWND_CLAMP 1002
struct bpf_perf_event_value {
__u64 counter;
__u64 enabled;
__u64 running;
};
-enum {
- BPF_DEVCG_ACC_MKNOD = (1ULL << 0),
- BPF_DEVCG_ACC_READ = (1ULL << 1),
- BPF_DEVCG_ACC_WRITE = (1ULL << 2),
-};
-enum {
- BPF_DEVCG_DEV_BLOCK = (1ULL << 0),
- BPF_DEVCG_DEV_CHAR = (1ULL << 1),
-};
+#define BPF_DEVCG_ACC_MKNOD (1ULL << 0)
+#define BPF_DEVCG_ACC_READ (1ULL << 1)
+#define BPF_DEVCG_ACC_WRITE (1ULL << 2)
+#define BPF_DEVCG_DEV_BLOCK (1ULL << 0)
+#define BPF_DEVCG_DEV_CHAR (1ULL << 1)
struct bpf_cgroup_dev_ctx {
__u32 access_type;
__u32 major;
@@ -986,10 +722,8 @@ struct bpf_cgroup_dev_ctx {
struct bpf_raw_tracepoint_args {
__u64 args[0];
};
-enum {
- BPF_FIB_LOOKUP_DIRECT = (1U << 0),
- BPF_FIB_LOOKUP_OUTPUT = (1U << 1),
-};
+#define BPF_FIB_LOOKUP_DIRECT (1U << 0)
+#define BPF_FIB_LOOKUP_OUTPUT (1U << 1)
enum {
BPF_FIB_LKUP_RET_SUCCESS,
BPF_FIB_LKUP_RET_BLACKHOLE,
@@ -1006,10 +740,7 @@ struct bpf_fib_lookup {
__u8 l4_protocol;
__be16 sport;
__be16 dport;
- union {
- __u16 tot_len;
- __u16 mtu_result;
- };
+ __u16 tot_len;
__u32 ifindex;
union {
__u8 tos;
@@ -1029,21 +760,6 @@ struct bpf_fib_lookup {
__u8 smac[6];
__u8 dmac[6];
};
-struct bpf_redir_neigh {
- __u32 nh_family;
- union {
- __be32 ipv4_nh;
- __u32 ipv6_nh[4];
- };
-};
-enum bpf_check_mtu_flags {
- BPF_MTU_CHK_SEGS = (1U << 0),
-};
-enum bpf_check_mtu_ret {
- BPF_MTU_CHK_RET_SUCCESS,
- BPF_MTU_CHK_RET_FRAG_NEEDED,
- BPF_MTU_CHK_RET_SEGS_TOOBIG,
-};
enum bpf_task_fd_type {
BPF_FD_TYPE_RAW_TRACEPOINT,
BPF_FD_TYPE_TRACEPOINT,
@@ -1052,11 +768,9 @@ enum bpf_task_fd_type {
BPF_FD_TYPE_UPROBE,
BPF_FD_TYPE_URETPROBE,
};
-enum {
- BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = (1U << 0),
- BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = (1U << 1),
- BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = (1U << 2),
-};
+#define BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG (1U << 0)
+#define BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL (1U << 1)
+#define BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP (1U << 2)
struct bpf_flow_keys {
__u16 nhoff;
__u16 thoff;
@@ -1109,30 +823,4 @@ struct bpf_sockopt {
__s32 optlen;
__s32 retval;
};
-struct bpf_pidns_info {
- __u32 pid;
- __u32 tgid;
-};
-struct bpf_sk_lookup {
- __bpf_md_ptr(struct bpf_sock *, sk);
- __u32 family;
- __u32 protocol;
- __u32 remote_ip4;
- __u32 remote_ip6[4];
- __u32 remote_port;
- __u32 local_ip4;
- __u32 local_ip6[4];
- __u32 local_port;
-};
-struct btf_ptr {
- void * ptr;
- __u32 type_id;
- __u32 flags;
-};
-enum {
- BTF_F_COMPACT = (1ULL << 0),
- BTF_F_NONAME = (1ULL << 1),
- BTF_F_PTR_RAW = (1ULL << 2),
- BTF_F_ZERO = (1ULL << 3),
-};
#endif
diff --git a/libc/kernel/uapi/linux/btf.h b/libc/kernel/uapi/linux/btf.h
index f22d637d4..21e7596c1 100644
--- a/libc/kernel/uapi/linux/btf.h
+++ b/libc/kernel/uapi/linux/btf.h
@@ -91,13 +91,7 @@ struct btf_param {
};
enum {
BTF_VAR_STATIC = 0,
- BTF_VAR_GLOBAL_ALLOCATED = 1,
- BTF_VAR_GLOBAL_EXTERN = 2,
-};
-enum btf_func_linkage {
- BTF_FUNC_STATIC = 0,
- BTF_FUNC_GLOBAL = 1,
- BTF_FUNC_EXTERN = 2,
+ BTF_VAR_GLOBAL_ALLOCATED,
};
struct btf_var {
__u32 linkage;
diff --git a/libc/kernel/uapi/linux/btrfs.h b/libc/kernel/uapi/linux/btrfs.h
index c0a586c87..684b295c3 100644
--- a/libc/kernel/uapi/linux/btrfs.h
+++ b/libc/kernel/uapi/linux/btrfs.h
@@ -34,8 +34,7 @@ struct btrfs_ioctl_vol_args {
#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
-#define BTRFS_SUBVOL_SPEC_BY_ID (1ULL << 4)
-#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT | BTRFS_DEVICE_SPEC_BY_ID | BTRFS_SUBVOL_SPEC_BY_ID)
+#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED (BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT | BTRFS_DEVICE_SPEC_BY_ID)
#define BTRFS_FSID_SIZE 16
#define BTRFS_UUID_SIZE 16
#define BTRFS_UUID_UNPARSED_SIZE 37
@@ -65,9 +64,6 @@ struct btrfs_ioctl_qgroup_limit_args {
__u64 qgroupid;
struct btrfs_qgroup_limit lim;
};
-#define BTRFS_DEVICE_REMOVE_ARGS_MASK (BTRFS_DEVICE_SPEC_BY_ID)
-#define BTRFS_SUBVOL_CREATE_ARGS_MASK (BTRFS_SUBVOL_RDONLY | BTRFS_SUBVOL_QGROUP_INHERIT)
-#define BTRFS_SUBVOL_DELETE_ARGS_MASK (BTRFS_SUBVOL_SPEC_BY_ID)
struct btrfs_ioctl_vol_args_v2 {
__s64 fd;
__u64 transid;
@@ -82,7 +78,6 @@ struct btrfs_ioctl_vol_args_v2 {
union {
char name[BTRFS_SUBVOL_NAME_MAX + 1];
__u64 devid;
- __u64 subvolid;
};
};
struct btrfs_scrub_progress {
@@ -156,9 +151,6 @@ struct btrfs_ioctl_dev_info_args {
__u64 unused[379];
__u8 path[BTRFS_DEVICE_PATH_NAME_MAX];
};
-#define BTRFS_FS_INFO_FLAG_CSUM_INFO (1 << 0)
-#define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1)
-#define BTRFS_FS_INFO_FLAG_METADATA_UUID (1 << 2)
struct btrfs_ioctl_fs_info_args {
__u64 max_id;
__u64 num_devices;
@@ -166,12 +158,8 @@ struct btrfs_ioctl_fs_info_args {
__u32 nodesize;
__u32 sectorsize;
__u32 clone_alignment;
- __u16 csum_type;
- __u16 csum_size;
- __u64 flags;
- __u64 generation;
- __u8 metadata_uuid[BTRFS_FSID_SIZE];
- __u8 reserved[944];
+ __u32 reserved32;
+ __u64 reserved[122];
};
#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0)
#define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID (1ULL << 1)
@@ -187,7 +175,6 @@ struct btrfs_ioctl_fs_info_args {
#define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9)
#define BTRFS_FEATURE_INCOMPAT_METADATA_UUID (1ULL << 10)
#define BTRFS_FEATURE_INCOMPAT_RAID1C34 (1ULL << 11)
-#define BTRFS_FEATURE_INCOMPAT_ZONED (1ULL << 12)
struct btrfs_ioctl_feature_flags {
__u64 compat_flags;
__u64 compat_ro_flags;
@@ -530,5 +517,4 @@ enum btrfs_err_code {
#define BTRFS_IOC_GET_SUBVOL_INFO _IOR(BTRFS_IOCTL_MAGIC, 60, struct btrfs_ioctl_get_subvol_info_args)
#define BTRFS_IOC_GET_SUBVOL_ROOTREF _IOWR(BTRFS_IOCTL_MAGIC, 61, struct btrfs_ioctl_get_subvol_rootref_args)
#define BTRFS_IOC_INO_LOOKUP_USER _IOWR(BTRFS_IOCTL_MAGIC, 62, struct btrfs_ioctl_ino_lookup_user_args)
-#define BTRFS_IOC_SNAP_DESTROY_V2 _IOW(BTRFS_IOCTL_MAGIC, 63, struct btrfs_ioctl_vol_args_v2)
#endif
diff --git a/libc/kernel/uapi/linux/btrfs_tree.h b/libc/kernel/uapi/linux/btrfs_tree.h
index 4e36c37f5..50ada3605 100644
--- a/libc/kernel/uapi/linux/btrfs_tree.h
+++ b/libc/kernel/uapi/linux/btrfs_tree.h
@@ -20,7 +20,6 @@
#define _BTRFS_CTREE_H_
#include <linux/btrfs.h>
#include <linux/types.h>
-#include <stddef.h>
#define BTRFS_ROOT_TREE_OBJECTID 1ULL
#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
@@ -92,7 +91,6 @@
#define BTRFS_UUID_KEY_SUBVOL 251
#define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252
#define BTRFS_STRING_ITEM_KEY 253
-#define BTRFS_MAX_METADATA_BLOCKSIZE 65536
#define BTRFS_CSUM_SIZE 32
enum btrfs_csum_type {
BTRFS_CSUM_TYPE_CRC32 = 0,
@@ -203,6 +201,12 @@ struct btrfs_extent_inline_ref {
__u8 type;
__le64 offset;
} __attribute__((__packed__));
+struct btrfs_extent_ref_v0 {
+ __le64 root;
+ __le64 generation;
+ __le64 objectid;
+ __le32 count;
+} __attribute__((__packed__));
struct btrfs_dev_extent {
__le64 chunk_tree;
__le64 chunk_objectid;
diff --git a/libc/kernel/uapi/linux/can.h b/libc/kernel/uapi/linux/can.h
index 59fc31ece..3933614f4 100644
--- a/libc/kernel/uapi/linux/can.h
+++ b/libc/kernel/uapi/linux/can.h
@@ -31,19 +31,15 @@ typedef __u32 canid_t;
#define CAN_EFF_ID_BITS 29
typedef __u32 can_err_mask_t;
#define CAN_MAX_DLC 8
-#define CAN_MAX_RAW_DLC 15
#define CAN_MAX_DLEN 8
#define CANFD_MAX_DLC 15
#define CANFD_MAX_DLEN 64
struct can_frame {
canid_t can_id;
- union {
- __u8 len;
- __u8 can_dlc;
- } __attribute__((packed));
+ __u8 can_dlc;
__u8 __pad;
__u8 __res0;
- __u8 len8_dlc;
+ __u8 __res1;
__u8 data[CAN_MAX_DLEN] __attribute__((aligned(8)));
};
#define CANFD_BRS 0x01
diff --git a/libc/kernel/uapi/linux/can/isotp.h b/libc/kernel/uapi/linux/can/isotp.h
deleted file mode 100644
index dd5e4f532..000000000
--- a/libc/kernel/uapi/linux/can/isotp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_CAN_ISOTP_H
-#define _UAPI_CAN_ISOTP_H
-#include <linux/types.h>
-#include <linux/can.h>
-#define SOL_CAN_ISOTP (SOL_CAN_BASE + CAN_ISOTP)
-#define CAN_ISOTP_OPTS 1
-#define CAN_ISOTP_RECV_FC 2
-#define CAN_ISOTP_TX_STMIN 3
-#define CAN_ISOTP_RX_STMIN 4
-#define CAN_ISOTP_LL_OPTS 5
-struct can_isotp_options {
- __u32 flags;
- __u32 frame_txtime;
- __u8 ext_address;
- __u8 txpad_content;
- __u8 rxpad_content;
- __u8 rx_ext_address;
-};
-struct can_isotp_fc_options {
- __u8 bs;
- __u8 stmin;
- __u8 wftmax;
-};
-struct can_isotp_ll_options {
- __u8 mtu;
- __u8 tx_dl;
- __u8 tx_flags;
-};
-#define CAN_ISOTP_LISTEN_MODE 0x001
-#define CAN_ISOTP_EXTEND_ADDR 0x002
-#define CAN_ISOTP_TX_PADDING 0x004
-#define CAN_ISOTP_RX_PADDING 0x008
-#define CAN_ISOTP_CHK_PAD_LEN 0x010
-#define CAN_ISOTP_CHK_PAD_DATA 0x020
-#define CAN_ISOTP_HALF_DUPLEX 0x040
-#define CAN_ISOTP_FORCE_TXSTMIN 0x080
-#define CAN_ISOTP_FORCE_RXSTMIN 0x100
-#define CAN_ISOTP_RX_EXT_ADDR 0x200
-#define CAN_ISOTP_WAIT_TX_DONE 0x400
-#define CAN_ISOTP_SF_BROADCAST 0x800
-#define CAN_ISOTP_DEFAULT_FLAGS 0
-#define CAN_ISOTP_DEFAULT_EXT_ADDRESS 0x00
-#define CAN_ISOTP_DEFAULT_PAD_CONTENT 0xCC
-#define CAN_ISOTP_DEFAULT_FRAME_TXTIME 0
-#define CAN_ISOTP_DEFAULT_RECV_BS 0
-#define CAN_ISOTP_DEFAULT_RECV_STMIN 0x00
-#define CAN_ISOTP_DEFAULT_RECV_WFTMAX 0
-#define CAN_ISOTP_DEFAULT_LL_MTU CAN_MTU
-#define CAN_ISOTP_DEFAULT_LL_TX_DL CAN_MAX_DLEN
-#define CAN_ISOTP_DEFAULT_LL_TX_FLAGS 0
-#endif
diff --git a/libc/kernel/uapi/linux/can/netlink.h b/libc/kernel/uapi/linux/can/netlink.h
index 3e6551d3a..ddf90589d 100644
--- a/libc/kernel/uapi/linux/can/netlink.h
+++ b/libc/kernel/uapi/linux/can/netlink.h
@@ -68,7 +68,6 @@ struct can_ctrlmode {
#define CAN_CTRLMODE_FD 0x20
#define CAN_CTRLMODE_PRESUME_ACK 0x40
#define CAN_CTRLMODE_FD_NON_ISO 0x80
-#define CAN_CTRLMODE_CC_LEN8_DLC 0x100
struct can_device_stats {
__u32 bus_error;
__u32 error_warning;
diff --git a/libc/kernel/uapi/linux/can/raw.h b/libc/kernel/uapi/linux/can/raw.h
index a3bddb76c..3d389b9ff 100644
--- a/libc/kernel/uapi/linux/can/raw.h
+++ b/libc/kernel/uapi/linux/can/raw.h
@@ -21,9 +21,6 @@
#include <linux/can.h>
#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
enum {
- SCM_CAN_RAW_ERRQUEUE = 1,
-};
-enum {
CAN_RAW_FILTER = 1,
CAN_RAW_ERR_FILTER,
CAN_RAW_LOOPBACK,
diff --git a/libc/kernel/uapi/linux/capability.h b/libc/kernel/uapi/linux/capability.h
index 958e6ab61..8ba448eb0 100644
--- a/libc/kernel/uapi/linux/capability.h
+++ b/libc/kernel/uapi/linux/capability.h
@@ -105,10 +105,7 @@ struct vfs_ns_cap_data {
#define CAP_WAKE_ALARM 35
#define CAP_BLOCK_SUSPEND 36
#define CAP_AUDIT_READ 37
-#define CAP_PERFMON 38
-#define CAP_BPF 39
-#define CAP_CHECKPOINT_RESTORE 40
-#define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE
+#define CAP_LAST_CAP CAP_AUDIT_READ
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
#define CAP_TO_INDEX(x) ((x) >> 5)
#define CAP_TO_MASK(x) (1 << ((x) & 31))
diff --git a/libc/kernel/uapi/linux/ccs.h b/libc/kernel/uapi/linux/ccs.h
deleted file mode 100644
index 53c88af4e..000000000
--- a/libc/kernel/uapi/linux/ccs.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __UAPI_CCS_H__
-#define __UAPI_CCS_H__
-#include <linux/v4l2-controls.h>
-#define V4L2_CID_CCS_ANALOGUE_GAIN_M0 (V4L2_CID_USER_CCS_BASE + 1)
-#define V4L2_CID_CCS_ANALOGUE_GAIN_C0 (V4L2_CID_USER_CCS_BASE + 2)
-#define V4L2_CID_CCS_ANALOGUE_GAIN_M1 (V4L2_CID_USER_CCS_BASE + 3)
-#define V4L2_CID_CCS_ANALOGUE_GAIN_C1 (V4L2_CID_USER_CCS_BASE + 4)
-#define V4L2_CID_CCS_ANALOGUE_LINEAR_GAIN (V4L2_CID_USER_CCS_BASE + 5)
-#define V4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN (V4L2_CID_USER_CCS_BASE + 6)
-#define V4L2_CID_CCS_SHADING_CORRECTION (V4L2_CID_USER_CCS_BASE + 8)
-#define V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL (V4L2_CID_USER_CCS_BASE + 9)
-#endif
diff --git a/libc/kernel/uapi/linux/cdrom.h b/libc/kernel/uapi/linux/cdrom.h
index 8f1c2f0b6..d8d7f68a7 100644
--- a/libc/kernel/uapi/linux/cdrom.h
+++ b/libc/kernel/uapi/linux/cdrom.h
@@ -155,10 +155,7 @@ struct cdrom_generic_command {
unsigned char data_direction;
int quiet;
int timeout;
- union {
- void __user * reserved[1];
- void __user * unused;
- };
+ void __user * reserved[1];
};
#define CD_MINS 74
#define CD_SECS 60
diff --git a/libc/kernel/uapi/linux/cfm_bridge.h b/libc/kernel/uapi/linux/cfm_bridge.h
deleted file mode 100644
index de9d02343..000000000
--- a/libc/kernel/uapi/linux/cfm_bridge.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_CFM_BRIDGE_H_
-#define _UAPI_LINUX_CFM_BRIDGE_H_
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#define ETHER_HEADER_LENGTH (6 + 6 + 4 + 2)
-#define CFM_MAID_LENGTH 48
-#define CFM_CCM_PDU_LENGTH 75
-#define CFM_PORT_STATUS_TLV_LENGTH 4
-#define CFM_IF_STATUS_TLV_LENGTH 4
-#define CFM_IF_STATUS_TLV_TYPE 4
-#define CFM_PORT_STATUS_TLV_TYPE 2
-#define CFM_ENDE_TLV_TYPE 0
-#define CFM_CCM_MAX_FRAME_LENGTH (ETHER_HEADER_LENGTH + CFM_CCM_PDU_LENGTH + CFM_PORT_STATUS_TLV_LENGTH + CFM_IF_STATUS_TLV_LENGTH)
-#define CFM_FRAME_PRIO 7
-#define CFM_CCM_TLV_OFFSET 70
-#define CFM_CCM_PDU_MAID_OFFSET 10
-#define CFM_CCM_PDU_MEPID_OFFSET 8
-#define CFM_CCM_PDU_SEQNR_OFFSET 4
-#define CFM_CCM_PDU_TLV_OFFSET 74
-#define CFM_CCM_ITU_RESERVED_SIZE 16
-struct br_cfm_common_hdr {
- __u8 mdlevel_version;
- __u8 opcode;
- __u8 flags;
- __u8 tlv_offset;
-};
-enum br_cfm_opcodes {
- BR_CFM_OPCODE_CCM = 0x1,
-};
-enum br_cfm_domain {
- BR_CFM_PORT,
- BR_CFM_VLAN,
-};
-enum br_cfm_mep_direction {
- BR_CFM_MEP_DIRECTION_DOWN,
- BR_CFM_MEP_DIRECTION_UP,
-};
-enum br_cfm_ccm_interval {
- BR_CFM_CCM_INTERVAL_NONE,
- BR_CFM_CCM_INTERVAL_3_3_MS,
- BR_CFM_CCM_INTERVAL_10_MS,
- BR_CFM_CCM_INTERVAL_100_MS,
- BR_CFM_CCM_INTERVAL_1_SEC,
- BR_CFM_CCM_INTERVAL_10_SEC,
- BR_CFM_CCM_INTERVAL_1_MIN,
- BR_CFM_CCM_INTERVAL_10_MIN,
-};
-#endif
diff --git a/libc/kernel/uapi/linux/cifs/cifs_netlink.h b/libc/kernel/uapi/linux/cifs/cifs_netlink.h
deleted file mode 100644
index 7286cfa80..000000000
--- a/libc/kernel/uapi/linux/cifs/cifs_netlink.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPILINUX_CIFS_NETLINK_H
-#define _UAPILINUX_CIFS_NETLINK_H
-#define CIFS_GENL_NAME "cifs"
-#define CIFS_GENL_VERSION 0x1
-#define CIFS_GENL_MCGRP_SWN_NAME "cifs_mcgrp_swn"
-enum cifs_genl_multicast_groups {
- CIFS_GENL_MCGRP_SWN,
-};
-enum cifs_genl_attributes {
- CIFS_GENL_ATTR_UNSPEC,
- CIFS_GENL_ATTR_SWN_REGISTRATION_ID,
- CIFS_GENL_ATTR_SWN_NET_NAME,
- CIFS_GENL_ATTR_SWN_SHARE_NAME,
- CIFS_GENL_ATTR_SWN_IP,
- CIFS_GENL_ATTR_SWN_NET_NAME_NOTIFY,
- CIFS_GENL_ATTR_SWN_SHARE_NAME_NOTIFY,
- CIFS_GENL_ATTR_SWN_IP_NOTIFY,
- CIFS_GENL_ATTR_SWN_KRB_AUTH,
- CIFS_GENL_ATTR_SWN_USER_NAME,
- CIFS_GENL_ATTR_SWN_PASSWORD,
- CIFS_GENL_ATTR_SWN_DOMAIN_NAME,
- CIFS_GENL_ATTR_SWN_NOTIFICATION_TYPE,
- CIFS_GENL_ATTR_SWN_RESOURCE_STATE,
- CIFS_GENL_ATTR_SWN_RESOURCE_NAME,
- __CIFS_GENL_ATTR_MAX,
-};
-#define CIFS_GENL_ATTR_MAX (__CIFS_GENL_ATTR_MAX - 1)
-enum cifs_genl_commands {
- CIFS_GENL_CMD_UNSPEC,
- CIFS_GENL_CMD_SWN_REGISTER,
- CIFS_GENL_CMD_SWN_UNREGISTER,
- CIFS_GENL_CMD_SWN_NOTIFY,
- __CIFS_GENL_CMD_MAX
-};
-#define CIFS_GENL_CMD_MAX (__CIFS_GENL_CMD_MAX - 1)
-enum cifs_swn_notification_type {
- CIFS_SWN_NOTIFICATION_RESOURCE_CHANGE = 0x01,
- CIFS_SWN_NOTIFICATION_CLIENT_MOVE = 0x02,
- CIFS_SWN_NOTIFICATION_SHARE_MOVE = 0x03,
- CIFS_SWN_NOTIFICATION_IP_CHANGE = 0x04,
-};
-enum cifs_swn_resource_state {
- CIFS_SWN_RESOURCE_STATE_UNKNOWN = 0x00,
- CIFS_SWN_RESOURCE_STATE_AVAILABLE = 0x01,
- CIFS_SWN_RESOURCE_STATE_UNAVAILABLE = 0xFF
-};
-#endif
diff --git a/libc/kernel/uapi/linux/close_range.h b/libc/kernel/uapi/linux/close_range.h
deleted file mode 100644
index 279e4bb95..000000000
--- a/libc/kernel/uapi/linux/close_range.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_CLOSE_RANGE_H
-#define _UAPI_LINUX_CLOSE_RANGE_H
-#define CLOSE_RANGE_UNSHARE (1U << 1)
-#define CLOSE_RANGE_CLOEXEC (1U << 2)
-#endif
diff --git a/libc/kernel/uapi/linux/const.h b/libc/kernel/uapi/linux/const.h
index c62a7029f..6a4c1f719 100644
--- a/libc/kernel/uapi/linux/const.h
+++ b/libc/kernel/uapi/linux/const.h
@@ -30,7 +30,4 @@
#define _ULL(x) (_AC(x, ULL))
#define _BITUL(x) (_UL(1) << (x))
#define _BITULL(x) (_ULL(1) << (x))
-#define __ALIGN_KERNEL(x,a) __ALIGN_KERNEL_MASK(x, (typeof(x)) (a) - 1)
-#define __ALIGN_KERNEL_MASK(x,mask) (((x) + (mask)) & ~(mask))
-#define __KERNEL_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#endif
diff --git a/libc/kernel/uapi/linux/coresight-stm.h b/libc/kernel/uapi/linux/coresight-stm.h
index 86d80ca72..2eac7e18e 100644
--- a/libc/kernel/uapi/linux/coresight-stm.h
+++ b/libc/kernel/uapi/linux/coresight-stm.h
@@ -18,10 +18,8 @@
****************************************************************************/
#ifndef __UAPI_CORESIGHT_STM_H_
#define __UAPI_CORESIGHT_STM_H_
-#include <linux/const.h>
-#define STM_FLAG_TIMESTAMPED _BITUL(3)
-#define STM_FLAG_MARKED _BITUL(4)
-#define STM_FLAG_GUARANTEED _BITUL(7)
+#define STM_FLAG_TIMESTAMPED BIT(3)
+#define STM_FLAG_GUARANTEED BIT(7)
enum {
STM_OPTION_GUARANTEED = 0,
STM_OPTION_INVARIANT,
diff --git a/libc/kernel/uapi/linux/cxl_mem.h b/libc/kernel/uapi/linux/cxl_mem.h
deleted file mode 100644
index 851bd7907..000000000
--- a/libc/kernel/uapi/linux/cxl_mem.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_CXL_MEM_H_
-#define _UAPI_CXL_MEM_H_
-#include <linux/types.h>
-#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
-#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
-#define CXL_CMDS ___C(INVALID, "Invalid Command"), ___C(IDENTIFY, "Identify Command"), ___C(RAW, "Raw device command"), ___C(GET_SUPPORTED_LOGS, "Get Supported Logs"), ___C(GET_FW_INFO, "Get FW Info"), ___C(GET_PARTITION_INFO, "Get Partition Information"), ___C(GET_LSA, "Get Label Storage Area"), ___C(GET_HEALTH_INFO, "Get Health Info"), ___C(GET_LOG, "Get Log"), ___C(MAX, "invalid / last command")
-#define ___C(a,b) CXL_MEM_COMMAND_ID_ ##a
-enum {
- CXL_CMDS
-};
-#undef ___C
-#define ___C(a,b) { b }
-static const struct {
- const char * name;
-} cxl_command_names[] = {
- CXL_CMDS
-};
-#undef ___C
-struct cxl_command_info {
- __u32 id;
- __u32 flags;
-#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
- __s32 size_in;
- __s32 size_out;
-};
-struct cxl_mem_query_commands {
- __u32 n_commands;
- __u32 rsvd;
- struct cxl_command_info __user commands[];
-};
-struct cxl_send_command {
- __u32 id;
- __u32 flags;
- union {
- struct {
- __u16 opcode;
- __u16 rsvd;
- } raw;
- __u32 rsvd;
- };
- __u32 retval;
- struct {
- __s32 size;
- __u32 rsvd;
- __u64 payload;
- } in;
- struct {
- __s32 size;
- __u32 rsvd;
- __u64 payload;
- } out;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/devlink.h b/libc/kernel/uapi/linux/devlink.h
index e6e006f85..b08fa8a25 100644
--- a/libc/kernel/uapi/linux/devlink.h
+++ b/libc/kernel/uapi/linux/devlink.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_DEVLINK_H_
#define _UAPI_LINUX_DEVLINK_H_
-#include <linux/const.h>
#define DEVLINK_GENL_NAME "devlink"
#define DEVLINK_GENL_VERSION 0x1
#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
@@ -94,11 +93,6 @@ enum devlink_command {
DEVLINK_CMD_TRAP_GROUP_SET,
DEVLINK_CMD_TRAP_GROUP_NEW,
DEVLINK_CMD_TRAP_GROUP_DEL,
- DEVLINK_CMD_TRAP_POLICER_GET,
- DEVLINK_CMD_TRAP_POLICER_SET,
- DEVLINK_CMD_TRAP_POLICER_NEW,
- DEVLINK_CMD_TRAP_POLICER_DEL,
- DEVLINK_CMD_HEALTH_REPORTER_TEST,
__DEVLINK_CMD_MAX,
DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
};
@@ -137,9 +131,6 @@ enum devlink_port_flavour {
DEVLINK_PORT_FLAVOUR_DSA,
DEVLINK_PORT_FLAVOUR_PCI_PF,
DEVLINK_PORT_FLAVOUR_PCI_VF,
- DEVLINK_PORT_FLAVOUR_VIRTUAL,
- DEVLINK_PORT_FLAVOUR_UNUSED,
- DEVLINK_PORT_FLAVOUR_PCI_SF,
};
enum devlink_param_cmode {
DEVLINK_PARAM_CMODE_RUNTIME,
@@ -163,47 +154,20 @@ enum devlink_param_reset_dev_on_drv_probe_value {
enum {
DEVLINK_ATTR_STATS_RX_PACKETS,
DEVLINK_ATTR_STATS_RX_BYTES,
- DEVLINK_ATTR_STATS_RX_DROPPED,
__DEVLINK_ATTR_STATS_MAX,
DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
};
-enum {
- DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,
- DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,
- __DEVLINK_FLASH_OVERWRITE_MAX_BIT,
- DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
-};
-#define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
-#define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)
-#define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS (_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)
enum devlink_trap_action {
DEVLINK_TRAP_ACTION_DROP,
DEVLINK_TRAP_ACTION_TRAP,
- DEVLINK_TRAP_ACTION_MIRROR,
};
enum devlink_trap_type {
DEVLINK_TRAP_TYPE_DROP,
DEVLINK_TRAP_TYPE_EXCEPTION,
- DEVLINK_TRAP_TYPE_CONTROL,
};
enum {
DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT,
- DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE,
-};
-enum devlink_reload_action {
- DEVLINK_RELOAD_ACTION_UNSPEC,
- DEVLINK_RELOAD_ACTION_DRIVER_REINIT,
- DEVLINK_RELOAD_ACTION_FW_ACTIVATE,
- __DEVLINK_RELOAD_ACTION_MAX,
- DEVLINK_RELOAD_ACTION_MAX = __DEVLINK_RELOAD_ACTION_MAX - 1
-};
-enum devlink_reload_limit {
- DEVLINK_RELOAD_LIMIT_UNSPEC,
- DEVLINK_RELOAD_LIMIT_NO_RESET,
- __DEVLINK_RELOAD_LIMIT_MAX,
- DEVLINK_RELOAD_LIMIT_MAX = __DEVLINK_RELOAD_LIMIT_MAX - 1
};
-#define DEVLINK_RELOAD_LIMITS_VALID_MASK (_BITUL(__DEVLINK_RELOAD_LIMIT_MAX) - 1)
enum devlink_attr {
DEVLINK_ATTR_UNSPEC,
DEVLINK_ATTR_BUS_NAME,
@@ -346,30 +310,6 @@ enum devlink_attr {
DEVLINK_ATTR_NETNS_FD,
DEVLINK_ATTR_NETNS_PID,
DEVLINK_ATTR_NETNS_ID,
- DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,
- DEVLINK_ATTR_TRAP_POLICER_ID,
- DEVLINK_ATTR_TRAP_POLICER_RATE,
- DEVLINK_ATTR_TRAP_POLICER_BURST,
- DEVLINK_ATTR_PORT_FUNCTION,
- DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,
- DEVLINK_ATTR_PORT_LANES,
- DEVLINK_ATTR_PORT_SPLITTABLE,
- DEVLINK_ATTR_PORT_EXTERNAL,
- DEVLINK_ATTR_PORT_CONTROLLER_NUMBER,
- DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,
- DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK,
- DEVLINK_ATTR_RELOAD_ACTION,
- DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED,
- DEVLINK_ATTR_RELOAD_LIMITS,
- DEVLINK_ATTR_DEV_STATS,
- DEVLINK_ATTR_RELOAD_STATS,
- DEVLINK_ATTR_RELOAD_STATS_ENTRY,
- DEVLINK_ATTR_RELOAD_STATS_LIMIT,
- DEVLINK_ATTR_RELOAD_STATS_VALUE,
- DEVLINK_ATTR_REMOTE_RELOAD_STATS,
- DEVLINK_ATTR_RELOAD_ACTION_INFO,
- DEVLINK_ATTR_RELOAD_ACTION_STATS,
- DEVLINK_ATTR_PORT_PCI_SF_NUMBER,
__DEVLINK_ATTR_MAX,
DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
};
@@ -400,20 +340,4 @@ enum devlink_dpipe_header_id {
enum devlink_resource_unit {
DEVLINK_RESOURCE_UNIT_ENTRY,
};
-enum devlink_port_function_attr {
- DEVLINK_PORT_FUNCTION_ATTR_UNSPEC,
- DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR,
- DEVLINK_PORT_FN_ATTR_STATE,
- DEVLINK_PORT_FN_ATTR_OPSTATE,
- __DEVLINK_PORT_FUNCTION_ATTR_MAX,
- DEVLINK_PORT_FUNCTION_ATTR_MAX = __DEVLINK_PORT_FUNCTION_ATTR_MAX - 1
-};
-enum devlink_port_fn_state {
- DEVLINK_PORT_FN_STATE_INACTIVE,
- DEVLINK_PORT_FN_STATE_ACTIVE,
-};
-enum devlink_port_fn_opstate {
- DEVLINK_PORT_FN_OPSTATE_DETACHED,
- DEVLINK_PORT_FN_OPSTATE_ATTACHED,
-};
#endif
diff --git a/libc/kernel/uapi/linux/dm-ioctl.h b/libc/kernel/uapi/linux/dm-ioctl.h
index 4c0a9f0ed..51e997ff1 100644
--- a/libc/kernel/uapi/linux/dm-ioctl.h
+++ b/libc/kernel/uapi/linux/dm-ioctl.h
@@ -104,9 +104,9 @@ enum {
#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 44
+#define DM_VERSION_MINOR 41
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl(2021-02-01)"
+#define DM_VERSION_EXTRA "-ioctl(2019-09-16)"
#define DM_READONLY_FLAG (1 << 0)
#define DM_SUSPEND_FLAG (1 << 1)
#define DM_PERSISTENT_DEV_FLAG (1 << 3)
diff --git a/libc/kernel/uapi/linux/dm-user.h b/libc/kernel/uapi/linux/dm-user.h
deleted file mode 100644
index 39624c812..000000000
--- a/libc/kernel/uapi/linux/dm-user.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_DM_USER_H
-#define _LINUX_DM_USER_H
-#include <linux/types.h>
-#define DM_USER_REQ_MAP_READ 0
-#define DM_USER_REQ_MAP_WRITE 1
-#define DM_USER_REQ_MAP_FLUSH 2
-#define DM_USER_REQ_MAP_DISCARD 3
-#define DM_USER_REQ_MAP_SECURE_ERASE 4
-#define DM_USER_REQ_MAP_WRITE_SAME 5
-#define DM_USER_REQ_MAP_WRITE_ZEROES 6
-#define DM_USER_REQ_MAP_ZONE_OPEN 7
-#define DM_USER_REQ_MAP_ZONE_CLOSE 8
-#define DM_USER_REQ_MAP_ZONE_FINISH 9
-#define DM_USER_REQ_MAP_ZONE_APPEND 10
-#define DM_USER_REQ_MAP_ZONE_RESET 11
-#define DM_USER_REQ_MAP_ZONE_RESET_ALL 12
-#define DM_USER_REQ_MAP_FLAG_FAILFAST_DEV 0x00001
-#define DM_USER_REQ_MAP_FLAG_FAILFAST_TRANSPORT 0x00002
-#define DM_USER_REQ_MAP_FLAG_FAILFAST_DRIVER 0x00004
-#define DM_USER_REQ_MAP_FLAG_SYNC 0x00008
-#define DM_USER_REQ_MAP_FLAG_META 0x00010
-#define DM_USER_REQ_MAP_FLAG_PRIO 0x00020
-#define DM_USER_REQ_MAP_FLAG_NOMERGE 0x00040
-#define DM_USER_REQ_MAP_FLAG_IDLE 0x00080
-#define DM_USER_REQ_MAP_FLAG_INTEGRITY 0x00100
-#define DM_USER_REQ_MAP_FLAG_FUA 0x00200
-#define DM_USER_REQ_MAP_FLAG_PREFLUSH 0x00400
-#define DM_USER_REQ_MAP_FLAG_RAHEAD 0x00800
-#define DM_USER_REQ_MAP_FLAG_BACKGROUND 0x01000
-#define DM_USER_REQ_MAP_FLAG_NOWAIT 0x02000
-#define DM_USER_REQ_MAP_FLAG_CGROUP_PUNT 0x04000
-#define DM_USER_REQ_MAP_FLAG_NOUNMAP 0x08000
-#define DM_USER_REQ_MAP_FLAG_HIPRI 0x10000
-#define DM_USER_REQ_MAP_FLAG_DRV 0x20000
-#define DM_USER_REQ_MAP_FLAG_SWAP 0x40000
-#define DM_USER_RESP_SUCCESS 0
-#define DM_USER_RESP_ERROR 1
-#define DM_USER_RESP_UNSUPPORTED 2
-struct dm_user_message {
- __u64 seq;
- __u64 type;
- __u64 flags;
- __u64 sector;
- __u64 len;
- __u8 buf[];
-};
-#endif
diff --git a/libc/kernel/uapi/linux/dma-buf.h b/libc/kernel/uapi/linux/dma-buf.h
index 221c20f80..3d7c0993c 100644
--- a/libc/kernel/uapi/linux/dma-buf.h
+++ b/libc/kernel/uapi/linux/dma-buf.h
@@ -32,6 +32,4 @@ struct dma_buf_sync {
#define DMA_BUF_BASE 'b'
#define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
-#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
-#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
#endif
diff --git a/libc/kernel/uapi/linux/dma-heap.h b/libc/kernel/uapi/linux/dma-heap.h
deleted file mode 100644
index a2746e3f0..000000000
--- a/libc/kernel/uapi/linux/dma-heap.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_DMABUF_POOL_H
-#define _UAPI_LINUX_DMABUF_POOL_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)
-#define DMA_HEAP_VALID_HEAP_FLAGS (0)
-struct dma_heap_allocation_data {
- __u64 len;
- __u32 fd;
- __u32 fd_flags;
- __u64 heap_flags;
-};
-#define DMA_HEAP_IOC_MAGIC 'H'
-#define DMA_HEAP_IOCTL_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0, struct dma_heap_allocation_data)
-#endif
diff --git a/libc/kernel/uapi/linux/dqblk_xfs.h b/libc/kernel/uapi/linux/dqblk_xfs.h
index db7c7e5ef..c8aebdac6 100644
--- a/libc/kernel/uapi/linux/dqblk_xfs.h
+++ b/libc/kernel/uapi/linux/dqblk_xfs.h
@@ -50,10 +50,7 @@ typedef struct fs_disk_quota {
__s32 d_btimer;
__u16 d_iwarns;
__u16 d_bwarns;
- __s8 d_itimer_hi;
- __s8 d_btimer_hi;
- __s8 d_rtbtimer_hi;
- __s8 d_padding2;
+ __s32 d_padding2;
__u64 d_rtb_hardlimit;
__u64 d_rtb_softlimit;
__u64 d_rtbcount;
@@ -81,7 +78,6 @@ typedef struct fs_disk_quota {
#define FS_DQ_ICOUNT (1 << 13)
#define FS_DQ_RTBCOUNT (1 << 14)
#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
-#define FS_DQ_BIGTIME (1 << 15)
#define FS_QUOTA_UDQ_ACCT (1 << 0)
#define FS_QUOTA_UDQ_ENFD (1 << 1)
#define FS_QUOTA_GDQ_ACCT (1 << 2)
diff --git a/libc/kernel/uapi/linux/elf.h b/libc/kernel/uapi/linux/elf.h
index f9f122aab..8f2e6688c 100644
--- a/libc/kernel/uapi/linux/elf.h
+++ b/libc/kernel/uapi/linux/elf.h
@@ -46,7 +46,6 @@ typedef __s64 Elf64_Sxword;
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
#define PT_GNU_EH_FRAME 0x6474e550
-#define PT_GNU_PROPERTY 0x6474e553
#define PT_GNU_STACK (PT_LOOS + 0x474e551)
#define PN_XNUM 0xffff
#define ET_NONE 0
@@ -359,13 +358,11 @@ typedef struct elf64_shdr {
#define NT_ARM_PAC_MASK 0x406
#define NT_ARM_PACA_KEYS 0x407
#define NT_ARM_PACG_KEYS 0x408
-#define NT_ARM_TAGGED_ADDR_CTRL 0x409
#define NT_ARC_V2 0x600
#define NT_VMCOREDD 0x700
#define NT_MIPS_DSP 0x800
#define NT_MIPS_FP_MODE 0x801
#define NT_MIPS_MSA 0x802
-#define NT_GNU_PROPERTY_TYPE_0 5
typedef struct elf32_note {
Elf32_Word n_namesz;
Elf32_Word n_descsz;
@@ -376,6 +373,4 @@ typedef struct elf64_note {
Elf64_Word n_descsz;
Elf64_Word n_type;
} Elf64_Nhdr;
-#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
-#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
#endif
diff --git a/libc/kernel/uapi/linux/elfcore.h b/libc/kernel/uapi/linux/elfcore.h
new file mode 100644
index 000000000..a1df1ffaf
--- /dev/null
+++ b/libc/kernel/uapi/linux/elfcore.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_ELFCORE_H
+#define _UAPI_LINUX_ELFCORE_H
+#include <linux/types.h>
+#include <linux/signal.h>
+#include <linux/time.h>
+#include <linux/ptrace.h>
+#include <linux/elf.h>
+#include <linux/fs.h>
+struct elf_siginfo {
+ int si_signo;
+ int si_code;
+ int si_errno;
+};
+typedef elf_greg_t greg_t;
+typedef elf_gregset_t gregset_t;
+typedef elf_fpregset_t fpregset_t;
+typedef elf_fpxregset_t fpxregset_t;
+#define NGREG ELF_NGREG
+struct elf_prstatus {
+ struct elf_siginfo pr_info;
+ short pr_cursig;
+ unsigned long pr_sigpend;
+ unsigned long pr_sighold;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ struct timeval pr_utime;
+ struct timeval pr_stime;
+ struct timeval pr_cutime;
+ struct timeval pr_cstime;
+ elf_gregset_t pr_reg;
+ int pr_fpvalid;
+};
+#define ELF_PRARGSZ (80)
+struct elf_prpsinfo {
+ char pr_state;
+ char pr_sname;
+ char pr_zomb;
+ char pr_nice;
+ unsigned long pr_flag;
+ __kernel_uid_t pr_uid;
+ __kernel_gid_t pr_gid;
+ pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ char pr_fname[16];
+ char pr_psargs[ELF_PRARGSZ];
+};
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+#define PRARGSZ ELF_PRARGSZ
+#endif
diff --git a/libc/kernel/uapi/linux/errqueue.h b/libc/kernel/uapi/linux/errqueue.h
index e93bad29c..7959d2b1f 100644
--- a/libc/kernel/uapi/linux/errqueue.h
+++ b/libc/kernel/uapi/linux/errqueue.h
@@ -20,11 +20,6 @@
#define _UAPI_LINUX_ERRQUEUE_H
#include <linux/types.h>
#include <linux/time_types.h>
-struct sock_ee_data_rfc4884 {
- __u16 len;
- __u8 flags;
- __u8 reserved;
-};
struct sock_extended_err {
__u32 ee_errno;
__u8 ee_origin;
@@ -32,10 +27,7 @@ struct sock_extended_err {
__u8 ee_code;
__u8 ee_pad;
__u32 ee_info;
- union {
- __u32 ee_data;
- struct sock_ee_data_rfc4884 ee_rfc4884;
- };
+ __u32 ee_data;
};
#define SO_EE_ORIGIN_NONE 0
#define SO_EE_ORIGIN_LOCAL 1
@@ -49,7 +41,6 @@ struct sock_extended_err {
#define SO_EE_CODE_ZEROCOPY_COPIED 1
#define SO_EE_CODE_TXTIME_INVALID_PARAM 1
#define SO_EE_CODE_TXTIME_MISSED 2
-#define SO_EE_RFC4884_FLAG_INVALID 1
struct scm_timestamping {
struct timespec ts[3];
};
diff --git a/libc/kernel/uapi/linux/ethtool.h b/libc/kernel/uapi/linux/ethtool.h
index 021a69b99..cc951d1da 100644
--- a/libc/kernel/uapi/linux/ethtool.h
+++ b/libc/kernel/uapi/linux/ethtool.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI_LINUX_ETHTOOL_H
#define _UAPI_LINUX_ETHTOOL_H
-#include <linux/const.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/if_ether.h>
#include <limits.h>
@@ -196,47 +196,6 @@ struct ethtool_pauseparam {
__u32 rx_pause;
__u32 tx_pause;
};
-enum ethtool_link_ext_state {
- ETHTOOL_LINK_EXT_STATE_AUTONEG,
- ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
- ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
- ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
- ETHTOOL_LINK_EXT_STATE_NO_CABLE,
- ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
- ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE,
- ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
- ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
- ETHTOOL_LINK_EXT_STATE_OVERHEAT,
-};
-enum ethtool_link_ext_substate_autoneg {
- ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1,
- ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED,
- ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED,
- ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE,
- ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE,
- ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD,
-};
-enum ethtool_link_ext_substate_link_training {
- ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1,
- ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT,
- ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY,
- ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT,
-};
-enum ethtool_link_ext_substate_link_logical_mismatch {
- ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1,
- ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK,
- ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS,
- ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED,
- ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED,
-};
-enum ethtool_link_ext_substate_bad_signal_integrity {
- ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
- ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
-};
-enum ethtool_link_ext_substate_cable_issue {
- ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1,
- ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
-};
#define ETH_GSTRING_LEN 32
enum ethtool_stringset {
ETH_SS_TEST = 0,
@@ -248,14 +207,6 @@ enum ethtool_stringset {
ETH_SS_TUNABLES,
ETH_SS_PHY_STATS,
ETH_SS_PHY_TUNABLES,
- ETH_SS_LINK_MODES,
- ETH_SS_MSG_CLASSES,
- ETH_SS_WOL_MODES,
- ETH_SS_SOF_TIMESTAMPING,
- ETH_SS_TS_TX_TYPES,
- ETH_SS_TS_RX_FILTERS,
- ETH_SS_UDP_TUNNEL_TYPES,
- ETH_SS_COUNT
};
struct ethtool_gstrings {
__u32 cmd;
@@ -501,14 +452,12 @@ enum ethtool_fec_config_bits {
ETHTOOL_FEC_OFF_BIT,
ETHTOOL_FEC_RS_BIT,
ETHTOOL_FEC_BASER_BIT,
- ETHTOOL_FEC_LLRS_BIT,
};
#define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
#define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT)
#define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)
#define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)
#define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT)
-#define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT)
#define ETHTOOL_GSET 0x00000001
#define ETHTOOL_SSET 0x00000002
#define ETHTOOL_GDRVINFO 0x00000003
@@ -666,24 +615,6 @@ enum ethtool_link_mode_bit_indices {
ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71,
ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72,
ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73,
- ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74,
- ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75,
- ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76,
- ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77,
- ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78,
- ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79,
- ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80,
- ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81,
- ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82,
- ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83,
- ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84,
- ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85,
- ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86,
- ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87,
- ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88,
- ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
- ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90,
- ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91,
__ETHTOOL_LINK_MODE_MASK_NBITS
};
#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) (1UL << (ETHTOOL_LINK_MODE_ ##base_name ##_BIT))
@@ -768,17 +699,6 @@ enum ethtool_link_mode_bit_indices {
#define DUPLEX_HALF 0x00
#define DUPLEX_FULL 0x01
#define DUPLEX_UNKNOWN 0xff
-#define MASTER_SLAVE_CFG_UNSUPPORTED 0
-#define MASTER_SLAVE_CFG_UNKNOWN 1
-#define MASTER_SLAVE_CFG_MASTER_PREFERRED 2
-#define MASTER_SLAVE_CFG_SLAVE_PREFERRED 3
-#define MASTER_SLAVE_CFG_MASTER_FORCE 4
-#define MASTER_SLAVE_CFG_SLAVE_FORCE 5
-#define MASTER_SLAVE_STATE_UNSUPPORTED 0
-#define MASTER_SLAVE_STATE_UNKNOWN 1
-#define MASTER_SLAVE_STATE_MASTER 2
-#define MASTER_SLAVE_STATE_SLAVE 3
-#define MASTER_SLAVE_STATE_ERR 4
#define PORT_TP 0x00
#define PORT_AUI 0x01
#define PORT_MII 0x02
@@ -806,7 +726,6 @@ enum ethtool_link_mode_bit_indices {
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6)
#define WAKE_FILTER (1 << 7)
-#define WOL_MODE_COUNT 8
#define TCP_V4_FLOW 0x01
#define UDP_V4_FLOW 0x02
#define SCTP_V4_FLOW 0x03
@@ -878,9 +797,7 @@ struct ethtool_link_settings {
__u8 eth_tp_mdix_ctrl;
__s8 link_mode_masks_nwords;
__u8 transceiver;
- __u8 master_slave_cfg;
- __u8 master_slave_state;
- __u8 reserved1[1];
+ __u8 reserved1[3];
__u32 reserved[7];
__u32 link_mode_masks[0];
};
diff --git a/libc/kernel/uapi/linux/ethtool_netlink.h b/libc/kernel/uapi/linux/ethtool_netlink.h
deleted file mode 100644
index 67091a160..000000000
--- a/libc/kernel/uapi/linux/ethtool_netlink.h
+++ /dev/null
@@ -1,467 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_ETHTOOL_NETLINK_H_
-#define _UAPI_LINUX_ETHTOOL_NETLINK_H_
-#include <linux/ethtool.h>
-enum {
- ETHTOOL_MSG_USER_NONE,
- ETHTOOL_MSG_STRSET_GET,
- ETHTOOL_MSG_LINKINFO_GET,
- ETHTOOL_MSG_LINKINFO_SET,
- ETHTOOL_MSG_LINKMODES_GET,
- ETHTOOL_MSG_LINKMODES_SET,
- ETHTOOL_MSG_LINKSTATE_GET,
- ETHTOOL_MSG_DEBUG_GET,
- ETHTOOL_MSG_DEBUG_SET,
- ETHTOOL_MSG_WOL_GET,
- ETHTOOL_MSG_WOL_SET,
- ETHTOOL_MSG_FEATURES_GET,
- ETHTOOL_MSG_FEATURES_SET,
- ETHTOOL_MSG_PRIVFLAGS_GET,
- ETHTOOL_MSG_PRIVFLAGS_SET,
- ETHTOOL_MSG_RINGS_GET,
- ETHTOOL_MSG_RINGS_SET,
- ETHTOOL_MSG_CHANNELS_GET,
- ETHTOOL_MSG_CHANNELS_SET,
- ETHTOOL_MSG_COALESCE_GET,
- ETHTOOL_MSG_COALESCE_SET,
- ETHTOOL_MSG_PAUSE_GET,
- ETHTOOL_MSG_PAUSE_SET,
- ETHTOOL_MSG_EEE_GET,
- ETHTOOL_MSG_EEE_SET,
- ETHTOOL_MSG_TSINFO_GET,
- ETHTOOL_MSG_CABLE_TEST_ACT,
- ETHTOOL_MSG_CABLE_TEST_TDR_ACT,
- ETHTOOL_MSG_TUNNEL_INFO_GET,
- __ETHTOOL_MSG_USER_CNT,
- ETHTOOL_MSG_USER_MAX = __ETHTOOL_MSG_USER_CNT - 1
-};
-enum {
- ETHTOOL_MSG_KERNEL_NONE,
- ETHTOOL_MSG_STRSET_GET_REPLY,
- ETHTOOL_MSG_LINKINFO_GET_REPLY,
- ETHTOOL_MSG_LINKINFO_NTF,
- ETHTOOL_MSG_LINKMODES_GET_REPLY,
- ETHTOOL_MSG_LINKMODES_NTF,
- ETHTOOL_MSG_LINKSTATE_GET_REPLY,
- ETHTOOL_MSG_DEBUG_GET_REPLY,
- ETHTOOL_MSG_DEBUG_NTF,
- ETHTOOL_MSG_WOL_GET_REPLY,
- ETHTOOL_MSG_WOL_NTF,
- ETHTOOL_MSG_FEATURES_GET_REPLY,
- ETHTOOL_MSG_FEATURES_SET_REPLY,
- ETHTOOL_MSG_FEATURES_NTF,
- ETHTOOL_MSG_PRIVFLAGS_GET_REPLY,
- ETHTOOL_MSG_PRIVFLAGS_NTF,
- ETHTOOL_MSG_RINGS_GET_REPLY,
- ETHTOOL_MSG_RINGS_NTF,
- ETHTOOL_MSG_CHANNELS_GET_REPLY,
- ETHTOOL_MSG_CHANNELS_NTF,
- ETHTOOL_MSG_COALESCE_GET_REPLY,
- ETHTOOL_MSG_COALESCE_NTF,
- ETHTOOL_MSG_PAUSE_GET_REPLY,
- ETHTOOL_MSG_PAUSE_NTF,
- ETHTOOL_MSG_EEE_GET_REPLY,
- ETHTOOL_MSG_EEE_NTF,
- ETHTOOL_MSG_TSINFO_GET_REPLY,
- ETHTOOL_MSG_CABLE_TEST_NTF,
- ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
- ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
- __ETHTOOL_MSG_KERNEL_CNT,
- ETHTOOL_MSG_KERNEL_MAX = __ETHTOOL_MSG_KERNEL_CNT - 1
-};
-#define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0)
-#define ETHTOOL_FLAG_OMIT_REPLY (1 << 1)
-#define ETHTOOL_FLAG_STATS (1 << 2)
-#define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | ETHTOOL_FLAG_OMIT_REPLY | ETHTOOL_FLAG_STATS)
-enum {
- ETHTOOL_A_HEADER_UNSPEC,
- ETHTOOL_A_HEADER_DEV_INDEX,
- ETHTOOL_A_HEADER_DEV_NAME,
- ETHTOOL_A_HEADER_FLAGS,
- __ETHTOOL_A_HEADER_CNT,
- ETHTOOL_A_HEADER_MAX = __ETHTOOL_A_HEADER_CNT - 1
-};
-enum {
- ETHTOOL_A_BITSET_BIT_UNSPEC,
- ETHTOOL_A_BITSET_BIT_INDEX,
- ETHTOOL_A_BITSET_BIT_NAME,
- ETHTOOL_A_BITSET_BIT_VALUE,
- __ETHTOOL_A_BITSET_BIT_CNT,
- ETHTOOL_A_BITSET_BIT_MAX = __ETHTOOL_A_BITSET_BIT_CNT - 1
-};
-enum {
- ETHTOOL_A_BITSET_BITS_UNSPEC,
- ETHTOOL_A_BITSET_BITS_BIT,
- __ETHTOOL_A_BITSET_BITS_CNT,
- ETHTOOL_A_BITSET_BITS_MAX = __ETHTOOL_A_BITSET_BITS_CNT - 1
-};
-enum {
- ETHTOOL_A_BITSET_UNSPEC,
- ETHTOOL_A_BITSET_NOMASK,
- ETHTOOL_A_BITSET_SIZE,
- ETHTOOL_A_BITSET_BITS,
- ETHTOOL_A_BITSET_VALUE,
- ETHTOOL_A_BITSET_MASK,
- __ETHTOOL_A_BITSET_CNT,
- ETHTOOL_A_BITSET_MAX = __ETHTOOL_A_BITSET_CNT - 1
-};
-enum {
- ETHTOOL_A_STRING_UNSPEC,
- ETHTOOL_A_STRING_INDEX,
- ETHTOOL_A_STRING_VALUE,
- __ETHTOOL_A_STRING_CNT,
- ETHTOOL_A_STRING_MAX = __ETHTOOL_A_STRING_CNT - 1
-};
-enum {
- ETHTOOL_A_STRINGS_UNSPEC,
- ETHTOOL_A_STRINGS_STRING,
- __ETHTOOL_A_STRINGS_CNT,
- ETHTOOL_A_STRINGS_MAX = __ETHTOOL_A_STRINGS_CNT - 1
-};
-enum {
- ETHTOOL_A_STRINGSET_UNSPEC,
- ETHTOOL_A_STRINGSET_ID,
- ETHTOOL_A_STRINGSET_COUNT,
- ETHTOOL_A_STRINGSET_STRINGS,
- __ETHTOOL_A_STRINGSET_CNT,
- ETHTOOL_A_STRINGSET_MAX = __ETHTOOL_A_STRINGSET_CNT - 1
-};
-enum {
- ETHTOOL_A_STRINGSETS_UNSPEC,
- ETHTOOL_A_STRINGSETS_STRINGSET,
- __ETHTOOL_A_STRINGSETS_CNT,
- ETHTOOL_A_STRINGSETS_MAX = __ETHTOOL_A_STRINGSETS_CNT - 1
-};
-enum {
- ETHTOOL_A_STRSET_UNSPEC,
- ETHTOOL_A_STRSET_HEADER,
- ETHTOOL_A_STRSET_STRINGSETS,
- ETHTOOL_A_STRSET_COUNTS_ONLY,
- __ETHTOOL_A_STRSET_CNT,
- ETHTOOL_A_STRSET_MAX = __ETHTOOL_A_STRSET_CNT - 1
-};
-enum {
- ETHTOOL_A_LINKINFO_UNSPEC,
- ETHTOOL_A_LINKINFO_HEADER,
- ETHTOOL_A_LINKINFO_PORT,
- ETHTOOL_A_LINKINFO_PHYADDR,
- ETHTOOL_A_LINKINFO_TP_MDIX,
- ETHTOOL_A_LINKINFO_TP_MDIX_CTRL,
- ETHTOOL_A_LINKINFO_TRANSCEIVER,
- __ETHTOOL_A_LINKINFO_CNT,
- ETHTOOL_A_LINKINFO_MAX = __ETHTOOL_A_LINKINFO_CNT - 1
-};
-enum {
- ETHTOOL_A_LINKMODES_UNSPEC,
- ETHTOOL_A_LINKMODES_HEADER,
- ETHTOOL_A_LINKMODES_AUTONEG,
- ETHTOOL_A_LINKMODES_OURS,
- ETHTOOL_A_LINKMODES_PEER,
- ETHTOOL_A_LINKMODES_SPEED,
- ETHTOOL_A_LINKMODES_DUPLEX,
- ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG,
- ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE,
- ETHTOOL_A_LINKMODES_LANES,
- __ETHTOOL_A_LINKMODES_CNT,
- ETHTOOL_A_LINKMODES_MAX = __ETHTOOL_A_LINKMODES_CNT - 1
-};
-enum {
- ETHTOOL_A_LINKSTATE_UNSPEC,
- ETHTOOL_A_LINKSTATE_HEADER,
- ETHTOOL_A_LINKSTATE_LINK,
- ETHTOOL_A_LINKSTATE_SQI,
- ETHTOOL_A_LINKSTATE_SQI_MAX,
- ETHTOOL_A_LINKSTATE_EXT_STATE,
- ETHTOOL_A_LINKSTATE_EXT_SUBSTATE,
- __ETHTOOL_A_LINKSTATE_CNT,
- ETHTOOL_A_LINKSTATE_MAX = __ETHTOOL_A_LINKSTATE_CNT - 1
-};
-enum {
- ETHTOOL_A_DEBUG_UNSPEC,
- ETHTOOL_A_DEBUG_HEADER,
- ETHTOOL_A_DEBUG_MSGMASK,
- __ETHTOOL_A_DEBUG_CNT,
- ETHTOOL_A_DEBUG_MAX = __ETHTOOL_A_DEBUG_CNT - 1
-};
-enum {
- ETHTOOL_A_WOL_UNSPEC,
- ETHTOOL_A_WOL_HEADER,
- ETHTOOL_A_WOL_MODES,
- ETHTOOL_A_WOL_SOPASS,
- __ETHTOOL_A_WOL_CNT,
- ETHTOOL_A_WOL_MAX = __ETHTOOL_A_WOL_CNT - 1
-};
-enum {
- ETHTOOL_A_FEATURES_UNSPEC,
- ETHTOOL_A_FEATURES_HEADER,
- ETHTOOL_A_FEATURES_HW,
- ETHTOOL_A_FEATURES_WANTED,
- ETHTOOL_A_FEATURES_ACTIVE,
- ETHTOOL_A_FEATURES_NOCHANGE,
- __ETHTOOL_A_FEATURES_CNT,
- ETHTOOL_A_FEATURES_MAX = __ETHTOOL_A_FEATURES_CNT - 1
-};
-enum {
- ETHTOOL_A_PRIVFLAGS_UNSPEC,
- ETHTOOL_A_PRIVFLAGS_HEADER,
- ETHTOOL_A_PRIVFLAGS_FLAGS,
- __ETHTOOL_A_PRIVFLAGS_CNT,
- ETHTOOL_A_PRIVFLAGS_MAX = __ETHTOOL_A_PRIVFLAGS_CNT - 1
-};
-enum {
- ETHTOOL_A_RINGS_UNSPEC,
- ETHTOOL_A_RINGS_HEADER,
- ETHTOOL_A_RINGS_RX_MAX,
- ETHTOOL_A_RINGS_RX_MINI_MAX,
- ETHTOOL_A_RINGS_RX_JUMBO_MAX,
- ETHTOOL_A_RINGS_TX_MAX,
- ETHTOOL_A_RINGS_RX,
- ETHTOOL_A_RINGS_RX_MINI,
- ETHTOOL_A_RINGS_RX_JUMBO,
- ETHTOOL_A_RINGS_TX,
- __ETHTOOL_A_RINGS_CNT,
- ETHTOOL_A_RINGS_MAX = (__ETHTOOL_A_RINGS_CNT - 1)
-};
-enum {
- ETHTOOL_A_CHANNELS_UNSPEC,
- ETHTOOL_A_CHANNELS_HEADER,
- ETHTOOL_A_CHANNELS_RX_MAX,
- ETHTOOL_A_CHANNELS_TX_MAX,
- ETHTOOL_A_CHANNELS_OTHER_MAX,
- ETHTOOL_A_CHANNELS_COMBINED_MAX,
- ETHTOOL_A_CHANNELS_RX_COUNT,
- ETHTOOL_A_CHANNELS_TX_COUNT,
- ETHTOOL_A_CHANNELS_OTHER_COUNT,
- ETHTOOL_A_CHANNELS_COMBINED_COUNT,
- __ETHTOOL_A_CHANNELS_CNT,
- ETHTOOL_A_CHANNELS_MAX = (__ETHTOOL_A_CHANNELS_CNT - 1)
-};
-enum {
- ETHTOOL_A_COALESCE_UNSPEC,
- ETHTOOL_A_COALESCE_HEADER,
- ETHTOOL_A_COALESCE_RX_USECS,
- ETHTOOL_A_COALESCE_RX_MAX_FRAMES,
- ETHTOOL_A_COALESCE_RX_USECS_IRQ,
- ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ,
- ETHTOOL_A_COALESCE_TX_USECS,
- ETHTOOL_A_COALESCE_TX_MAX_FRAMES,
- ETHTOOL_A_COALESCE_TX_USECS_IRQ,
- ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ,
- ETHTOOL_A_COALESCE_STATS_BLOCK_USECS,
- ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX,
- ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX,
- ETHTOOL_A_COALESCE_PKT_RATE_LOW,
- ETHTOOL_A_COALESCE_RX_USECS_LOW,
- ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW,
- ETHTOOL_A_COALESCE_TX_USECS_LOW,
- ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW,
- ETHTOOL_A_COALESCE_PKT_RATE_HIGH,
- ETHTOOL_A_COALESCE_RX_USECS_HIGH,
- ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH,
- ETHTOOL_A_COALESCE_TX_USECS_HIGH,
- ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH,
- ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL,
- __ETHTOOL_A_COALESCE_CNT,
- ETHTOOL_A_COALESCE_MAX = (__ETHTOOL_A_COALESCE_CNT - 1)
-};
-enum {
- ETHTOOL_A_PAUSE_UNSPEC,
- ETHTOOL_A_PAUSE_HEADER,
- ETHTOOL_A_PAUSE_AUTONEG,
- ETHTOOL_A_PAUSE_RX,
- ETHTOOL_A_PAUSE_TX,
- ETHTOOL_A_PAUSE_STATS,
- __ETHTOOL_A_PAUSE_CNT,
- ETHTOOL_A_PAUSE_MAX = (__ETHTOOL_A_PAUSE_CNT - 1)
-};
-enum {
- ETHTOOL_A_PAUSE_STAT_UNSPEC,
- ETHTOOL_A_PAUSE_STAT_PAD,
- ETHTOOL_A_PAUSE_STAT_TX_FRAMES,
- ETHTOOL_A_PAUSE_STAT_RX_FRAMES,
- __ETHTOOL_A_PAUSE_STAT_CNT,
- ETHTOOL_A_PAUSE_STAT_MAX = (__ETHTOOL_A_PAUSE_STAT_CNT - 1)
-};
-enum {
- ETHTOOL_A_EEE_UNSPEC,
- ETHTOOL_A_EEE_HEADER,
- ETHTOOL_A_EEE_MODES_OURS,
- ETHTOOL_A_EEE_MODES_PEER,
- ETHTOOL_A_EEE_ACTIVE,
- ETHTOOL_A_EEE_ENABLED,
- ETHTOOL_A_EEE_TX_LPI_ENABLED,
- ETHTOOL_A_EEE_TX_LPI_TIMER,
- __ETHTOOL_A_EEE_CNT,
- ETHTOOL_A_EEE_MAX = (__ETHTOOL_A_EEE_CNT - 1)
-};
-enum {
- ETHTOOL_A_TSINFO_UNSPEC,
- ETHTOOL_A_TSINFO_HEADER,
- ETHTOOL_A_TSINFO_TIMESTAMPING,
- ETHTOOL_A_TSINFO_TX_TYPES,
- ETHTOOL_A_TSINFO_RX_FILTERS,
- ETHTOOL_A_TSINFO_PHC_INDEX,
- __ETHTOOL_A_TSINFO_CNT,
- ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TEST_UNSPEC,
- ETHTOOL_A_CABLE_TEST_HEADER,
- __ETHTOOL_A_CABLE_TEST_CNT,
- ETHTOOL_A_CABLE_TEST_MAX = __ETHTOOL_A_CABLE_TEST_CNT - 1
-};
-enum {
- ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC,
- ETHTOOL_A_CABLE_RESULT_CODE_OK,
- ETHTOOL_A_CABLE_RESULT_CODE_OPEN,
- ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT,
- ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT,
-};
-enum {
- ETHTOOL_A_CABLE_PAIR_A,
- ETHTOOL_A_CABLE_PAIR_B,
- ETHTOOL_A_CABLE_PAIR_C,
- ETHTOOL_A_CABLE_PAIR_D,
-};
-enum {
- ETHTOOL_A_CABLE_RESULT_UNSPEC,
- ETHTOOL_A_CABLE_RESULT_PAIR,
- ETHTOOL_A_CABLE_RESULT_CODE,
- __ETHTOOL_A_CABLE_RESULT_CNT,
- ETHTOOL_A_CABLE_RESULT_MAX = (__ETHTOOL_A_CABLE_RESULT_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC,
- ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR,
- ETHTOOL_A_CABLE_FAULT_LENGTH_CM,
- __ETHTOOL_A_CABLE_FAULT_LENGTH_CNT,
- ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = (__ETHTOOL_A_CABLE_FAULT_LENGTH_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC,
- ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED,
- ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED
-};
-enum {
- ETHTOOL_A_CABLE_NEST_UNSPEC,
- ETHTOOL_A_CABLE_NEST_RESULT,
- ETHTOOL_A_CABLE_NEST_FAULT_LENGTH,
- __ETHTOOL_A_CABLE_NEST_CNT,
- ETHTOOL_A_CABLE_NEST_MAX = (__ETHTOOL_A_CABLE_NEST_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TEST_NTF_UNSPEC,
- ETHTOOL_A_CABLE_TEST_NTF_HEADER,
- ETHTOOL_A_CABLE_TEST_NTF_STATUS,
- ETHTOOL_A_CABLE_TEST_NTF_NEST,
- __ETHTOOL_A_CABLE_TEST_NTF_CNT,
- ETHTOOL_A_CABLE_TEST_NTF_MAX = (__ETHTOOL_A_CABLE_TEST_NTF_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC,
- ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST,
- ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST,
- ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP,
- ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR,
- __ETHTOOL_A_CABLE_TEST_TDR_CFG_CNT,
- ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX = __ETHTOOL_A_CABLE_TEST_TDR_CFG_CNT - 1
-};
-enum {
- ETHTOOL_A_CABLE_TEST_TDR_UNSPEC,
- ETHTOOL_A_CABLE_TEST_TDR_HEADER,
- ETHTOOL_A_CABLE_TEST_TDR_CFG,
- __ETHTOOL_A_CABLE_TEST_TDR_CNT,
- ETHTOOL_A_CABLE_TEST_TDR_MAX = __ETHTOOL_A_CABLE_TEST_TDR_CNT - 1
-};
-enum {
- ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC,
- ETHTOOL_A_CABLE_AMPLITUDE_PAIR,
- ETHTOOL_A_CABLE_AMPLITUDE_mV,
- __ETHTOOL_A_CABLE_AMPLITUDE_CNT,
- ETHTOOL_A_CABLE_AMPLITUDE_MAX = (__ETHTOOL_A_CABLE_AMPLITUDE_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_PULSE_UNSPEC,
- ETHTOOL_A_CABLE_PULSE_mV,
- __ETHTOOL_A_CABLE_PULSE_CNT,
- ETHTOOL_A_CABLE_PULSE_MAX = (__ETHTOOL_A_CABLE_PULSE_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_STEP_UNSPEC,
- ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE,
- ETHTOOL_A_CABLE_STEP_LAST_DISTANCE,
- ETHTOOL_A_CABLE_STEP_STEP_DISTANCE,
- __ETHTOOL_A_CABLE_STEP_CNT,
- ETHTOOL_A_CABLE_STEP_MAX = (__ETHTOOL_A_CABLE_STEP_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TDR_NEST_UNSPEC,
- ETHTOOL_A_CABLE_TDR_NEST_STEP,
- ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE,
- ETHTOOL_A_CABLE_TDR_NEST_PULSE,
- __ETHTOOL_A_CABLE_TDR_NEST_CNT,
- ETHTOOL_A_CABLE_TDR_NEST_MAX = (__ETHTOOL_A_CABLE_TDR_NEST_CNT - 1)
-};
-enum {
- ETHTOOL_A_CABLE_TEST_TDR_NTF_UNSPEC,
- ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER,
- ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS,
- ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST,
- __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT,
- ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = __ETHTOOL_A_CABLE_TEST_TDR_NTF_CNT - 1
-};
-enum {
- ETHTOOL_UDP_TUNNEL_TYPE_VXLAN,
- ETHTOOL_UDP_TUNNEL_TYPE_GENEVE,
- ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE,
- __ETHTOOL_UDP_TUNNEL_TYPE_CNT
-};
-enum {
- ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC,
- ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT,
- ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE,
- __ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT,
- ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = (__ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT - 1)
-};
-enum {
- ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC,
- ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE,
- ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES,
- ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY,
- __ETHTOOL_A_TUNNEL_UDP_TABLE_CNT,
- ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = (__ETHTOOL_A_TUNNEL_UDP_TABLE_CNT - 1)
-};
-enum {
- ETHTOOL_A_TUNNEL_UDP_UNSPEC,
- ETHTOOL_A_TUNNEL_UDP_TABLE,
- __ETHTOOL_A_TUNNEL_UDP_CNT,
- ETHTOOL_A_TUNNEL_UDP_MAX = (__ETHTOOL_A_TUNNEL_UDP_CNT - 1)
-};
-enum {
- ETHTOOL_A_TUNNEL_INFO_UNSPEC,
- ETHTOOL_A_TUNNEL_INFO_HEADER,
- ETHTOOL_A_TUNNEL_INFO_UDP_PORTS,
- __ETHTOOL_A_TUNNEL_INFO_CNT,
- ETHTOOL_A_TUNNEL_INFO_MAX = (__ETHTOOL_A_TUNNEL_INFO_CNT - 1)
-};
-#define ETHTOOL_GENL_NAME "ethtool"
-#define ETHTOOL_GENL_VERSION 1
-#define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
-#endif
diff --git a/libc/kernel/uapi/linux/f2fs.h b/libc/kernel/uapi/linux/f2fs.h
deleted file mode 100644
index 76da8f611..000000000
--- a/libc/kernel/uapi/linux/f2fs.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_F2FS_H
-#define _UAPI_LINUX_F2FS_H
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#define F2FS_IOCTL_MAGIC 0xf5
-#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1)
-#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2)
-#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3)
-#define F2FS_IOC_RELEASE_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 4)
-#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5)
-#define F2FS_IOC_GARBAGE_COLLECT _IOW(F2FS_IOCTL_MAGIC, 6, __u32)
-#define F2FS_IOC_WRITE_CHECKPOINT _IO(F2FS_IOCTL_MAGIC, 7)
-#define F2FS_IOC_DEFRAGMENT _IOWR(F2FS_IOCTL_MAGIC, 8, struct f2fs_defragment)
-#define F2FS_IOC_MOVE_RANGE _IOWR(F2FS_IOCTL_MAGIC, 9, struct f2fs_move_range)
-#define F2FS_IOC_FLUSH_DEVICE _IOW(F2FS_IOCTL_MAGIC, 10, struct f2fs_flush_device)
-#define F2FS_IOC_GARBAGE_COLLECT_RANGE _IOW(F2FS_IOCTL_MAGIC, 11, struct f2fs_gc_range)
-#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, __u32)
-#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32)
-#define F2FS_IOC_GET_PIN_FILE _IOR(F2FS_IOCTL_MAGIC, 14, __u32)
-#define F2FS_IOC_PRECACHE_EXTENTS _IO(F2FS_IOCTL_MAGIC, 15)
-#define F2FS_IOC_RESIZE_FS _IOW(F2FS_IOCTL_MAGIC, 16, __u64)
-#define F2FS_IOC_GET_COMPRESS_BLOCKS _IOR(F2FS_IOCTL_MAGIC, 17, __u64)
-#define F2FS_IOC_RELEASE_COMPRESS_BLOCKS _IOR(F2FS_IOCTL_MAGIC, 18, __u64)
-#define F2FS_IOC_RESERVE_COMPRESS_BLOCKS _IOR(F2FS_IOCTL_MAGIC, 19, __u64)
-#define F2FS_IOC_SEC_TRIM_FILE _IOW(F2FS_IOCTL_MAGIC, 20, struct f2fs_sectrim_range)
-#define F2FS_IOC_GET_COMPRESS_OPTION _IOR(F2FS_IOCTL_MAGIC, 21, struct f2fs_comp_option)
-#define F2FS_IOC_SET_COMPRESS_OPTION _IOW(F2FS_IOCTL_MAGIC, 22, struct f2fs_comp_option)
-#define F2FS_IOC_DECOMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 23)
-#define F2FS_IOC_COMPRESS_FILE _IO(F2FS_IOCTL_MAGIC, 24)
-#define F2FS_IOC_SHUTDOWN _IOR('X', 125, __u32)
-#define F2FS_GOING_DOWN_FULLSYNC 0x0
-#define F2FS_GOING_DOWN_METASYNC 0x1
-#define F2FS_GOING_DOWN_NOSYNC 0x2
-#define F2FS_GOING_DOWN_METAFLUSH 0x3
-#define F2FS_GOING_DOWN_NEED_FSCK 0x4
-#define F2FS_TRIM_FILE_DISCARD 0x1
-#define F2FS_TRIM_FILE_ZEROOUT 0x2
-#define F2FS_TRIM_FILE_MASK 0x3
-struct f2fs_gc_range {
- __u32 sync;
- __u64 start;
- __u64 len;
-};
-struct f2fs_defragment {
- __u64 start;
- __u64 len;
-};
-struct f2fs_move_range {
- __u32 dst_fd;
- __u64 pos_in;
- __u64 pos_out;
- __u64 len;
-};
-struct f2fs_flush_device {
- __u32 dev_num;
- __u32 segments;
-};
-struct f2fs_sectrim_range {
- __u64 start;
- __u64 len;
- __u64 flags;
-};
-struct f2fs_comp_option {
- __u8 algorithm;
- __u8 log_cluster_size;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/fanotify.h b/libc/kernel/uapi/linux/fanotify.h
index c63d0587a..8b4494f5a 100644
--- a/libc/kernel/uapi/linux/fanotify.h
+++ b/libc/kernel/uapi/linux/fanotify.h
@@ -36,8 +36,8 @@
#define FAN_OPEN_PERM 0x00010000
#define FAN_ACCESS_PERM 0x00020000
#define FAN_OPEN_EXEC_PERM 0x00040000
-#define FAN_EVENT_ON_CHILD 0x08000000
#define FAN_ONDIR 0x40000000
+#define FAN_EVENT_ON_CHILD 0x08000000
#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE)
#define FAN_MOVE (FAN_MOVED_FROM | FAN_MOVED_TO)
#define FAN_CLOEXEC 0x00000001
@@ -51,9 +51,6 @@
#define FAN_ENABLE_AUDIT 0x00000040
#define FAN_REPORT_TID 0x00000100
#define FAN_REPORT_FID 0x00000200
-#define FAN_REPORT_DIR_FID 0x00000400
-#define FAN_REPORT_NAME 0x00000800
-#define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME)
#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)
#define FAN_MARK_ADD 0x00000001
#define FAN_MARK_REMOVE 0x00000002
@@ -80,8 +77,6 @@ struct fanotify_event_metadata {
__s32 pid;
};
#define FAN_EVENT_INFO_TYPE_FID 1
-#define FAN_EVENT_INFO_TYPE_DFID_NAME 2
-#define FAN_EVENT_INFO_TYPE_DFID 3
struct fanotify_event_info_header {
__u8 info_type;
__u8 pad;
diff --git a/libc/kernel/uapi/linux/fb.h b/libc/kernel/uapi/linux/fb.h
index a0ef0c408..38da042df 100644
--- a/libc/kernel/uapi/linux/fb.h
+++ b/libc/kernel/uapi/linux/fb.h
@@ -182,7 +182,6 @@ struct fb_bitfield {
#define FB_ACTIVATE_ALL 64
#define FB_ACTIVATE_FORCE 128
#define FB_ACTIVATE_INV_MODE 256
-#define FB_ACTIVATE_KD_TEXT 512
#define FB_ACCELF_TEXT 1
#define FB_SYNC_HOR_HIGH_ACT 1
#define FB_SYNC_VERT_HIGH_ACT 2
diff --git a/libc/kernel/uapi/linux/fcntl.h b/libc/kernel/uapi/linux/fcntl.h
index a46726bb2..d0f19c856 100644
--- a/libc/kernel/uapi/linux/fcntl.h
+++ b/libc/kernel/uapi/linux/fcntl.h
@@ -19,7 +19,6 @@
#ifndef _UAPI_LINUX_FCNTL_H
#define _UAPI_LINUX_FCNTL_H
#include <asm/fcntl.h>
-#include <linux/openat2.h>
#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
@@ -54,7 +53,6 @@
#define DN_MULTISHOT 0x80000000
#define AT_FDCWD - 100
#define AT_SYMLINK_NOFOLLOW 0x100
-#define AT_EACCESS 0x200
#define AT_REMOVEDIR 0x200
#define AT_SYMLINK_FOLLOW 0x400
#define AT_NO_AUTOMOUNT 0x800
diff --git a/libc/kernel/uapi/linux/fd.h b/libc/kernel/uapi/linux/fd.h
index 4d72d6954..f3c2d50ef 100644
--- a/libc/kernel/uapi/linux/fd.h
+++ b/libc/kernel/uapi/linux/fd.h
@@ -84,8 +84,7 @@ struct floppy_drive_params {
#define FD_SILENT_DCL_CLEAR 0x4
#define FD_INVERTED_DCL 0x80
char read_track;
-#define FD_AUTODETECT_SIZE 8
- short autodetect[FD_AUTODETECT_SIZE];
+ short autodetect[8];
int checkfreq;
int native_format;
};
@@ -182,18 +181,10 @@ struct floppy_raw_cmd {
long phys_length;
int buffer_length;
unsigned char rate;
-#define FD_RAW_CMD_SIZE 16
-#define FD_RAW_REPLY_SIZE 16
-#define FD_RAW_CMD_FULLSIZE (FD_RAW_CMD_SIZE + 1 + FD_RAW_REPLY_SIZE)
unsigned char cmd_count;
- union {
- struct {
- unsigned char cmd[FD_RAW_CMD_SIZE];
- unsigned char reply_count;
- unsigned char reply[FD_RAW_REPLY_SIZE];
- };
- unsigned char fullcmd[FD_RAW_CMD_FULLSIZE];
- };
+ unsigned char cmd[16];
+ unsigned char reply_count;
+ unsigned char reply[16];
int track;
int resultcode;
int reserved1;
diff --git a/libc/kernel/uapi/linux/fdreg.h b/libc/kernel/uapi/linux/fdreg.h
index 2aeaf9a82..5280a59ee 100644
--- a/libc/kernel/uapi/linux/fdreg.h
+++ b/libc/kernel/uapi/linux/fdreg.h
@@ -18,15 +18,16 @@
****************************************************************************/
#ifndef _LINUX_FDREG_H
#define _LINUX_FDREG_H
-#define FD_SRA 0
-#define FD_SRB 1
-#define FD_DOR 2
-#define FD_TDR 3
-#define FD_DSR 4
-#define FD_STATUS 4
-#define FD_DATA 5
-#define FD_DIR 7
-#define FD_DCR 7
+#ifdef FDPATCHES
+#define FD_IOPORT fdc_state[fdc].address
+#else
+#define FD_IOPORT 0x3f0
+#endif
+#define FD_STATUS (4 + FD_IOPORT)
+#define FD_DATA (5 + FD_IOPORT)
+#define FD_DOR (2 + FD_IOPORT)
+#define FD_DIR (7 + FD_IOPORT)
+#define FD_DCR (7 + FD_IOPORT)
#define STATUS_BUSYMASK 0x0F
#define STATUS_BUSY 0x10
#define STATUS_DMA 0x20
diff --git a/libc/kernel/uapi/linux/fiemap.h b/libc/kernel/uapi/linux/fiemap.h
index 431078657..77c3cc582 100644
--- a/libc/kernel/uapi/linux/fiemap.h
+++ b/libc/kernel/uapi/linux/fiemap.h
@@ -16,8 +16,8 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_FIEMAP_H
-#define _UAPI_LINUX_FIEMAP_H
+#ifndef _LINUX_FIEMAP_H
+#define _LINUX_FIEMAP_H
#include <linux/types.h>
struct fiemap_extent {
__u64 fe_logical;
diff --git a/libc/kernel/uapi/linux/fpga-dfl.h b/libc/kernel/uapi/linux/fpga-dfl.h
index 54b93d007..8712e4cf3 100644
--- a/libc/kernel/uapi/linux/fpga-dfl.h
+++ b/libc/kernel/uapi/linux/fpga-dfl.h
@@ -63,15 +63,6 @@ struct dfl_fpga_port_dma_unmap {
__u64 iova;
};
#define DFL_FPGA_PORT_DMA_UNMAP _IO(DFL_FPGA_MAGIC, DFL_PORT_BASE + 4)
-struct dfl_fpga_irq_set {
- __u32 start;
- __u32 count;
- __s32 evtfds[];
-};
-#define DFL_FPGA_PORT_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 5, __u32)
-#define DFL_FPGA_PORT_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 6, struct dfl_fpga_irq_set)
-#define DFL_FPGA_PORT_UINT_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 7, __u32)
-#define DFL_FPGA_PORT_UINT_SET_IRQ _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 8, struct dfl_fpga_irq_set)
struct dfl_fpga_fme_port_pr {
__u32 argsz;
__u32 flags;
@@ -82,6 +73,4 @@ struct dfl_fpga_fme_port_pr {
#define DFL_FPGA_FME_PORT_PR _IO(DFL_FPGA_MAGIC, DFL_FME_BASE + 0)
#define DFL_FPGA_FME_PORT_RELEASE _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 1, int)
#define DFL_FPGA_FME_PORT_ASSIGN _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 2, int)
-#define DFL_FPGA_FME_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC, DFL_FME_BASE + 3, __u32)
-#define DFL_FPGA_FME_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 4, struct dfl_fpga_irq_set)
#endif
diff --git a/libc/kernel/uapi/linux/fs.h b/libc/kernel/uapi/linux/fs.h
index 0601768ae..1dd16026f 100644
--- a/libc/kernel/uapi/linux/fs.h
+++ b/libc/kernel/uapi/linux/fs.h
@@ -177,7 +177,6 @@ struct fsxattr {
#define FS_EA_INODE_FL 0x00200000
#define FS_EOFBLOCKS_FL 0x00400000
#define FS_NOCOW_FL 0x00800000
-#define FS_DAX_FL 0x02000000
#define FS_INLINE_DATA_FL 0x10000000
#define FS_PROJINHERIT_FL 0x20000000
#define FS_CASEFOLD_FL 0x40000000
diff --git a/libc/kernel/uapi/linux/fscrypt.h b/libc/kernel/uapi/linux/fscrypt.h
index ca42eb322..f91ce85e8 100644
--- a/libc/kernel/uapi/linux/fscrypt.h
+++ b/libc/kernel/uapi/linux/fscrypt.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_FSCRYPT_H
#define _UAPI_LINUX_FSCRYPT_H
-#include <linux/ioctl.h>
#include <linux/types.h>
#define FSCRYPT_POLICY_FLAGS_PAD_4 0x00
#define FSCRYPT_POLICY_FLAGS_PAD_8 0x01
@@ -27,12 +26,13 @@
#define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03
#define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04
#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 0x08
-#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
+#define FSCRYPT_POLICY_FLAGS_VALID 0x0F
#define FSCRYPT_MODE_AES_256_XTS 1
#define FSCRYPT_MODE_AES_256_CTS 4
#define FSCRYPT_MODE_AES_128_CBC 5
#define FSCRYPT_MODE_AES_128_CTS 6
#define FSCRYPT_MODE_ADIANTUM 9
+#define __FSCRYPT_MODE_MAX 9
#define FSCRYPT_POLICY_V1 0
#define FSCRYPT_KEY_DESCRIPTOR_SIZE 8
struct fscrypt_policy_v1 {
@@ -42,6 +42,7 @@ struct fscrypt_policy_v1 {
__u8 flags;
__u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
};
+#define fscrypt_policy fscrypt_policy_v1
#define FSCRYPT_KEY_DESC_PREFIX "fscrypt:"
#define FSCRYPT_KEY_DESC_PREFIX_SIZE 8
#define FSCRYPT_MAX_KEY_SIZE 64
@@ -79,16 +80,10 @@ struct fscrypt_key_specifier {
__u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE];
} u;
};
-struct fscrypt_provisioning_key_payload {
- __u32 type;
- __u32 __reserved;
- __u8 raw[];
-};
struct fscrypt_add_key_arg {
struct fscrypt_key_specifier key_spec;
__u32 raw_size;
- __u32 key_id;
- __u32 __reserved[7];
+ __u32 __reserved[8];
#define __FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED 0x00000001
__u32 __flags;
__u8 raw[];
@@ -112,16 +107,14 @@ struct fscrypt_get_key_status_arg {
__u32 user_count;
__u32 __out_reserved[13];
};
-#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy_v1)
+#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy)
#define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
-#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy_v1)
+#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy)
#define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9])
#define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg)
#define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
#define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
#define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
-#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
-#define fscrypt_policy fscrypt_policy_v1
#define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE
#define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4
#define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8
@@ -129,7 +122,7 @@ struct fscrypt_get_key_status_arg {
#define FS_POLICY_FLAGS_PAD_32 FSCRYPT_POLICY_FLAGS_PAD_32
#define FS_POLICY_FLAGS_PAD_MASK FSCRYPT_POLICY_FLAGS_PAD_MASK
#define FS_POLICY_FLAG_DIRECT_KEY FSCRYPT_POLICY_FLAG_DIRECT_KEY
-#define FS_POLICY_FLAGS_VALID 0x07
+#define FS_POLICY_FLAGS_VALID FSCRYPT_POLICY_FLAGS_VALID
#define FS_ENCRYPTION_MODE_INVALID 0
#define FS_ENCRYPTION_MODE_AES_256_XTS FSCRYPT_MODE_AES_256_XTS
#define FS_ENCRYPTION_MODE_AES_256_GCM 2
diff --git a/libc/kernel/uapi/linux/fsl_mc.h b/libc/kernel/uapi/linux/fsl_mc.h
deleted file mode 100644
index 721da936f..000000000
--- a/libc/kernel/uapi/linux/fsl_mc.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_FSL_MC_H_
-#define _UAPI_FSL_MC_H_
-#include <linux/types.h>
-#define MC_CMD_NUM_OF_PARAMS 7
-struct fsl_mc_command {
- __le64 header;
- __le64 params[MC_CMD_NUM_OF_PARAMS];
-};
-#define FSL_MC_SEND_CMD_IOCTL_TYPE 'R'
-#define FSL_MC_SEND_CMD_IOCTL_SEQ 0xE0
-#define FSL_MC_SEND_MC_COMMAND _IOWR(FSL_MC_SEND_CMD_IOCTL_TYPE, FSL_MC_SEND_CMD_IOCTL_SEQ, struct fsl_mc_command)
-#endif
diff --git a/libc/kernel/uapi/linux/fsverity.h b/libc/kernel/uapi/linux/fsverity.h
index ff1603cb4..501356753 100644
--- a/libc/kernel/uapi/linux/fsverity.h
+++ b/libc/kernel/uapi/linux/fsverity.h
@@ -38,34 +38,6 @@ struct fsverity_digest {
__u16 digest_size;
__u8 digest[];
};
-struct fsverity_descriptor {
- __u8 version;
- __u8 hash_algorithm;
- __u8 log_blocksize;
- __u8 salt_size;
- __le32 __reserved_0x04;
- __le64 data_size;
- __u8 root_hash[64];
- __u8 salt[32];
- __u8 __reserved[144];
-};
-struct fsverity_formatted_digest {
- char magic[8];
- __le16 digest_algorithm;
- __le16 digest_size;
- __u8 digest[];
-};
-#define FS_VERITY_METADATA_TYPE_MERKLE_TREE 1
-#define FS_VERITY_METADATA_TYPE_DESCRIPTOR 2
-#define FS_VERITY_METADATA_TYPE_SIGNATURE 3
-struct fsverity_read_metadata_arg {
- __u64 metadata_type;
- __u64 offset;
- __u64 length;
- __u64 buf_ptr;
- __u64 __reserved;
-};
#define FS_IOC_ENABLE_VERITY _IOW('f', 133, struct fsverity_enable_arg)
#define FS_IOC_MEASURE_VERITY _IOWR('f', 134, struct fsverity_digest)
-#define FS_IOC_READ_VERITY_METADATA _IOWR('f', 135, struct fsverity_read_metadata_arg)
#endif
diff --git a/libc/kernel/uapi/linux/fuse.h b/libc/kernel/uapi/linux/fuse.h
index efb5424ba..7a7ff9d1d 100644
--- a/libc/kernel/uapi/linux/fuse.h
+++ b/libc/kernel/uapi/linux/fuse.h
@@ -20,7 +20,7 @@
#define _LINUX_FUSE_H
#include <stdint.h>
#define FUSE_KERNEL_VERSION 7
-#define FUSE_KERNEL_MINOR_VERSION 33
+#define FUSE_KERNEL_MINOR_VERSION 31
#define FUSE_ROOT_ID 1
struct fuse_attr {
uint64_t ino;
@@ -38,7 +38,7 @@ struct fuse_attr {
uint32_t gid;
uint32_t rdev;
uint32_t blksize;
- uint32_t flags;
+ uint32_t padding;
};
struct fuse_kstatfs {
uint64_t blocks;
@@ -69,7 +69,6 @@ struct fuse_file_lock {
#define FATTR_MTIME_NOW (1 << 8)
#define FATTR_LOCKOWNER (1 << 9)
#define FATTR_CTIME (1 << 10)
-#define FATTR_KILL_SUIDGID (1 << 11)
#define FOPEN_DIRECT_IO (1 << 0)
#define FOPEN_KEEP_CACHE (1 << 1)
#define FOPEN_NONSEEKABLE (1 << 2)
@@ -102,9 +101,6 @@ struct fuse_file_lock {
#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
#define FUSE_MAP_ALIGNMENT (1 << 26)
-#define FUSE_SUBMOUNTS (1 << 27)
-#define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)
-#define FUSE_PASSTHROUGH (1 << 31)
#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
#define FUSE_RELEASE_FLUSH (1 << 0)
#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
@@ -112,8 +108,7 @@ struct fuse_file_lock {
#define FUSE_LK_FLOCK (1 << 0)
#define FUSE_WRITE_CACHE (1 << 0)
#define FUSE_WRITE_LOCKOWNER (1 << 1)
-#define FUSE_WRITE_KILL_SUIDGID (1 << 2)
-#define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID
+#define FUSE_WRITE_KILL_PRIV (1 << 2)
#define FUSE_READ_LOCKOWNER (1 << 1)
#define FUSE_IOCTL_COMPAT (1 << 0)
#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
@@ -124,8 +119,6 @@ struct fuse_file_lock {
#define FUSE_IOCTL_MAX_IOV 256
#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
#define FUSE_FSYNC_FDATASYNC (1 << 0)
-#define FUSE_ATTR_SUBMOUNT (1 << 0)
-#define FUSE_OPEN_KILL_SUIDGID (1 << 0)
enum fuse_opcode {
FUSE_LOOKUP = 1,
FUSE_FORGET = 2,
@@ -174,7 +167,6 @@ enum fuse_opcode {
FUSE_COPY_FILE_RANGE = 47,
FUSE_SETUPMAPPING = 48,
FUSE_REMOVEMAPPING = 49,
- FUSE_CANONICAL_PATH = 2016,
CUSE_INIT = 4096,
CUSE_INIT_BSWAP_RESERVED = 1048576,
FUSE_INIT_BSWAP_RESERVED = 436207616,
@@ -264,18 +256,18 @@ struct fuse_setattr_in {
};
struct fuse_open_in {
uint32_t flags;
- uint32_t open_flags;
+ uint32_t unused;
};
struct fuse_create_in {
uint32_t flags;
uint32_t mode;
uint32_t umask;
- uint32_t open_flags;
+ uint32_t padding;
};
struct fuse_open_out {
uint64_t fh;
uint32_t open_flags;
- uint32_t passthrough_fh;
+ uint32_t padding;
};
struct fuse_release_in {
uint64_t fh;
@@ -445,11 +437,6 @@ struct fuse_in_header {
uint32_t pid;
uint32_t padding;
};
-struct fuse_passthrough_out {
- uint32_t fd;
- uint32_t len;
- void * vec;
-};
struct fuse_out_header {
uint32_t len;
int32_t error;
@@ -508,9 +495,7 @@ struct fuse_notify_retrieve_in {
uint64_t dummy3;
uint64_t dummy4;
};
-#define FUSE_DEV_IOC_MAGIC 229
-#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
-#define FUSE_DEV_IOC_PASSTHROUGH_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 127, struct fuse_passthrough_out)
+#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
struct fuse_lseek_in {
uint64_t fh;
uint64_t offset;
@@ -529,21 +514,4 @@ struct fuse_copy_file_range_in {
uint64_t len;
uint64_t flags;
};
-#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
-#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
-struct fuse_setupmapping_in {
- uint64_t fh;
- uint64_t foffset;
- uint64_t len;
- uint64_t flags;
- uint64_t moffset;
-};
-struct fuse_removemapping_in {
- uint32_t count;
-};
-struct fuse_removemapping_one {
- uint64_t moffset;
- uint64_t len;
-};
-#define FUSE_REMOVEMAPPING_MAX_ENTRY (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
#endif
diff --git a/libc/kernel/uapi/linux/genetlink.h b/libc/kernel/uapi/linux/genetlink.h
index 2e2137d7d..a6e376033 100644
--- a/libc/kernel/uapi/linux/genetlink.h
+++ b/libc/kernel/uapi/linux/genetlink.h
@@ -49,7 +49,6 @@ enum {
CTRL_CMD_NEWMCAST_GRP,
CTRL_CMD_DELMCAST_GRP,
CTRL_CMD_GETMCAST_GRP,
- CTRL_CMD_GETPOLICY,
__CTRL_CMD_MAX,
};
#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
@@ -62,9 +61,6 @@ enum {
CTRL_ATTR_MAXATTR,
CTRL_ATTR_OPS,
CTRL_ATTR_MCAST_GROUPS,
- CTRL_ATTR_POLICY,
- CTRL_ATTR_OP_POLICY,
- CTRL_ATTR_OP,
__CTRL_ATTR_MAX,
};
#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
@@ -81,12 +77,5 @@ enum {
CTRL_ATTR_MCAST_GRP_ID,
__CTRL_ATTR_MCAST_GRP_MAX,
};
-enum {
- CTRL_ATTR_POLICY_UNSPEC,
- CTRL_ATTR_POLICY_DO,
- CTRL_ATTR_POLICY_DUMP,
- __CTRL_ATTR_POLICY_DUMP_MAX,
- CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1
-};
#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/gfs2_ondisk.h b/libc/kernel/uapi/linux/gfs2_ondisk.h
index 1ce427857..7d03ba53b 100644
--- a/libc/kernel/uapi/linux/gfs2_ondisk.h
+++ b/libc/kernel/uapi/linux/gfs2_ondisk.h
@@ -45,7 +45,7 @@
#define GFS2_FORMAT_RI 1100
#define GFS2_FORMAT_DE 1200
#define GFS2_FORMAT_QU 1500
-#define GFS2_FORMAT_FS 1802
+#define GFS2_FORMAT_FS 1801
#define GFS2_FORMAT_MULTI 1900
struct gfs2_inum {
__be64 no_formal_ino;
@@ -117,11 +117,6 @@ struct gfs2_rindex {
#define GFS2_RGF_DATAONLY 0x00000004
#define GFS2_RGF_NOALLOC 0x00000008
#define GFS2_RGF_TRIMMED 0x00000010
-struct gfs2_inode_lvb {
- __be32 ri_magic;
- __be32 __pad;
- __be64 ri_generation_deleted;
-};
struct gfs2_rgrp_lvb {
__be32 rl_magic;
__be32 rl_flags;
@@ -260,8 +255,7 @@ struct gfs2_leaf {
#define GFS2_EATYPE_USR 1
#define GFS2_EATYPE_SYS 2
#define GFS2_EATYPE_SECURITY 3
-#define GFS2_EATYPE_TRUSTED 4
-#define GFS2_EATYPE_LAST 4
+#define GFS2_EATYPE_LAST 3
#define GFS2_EATYPE_VALID(x) ((x) <= GFS2_EATYPE_LAST)
#define GFS2_EAFLAG_LAST 0x01
struct gfs2_ea_header {
diff --git a/libc/kernel/uapi/linux/remoteproc_cdev.h b/libc/kernel/uapi/linux/gigaset_dev.h
index a10ff01bb..5741d7d51 100644
--- a/libc/kernel/uapi/linux/remoteproc_cdev.h
+++ b/libc/kernel/uapi/linux/gigaset_dev.h
@@ -16,11 +16,15 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_REMOTEPROC_CDEV_H_
-#define _UAPI_REMOTEPROC_CDEV_H_
+#ifndef GIGASET_INTERFACE_H
+#define GIGASET_INTERFACE_H
#include <linux/ioctl.h>
-#include <linux/types.h>
-#define RPROC_MAGIC 0xB7
-#define RPROC_SET_SHUTDOWN_ON_RELEASE _IOW(RPROC_MAGIC, 1, __s32)
-#define RPROC_GET_SHUTDOWN_ON_RELEASE _IOR(RPROC_MAGIC, 2, __s32)
+#define GIGASET_IOCTL 0x47
+#define GIGASET_REDIR _IOWR(GIGASET_IOCTL, 0, int)
+#define GIGASET_CONFIG _IOWR(GIGASET_IOCTL, 1, int)
+#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
+#define GIGASET_VERSION _IOWR(GIGASET_IOCTL, 3, unsigned[4])
+#define GIGVER_DRIVER 0
+#define GIGVER_COMPAT 1
+#define GIGVER_FWBASE 2
#endif
diff --git a/libc/kernel/uapi/linux/gpio.h b/libc/kernel/uapi/linux/gpio.h
index 7e010d9ad..773f40933 100644
--- a/libc/kernel/uapi/linux/gpio.h
+++ b/libc/kernel/uapi/linux/gpio.h
@@ -18,100 +18,13 @@
****************************************************************************/
#ifndef _UAPI_GPIO_H_
#define _UAPI_GPIO_H_
-#include <linux/const.h>
#include <linux/ioctl.h>
#include <linux/types.h>
-#define GPIO_MAX_NAME_SIZE 32
struct gpiochip_info {
- char name[GPIO_MAX_NAME_SIZE];
- char label[GPIO_MAX_NAME_SIZE];
+ char name[32];
+ char label[32];
__u32 lines;
};
-#define GPIO_V2_LINES_MAX 64
-#define GPIO_V2_LINE_NUM_ATTRS_MAX 10
-enum gpio_v2_line_flag {
- GPIO_V2_LINE_FLAG_USED = _BITULL(0),
- GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL(1),
- GPIO_V2_LINE_FLAG_INPUT = _BITULL(2),
- GPIO_V2_LINE_FLAG_OUTPUT = _BITULL(3),
- GPIO_V2_LINE_FLAG_EDGE_RISING = _BITULL(4),
- GPIO_V2_LINE_FLAG_EDGE_FALLING = _BITULL(5),
- GPIO_V2_LINE_FLAG_OPEN_DRAIN = _BITULL(6),
- GPIO_V2_LINE_FLAG_OPEN_SOURCE = _BITULL(7),
- GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),
- GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
- GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
- GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11),
-};
-struct gpio_v2_line_values {
- __aligned_u64 bits;
- __aligned_u64 mask;
-};
-enum gpio_v2_line_attr_id {
- GPIO_V2_LINE_ATTR_ID_FLAGS = 1,
- GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2,
- GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3,
-};
-struct gpio_v2_line_attribute {
- __u32 id;
- __u32 padding;
- union {
- __aligned_u64 flags;
- __aligned_u64 values;
- __u32 debounce_period_us;
- };
-};
-struct gpio_v2_line_config_attribute {
- struct gpio_v2_line_attribute attr;
- __aligned_u64 mask;
-};
-struct gpio_v2_line_config {
- __aligned_u64 flags;
- __u32 num_attrs;
- __u32 padding[5];
- struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
-};
-struct gpio_v2_line_request {
- __u32 offsets[GPIO_V2_LINES_MAX];
- char consumer[GPIO_MAX_NAME_SIZE];
- struct gpio_v2_line_config config;
- __u32 num_lines;
- __u32 event_buffer_size;
- __u32 padding[5];
- __s32 fd;
-};
-struct gpio_v2_line_info {
- char name[GPIO_MAX_NAME_SIZE];
- char consumer[GPIO_MAX_NAME_SIZE];
- __u32 offset;
- __u32 num_attrs;
- __aligned_u64 flags;
- struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
- __u32 padding[4];
-};
-enum gpio_v2_line_changed_type {
- GPIO_V2_LINE_CHANGED_REQUESTED = 1,
- GPIO_V2_LINE_CHANGED_RELEASED = 2,
- GPIO_V2_LINE_CHANGED_CONFIG = 3,
-};
-struct gpio_v2_line_info_changed {
- struct gpio_v2_line_info info;
- __aligned_u64 timestamp_ns;
- __u32 event_type;
- __u32 padding[5];
-};
-enum gpio_v2_line_event_id {
- GPIO_V2_LINE_EVENT_RISING_EDGE = 1,
- GPIO_V2_LINE_EVENT_FALLING_EDGE = 2,
-};
-struct gpio_v2_line_event {
- __aligned_u64 timestamp_ns;
- __u32 id;
- __u32 offset;
- __u32 seqno;
- __u32 line_seqno;
- __u32 padding[6];
-};
#define GPIOLINE_FLAG_KERNEL (1UL << 0)
#define GPIOLINE_FLAG_IS_OUT (1UL << 1)
#define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
@@ -123,21 +36,10 @@ struct gpio_v2_line_event {
struct gpioline_info {
__u32 line_offset;
__u32 flags;
- char name[GPIO_MAX_NAME_SIZE];
- char consumer[GPIO_MAX_NAME_SIZE];
+ char name[32];
+ char consumer[32];
};
#define GPIOHANDLES_MAX 64
-enum {
- GPIOLINE_CHANGED_REQUESTED = 1,
- GPIOLINE_CHANGED_RELEASED,
- GPIOLINE_CHANGED_CONFIG,
-};
-struct gpioline_info_changed {
- struct gpioline_info info;
- __u64 timestamp;
- __u32 event_type;
- __u32 padding[5];
-};
#define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
#define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
#define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
@@ -150,7 +52,7 @@ struct gpiohandle_request {
__u32 lineoffsets[GPIOHANDLES_MAX];
__u32 flags;
__u8 default_values[GPIOHANDLES_MAX];
- char consumer_label[GPIO_MAX_NAME_SIZE];
+ char consumer_label[32];
__u32 lines;
int fd;
};
@@ -159,9 +61,12 @@ struct gpiohandle_config {
__u8 default_values[GPIOHANDLES_MAX];
__u32 padding[4];
};
+#define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0a, struct gpiohandle_config)
struct gpiohandle_data {
__u8 values[GPIOHANDLES_MAX];
};
+#define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
+#define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
#define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0)
#define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1)
#define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1))
@@ -169,7 +74,7 @@ struct gpioevent_request {
__u32 lineoffset;
__u32 handleflags;
__u32 eventflags;
- char consumer_label[GPIO_MAX_NAME_SIZE];
+ char consumer_label[32];
int fd;
};
#define GPIOEVENT_EVENT_RISING_EDGE 0x01
@@ -179,18 +84,7 @@ struct gpioevent_data {
__u32 id;
};
#define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
-#define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, __u32)
-#define GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct gpio_v2_line_info)
-#define GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct gpio_v2_line_info)
-#define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request)
-#define GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct gpio_v2_line_config)
-#define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
-#define GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct gpio_v2_line_values)
#define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
#define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
#define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
-#define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
-#define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
-#define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct gpiohandle_config)
-#define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct gpioline_info)
#endif
diff --git a/libc/kernel/uapi/linux/gtp.h b/libc/kernel/uapi/linux/gtp.h
index 3b9416ebf..bd2fbcb24 100644
--- a/libc/kernel/uapi/linux/gtp.h
+++ b/libc/kernel/uapi/linux/gtp.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_GTP_H_
#define _UAPI_LINUX_GTP_H_
-#define GTP_GENL_MCGRP_NAME "gtp"
enum gtp_genl_cmds {
GTP_CMD_NEWPDP,
GTP_CMD_DELPDP,
diff --git a/libc/kernel/uapi/linux/hdlc/ioctl.h b/libc/kernel/uapi/linux/hdlc/ioctl.h
index 3c727c5e9..67b4d139b 100644
--- a/libc/kernel/uapi/linux/hdlc/ioctl.h
+++ b/libc/kernel/uapi/linux/hdlc/ioctl.h
@@ -79,13 +79,5 @@ typedef struct {
unsigned int interval;
unsigned int timeout;
} cisco_proto;
-typedef struct {
- unsigned short dce;
- unsigned int modulo;
- unsigned int window;
- unsigned int t1;
- unsigned int t2;
- unsigned int n2;
-} x25_hdlc_proto;
#endif
#endif
diff --git a/libc/kernel/uapi/linux/hidraw.h b/libc/kernel/uapi/linux/hidraw.h
index 65020ac62..3ce49e185 100644
--- a/libc/kernel/uapi/linux/hidraw.h
+++ b/libc/kernel/uapi/linux/hidraw.h
@@ -36,11 +36,6 @@ struct hidraw_devinfo {
#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x06, len)
#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x07, len)
-#define HIDIOCGRAWUNIQ(len) _IOC(_IOC_READ, 'H', 0x08, len)
-#define HIDIOCSINPUT(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x09, len)
-#define HIDIOCGINPUT(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x0A, len)
-#define HIDIOCSOUTPUT(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x0B, len)
-#define HIDIOCGOUTPUT(len) _IOC(_IOC_WRITE | _IOC_READ, 'H', 0x0C, len)
#define HIDRAW_FIRST_MINOR 0
#define HIDRAW_MAX_DEVICES 64
#define HIDRAW_BUFFER_SIZE 64
diff --git a/libc/kernel/uapi/linux/hyperv.h b/libc/kernel/uapi/linux/hyperv.h
index daa8fc7e2..fb114ad84 100644
--- a/libc/kernel/uapi/linux/hyperv.h
+++ b/libc/kernel/uapi/linux/hyperv.h
@@ -70,8 +70,8 @@ enum hv_fcopy_op {
};
struct hv_fcopy_hdr {
__u32 operation;
- __u8 service_id0[16];
- __u8 service_id1[16];
+ uuid_le service_id0;
+ uuid_le service_id1;
} __attribute__((packed));
#define OVER_WRITE 0x1
#define CREATE_PATH 0x2
diff --git a/libc/kernel/uapi/linux/pidfd.h b/libc/kernel/uapi/linux/hysdn_if.h
index cd60118cb..2aac1d0da 100644
--- a/libc/kernel/uapi/linux/pidfd.h
+++ b/libc/kernel/uapi/linux/hysdn_if.h
@@ -16,9 +16,16 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_LINUX_PIDFD_H
-#define _UAPI_LINUX_PIDFD_H
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#define PIDFD_NONBLOCK O_NONBLOCK
-#endif
+#define ERR_NONE 0
+#define ERR_ALREADY_BOOT 1000
+#define EPOF_BAD_MAGIC 1001
+#define ERR_BOARD_DPRAM 1002
+#define EPOF_INTERNAL 1003
+#define EPOF_BAD_IMG_SIZE 1004
+#define ERR_BOOTIMG_FAIL 1005
+#define ERR_BOOTSEQ_FAIL 1006
+#define ERR_POF_TIMEOUT 1007
+#define ERR_NOT_BOOTED 1008
+#define ERR_CONF_LONG 1009
+#define ERR_INV_CHAN 1010
+#define ERR_ASYNC_TIME 1011
diff --git a/libc/kernel/uapi/linux/i2c.h b/libc/kernel/uapi/linux/i2c.h
index fe578e867..dc1e96aaa 100644
--- a/libc/kernel/uapi/linux/i2c.h
+++ b/libc/kernel/uapi/linux/i2c.h
@@ -60,7 +60,6 @@ struct i2c_msg {
#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_PEC)
-#define I2C_FUNC_SMBUS_EMUL_ALL (I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL)
#define I2C_SMBUS_BLOCK_MAX 32
union i2c_smbus_data {
__u8 byte;
diff --git a/libc/kernel/uapi/linux/icmp.h b/libc/kernel/uapi/linux/icmp.h
index 5892d1268..03aa08728 100644
--- a/libc/kernel/uapi/linux/icmp.h
+++ b/libc/kernel/uapi/linux/icmp.h
@@ -19,7 +19,6 @@
#ifndef _UAPI_LINUX_ICMP_H
#define _UAPI_LINUX_ICMP_H
#include <linux/types.h>
-#include <asm/byteorder.h>
#define ICMP_ECHOREPLY 0
#define ICMP_DEST_UNREACH 3
#define ICMP_SOURCE_QUENCH 4
@@ -78,20 +77,4 @@ struct icmphdr {
struct icmp_filter {
__u32 data;
};
-struct icmp_ext_hdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
- __u8 reserved1 : 4, version : 4;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- __u8 version : 4, reserved1 : 4;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
- __u8 reserved2;
- __sum16 checksum;
-};
-struct icmp_extobj_hdr {
- __be16 length;
- __u8 class_num;
- __u8 class_type;
-};
#endif
diff --git a/libc/kernel/uapi/linux/icmpv6.h b/libc/kernel/uapi/linux/icmpv6.h
index e23fbb4c5..798a94599 100644
--- a/libc/kernel/uapi/linux/icmpv6.h
+++ b/libc/kernel/uapi/linux/icmpv6.h
@@ -59,7 +59,6 @@ struct icmp6hdr {
#define icmp6_mtu icmp6_dataun.un_data32[0]
#define icmp6_unused icmp6_dataun.un_data32[0]
#define icmp6_maxdelay icmp6_dataun.un_data16[0]
-#define icmp6_datagram_len icmp6_dataun.un_data8[0]
#define icmp6_router icmp6_dataun.u_nd_advt.router
#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited
#define icmp6_override icmp6_dataun.u_nd_advt.override
@@ -106,7 +105,6 @@ struct icmp6hdr {
#define ICMPV6_HDR_FIELD 0
#define ICMPV6_UNK_NEXTHDR 1
#define ICMPV6_UNK_OPTION 2
-#define ICMPV6_HDR_INCOMP 3
#define ICMPV6_FILTER 1
#define ICMPV6_FILTER_BLOCK 1
#define ICMPV6_FILTER_PASS 2
diff --git a/libc/kernel/uapi/linux/idxd.h b/libc/kernel/uapi/linux/idxd.h
deleted file mode 100644
index 4f1282e55..000000000
--- a/libc/kernel/uapi/linux/idxd.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _USR_IDXD_H_
-#define _USR_IDXD_H_
-#include <stdint.h>
-#define IDXD_OP_FLAG_FENCE 0x0001
-#define IDXD_OP_FLAG_BOF 0x0002
-#define IDXD_OP_FLAG_CRAV 0x0004
-#define IDXD_OP_FLAG_RCR 0x0008
-#define IDXD_OP_FLAG_RCI 0x0010
-#define IDXD_OP_FLAG_CRSTS 0x0020
-#define IDXD_OP_FLAG_CR 0x0080
-#define IDXD_OP_FLAG_CC 0x0100
-#define IDXD_OP_FLAG_ADDR1_TCS 0x0200
-#define IDXD_OP_FLAG_ADDR2_TCS 0x0400
-#define IDXD_OP_FLAG_ADDR3_TCS 0x0800
-#define IDXD_OP_FLAG_CR_TCS 0x1000
-#define IDXD_OP_FLAG_STORD 0x2000
-#define IDXD_OP_FLAG_DRDBK 0x4000
-#define IDXD_OP_FLAG_DSTS 0x8000
-#define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000
-enum dsa_opcode {
- DSA_OPCODE_NOOP = 0,
- DSA_OPCODE_BATCH,
- DSA_OPCODE_DRAIN,
- DSA_OPCODE_MEMMOVE,
- DSA_OPCODE_MEMFILL,
- DSA_OPCODE_COMPARE,
- DSA_OPCODE_COMPVAL,
- DSA_OPCODE_CR_DELTA,
- DSA_OPCODE_AP_DELTA,
- DSA_OPCODE_DUALCAST,
- DSA_OPCODE_CRCGEN = 0x10,
- DSA_OPCODE_COPY_CRC,
- DSA_OPCODE_DIF_CHECK,
- DSA_OPCODE_DIF_INS,
- DSA_OPCODE_DIF_STRP,
- DSA_OPCODE_DIF_UPDT,
- DSA_OPCODE_CFLUSH = 0x20,
-};
-enum iax_opcode {
- IAX_OPCODE_NOOP = 0,
- IAX_OPCODE_DRAIN = 2,
- IAX_OPCODE_MEMMOVE,
- IAX_OPCODE_DECOMPRESS = 0x42,
- IAX_OPCODE_COMPRESS,
-};
-enum dsa_completion_status {
- DSA_COMP_NONE = 0,
- DSA_COMP_SUCCESS,
- DSA_COMP_SUCCESS_PRED,
- DSA_COMP_PAGE_FAULT_NOBOF,
- DSA_COMP_PAGE_FAULT_IR,
- DSA_COMP_BATCH_FAIL,
- DSA_COMP_BATCH_PAGE_FAULT,
- DSA_COMP_DR_OFFSET_NOINC,
- DSA_COMP_DR_OFFSET_ERANGE,
- DSA_COMP_DIF_ERR,
- DSA_COMP_BAD_OPCODE = 0x10,
- DSA_COMP_INVALID_FLAGS,
- DSA_COMP_NOZERO_RESERVE,
- DSA_COMP_XFER_ERANGE,
- DSA_COMP_DESC_CNT_ERANGE,
- DSA_COMP_DR_ERANGE,
- DSA_COMP_OVERLAP_BUFFERS,
- DSA_COMP_DCAST_ERR,
- DSA_COMP_DESCLIST_ALIGN,
- DSA_COMP_INT_HANDLE_INVAL,
- DSA_COMP_CRA_XLAT,
- DSA_COMP_CRA_ALIGN,
- DSA_COMP_ADDR_ALIGN,
- DSA_COMP_PRIV_BAD,
- DSA_COMP_TRAFFIC_CLASS_CONF,
- DSA_COMP_PFAULT_RDBA,
- DSA_COMP_HW_ERR1,
- DSA_COMP_HW_ERR_DRB,
- DSA_COMP_TRANSLATION_FAIL,
-};
-enum iax_completion_status {
- IAX_COMP_NONE = 0,
- IAX_COMP_SUCCESS,
- IAX_COMP_PAGE_FAULT_IR = 0x04,
- IAX_COMP_OUTBUF_OVERFLOW,
- IAX_COMP_BAD_OPCODE = 0x10,
- IAX_COMP_INVALID_FLAGS,
- IAX_COMP_NOZERO_RESERVE,
- IAX_COMP_INVALID_SIZE,
- IAX_COMP_OVERLAP_BUFFERS = 0x16,
- IAX_COMP_INT_HANDLE_INVAL = 0x19,
- IAX_COMP_CRA_XLAT,
- IAX_COMP_CRA_ALIGN,
- IAX_COMP_ADDR_ALIGN,
- IAX_COMP_PRIV_BAD,
- IAX_COMP_TRAFFIC_CLASS_CONF,
- IAX_COMP_PFAULT_RDBA,
- IAX_COMP_HW_ERR1,
- IAX_COMP_HW_ERR_DRB,
- IAX_COMP_TRANSLATION_FAIL,
- IAX_COMP_PRS_TIMEOUT,
- IAX_COMP_WATCHDOG,
- IAX_COMP_INVALID_COMP_FLAG = 0x30,
- IAX_COMP_INVALID_FILTER_FLAG,
- IAX_COMP_INVALID_NUM_ELEMS = 0x33,
-};
-#define DSA_COMP_STATUS_MASK 0x7f
-#define DSA_COMP_STATUS_WRITE 0x80
-struct dsa_hw_desc {
- uint32_t pasid : 20;
- uint32_t rsvd : 11;
- uint32_t priv : 1;
- uint32_t flags : 24;
- uint32_t opcode : 8;
- uint64_t completion_addr;
- union {
- uint64_t src_addr;
- uint64_t rdback_addr;
- uint64_t pattern;
- uint64_t desc_list_addr;
- };
- union {
- uint64_t dst_addr;
- uint64_t rdback_addr2;
- uint64_t src2_addr;
- uint64_t comp_pattern;
- };
- union {
- uint32_t xfer_size;
- uint32_t desc_count;
- };
- uint16_t int_handle;
- uint16_t rsvd1;
- union {
- uint8_t expected_res;
- struct {
- uint64_t delta_addr;
- uint32_t max_delta_size;
- uint32_t delt_rsvd;
- uint8_t expected_res_mask;
- };
- uint32_t delta_rec_size;
- uint64_t dest2;
- struct {
- uint32_t crc_seed;
- uint32_t crc_rsvd;
- uint64_t seed_addr;
- };
- struct {
- uint8_t src_dif_flags;
- uint8_t dif_chk_res;
- uint8_t dif_chk_flags;
- uint8_t dif_chk_res2[5];
- uint32_t chk_ref_tag_seed;
- uint16_t chk_app_tag_mask;
- uint16_t chk_app_tag_seed;
- };
- struct {
- uint8_t dif_ins_res;
- uint8_t dest_dif_flag;
- uint8_t dif_ins_flags;
- uint8_t dif_ins_res2[13];
- uint32_t ins_ref_tag_seed;
- uint16_t ins_app_tag_mask;
- uint16_t ins_app_tag_seed;
- };
- struct {
- uint8_t src_upd_flags;
- uint8_t upd_dest_flags;
- uint8_t dif_upd_flags;
- uint8_t dif_upd_res[5];
- uint32_t src_ref_tag_seed;
- uint16_t src_app_tag_mask;
- uint16_t src_app_tag_seed;
- uint32_t dest_ref_tag_seed;
- uint16_t dest_app_tag_mask;
- uint16_t dest_app_tag_seed;
- };
- uint8_t op_specific[24];
- };
-} __attribute__((packed));
-struct iax_hw_desc {
- uint32_t pasid : 20;
- uint32_t rsvd : 11;
- uint32_t priv : 1;
- uint32_t flags : 24;
- uint32_t opcode : 8;
- uint64_t completion_addr;
- uint64_t src1_addr;
- uint64_t dst_addr;
- uint32_t src1_size;
- uint16_t int_handle;
- union {
- uint16_t compr_flags;
- uint16_t decompr_flags;
- };
- uint64_t src2_addr;
- uint32_t max_dst_size;
- uint32_t src2_size;
- uint32_t filter_flags;
- uint32_t num_inputs;
-} __attribute__((packed));
-struct dsa_raw_desc {
- uint64_t field[8];
-} __attribute__((packed));
-struct dsa_completion_record {
- volatile uint8_t status;
- union {
- uint8_t result;
- uint8_t dif_status;
- };
- uint16_t rsvd;
- uint32_t bytes_completed;
- uint64_t fault_addr;
- union {
- struct {
- uint32_t invalid_flags : 24;
- uint32_t rsvd2 : 8;
- };
- uint32_t delta_rec_size;
- uint32_t crc_val;
- struct {
- uint32_t dif_chk_ref_tag;
- uint16_t dif_chk_app_tag_mask;
- uint16_t dif_chk_app_tag;
- };
- struct {
- uint64_t dif_ins_res;
- uint32_t dif_ins_ref_tag;
- uint16_t dif_ins_app_tag_mask;
- uint16_t dif_ins_app_tag;
- };
- struct {
- uint32_t dif_upd_src_ref_tag;
- uint16_t dif_upd_src_app_tag_mask;
- uint16_t dif_upd_src_app_tag;
- uint32_t dif_upd_dest_ref_tag;
- uint16_t dif_upd_dest_app_tag_mask;
- uint16_t dif_upd_dest_app_tag;
- };
- uint8_t op_specific[16];
- };
-} __attribute__((packed));
-struct dsa_raw_completion_record {
- uint64_t field[4];
-} __attribute__((packed));
-struct iax_completion_record {
- volatile uint8_t status;
- uint8_t error_code;
- uint16_t rsvd;
- uint32_t bytes_completed;
- uint64_t fault_addr;
- uint32_t invalid_flags;
- uint32_t rsvd2;
- uint32_t output_size;
- uint8_t output_bits;
- uint8_t rsvd3;
- uint16_t rsvd4;
- uint64_t rsvd5[4];
-} __attribute__((packed));
-struct iax_raw_completion_record {
- uint64_t field[8];
-} __attribute__((packed));
-#endif
diff --git a/libc/kernel/uapi/linux/if.h b/libc/kernel/uapi/linux/if.h
index 63c77ebd9..12967f791 100644
--- a/libc/kernel/uapi/linux/if.h
+++ b/libc/kernel/uapi/linux/if.h
@@ -114,7 +114,6 @@ enum {
enum {
IF_LINK_MODE_DEFAULT,
IF_LINK_MODE_DORMANT,
- IF_LINK_MODE_TESTING,
};
#if __UAPI_DEF_IF_IFMAP
struct ifmap {
@@ -135,7 +134,6 @@ struct if_settings {
fr_proto __user * fr;
fr_proto_pvc __user * fr_pvc;
fr_proto_pvc_info __user * fr_pvc_info;
- x25_hdlc_proto __user * x25;
sync_serial_settings __user * sync;
te1_settings __user * te1;
} ifs_ifsu;
diff --git a/libc/kernel/uapi/linux/if_alg.h b/libc/kernel/uapi/linux/if_alg.h
index 6530a16be..9befa4d68 100644
--- a/libc/kernel/uapi/linux/if_alg.h
+++ b/libc/kernel/uapi/linux/if_alg.h
@@ -26,13 +26,6 @@ struct sockaddr_alg {
__u32 salg_mask;
__u8 salg_name[64];
};
-struct sockaddr_alg_new {
- __u16 salg_family;
- __u8 salg_type[14];
- __u32 salg_feat;
- __u32 salg_mask;
- __u8 salg_name[];
-};
struct af_alg_iv {
__u32 ivlen;
__u8 iv[0];
@@ -42,7 +35,6 @@ struct af_alg_iv {
#define ALG_SET_OP 3
#define ALG_SET_AEAD_ASSOCLEN 4
#define ALG_SET_AEAD_AUTHSIZE 5
-#define ALG_SET_DRBG_ENTROPY 6
#define ALG_OP_DECRYPT 0
#define ALG_OP_ENCRYPT 1
#endif
diff --git a/libc/kernel/uapi/linux/if_bonding.h b/libc/kernel/uapi/linux/if_bonding.h
index 60abfdec9..a1fa959e6 100644
--- a/libc/kernel/uapi/linux/if_bonding.h
+++ b/libc/kernel/uapi/linux/if_bonding.h
@@ -50,15 +50,6 @@
#define BOND_XMIT_POLICY_LAYER23 2
#define BOND_XMIT_POLICY_ENCAP23 3
#define BOND_XMIT_POLICY_ENCAP34 4
-#define BOND_XMIT_POLICY_VLAN_SRCMAC 5
-#define LACP_STATE_LACP_ACTIVITY 0x1
-#define LACP_STATE_LACP_TIMEOUT 0x2
-#define LACP_STATE_AGGREGATION 0x4
-#define LACP_STATE_SYNCHRONIZATION 0x8
-#define LACP_STATE_COLLECTING 0x10
-#define LACP_STATE_DISTRIBUTING 0x20
-#define LACP_STATE_DEFAULTED 0x40
-#define LACP_STATE_EXPIRED 0x80
typedef struct ifbond {
__s32 bond_mode;
__s32 num_slaves;
diff --git a/libc/kernel/uapi/linux/if_bridge.h b/libc/kernel/uapi/linux/if_bridge.h
index 570c09ea6..03cc1c45d 100644
--- a/libc/kernel/uapi/linux/if_bridge.h
+++ b/libc/kernel/uapi/linux/if_bridge.h
@@ -106,8 +106,6 @@ enum {
IFLA_BRIDGE_MODE,
IFLA_BRIDGE_VLAN_INFO,
IFLA_BRIDGE_VLAN_TUNNEL_INFO,
- IFLA_BRIDGE_MRP,
- IFLA_BRIDGE_CFM,
__IFLA_BRIDGE_MAX,
};
#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
@@ -117,7 +115,6 @@ enum {
#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1 << 3)
#define BRIDGE_VLAN_INFO_RANGE_END (1 << 4)
#define BRIDGE_VLAN_INFO_BRENTRY (1 << 5)
-#define BRIDGE_VLAN_INFO_ONLY_OPTS (1 << 6)
struct bridge_vlan_info {
__u16 flags;
__u16 vid;
@@ -140,305 +137,6 @@ struct bridge_vlan_xstats {
__u32 pad2;
};
enum {
- IFLA_BRIDGE_MRP_UNSPEC,
- IFLA_BRIDGE_MRP_INSTANCE,
- IFLA_BRIDGE_MRP_PORT_STATE,
- IFLA_BRIDGE_MRP_PORT_ROLE,
- IFLA_BRIDGE_MRP_RING_STATE,
- IFLA_BRIDGE_MRP_RING_ROLE,
- IFLA_BRIDGE_MRP_START_TEST,
- IFLA_BRIDGE_MRP_INFO,
- IFLA_BRIDGE_MRP_IN_ROLE,
- IFLA_BRIDGE_MRP_IN_STATE,
- IFLA_BRIDGE_MRP_START_IN_TEST,
- __IFLA_BRIDGE_MRP_MAX,
-};
-#define IFLA_BRIDGE_MRP_MAX (__IFLA_BRIDGE_MRP_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_INSTANCE_UNSPEC,
- IFLA_BRIDGE_MRP_INSTANCE_RING_ID,
- IFLA_BRIDGE_MRP_INSTANCE_P_IFINDEX,
- IFLA_BRIDGE_MRP_INSTANCE_S_IFINDEX,
- IFLA_BRIDGE_MRP_INSTANCE_PRIO,
- __IFLA_BRIDGE_MRP_INSTANCE_MAX,
-};
-#define IFLA_BRIDGE_MRP_INSTANCE_MAX (__IFLA_BRIDGE_MRP_INSTANCE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_PORT_STATE_UNSPEC,
- IFLA_BRIDGE_MRP_PORT_STATE_STATE,
- __IFLA_BRIDGE_MRP_PORT_STATE_MAX,
-};
-#define IFLA_BRIDGE_MRP_PORT_STATE_MAX (__IFLA_BRIDGE_MRP_PORT_STATE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_PORT_ROLE_UNSPEC,
- IFLA_BRIDGE_MRP_PORT_ROLE_ROLE,
- __IFLA_BRIDGE_MRP_PORT_ROLE_MAX,
-};
-#define IFLA_BRIDGE_MRP_PORT_ROLE_MAX (__IFLA_BRIDGE_MRP_PORT_ROLE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_RING_STATE_UNSPEC,
- IFLA_BRIDGE_MRP_RING_STATE_RING_ID,
- IFLA_BRIDGE_MRP_RING_STATE_STATE,
- __IFLA_BRIDGE_MRP_RING_STATE_MAX,
-};
-#define IFLA_BRIDGE_MRP_RING_STATE_MAX (__IFLA_BRIDGE_MRP_RING_STATE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_RING_ROLE_UNSPEC,
- IFLA_BRIDGE_MRP_RING_ROLE_RING_ID,
- IFLA_BRIDGE_MRP_RING_ROLE_ROLE,
- __IFLA_BRIDGE_MRP_RING_ROLE_MAX,
-};
-#define IFLA_BRIDGE_MRP_RING_ROLE_MAX (__IFLA_BRIDGE_MRP_RING_ROLE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_START_TEST_UNSPEC,
- IFLA_BRIDGE_MRP_START_TEST_RING_ID,
- IFLA_BRIDGE_MRP_START_TEST_INTERVAL,
- IFLA_BRIDGE_MRP_START_TEST_MAX_MISS,
- IFLA_BRIDGE_MRP_START_TEST_PERIOD,
- IFLA_BRIDGE_MRP_START_TEST_MONITOR,
- __IFLA_BRIDGE_MRP_START_TEST_MAX,
-};
-#define IFLA_BRIDGE_MRP_START_TEST_MAX (__IFLA_BRIDGE_MRP_START_TEST_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_INFO_UNSPEC,
- IFLA_BRIDGE_MRP_INFO_RING_ID,
- IFLA_BRIDGE_MRP_INFO_P_IFINDEX,
- IFLA_BRIDGE_MRP_INFO_S_IFINDEX,
- IFLA_BRIDGE_MRP_INFO_PRIO,
- IFLA_BRIDGE_MRP_INFO_RING_STATE,
- IFLA_BRIDGE_MRP_INFO_RING_ROLE,
- IFLA_BRIDGE_MRP_INFO_TEST_INTERVAL,
- IFLA_BRIDGE_MRP_INFO_TEST_MAX_MISS,
- IFLA_BRIDGE_MRP_INFO_TEST_MONITOR,
- IFLA_BRIDGE_MRP_INFO_I_IFINDEX,
- IFLA_BRIDGE_MRP_INFO_IN_STATE,
- IFLA_BRIDGE_MRP_INFO_IN_ROLE,
- IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL,
- IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS,
- __IFLA_BRIDGE_MRP_INFO_MAX,
-};
-#define IFLA_BRIDGE_MRP_INFO_MAX (__IFLA_BRIDGE_MRP_INFO_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_IN_STATE_UNSPEC,
- IFLA_BRIDGE_MRP_IN_STATE_IN_ID,
- IFLA_BRIDGE_MRP_IN_STATE_STATE,
- __IFLA_BRIDGE_MRP_IN_STATE_MAX,
-};
-#define IFLA_BRIDGE_MRP_IN_STATE_MAX (__IFLA_BRIDGE_MRP_IN_STATE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC,
- IFLA_BRIDGE_MRP_IN_ROLE_RING_ID,
- IFLA_BRIDGE_MRP_IN_ROLE_IN_ID,
- IFLA_BRIDGE_MRP_IN_ROLE_ROLE,
- IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX,
- __IFLA_BRIDGE_MRP_IN_ROLE_MAX,
-};
-#define IFLA_BRIDGE_MRP_IN_ROLE_MAX (__IFLA_BRIDGE_MRP_IN_ROLE_MAX - 1)
-enum {
- IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC,
- IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID,
- IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL,
- IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS,
- IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD,
- __IFLA_BRIDGE_MRP_START_IN_TEST_MAX,
-};
-#define IFLA_BRIDGE_MRP_START_IN_TEST_MAX (__IFLA_BRIDGE_MRP_START_IN_TEST_MAX - 1)
-struct br_mrp_instance {
- __u32 ring_id;
- __u32 p_ifindex;
- __u32 s_ifindex;
- __u16 prio;
-};
-struct br_mrp_ring_state {
- __u32 ring_id;
- __u32 ring_state;
-};
-struct br_mrp_ring_role {
- __u32 ring_id;
- __u32 ring_role;
-};
-struct br_mrp_start_test {
- __u32 ring_id;
- __u32 interval;
- __u32 max_miss;
- __u32 period;
- __u32 monitor;
-};
-struct br_mrp_in_state {
- __u32 in_state;
- __u16 in_id;
-};
-struct br_mrp_in_role {
- __u32 ring_id;
- __u32 in_role;
- __u32 i_ifindex;
- __u16 in_id;
-};
-struct br_mrp_start_in_test {
- __u32 interval;
- __u32 max_miss;
- __u32 period;
- __u16 in_id;
-};
-enum {
- IFLA_BRIDGE_CFM_UNSPEC,
- IFLA_BRIDGE_CFM_MEP_CREATE,
- IFLA_BRIDGE_CFM_MEP_DELETE,
- IFLA_BRIDGE_CFM_MEP_CONFIG,
- IFLA_BRIDGE_CFM_CC_CONFIG,
- IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD,
- IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE,
- IFLA_BRIDGE_CFM_CC_RDI,
- IFLA_BRIDGE_CFM_CC_CCM_TX,
- IFLA_BRIDGE_CFM_MEP_CREATE_INFO,
- IFLA_BRIDGE_CFM_MEP_CONFIG_INFO,
- IFLA_BRIDGE_CFM_CC_CONFIG_INFO,
- IFLA_BRIDGE_CFM_CC_RDI_INFO,
- IFLA_BRIDGE_CFM_CC_CCM_TX_INFO,
- IFLA_BRIDGE_CFM_CC_PEER_MEP_INFO,
- IFLA_BRIDGE_CFM_MEP_STATUS_INFO,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_INFO,
- __IFLA_BRIDGE_CFM_MAX,
-};
-#define IFLA_BRIDGE_CFM_MAX (__IFLA_BRIDGE_CFM_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_MEP_CREATE_UNSPEC,
- IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE,
- IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN,
- IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION,
- IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX,
- __IFLA_BRIDGE_CFM_MEP_CREATE_MAX,
-};
-#define IFLA_BRIDGE_CFM_MEP_CREATE_MAX (__IFLA_BRIDGE_CFM_MEP_CREATE_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_MEP_DELETE_UNSPEC,
- IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE,
- __IFLA_BRIDGE_CFM_MEP_DELETE_MAX,
-};
-#define IFLA_BRIDGE_CFM_MEP_DELETE_MAX (__IFLA_BRIDGE_CFM_MEP_DELETE_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_MEP_CONFIG_UNSPEC,
- IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE,
- IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC,
- IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL,
- IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID,
- __IFLA_BRIDGE_CFM_MEP_CONFIG_MAX,
-};
-#define IFLA_BRIDGE_CFM_MEP_CONFIG_MAX (__IFLA_BRIDGE_CFM_MEP_CONFIG_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_CC_CONFIG_UNSPEC,
- IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE,
- IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE,
- IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL,
- IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID,
- __IFLA_BRIDGE_CFM_CC_CONFIG_MAX,
-};
-#define IFLA_BRIDGE_CFM_CC_CONFIG_MAX (__IFLA_BRIDGE_CFM_CC_CONFIG_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_CC_PEER_MEP_UNSPEC,
- IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE,
- IFLA_BRIDGE_CFM_CC_PEER_MEPID,
- __IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX,
-};
-#define IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX (__IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_CC_RDI_UNSPEC,
- IFLA_BRIDGE_CFM_CC_RDI_INSTANCE,
- IFLA_BRIDGE_CFM_CC_RDI_RDI,
- __IFLA_BRIDGE_CFM_CC_RDI_MAX,
-};
-#define IFLA_BRIDGE_CFM_CC_RDI_MAX (__IFLA_BRIDGE_CFM_CC_RDI_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_CC_CCM_TX_UNSPEC,
- IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE,
- IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC,
- IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE,
- IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD,
- IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV,
- IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE,
- IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV,
- IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE,
- __IFLA_BRIDGE_CFM_CC_CCM_TX_MAX,
-};
-#define IFLA_BRIDGE_CFM_CC_CCM_TX_MAX (__IFLA_BRIDGE_CFM_CC_CCM_TX_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_MEP_STATUS_UNSPEC,
- IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE,
- IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN,
- IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN,
- IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN,
- __IFLA_BRIDGE_CFM_MEP_STATUS_MAX,
-};
-#define IFLA_BRIDGE_CFM_MEP_STATUS_MAX (__IFLA_BRIDGE_CFM_MEP_STATUS_MAX - 1)
-enum {
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_UNSPEC,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN,
- IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN,
- __IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX,
-};
-#define IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX (__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX - 1)
-struct bridge_stp_xstats {
- __u64 transition_blk;
- __u64 transition_fwd;
- __u64 rx_bpdu;
- __u64 tx_bpdu;
- __u64 rx_tcn;
- __u64 tx_tcn;
-};
-struct br_vlan_msg {
- __u8 family;
- __u8 reserved1;
- __u16 reserved2;
- __u32 ifindex;
-};
-enum {
- BRIDGE_VLANDB_DUMP_UNSPEC,
- BRIDGE_VLANDB_DUMP_FLAGS,
- __BRIDGE_VLANDB_DUMP_MAX,
-};
-#define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
-#define BRIDGE_VLANDB_DUMPF_STATS (1 << 0)
-enum {
- BRIDGE_VLANDB_UNSPEC,
- BRIDGE_VLANDB_ENTRY,
- __BRIDGE_VLANDB_MAX,
-};
-#define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
-enum {
- BRIDGE_VLANDB_ENTRY_UNSPEC,
- BRIDGE_VLANDB_ENTRY_INFO,
- BRIDGE_VLANDB_ENTRY_RANGE,
- BRIDGE_VLANDB_ENTRY_STATE,
- BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
- BRIDGE_VLANDB_ENTRY_STATS,
- __BRIDGE_VLANDB_ENTRY_MAX,
-};
-#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
-enum {
- BRIDGE_VLANDB_TINFO_UNSPEC,
- BRIDGE_VLANDB_TINFO_ID,
- BRIDGE_VLANDB_TINFO_CMD,
- __BRIDGE_VLANDB_TINFO_MAX,
-};
-#define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
-enum {
- BRIDGE_VLANDB_STATS_UNSPEC,
- BRIDGE_VLANDB_STATS_RX_BYTES,
- BRIDGE_VLANDB_STATS_RX_PACKETS,
- BRIDGE_VLANDB_STATS_TX_BYTES,
- BRIDGE_VLANDB_STATS_TX_PACKETS,
- BRIDGE_VLANDB_STATS_PAD,
- __BRIDGE_VLANDB_STATS_MAX,
-};
-#define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
-enum {
MDBA_UNSPEC,
MDBA_MDB,
MDBA_ROUTER,
@@ -460,27 +158,10 @@ enum {
enum {
MDBA_MDB_EATTR_UNSPEC,
MDBA_MDB_EATTR_TIMER,
- MDBA_MDB_EATTR_SRC_LIST,
- MDBA_MDB_EATTR_GROUP_MODE,
- MDBA_MDB_EATTR_SOURCE,
- MDBA_MDB_EATTR_RTPROT,
__MDBA_MDB_EATTR_MAX
};
#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
enum {
- MDBA_MDB_SRCLIST_UNSPEC,
- MDBA_MDB_SRCLIST_ENTRY,
- __MDBA_MDB_SRCLIST_MAX
-};
-#define MDBA_MDB_SRCLIST_MAX (__MDBA_MDB_SRCLIST_MAX - 1)
-enum {
- MDBA_MDB_SRCATTR_UNSPEC,
- MDBA_MDB_SRCATTR_ADDRESS,
- MDBA_MDB_SRCATTR_TIMER,
- __MDBA_MDB_SRCATTR_MAX
-};
-#define MDBA_MDB_SRCATTR_MAX (__MDBA_MDB_SRCATTR_MAX - 1)
-enum {
MDB_RTR_TYPE_DISABLED,
MDB_RTR_TYPE_TEMP_QUERY,
MDB_RTR_TYPE_PERM,
@@ -510,15 +191,12 @@ struct br_mdb_entry {
__u8 state;
#define MDB_FLAGS_OFFLOAD (1 << 0)
#define MDB_FLAGS_FAST_LEAVE (1 << 1)
-#define MDB_FLAGS_STAR_EXCL (1 << 2)
-#define MDB_FLAGS_BLOCKED (1 << 3)
__u8 flags;
__u16 vid;
struct {
union {
__be32 ip4;
struct in6_addr ip6;
- unsigned char mac_addr[ETH_ALEN];
} u;
__be16 proto;
} addr;
@@ -526,22 +204,14 @@ struct br_mdb_entry {
enum {
MDBA_SET_ENTRY_UNSPEC,
MDBA_SET_ENTRY,
- MDBA_SET_ENTRY_ATTRS,
__MDBA_SET_ENTRY_MAX,
};
#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
enum {
- MDBE_ATTR_UNSPEC,
- MDBE_ATTR_SOURCE,
- __MDBE_ATTR_MAX,
-};
-#define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
-enum {
BRIDGE_XSTATS_UNSPEC,
BRIDGE_XSTATS_VLAN,
BRIDGE_XSTATS_MCAST,
BRIDGE_XSTATS_PAD,
- BRIDGE_XSTATS_STP,
__BRIDGE_XSTATS_MAX
};
#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_ether.h b/libc/kernel/uapi/linux/if_ether.h
index 840565393..dd2dedb41 100644
--- a/libc/kernel/uapi/linux/if_ether.h
+++ b/libc/kernel/uapi/linux/if_ether.h
@@ -73,14 +73,12 @@
#define ETH_P_PREAUTH 0x88C7
#define ETH_P_TIPC 0x88CA
#define ETH_P_LLDP 0x88CC
-#define ETH_P_MRP 0x88E3
#define ETH_P_MACSEC 0x88E5
#define ETH_P_8021AH 0x88E7
#define ETH_P_MVRP 0x88F5
#define ETH_P_1588 0x88F7
#define ETH_P_NCSI 0x88F8
#define ETH_P_PRP 0x88FB
-#define ETH_P_CFM 0x8902
#define ETH_P_FCOE 0x8906
#define ETH_P_IBOE 0x8915
#define ETH_P_TDLS 0x890D
diff --git a/libc/kernel/uapi/linux/if_frad.h b/libc/kernel/uapi/linux/if_frad.h
new file mode 100644
index 000000000..18763050f
--- /dev/null
+++ b/libc/kernel/uapi/linux/if_frad.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_FRAD_H_
+#define _UAPI_FRAD_H_
+#include <linux/if.h>
+struct dlci_add {
+ char devname[IFNAMSIZ];
+ short dlci;
+};
+#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
+#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
+struct dlci_conf {
+ short flags;
+ short CIR_fwd;
+ short Bc_fwd;
+ short Be_fwd;
+ short CIR_bwd;
+ short Bc_bwd;
+ short Be_bwd;
+ short Tc_fwd;
+ short Tc_bwd;
+ short Tf_max;
+ short Tb_max;
+};
+#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
+#define DLCI_IGNORE_CIR_OUT 0x0001
+#define DLCI_ACCOUNT_CIR_IN 0x0002
+#define DLCI_BUFFER_IF 0x0008
+#define DLCI_VALID_FLAGS 0x000B
+#define FRAD_GET_CONF (SIOCDEVPRIVATE)
+#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
+#define FRAD_LAST_IOCTL FRAD_SET_CONF
+struct frad_conf {
+ short station;
+ short flags;
+ short kbaud;
+ short clocking;
+ short mtu;
+ short T391;
+ short T392;
+ short N391;
+ short N392;
+ short N393;
+ short CIR_fwd;
+ short Bc_fwd;
+ short Be_fwd;
+ short CIR_bwd;
+ short Bc_bwd;
+ short Be_bwd;
+};
+#define FRAD_STATION_CPE 0x0000
+#define FRAD_STATION_NODE 0x0001
+#define FRAD_TX_IGNORE_CIR 0x0001
+#define FRAD_RX_ACCOUNT_CIR 0x0002
+#define FRAD_DROP_ABORTED 0x0004
+#define FRAD_BUFFERIF 0x0008
+#define FRAD_STATS 0x0010
+#define FRAD_MCI 0x0100
+#define FRAD_AUTODLCI 0x8000
+#define FRAD_VALID_FLAGS 0x811F
+#define FRAD_CLOCK_INT 0x0001
+#define FRAD_CLOCK_EXT 0x0000
+#endif
diff --git a/libc/kernel/uapi/linux/if_link.h b/libc/kernel/uapi/linux/if_link.h
index 2a5ba5a11..7843fb52e 100644
--- a/libc/kernel/uapi/linux/if_link.h
+++ b/libc/kernel/uapi/linux/if_link.h
@@ -146,18 +146,9 @@ enum {
IFLA_MAX_MTU,
IFLA_PROP_LIST,
IFLA_ALT_IFNAME,
- IFLA_PERM_ADDRESS,
- IFLA_PROTO_DOWN_REASON,
__IFLA_MAX
};
#define IFLA_MAX (__IFLA_MAX - 1)
-enum {
- IFLA_PROTO_DOWN_REASON_UNSPEC,
- IFLA_PROTO_DOWN_REASON_MASK,
- IFLA_PROTO_DOWN_REASON_VALUE,
- __IFLA_PROTO_DOWN_REASON_CNT,
- IFLA_PROTO_DOWN_REASON_MAX = __IFLA_PROTO_DOWN_REASON_CNT - 1
-};
#define IFLA_RTA(r) ((struct rtattr *) (((char *) (r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg))
enum {
@@ -280,10 +271,6 @@ enum {
IFLA_BRPORT_NEIGH_SUPPRESS,
IFLA_BRPORT_ISOLATED,
IFLA_BRPORT_BACKUP_PORT,
- IFLA_BRPORT_MRP_RING_OPEN,
- IFLA_BRPORT_MRP_IN_OPEN,
- IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT,
- IFLA_BRPORT_MCAST_EHT_HOSTS_CNT,
__IFLA_BRPORT_MAX
};
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -335,8 +322,6 @@ enum {
IFLA_MACVLAN_MACADDR,
IFLA_MACVLAN_MACADDR_DATA,
IFLA_MACVLAN_MACADDR_COUNT,
- IFLA_MACVLAN_BC_QUEUE_LEN,
- IFLA_MACVLAN_BC_QUEUE_LEN_USED,
__IFLA_MACVLAN_MAX,
};
#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
@@ -382,7 +367,6 @@ enum {
IFLA_MACSEC_REPLAY_PROTECT,
IFLA_MACSEC_VALIDATION,
IFLA_MACSEC_PAD,
- IFLA_MACSEC_OFFLOAD,
__IFLA_MACSEC_MAX,
};
#define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1)
@@ -400,13 +384,6 @@ enum macsec_validation_type {
__MACSEC_VALIDATE_END,
MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
};
-enum macsec_offload {
- MACSEC_OFFLOAD_OFF = 0,
- MACSEC_OFFLOAD_PHY = 1,
- MACSEC_OFFLOAD_MAC = 2,
- __MACSEC_OFFLOAD_END,
- MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
-};
enum {
IFLA_IPVLAN_UNSPEC,
IFLA_IPVLAN_MODE,
@@ -493,15 +470,6 @@ enum ifla_geneve_df {
GENEVE_DF_MAX = __GENEVE_DF_END - 1,
};
enum {
- IFLA_BAREUDP_UNSPEC,
- IFLA_BAREUDP_PORT,
- IFLA_BAREUDP_ETHERTYPE,
- IFLA_BAREUDP_SRCPORT_MIN,
- IFLA_BAREUDP_MULTIPROTO_MODE,
- __IFLA_BAREUDP_MAX
-};
-#define IFLA_BAREUDP_MAX (__IFLA_BAREUDP_MAX - 1)
-enum {
IFLA_PPP_UNSPEC,
IFLA_PPP_DEV_FD,
__IFLA_PPP_MAX
@@ -734,11 +702,6 @@ enum {
};
#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
enum {
- HSR_PROTOCOL_HSR,
- HSR_PROTOCOL_PRP,
- HSR_PROTOCOL_MAX,
-};
-enum {
IFLA_HSR_UNSPEC,
IFLA_HSR_SLAVE1,
IFLA_HSR_SLAVE2,
@@ -746,7 +709,6 @@ enum {
IFLA_HSR_SUPERVISION_ADDR,
IFLA_HSR_SEQ_NR,
IFLA_HSR_VERSION,
- IFLA_HSR_PROTOCOL,
__IFLA_HSR_MAX,
};
#define IFLA_HSR_MAX (__IFLA_HSR_MAX - 1)
@@ -785,9 +747,8 @@ enum {
#define XDP_FLAGS_SKB_MODE (1U << 1)
#define XDP_FLAGS_DRV_MODE (1U << 2)
#define XDP_FLAGS_HW_MODE (1U << 3)
-#define XDP_FLAGS_REPLACE (1U << 4)
#define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE)
-#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES | XDP_FLAGS_REPLACE)
+#define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | XDP_FLAGS_MODES)
enum {
XDP_ATTACHED_NONE = 0,
XDP_ATTACHED_DRV,
@@ -804,7 +765,6 @@ enum {
IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID,
IFLA_XDP_HW_PROG_ID,
- IFLA_XDP_EXPECTED_FD,
__IFLA_XDP_MAX,
};
#define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/if_macsec.h b/libc/kernel/uapi/linux/if_macsec.h
index e60d76746..a58f5316e 100644
--- a/libc/kernel/uapi/linux/if_macsec.h
+++ b/libc/kernel/uapi/linux/if_macsec.h
@@ -25,8 +25,6 @@
#define MACSEC_KEYID_LEN 16
#define MACSEC_CIPHER_ID_GCM_AES_128 0x0080C20001000001ULL
#define MACSEC_CIPHER_ID_GCM_AES_256 0x0080C20001000002ULL
-#define MACSEC_CIPHER_ID_GCM_AES_XPN_128 0x0080C20001000003ULL
-#define MACSEC_CIPHER_ID_GCM_AES_XPN_256 0x0080C20001000004ULL
#define MACSEC_DEFAULT_CIPHER_ID 0x0080020001000001ULL
#define MACSEC_DEFAULT_CIPHER_ALT MACSEC_CIPHER_ID_GCM_AES_128
#define MACSEC_MIN_ICV_LEN 8
@@ -42,7 +40,6 @@ enum macsec_attrs {
MACSEC_ATTR_RXSC_LIST,
MACSEC_ATTR_TXSC_STATS,
MACSEC_ATTR_SECY_STATS,
- MACSEC_ATTR_OFFLOAD,
__MACSEC_ATTR_END,
NUM_MACSEC_ATTR = __MACSEC_ATTR_END,
MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1,
@@ -87,20 +84,10 @@ enum macsec_sa_attrs {
MACSEC_SA_ATTR_KEYID,
MACSEC_SA_ATTR_STATS,
MACSEC_SA_ATTR_PAD,
- MACSEC_SA_ATTR_SSCI,
- MACSEC_SA_ATTR_SALT,
__MACSEC_SA_ATTR_END,
NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END,
MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1,
};
-enum macsec_offload_attrs {
- MACSEC_OFFLOAD_ATTR_UNSPEC,
- MACSEC_OFFLOAD_ATTR_TYPE,
- MACSEC_OFFLOAD_ATTR_PAD,
- __MACSEC_OFFLOAD_ATTR_END,
- NUM_MACSEC_OFFLOAD_ATTR = __MACSEC_OFFLOAD_ATTR_END,
- MACSEC_OFFLOAD_ATTR_MAX = __MACSEC_OFFLOAD_ATTR_END - 1,
-};
enum macsec_nl_commands {
MACSEC_CMD_GET_TXSC,
MACSEC_CMD_ADD_RXSC,
@@ -112,7 +99,6 @@ enum macsec_nl_commands {
MACSEC_CMD_ADD_RXSA,
MACSEC_CMD_DEL_RXSA,
MACSEC_CMD_UPD_RXSA,
- MACSEC_CMD_UPD_OFFLOAD,
};
enum macsec_rxsc_stats_attr {
MACSEC_RXSC_STATS_ATTR_UNSPEC,
diff --git a/libc/kernel/uapi/linux/if_packet.h b/libc/kernel/uapi/linux/if_packet.h
index e7e7a3313..db24bbef1 100644
--- a/libc/kernel/uapi/linux/if_packet.h
+++ b/libc/kernel/uapi/linux/if_packet.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef __LINUX_IF_PACKET_H
#define __LINUX_IF_PACKET_H
-#include <asm/byteorder.h>
#include <linux/types.h>
struct sockaddr_pkt {
unsigned short spkt_family;
@@ -219,16 +218,6 @@ struct packet_mreq {
unsigned short mr_alen;
unsigned char mr_address[8];
};
-struct fanout_args {
-#ifdef __LITTLE_ENDIAN_BITFIELD
- __u16 id;
- __u16 type_flags;
-#else
- __u16 type_flags;
- __u16 id;
-#endif
- __u32 max_num_members;
-};
#define PACKET_MR_MULTICAST 0
#define PACKET_MR_PROMISC 1
#define PACKET_MR_ALLMULTI 2
diff --git a/libc/kernel/uapi/linux/if_xdp.h b/libc/kernel/uapi/linux/if_xdp.h
index d2b6bfd8a..3615edbf2 100644
--- a/libc/kernel/uapi/linux/if_xdp.h
+++ b/libc/kernel/uapi/linux/if_xdp.h
@@ -63,9 +63,6 @@ struct xdp_statistics {
__u64 rx_dropped;
__u64 rx_invalid_descs;
__u64 tx_invalid_descs;
- __u64 rx_ring_full;
- __u64 rx_fill_ring_empty_descs;
- __u64 tx_ring_empty_descs;
};
struct xdp_options {
__u32 flags;
diff --git a/libc/kernel/uapi/linux/iio/types.h b/libc/kernel/uapi/linux/iio/types.h
index 22409a76f..e3f3ec4d7 100644
--- a/libc/kernel/uapi/linux/iio/types.h
+++ b/libc/kernel/uapi/linux/iio/types.h
@@ -100,7 +100,6 @@ enum iio_modifier {
IIO_MOD_PM10,
IIO_MOD_ETHANOL,
IIO_MOD_H2,
- IIO_MOD_O2,
};
enum iio_event_type {
IIO_EV_TYPE_THRESH,
diff --git a/libc/kernel/uapi/linux/in.h b/libc/kernel/uapi/linux/in.h
index e5437ca1a..f1dab00eb 100644
--- a/libc/kernel/uapi/linux/in.h
+++ b/libc/kernel/uapi/linux/in.h
@@ -74,12 +74,8 @@ enum {
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
IPPROTO_MPLS = 137,
#define IPPROTO_MPLS IPPROTO_MPLS
- IPPROTO_ETHERNET = 143,
-#define IPPROTO_ETHERNET IPPROTO_ETHERNET
IPPROTO_RAW = 255,
#define IPPROTO_RAW IPPROTO_RAW
- IPPROTO_MPTCP = 262,
-#define IPPROTO_MPTCP IPPROTO_MPTCP
IPPROTO_MAX
};
#endif
@@ -112,7 +108,6 @@ enum {
#define IP_CHECKSUM 23
#define IP_BIND_ADDRESS_NO_PORT 24
#define IP_RECVFRAGSIZE 25
-#define IP_RECVERR_RFC4884 26
#define IP_PMTUDISC_DONT 0
#define IP_PMTUDISC_WANT 1
#define IP_PMTUDISC_DO 2
diff --git a/libc/kernel/uapi/linux/in6.h b/libc/kernel/uapi/linux/in6.h
index 8dd32383d..2eb64d035 100644
--- a/libc/kernel/uapi/linux/in6.h
+++ b/libc/kernel/uapi/linux/in6.h
@@ -134,7 +134,6 @@ struct in6_flowlabel_req {
#define IPV6_LEAVE_ANYCAST 28
#define IPV6_MULTICAST_ALL 29
#define IPV6_ROUTER_ALERT_ISOLATE 30
-#define IPV6_RECVERR_RFC4884 31
#define IPV6_PMTUDISC_DONT 0
#define IPV6_PMTUDISC_WANT 1
#define IPV6_PMTUDISC_DO 2
diff --git a/libc/kernel/uapi/linux/incrementalfs.h b/libc/kernel/uapi/linux/incrementalfs.h
deleted file mode 100644
index 622a9987b..000000000
--- a/libc/kernel/uapi/linux/incrementalfs.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_INCREMENTALFS_H
-#define _UAPI_LINUX_INCREMENTALFS_H
-#include <linux/limits.h>
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#include <linux/xattr.h>
-#define INCFS_NAME "incremental-fs"
-#define INCFS_MAGIC_NUMBER (0x5346434e49ul & ULONG_MAX)
-#define INCFS_DATA_FILE_BLOCK_SIZE 4096
-#define INCFS_HEADER_VER 1
-#define INCFS_MAX_HASH_SIZE 32
-#define INCFS_MAX_FILE_ATTR_SIZE 512
-#define INCFS_INDEX_NAME ".index"
-#define INCFS_INCOMPLETE_NAME ".incomplete"
-#define INCFS_PENDING_READS_FILENAME ".pending_reads"
-#define INCFS_LOG_FILENAME ".log"
-#define INCFS_BLOCKS_WRITTEN_FILENAME ".blocks_written"
-#define INCFS_XATTR_ID_NAME (XATTR_USER_PREFIX "incfs.id")
-#define INCFS_XATTR_SIZE_NAME (XATTR_USER_PREFIX "incfs.size")
-#define INCFS_XATTR_METADATA_NAME (XATTR_USER_PREFIX "incfs.metadata")
-#define INCFS_XATTR_VERITY_NAME (XATTR_USER_PREFIX "incfs.verity")
-#define INCFS_MAX_SIGNATURE_SIZE 8096
-#define INCFS_SIGNATURE_VERSION 2
-#define INCFS_SIGNATURE_SECTIONS 2
-#define INCFS_IOCTL_BASE_CODE 'g'
-#define INCFS_IOC_CREATE_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 30, struct incfs_new_file_args)
-#define INCFS_IOC_READ_FILE_SIGNATURE _IOR(INCFS_IOCTL_BASE_CODE, 31, struct incfs_get_file_sig_args)
-#define INCFS_IOC_FILL_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 32, struct incfs_fill_blocks)
-#define INCFS_IOC_PERMIT_FILL _IOW(INCFS_IOCTL_BASE_CODE, 33, struct incfs_permit_fill)
-#define INCFS_IOC_GET_FILLED_BLOCKS _IOR(INCFS_IOCTL_BASE_CODE, 34, struct incfs_get_filled_blocks_args)
-#define INCFS_IOC_CREATE_MAPPED_FILE _IOWR(INCFS_IOCTL_BASE_CODE, 35, struct incfs_create_mapped_file_args)
-#define INCFS_IOC_GET_BLOCK_COUNT _IOR(INCFS_IOCTL_BASE_CODE, 36, struct incfs_get_block_count_args)
-#define INCFS_IOC_GET_READ_TIMEOUTS _IOR(INCFS_IOCTL_BASE_CODE, 37, struct incfs_get_read_timeouts_args)
-#define INCFS_IOC_SET_READ_TIMEOUTS _IOW(INCFS_IOCTL_BASE_CODE, 38, struct incfs_set_read_timeouts_args)
-#define INCFS_IOC_GET_LAST_READ_ERROR _IOW(INCFS_IOCTL_BASE_CODE, 39, struct incfs_get_last_read_error_args)
-#define INCFS_FEATURE_FLAG_COREFS "corefs"
-#define INCFS_FEATURE_FLAG_ZSTD "zstd"
-#define INCFS_FEATURE_FLAG_V2 "v2"
-enum incfs_compression_alg {
- COMPRESSION_NONE = 0,
- COMPRESSION_LZ4 = 1,
- COMPRESSION_ZSTD = 2,
-};
-enum incfs_block_flags {
- INCFS_BLOCK_FLAGS_NONE = 0,
- INCFS_BLOCK_FLAGS_HASH = 1,
-};
-typedef struct {
- __u8 bytes[16];
-} incfs_uuid_t __attribute__((aligned(8)));
-struct incfs_pending_read_info {
- incfs_uuid_t file_id;
- __aligned_u64 timestamp_us;
- __u32 block_index;
- __u32 serial_number;
-};
-struct incfs_pending_read_info2 {
- incfs_uuid_t file_id;
- __aligned_u64 timestamp_us;
- __u32 block_index;
- __u32 serial_number;
- __u32 uid;
- __u32 reserved;
-};
-struct incfs_fill_block {
- __u32 block_index;
- __u32 data_len;
- __aligned_u64 data;
- __u8 compression;
- __u8 flags;
- __u16 reserved1;
- __u32 reserved2;
- __aligned_u64 reserved3;
-};
-struct incfs_fill_blocks {
- __u64 count;
- __aligned_u64 fill_blocks;
-};
-struct incfs_permit_fill {
- __u32 file_descriptor;
-};
-enum incfs_hash_tree_algorithm {
- INCFS_HASH_TREE_NONE = 0,
- INCFS_HASH_TREE_SHA256 = 1
-};
-struct incfs_new_file_args {
- incfs_uuid_t file_id;
- __aligned_u64 size;
- __u16 mode;
- __u16 reserved1;
- __u32 reserved2;
- __aligned_u64 directory_path;
- __aligned_u64 file_name;
- __aligned_u64 file_attr;
- __u32 file_attr_len;
- __u32 reserved4;
- __aligned_u64 signature_info;
- __aligned_u64 signature_size;
- __aligned_u64 reserved6;
-};
-struct incfs_get_file_sig_args {
- __aligned_u64 file_signature;
- __u32 file_signature_buf_size;
- __u32 file_signature_len_out;
-};
-struct incfs_filled_range {
- __u32 begin;
- __u32 end;
-};
-struct incfs_get_filled_blocks_args {
- __aligned_u64 range_buffer;
- __u32 range_buffer_size;
- __u32 start_index;
- __u32 end_index;
- __u32 total_blocks_out;
- __u32 data_blocks_out;
- __u32 range_buffer_size_out;
- __u32 index_out;
-};
-struct incfs_create_mapped_file_args {
- __aligned_u64 size;
- __u16 mode;
- __u16 reserved1;
- __u32 reserved2;
- __aligned_u64 directory_path;
- __aligned_u64 file_name;
- incfs_uuid_t source_file_id;
- __aligned_u64 source_offset;
-};
-struct incfs_get_block_count_args {
- __u32 total_data_blocks_out;
- __u32 filled_data_blocks_out;
- __u32 total_hash_blocks_out;
- __u32 filled_hash_blocks_out;
-};
-struct incfs_per_uid_read_timeouts {
- __u32 uid;
- __u32 min_time_us;
- __u32 min_pending_time_us;
- __u32 max_pending_time_us;
-};
-struct incfs_get_read_timeouts_args {
- __aligned_u64 timeouts_array;
- __u32 timeouts_array_size;
- __u32 timeouts_array_size_out;
-};
-struct incfs_set_read_timeouts_args {
- __aligned_u64 timeouts_array;
- __u32 timeouts_array_size;
-};
-struct incfs_get_last_read_error_args {
- incfs_uuid_t file_id_out;
- __u64 time_us_out;
- __u32 page_out;
- __u32 errno_out;
- __u64 reserved;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/inet_diag.h b/libc/kernel/uapi/linux/inet_diag.h
index 8656dd446..5df55efc4 100644
--- a/libc/kernel/uapi/linux/inet_diag.h
+++ b/libc/kernel/uapi/linux/inet_diag.h
@@ -59,11 +59,8 @@ struct inet_diag_req_raw {
enum {
INET_DIAG_REQ_NONE,
INET_DIAG_REQ_BYTECODE,
- INET_DIAG_REQ_SK_BPF_STORAGES,
- INET_DIAG_REQ_PROTOCOL,
- __INET_DIAG_REQ_MAX,
};
-#define INET_DIAG_REQ_MAX (__INET_DIAG_REQ_MAX - 1)
+#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
struct inet_diag_bc_op {
unsigned char code;
unsigned char yes;
@@ -83,7 +80,6 @@ enum {
INET_DIAG_BC_MARK_COND,
INET_DIAG_BC_S_EQ,
INET_DIAG_BC_D_EQ,
- INET_DIAG_BC_CGROUP_COND,
};
struct inet_diag_hostcond {
__u8 family;
@@ -128,9 +124,6 @@ enum {
INET_DIAG_CLASS_ID,
INET_DIAG_MD5SIG,
INET_DIAG_ULP_INFO,
- INET_DIAG_SK_BPF_STORAGES,
- INET_DIAG_CGROUP_ID,
- INET_DIAG_SOCKOPT,
__INET_DIAG_MAX,
};
#define INET_DIAG_MAX (__INET_DIAG_MAX - 1)
@@ -138,7 +131,6 @@ enum {
INET_ULP_INFO_UNSPEC,
INET_ULP_INFO_NAME,
INET_ULP_INFO_TLS,
- INET_ULP_INFO_MPTCP,
__INET_ULP_INFO_MAX,
};
#define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1)
@@ -148,10 +140,6 @@ struct inet_diag_meminfo {
__u32 idiag_fmem;
__u32 idiag_tmem;
};
-struct inet_diag_sockopt {
- __u8 recverr : 1, is_icsk : 1, freebind : 1, hdrincl : 1, mc_loop : 1, transparent : 1, mc_all : 1, nodefrag : 1;
- __u8 bind_address_no_port : 1, recverr_rfc4884 : 1, defer_connect : 1, unused : 5;
-};
struct tcpvegas_info {
__u32 tcpv_enabled;
__u32 tcpv_rttcnt;
diff --git a/libc/kernel/uapi/linux/input-event-codes.h b/libc/kernel/uapi/linux/input-event-codes.h
index 732e9b7bc..ee0e92f2e 100644
--- a/libc/kernel/uapi/linux/input-event-codes.h
+++ b/libc/kernel/uapi/linux/input-event-codes.h
@@ -463,9 +463,6 @@
#define KEY_10CHANNELSUP 0x1b8
#define KEY_10CHANNELSDOWN 0x1b9
#define KEY_IMAGES 0x1ba
-#define KEY_NOTIFICATION_CENTER 0x1bc
-#define KEY_PICKUP_PHONE 0x1bd
-#define KEY_HANGUP_PHONE 0x1be
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
#define KEY_INS_LINE 0x1c2
@@ -491,7 +488,6 @@
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
-#define KEY_FN_RIGHT_SHIFT 0x1e5
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
#define KEY_BRL_DOT3 0x1f3
@@ -576,7 +572,6 @@
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
-#define KEY_SELECTIVE_SCREENSHOT 0x27a
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
@@ -738,8 +733,10 @@
#define SW_LINEIN_INSERT 0x0d
#define SW_MUTE_DEVICE 0x0e
#define SW_PEN_INSERTED 0x0f
-#define SW_MACHINE_COVER 0x10
-#define SW_MAX 0x10
+#define SW_HPHL_OVERCURRENT 0x10
+#define SW_HPHR_OVERCURRENT 0x11
+#define SW_UNSUPPORT_INSERT 0x12
+#define SW_MAX 0x20
#define SW_CNT (SW_MAX + 1)
#define MSC_SERIAL 0x00
#define MSC_PULSELED 0x01
diff --git a/libc/kernel/uapi/linux/io_uring.h b/libc/kernel/uapi/linux/io_uring.h
index fa59d3925..0639a8003 100644
--- a/libc/kernel/uapi/linux/io_uring.h
+++ b/libc/kernel/uapi/linux/io_uring.h
@@ -29,62 +29,32 @@ struct io_uring_sqe {
__u64 off;
__u64 addr2;
};
- union {
- __u64 addr;
- __u64 splice_off_in;
- };
+ __u64 addr;
__u32 len;
union {
__kernel_rwf_t rw_flags;
__u32 fsync_flags;
__u16 poll_events;
- __u32 poll32_events;
__u32 sync_range_flags;
__u32 msg_flags;
__u32 timeout_flags;
__u32 accept_flags;
__u32 cancel_flags;
- __u32 open_flags;
- __u32 statx_flags;
- __u32 fadvise_advice;
- __u32 splice_flags;
- __u32 rename_flags;
- __u32 unlink_flags;
};
__u64 user_data;
union {
- struct {
- union {
- __u16 buf_index;
- __u16 buf_group;
- } __attribute__((packed));
- __u16 personality;
- __s32 splice_fd_in;
- };
+ __u16 buf_index;
__u64 __pad2[3];
};
};
-enum {
- IOSQE_FIXED_FILE_BIT,
- IOSQE_IO_DRAIN_BIT,
- IOSQE_IO_LINK_BIT,
- IOSQE_IO_HARDLINK_BIT,
- IOSQE_ASYNC_BIT,
- IOSQE_BUFFER_SELECT_BIT,
-};
-#define IOSQE_FIXED_FILE (1U << IOSQE_FIXED_FILE_BIT)
-#define IOSQE_IO_DRAIN (1U << IOSQE_IO_DRAIN_BIT)
-#define IOSQE_IO_LINK (1U << IOSQE_IO_LINK_BIT)
-#define IOSQE_IO_HARDLINK (1U << IOSQE_IO_HARDLINK_BIT)
-#define IOSQE_ASYNC (1U << IOSQE_ASYNC_BIT)
-#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
+#define IOSQE_FIXED_FILE (1U << 0)
+#define IOSQE_IO_DRAIN (1U << 1)
+#define IOSQE_IO_LINK (1U << 2)
+#define IOSQE_IO_HARDLINK (1U << 3)
#define IORING_SETUP_IOPOLL (1U << 0)
#define IORING_SETUP_SQPOLL (1U << 1)
#define IORING_SETUP_SQ_AFF (1U << 2)
#define IORING_SETUP_CQSIZE (1U << 3)
-#define IORING_SETUP_CLAMP (1U << 4)
-#define IORING_SETUP_ATTACH_WQ (1U << 5)
-#define IORING_SETUP_R_DISABLED (1U << 6)
enum {
IORING_OP_NOP,
IORING_OP_READV,
@@ -103,41 +73,15 @@ enum {
IORING_OP_ASYNC_CANCEL,
IORING_OP_LINK_TIMEOUT,
IORING_OP_CONNECT,
- IORING_OP_FALLOCATE,
- IORING_OP_OPENAT,
- IORING_OP_CLOSE,
- IORING_OP_FILES_UPDATE,
- IORING_OP_STATX,
- IORING_OP_READ,
- IORING_OP_WRITE,
- IORING_OP_FADVISE,
- IORING_OP_MADVISE,
- IORING_OP_SEND,
- IORING_OP_RECV,
- IORING_OP_OPENAT2,
- IORING_OP_EPOLL_CTL,
- IORING_OP_SPLICE,
- IORING_OP_PROVIDE_BUFFERS,
- IORING_OP_REMOVE_BUFFERS,
- IORING_OP_TEE,
- IORING_OP_SHUTDOWN,
- IORING_OP_RENAMEAT,
- IORING_OP_UNLINKAT,
IORING_OP_LAST,
};
#define IORING_FSYNC_DATASYNC (1U << 0)
#define IORING_TIMEOUT_ABS (1U << 0)
-#define IORING_TIMEOUT_UPDATE (1U << 1)
-#define SPLICE_F_FD_IN_FIXED (1U << 31)
struct io_uring_cqe {
__u64 user_data;
__s32 res;
__u32 flags;
};
-#define IORING_CQE_F_BUFFER (1U << 0)
-enum {
- IORING_CQE_BUFFER_SHIFT = 16,
-};
#define IORING_OFF_SQ_RING 0ULL
#define IORING_OFF_CQ_RING 0x8000000ULL
#define IORING_OFF_SQES 0x10000000ULL
@@ -153,7 +97,6 @@ struct io_sqring_offsets {
__u64 resv2;
};
#define IORING_SQ_NEED_WAKEUP (1U << 0)
-#define IORING_SQ_CQ_OVERFLOW (1U << 1)
struct io_cqring_offsets {
__u32 head;
__u32 tail;
@@ -161,15 +104,10 @@ struct io_cqring_offsets {
__u32 ring_entries;
__u32 overflow;
__u32 cqes;
- __u32 flags;
- __u32 resv1;
- __u64 resv2;
+ __u64 resv[2];
};
-#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
#define IORING_ENTER_GETEVENTS (1U << 0)
#define IORING_ENTER_SQ_WAKEUP (1U << 1)
-#define IORING_ENTER_SQ_WAIT (1U << 2)
-#define IORING_ENTER_EXT_ARG (1U << 3)
struct io_uring_params {
__u32 sq_entries;
__u32 cq_entries;
@@ -177,83 +115,23 @@ struct io_uring_params {
__u32 sq_thread_cpu;
__u32 sq_thread_idle;
__u32 features;
- __u32 wq_fd;
- __u32 resv[3];
+ __u32 resv[4];
struct io_sqring_offsets sq_off;
struct io_cqring_offsets cq_off;
};
#define IORING_FEAT_SINGLE_MMAP (1U << 0)
#define IORING_FEAT_NODROP (1U << 1)
#define IORING_FEAT_SUBMIT_STABLE (1U << 2)
-#define IORING_FEAT_RW_CUR_POS (1U << 3)
-#define IORING_FEAT_CUR_PERSONALITY (1U << 4)
-#define IORING_FEAT_FAST_POLL (1U << 5)
-#define IORING_FEAT_POLL_32BITS (1U << 6)
-#define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
-#define IORING_FEAT_EXT_ARG (1U << 8)
-#define IORING_FEAT_NATIVE_WORKERS (1U << 9)
-enum {
- IORING_REGISTER_BUFFERS = 0,
- IORING_UNREGISTER_BUFFERS = 1,
- IORING_REGISTER_FILES = 2,
- IORING_UNREGISTER_FILES = 3,
- IORING_REGISTER_EVENTFD = 4,
- IORING_UNREGISTER_EVENTFD = 5,
- IORING_REGISTER_FILES_UPDATE = 6,
- IORING_REGISTER_EVENTFD_ASYNC = 7,
- IORING_REGISTER_PROBE = 8,
- IORING_REGISTER_PERSONALITY = 9,
- IORING_UNREGISTER_PERSONALITY = 10,
- IORING_REGISTER_RESTRICTIONS = 11,
- IORING_REGISTER_ENABLE_RINGS = 12,
- IORING_REGISTER_LAST
-};
+#define IORING_REGISTER_BUFFERS 0
+#define IORING_UNREGISTER_BUFFERS 1
+#define IORING_REGISTER_FILES 2
+#define IORING_UNREGISTER_FILES 3
+#define IORING_REGISTER_EVENTFD 4
+#define IORING_UNREGISTER_EVENTFD 5
+#define IORING_REGISTER_FILES_UPDATE 6
struct io_uring_files_update {
__u32 offset;
__u32 resv;
__aligned_u64 fds;
};
-struct io_uring_rsrc_update {
- __u32 offset;
- __u32 resv;
- __aligned_u64 data;
-};
-#define IORING_REGISTER_FILES_SKIP (- 2)
-#define IO_URING_OP_SUPPORTED (1U << 0)
-struct io_uring_probe_op {
- __u8 op;
- __u8 resv;
- __u16 flags;
- __u32 resv2;
-};
-struct io_uring_probe {
- __u8 last_op;
- __u8 ops_len;
- __u16 resv;
- __u32 resv2[3];
- struct io_uring_probe_op ops[0];
-};
-struct io_uring_restriction {
- __u16 opcode;
- union {
- __u8 register_op;
- __u8 sqe_op;
- __u8 sqe_flags;
- };
- __u8 resv;
- __u32 resv2[3];
-};
-enum {
- IORING_RESTRICTION_REGISTER_OP = 0,
- IORING_RESTRICTION_SQE_OP = 1,
- IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2,
- IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3,
- IORING_RESTRICTION_LAST
-};
-struct io_uring_getevents_arg {
- __u64 sigmask;
- __u32 sigmask_sz;
- __u32 pad;
- __u64 ts;
-};
#endif
diff --git a/libc/kernel/uapi/linux/iommu.h b/libc/kernel/uapi/linux/iommu.h
index 1802fb425..54452c382 100644
--- a/libc/kernel/uapi/linux/iommu.h
+++ b/libc/kernel/uapi/linux/iommu.h
@@ -53,7 +53,6 @@ struct iommu_fault_page_request {
#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
-#define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 3)
__u32 flags;
__u32 pasid;
__u32 grpid;
@@ -76,7 +75,6 @@ enum iommu_page_response_code {
IOMMU_PAGE_RESP_FAILURE,
};
struct iommu_page_response {
- __u32 argsz;
#define IOMMU_PAGE_RESP_VERSION_1 1
__u32 version;
#define IOMMU_PAGE_RESP_PASID_VALID (1 << 0)
@@ -110,7 +108,6 @@ struct iommu_inv_pasid_info {
__u64 pasid;
};
struct iommu_cache_invalidate_info {
- __u32 argsz;
#define IOMMU_CACHE_INVALIDATE_INFO_VERSION_1 1
__u32 version;
#define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0)
@@ -119,11 +116,11 @@ struct iommu_cache_invalidate_info {
#define IOMMU_CACHE_INV_TYPE_NR (3)
__u8 cache;
__u8 granularity;
- __u8 padding[6];
+ __u8 padding[2];
union {
struct iommu_inv_pasid_info pasid_info;
struct iommu_inv_addr_info addr_info;
- } granu;
+ };
};
struct iommu_gpasid_bind_data_vtd {
#define IOMMU_SVA_VTD_GPASID_SRE (1 << 0)
@@ -132,28 +129,24 @@ struct iommu_gpasid_bind_data_vtd {
#define IOMMU_SVA_VTD_GPASID_PWT (1 << 3)
#define IOMMU_SVA_VTD_GPASID_EMTE (1 << 4)
#define IOMMU_SVA_VTD_GPASID_CD (1 << 5)
-#define IOMMU_SVA_VTD_GPASID_LAST (1 << 6)
__u64 flags;
__u32 pat;
__u32 emt;
};
-#define IOMMU_SVA_VTD_GPASID_MTS_MASK (IOMMU_SVA_VTD_GPASID_CD | IOMMU_SVA_VTD_GPASID_EMTE | IOMMU_SVA_VTD_GPASID_PCD | IOMMU_SVA_VTD_GPASID_PWT)
struct iommu_gpasid_bind_data {
- __u32 argsz;
#define IOMMU_GPASID_BIND_VERSION_1 1
__u32 version;
#define IOMMU_PASID_FORMAT_INTEL_VTD 1
-#define IOMMU_PASID_FORMAT_LAST 2
__u32 format;
- __u32 addr_width;
#define IOMMU_SVA_GPASID_VAL (1 << 0)
__u64 flags;
__u64 gpgd;
__u64 hpasid;
__u64 gpasid;
- __u8 padding[8];
+ __u32 addr_width;
+ __u8 padding[12];
union {
struct iommu_gpasid_bind_data_vtd vtd;
- } vendor;
+ };
};
#endif
diff --git a/libc/kernel/uapi/linux/ipmi_msgdefs.h b/libc/kernel/uapi/linux/ipmi_msgdefs.h
index cfd435fe4..605dd832c 100644
--- a/libc/kernel/uapi/linux/ipmi_msgdefs.h
+++ b/libc/kernel/uapi/linux/ipmi_msgdefs.h
@@ -53,8 +53,6 @@
#define IPMI_ERR_MSG_TRUNCATED 0xc6
#define IPMI_REQ_LEN_INVALID_ERR 0xc7
#define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8
-#define IPMI_DEVICE_IN_FW_UPDATE_ERR 0xd1
-#define IPMI_DEVICE_IN_INIT_ERR 0xd2
#define IPMI_NOT_IN_MY_STATE_ERR 0xd5
#define IPMI_LOST_ARBITRATION_ERR 0x81
#define IPMI_BUS_ERR 0x82
diff --git a/libc/kernel/uapi/linux/ipv6.h b/libc/kernel/uapi/linux/ipv6.h
index 438cacc4e..ff345a6ad 100644
--- a/libc/kernel/uapi/linux/ipv6.h
+++ b/libc/kernel/uapi/linux/ipv6.h
@@ -43,7 +43,6 @@ struct in6_ifreq {
#define IPV6_SRCRT_STRICT 0x01
#define IPV6_SRCRT_TYPE_0 0
#define IPV6_SRCRT_TYPE_2 2
-#define IPV6_SRCRT_TYPE_3 3
#define IPV6_SRCRT_TYPE_4 4
struct ipv6_rt_hdr {
__u8 nexthdr;
@@ -142,8 +141,6 @@ enum {
DEVCONF_DISABLE_POLICY,
DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN,
DEVCONF_NDISC_TCLASS,
- DEVCONF_RPL_SEG_ENABLED,
- DEVCONF_RA_DEFRTR_METRIC,
DEVCONF_MAX
};
#endif
diff --git a/libc/kernel/uapi/linux/kernel.h b/libc/kernel/uapi/linux/kernel.h
index 7506a41f2..000cd30a2 100644
--- a/libc/kernel/uapi/linux/kernel.h
+++ b/libc/kernel/uapi/linux/kernel.h
@@ -19,5 +19,7 @@
#ifndef _UAPI_LINUX_KERNEL_H
#define _UAPI_LINUX_KERNEL_H
#include <linux/sysinfo.h>
-#include <linux/const.h>
+#define __ALIGN_KERNEL(x,a) __ALIGN_KERNEL_MASK(x, (typeof(x)) (a) - 1)
+#define __ALIGN_KERNEL_MASK(x,mask) (((x) + (mask)) & ~(mask))
+#define __KERNEL_DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
#endif
diff --git a/libc/kernel/uapi/linux/keyboard.h b/libc/kernel/uapi/linux/keyboard.h
index a05438b1b..570cca9b3 100644
--- a/libc/kernel/uapi/linux/keyboard.h
+++ b/libc/kernel/uapi/linux/keyboard.h
@@ -35,6 +35,7 @@
#define MAX_NR_OF_USER_KEYMAPS 256
#define MAX_NR_FUNC 256
#define KT_LATIN 0
+#define KT_LETTER 11
#define KT_FN 1
#define KT_SPEC 2
#define KT_PAD 3
@@ -45,7 +46,6 @@
#define KT_META 8
#define KT_ASCII 9
#define KT_LOCK 10
-#define KT_LETTER 11
#define KT_SLOCK 12
#define KT_DEAD2 13
#define KT_BRL 14
diff --git a/libc/kernel/uapi/linux/keyctl.h b/libc/kernel/uapi/linux/keyctl.h
index 01ea576d3..e3fef38fc 100644
--- a/libc/kernel/uapi/linux/keyctl.h
+++ b/libc/kernel/uapi/linux/keyctl.h
@@ -68,7 +68,6 @@
#define KEYCTL_RESTRICT_KEYRING 29
#define KEYCTL_MOVE 30
#define KEYCTL_CAPABILITIES 31
-#define KEYCTL_WATCH_KEY 32
struct keyctl_dh_params {
union {
#ifndef __cplusplus
@@ -118,5 +117,4 @@ struct keyctl_pkey_params {
#define KEYCTL_CAPS0_MOVE 0x80
#define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01
#define KEYCTL_CAPS1_NS_KEY_TAG 0x02
-#define KEYCTL_CAPS1_NOTIFICATIONS 0x04
#endif
diff --git a/libc/kernel/uapi/linux/kfd_ioctl.h b/libc/kernel/uapi/linux/kfd_ioctl.h
index 73ef5de70..8b09f0049 100644
--- a/libc/kernel/uapi/linux/kfd_ioctl.h
+++ b/libc/kernel/uapi/linux/kfd_ioctl.h
@@ -21,7 +21,7 @@
#include <drm/drm.h>
#include <linux/ioctl.h>
#define KFD_IOCTL_MAJOR_VERSION 1
-#define KFD_IOCTL_MINOR_VERSION 3
+#define KFD_IOCTL_MINOR_VERSION 1
struct kfd_ioctl_get_version_args {
__u32 major_version;
__u32 minor_version;
@@ -267,12 +267,6 @@ struct kfd_ioctl_unmap_memory_from_gpu_args {
__u32 n_devices;
__u32 n_success;
};
-struct kfd_ioctl_alloc_queue_gws_args {
- __u32 queue_id;
- __u32 num_gws;
- __u32 first_gws;
- __u32 pad;
-};
struct kfd_ioctl_get_dmabuf_info_args {
__u64 size;
__u64 metadata_ptr;
@@ -287,18 +281,6 @@ struct kfd_ioctl_import_dmabuf_args {
__u32 gpu_id;
__u32 dmabuf_fd;
};
-enum kfd_smi_event {
- KFD_SMI_EVENT_NONE = 0,
- KFD_SMI_EVENT_VMFAULT = 1,
- KFD_SMI_EVENT_THERMAL_THROTTLE = 2,
- KFD_SMI_EVENT_GPU_PRE_RESET = 3,
- KFD_SMI_EVENT_GPU_POST_RESET = 4,
-};
-#define KFD_SMI_EVENT_MASK_FROM_INDEX(i) (1ULL << ((i) - 1))
-struct kfd_ioctl_smi_events_args {
- __u32 gpuid;
- __u32 anon_fd;
-};
enum kfd_mmio_remap {
KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL = 0,
KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL = 4,
@@ -337,8 +319,6 @@ enum kfd_mmio_remap {
#define AMDKFD_IOC_GET_QUEUE_WAVE_STATE AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args)
#define AMDKFD_IOC_GET_DMABUF_INFO AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_dmabuf_info_args)
#define AMDKFD_IOC_IMPORT_DMABUF AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args)
-#define AMDKFD_IOC_ALLOC_QUEUE_GWS AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args)
-#define AMDKFD_IOC_SMI_EVENTS AMDKFD_IOWR(0x1F, struct kfd_ioctl_smi_events_args)
#define AMDKFD_COMMAND_START 0x01
-#define AMDKFD_COMMAND_END 0x20
+#define AMDKFD_COMMAND_END 0x1E
#endif
diff --git a/libc/kernel/uapi/linux/kvm.h b/libc/kernel/uapi/linux/kvm.h
index 81fa779d8..b865936d1 100644
--- a/libc/kernel/uapi/linux/kvm.h
+++ b/libc/kernel/uapi/linux/kvm.h
@@ -137,13 +137,10 @@ struct kvm_s390_cmma_log {
struct kvm_hyperv_exit {
#define KVM_EXIT_HYPERV_SYNIC 1
#define KVM_EXIT_HYPERV_HCALL 2
-#define KVM_EXIT_HYPERV_SYNDBG 3
__u32 type;
- __u32 pad1;
union {
struct {
__u32 msr;
- __u32 pad2;
__u64 control;
__u64 evt_page;
__u64 msg_page;
@@ -153,28 +150,6 @@ struct kvm_hyperv_exit {
__u64 result;
__u64 params[2];
} hcall;
- struct {
- __u32 msr;
- __u32 pad2;
- __u64 control;
- __u64 status;
- __u64 send_page;
- __u64 recv_page;
- __u64 pending_page;
- } syndbg;
- } u;
-};
-struct kvm_xen_exit {
-#define KVM_EXIT_XEN_HCALL 1
- __u32 type;
- union {
- struct {
- __u32 longmode;
- __u32 cpl;
- __u64 input;
- __u64 result;
- __u64 params[6];
- } hcall;
} u;
};
#define KVM_S390_GET_SKEYS_NONE 1
@@ -208,12 +183,6 @@ struct kvm_xen_exit {
#define KVM_EXIT_IOAPIC_EOI 26
#define KVM_EXIT_HYPERV 27
#define KVM_EXIT_ARM_NISV 28
-#define KVM_EXIT_X86_RDMSR 29
-#define KVM_EXIT_X86_WRMSR 30
-#define KVM_EXIT_DIRTY_RING_FULL 31
-#define KVM_EXIT_AP_RESET_HOLD 32
-#define KVM_EXIT_X86_BUS_LOCK 33
-#define KVM_EXIT_XEN 34
#define KVM_INTERNAL_ERROR_EMULATION 1
#define KVM_INTERNAL_ERROR_SIMUL_EX 2
#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
@@ -238,7 +207,6 @@ struct kvm_run {
} hw;
struct {
__u64 hardware_entry_failure_reason;
- __u32 cpu;
} fail_entry;
struct {
__u32 exception;
@@ -341,17 +309,6 @@ struct kvm_run {
__u64 esr_iss;
__u64 fault_ipa;
} arm_nisv;
- struct {
- __u8 error;
- __u8 pad[7];
-#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
-#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
-#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
- __u32 reason;
- __u32 index;
- __u64 data;
- } msr;
- struct kvm_xen_exit xen;
char padding[256];
};
#define SYNC_REGS_SIZE_BYTES 2048
@@ -398,16 +355,11 @@ struct kvm_s390_mem_op {
__u32 size;
__u32 op;
__u64 buf;
- union {
- __u8 ar;
- __u32 sida_offset;
- __u8 reserved[32];
- };
+ __u8 ar;
+ __u8 reserved[31];
};
#define KVM_S390_MEMOP_LOGICAL_READ 0
#define KVM_S390_MEMOP_LOGICAL_WRITE 1
-#define KVM_S390_MEMOP_SIDA_READ 2
-#define KVM_S390_MEMOP_SIDA_WRITE 3
#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
struct kvm_interrupt {
@@ -451,7 +403,6 @@ struct kvm_vapic_addr {
#define KVM_MP_STATE_CHECK_STOP 6
#define KVM_MP_STATE_OPERATING 7
#define KVM_MP_STATE_LOAD 8
-#define KVM_MP_STATE_AP_RESET_HOLD 9
struct kvm_mp_state {
__u32 mp_state;
};
@@ -627,9 +578,8 @@ struct kvm_ppc_resize_hpt {
#define KVM_VM_S390_UCONTROL 1
#define KVM_VM_PPC_HV 1
#define KVM_VM_PPC_PR 2
-#define KVM_VM_MIPS_AUTO 0
+#define KVM_VM_MIPS_TE 0
#define KVM_VM_MIPS_VZ 1
-#define KVM_VM_MIPS_TE 2
#define KVM_S390_SIE_PAGE_OFFSET 1
#define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL
#define KVM_VM_TYPE_ARM_IPA_SIZE(x) ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK)
@@ -838,22 +788,6 @@ struct kvm_ppc_resize_hpt {
#define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176
#define KVM_CAP_ARM_NISV_TO_USER 177
#define KVM_CAP_ARM_INJECT_EXT_DABT 178
-#define KVM_CAP_S390_VCPU_RESETS 179
-#define KVM_CAP_S390_PROTECTED 180
-#define KVM_CAP_PPC_SECURE_GUEST 181
-#define KVM_CAP_HALT_POLL 182
-#define KVM_CAP_ASYNC_PF_INT 183
-#define KVM_CAP_LAST_CPU 184
-#define KVM_CAP_SMALLER_MAXPHYADDR 185
-#define KVM_CAP_S390_DIAG318 186
-#define KVM_CAP_STEAL_TIME 187
-#define KVM_CAP_X86_USER_SPACE_MSR 188
-#define KVM_CAP_X86_MSR_FILTER 189
-#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
-#define KVM_CAP_SYS_HYPERV_CPUID 191
-#define KVM_CAP_DIRTY_LOG_RING 192
-#define KVM_CAP_X86_BUS_LOCK_EXIT 193
-#define KVM_CAP_PPC_DAWR1 194
#ifdef KVM_CAP_IRQ_ROUTING
struct kvm_irq_routing_irqchip {
__u32 irqchip;
@@ -914,10 +848,6 @@ struct kvm_x86_mce {
};
#endif
#ifdef KVM_CAP_XEN_HVM
-#define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0)
-#define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1)
-#define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
-#define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
struct kvm_xen_hvm_config {
__u32 flags;
__u32 msr;
@@ -1180,78 +1110,6 @@ struct kvm_enc_region {
#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
-#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
-#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
-struct kvm_s390_pv_sec_parm {
- __u64 origin;
- __u64 length;
-};
-struct kvm_s390_pv_unp {
- __u64 addr;
- __u64 size;
- __u64 tweak;
-};
-enum pv_cmd_id {
- KVM_PV_ENABLE,
- KVM_PV_DISABLE,
- KVM_PV_SET_SEC_PARMS,
- KVM_PV_UNPACK,
- KVM_PV_VERIFY,
- KVM_PV_PREP_RESET,
- KVM_PV_UNSHARE_ALL,
-};
-struct kvm_pv_cmd {
- __u32 cmd;
- __u16 rc;
- __u16 rrc;
- __u64 data;
- __u32 flags;
- __u32 reserved[3];
-};
-#define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
-#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter)
-#define KVM_RESET_DIRTY_RINGS _IO(KVMIO, 0xc7)
-#define KVM_XEN_HVM_GET_ATTR _IOWR(KVMIO, 0xc8, struct kvm_xen_hvm_attr)
-#define KVM_XEN_HVM_SET_ATTR _IOW(KVMIO, 0xc9, struct kvm_xen_hvm_attr)
-struct kvm_xen_hvm_attr {
- __u16 type;
- __u16 pad[3];
- union {
- __u8 long_mode;
- __u8 vector;
- struct {
- __u64 gfn;
- } shared_info;
- __u64 pad[8];
- } u;
-};
-#define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
-#define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1
-#define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2
-#define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr)
-#define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr)
-struct kvm_xen_vcpu_attr {
- __u16 type;
- __u16 pad[3];
- union {
- __u64 gpa;
- __u64 pad[8];
- struct {
- __u64 state;
- __u64 state_entry_time;
- __u64 time_running;
- __u64 time_runnable;
- __u64 time_blocked;
- __u64 time_offline;
- } runstate;
- } u;
-};
-#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO 0x0
-#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO 0x1
-#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR 0x2
-#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3
-#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4
-#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5
enum sev_cmd_id {
KVM_SEV_INIT = 0,
KVM_SEV_ES_INIT,
@@ -1273,7 +1131,6 @@ enum sev_cmd_id {
KVM_SEV_DBG_DECRYPT,
KVM_SEV_DBG_ENCRYPT,
KVM_SEV_CERT_EXPORT,
- KVM_SEV_GET_ATTESTATION_REPORT,
KVM_SEV_NR_MAX,
};
struct kvm_sev_cmd {
@@ -1316,11 +1173,6 @@ struct kvm_sev_dbg {
__u64 dst_uaddr;
__u32 len;
};
-struct kvm_sev_attestation_report {
- __u8 mnonce[16];
- __u64 uaddr;
- __u32 len;
-};
#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2)
@@ -1376,19 +1228,4 @@ struct kvm_hyperv_eventfd {
};
#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
-#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0)
-#define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1)
-#ifndef KVM_DIRTY_LOG_PAGE_OFFSET
-#define KVM_DIRTY_LOG_PAGE_OFFSET 0
-#endif
-#define KVM_DIRTY_GFN_F_DIRTY BIT(0)
-#define KVM_DIRTY_GFN_F_RESET BIT(1)
-#define KVM_DIRTY_GFN_F_MASK 0x3
-struct kvm_dirty_gfn {
- __u32 flags;
- __u32 slot;
- __u64 offset;
-};
-#define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
-#define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
#endif
diff --git a/libc/kernel/uapi/linux/l2tp.h b/libc/kernel/uapi/linux/l2tp.h
index a054819f5..3f77b25bb 100644
--- a/libc/kernel/uapi/linux/l2tp.h
+++ b/libc/kernel/uapi/linux/l2tp.h
@@ -103,8 +103,6 @@ enum {
L2TP_ATTR_RX_OOS_PACKETS,
L2TP_ATTR_RX_ERRORS,
L2TP_ATTR_STATS_PAD,
- L2TP_ATTR_RX_COOKIE_DISCARDS,
- L2TP_ATTR_RX_INVALID,
__L2TP_ATTR_STATS_MAX,
};
#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
diff --git a/libc/kernel/uapi/linux/lirc.h b/libc/kernel/uapi/linux/lirc.h
index a0ac24ac9..20b08e9ed 100644
--- a/libc/kernel/uapi/linux/lirc.h
+++ b/libc/kernel/uapi/linux/lirc.h
@@ -131,6 +131,5 @@ enum rc_proto {
RC_PROTO_RCMM24 = 25,
RC_PROTO_RCMM32 = 26,
RC_PROTO_XBOX_DVD = 27,
- RC_PROTO_MAX = RC_PROTO_XBOX_DVD,
};
#endif
diff --git a/libc/kernel/uapi/linux/loop.h b/libc/kernel/uapi/linux/loop.h
index 56eba9108..d5a23b597 100644
--- a/libc/kernel/uapi/linux/loop.h
+++ b/libc/kernel/uapi/linux/loop.h
@@ -26,9 +26,6 @@ enum {
LO_FLAGS_PARTSCAN = 8,
LO_FLAGS_DIRECT_IO = 16,
};
-#define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)
-#define LOOP_SET_STATUS_CLEARABLE_FLAGS (LO_FLAGS_AUTOCLEAR)
-#define LOOP_CONFIGURE_SETTABLE_FLAGS (LO_FLAGS_READ_ONLY | LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN | LO_FLAGS_DIRECT_IO)
#include <asm/posix_types.h>
#include <linux/types.h>
struct loop_info {
@@ -60,12 +57,6 @@ struct loop_info64 {
__u8 lo_encrypt_key[LO_KEY_SIZE];
__u64 lo_init[2];
};
-struct loop_config {
- __u32 fd;
- __u32 block_size;
- struct loop_info64 info;
- __u64 __reserved[8];
-};
#define LO_CRYPT_NONE 0
#define LO_CRYPT_XOR 1
#define LO_CRYPT_DES 2
@@ -87,7 +78,6 @@ struct loop_config {
#define LOOP_SET_CAPACITY 0x4C07
#define LOOP_SET_DIRECT_IO 0x4C08
#define LOOP_SET_BLOCK_SIZE 0x4C09
-#define LOOP_CONFIGURE 0x4C0A
#define LOOP_CTL_ADD 0x4C80
#define LOOP_CTL_REMOVE 0x4C81
#define LOOP_CTL_GET_FREE 0x4C82
diff --git a/libc/kernel/uapi/linux/lwtunnel.h b/libc/kernel/uapi/linux/lwtunnel.h
index f472150e9..f1e2ab83a 100644
--- a/libc/kernel/uapi/linux/lwtunnel.h
+++ b/libc/kernel/uapi/linux/lwtunnel.h
@@ -28,7 +28,6 @@ enum lwtunnel_encap_types {
LWTUNNEL_ENCAP_SEG6,
LWTUNNEL_ENCAP_BPF,
LWTUNNEL_ENCAP_SEG6_LOCAL,
- LWTUNNEL_ENCAP_RPL,
__LWTUNNEL_ENCAP_MAX,
};
#define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1)
diff --git a/libc/kernel/uapi/linux/magic.h b/libc/kernel/uapi/linux/magic.h
index 479ae811b..ca1daea20 100644
--- a/libc/kernel/uapi/linux/magic.h
+++ b/libc/kernel/uapi/linux/magic.h
@@ -68,6 +68,7 @@
#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs"
#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs"
#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
+#define SDCARDFS_SUPER_MAGIC 0x5dca2df5
#define SMB_SUPER_MAGIC 0x517B
#define CGROUP_SUPER_MAGIC 0x27e0eb
#define CGROUP2_SUPER_MAGIC 0x63677270
@@ -92,12 +93,10 @@
#define NSFS_MAGIC 0x6e736673
#define BPF_FS_MAGIC 0xcafe4a11
#define AAFS_MAGIC 0x5a3c69f0
-#define ZONEFS_MAGIC 0x5a4f4653
#define UDF_SUPER_MAGIC 0x15013346
#define BALLOON_KVM_MAGIC 0x13661366
#define ZSMALLOC_MAGIC 0x58295829
#define DMA_BUF_MAGIC 0x444d4142
-#define DEVMEM_MAGIC 0x454d444d
#define Z3FOLD_MAGIC 0x33
#define PPC_CMM_MAGIC 0xc7571590
#endif
diff --git a/libc/kernel/uapi/linux/mdio.h b/libc/kernel/uapi/linux/mdio.h
index a38cbfc16..3bbe43357 100644
--- a/libc/kernel/uapi/linux/mdio.h
+++ b/libc/kernel/uapi/linux/mdio.h
@@ -246,28 +246,4 @@
#define MDIO_PHY_ID_PRTAD 0x03e0
#define MDIO_PHY_ID_DEVAD 0x001f
#define MDIO_PHY_ID_C45_MASK (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
-#define MDIO_USXGMII_EEE_CLK_STP 0x0080
-#define MDIO_USXGMII_EEE 0x0100
-#define MDIO_USXGMII_SPD_MASK 0x0e00
-#define MDIO_USXGMII_FULL_DUPLEX 0x1000
-#define MDIO_USXGMII_DPX_SPD_MASK 0x1e00
-#define MDIO_USXGMII_10 0x0000
-#define MDIO_USXGMII_10HALF 0x0000
-#define MDIO_USXGMII_10FULL 0x1000
-#define MDIO_USXGMII_100 0x0200
-#define MDIO_USXGMII_100HALF 0x0200
-#define MDIO_USXGMII_100FULL 0x1200
-#define MDIO_USXGMII_1000 0x0400
-#define MDIO_USXGMII_1000HALF 0x0400
-#define MDIO_USXGMII_1000FULL 0x1400
-#define MDIO_USXGMII_10G 0x0600
-#define MDIO_USXGMII_10GHALF 0x0600
-#define MDIO_USXGMII_10GFULL 0x1600
-#define MDIO_USXGMII_2500 0x0800
-#define MDIO_USXGMII_2500HALF 0x0800
-#define MDIO_USXGMII_2500FULL 0x1800
-#define MDIO_USXGMII_5000 0x0a00
-#define MDIO_USXGMII_5000HALF 0x0a00
-#define MDIO_USXGMII_5000FULL 0x1a00
-#define MDIO_USXGMII_LINK 0x8000
#endif
diff --git a/libc/kernel/uapi/linux/media-bus-format.h b/libc/kernel/uapi/linux/media-bus-format.h
index 2542a32c4..f0d81d0ab 100644
--- a/libc/kernel/uapi/linux/media-bus-format.h
+++ b/libc/kernel/uapi/linux/media-bus-format.h
@@ -40,7 +40,6 @@
#define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b
#define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c
#define MEDIA_BUS_FMT_RGB888_3X8 0x101c
-#define MEDIA_BUS_FMT_RGB888_3X8_DELTA 0x101d
#define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011
#define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012
#define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d
@@ -69,7 +68,6 @@
#define MEDIA_BUS_FMT_VYUY12_2X12 0x201d
#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
-#define MEDIA_BUS_FMT_Y14_1X14 0x202d
#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
@@ -128,5 +126,4 @@
#define MEDIA_BUS_FMT_JPEG_1X8 0x4001
#define MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 0x5001
#define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001
-#define MEDIA_BUS_FMT_METADATA_FIXED 0x7001
#endif
diff --git a/libc/kernel/uapi/linux/media.h b/libc/kernel/uapi/linux/media.h
index 5c8efcd28..fe29568c6 100644
--- a/libc/kernel/uapi/linux/media.h
+++ b/libc/kernel/uapi/linux/media.h
@@ -61,7 +61,6 @@ struct media_device_info {
#define MEDIA_ENT_F_PROC_VIDEO_STATISTICS (MEDIA_ENT_F_BASE + 0x4006)
#define MEDIA_ENT_F_PROC_VIDEO_ENCODER (MEDIA_ENT_F_BASE + 0x4007)
#define MEDIA_ENT_F_PROC_VIDEO_DECODER (MEDIA_ENT_F_BASE + 0x4008)
-#define MEDIA_ENT_F_PROC_VIDEO_ISP (MEDIA_ENT_F_BASE + 0x4009)
#define MEDIA_ENT_F_VID_MUX (MEDIA_ENT_F_BASE + 0x5001)
#define MEDIA_ENT_F_VID_IF_BRIDGE (MEDIA_ENT_F_BASE + 0x5002)
#define MEDIA_ENT_F_ATV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 4)
diff --git a/libc/kernel/uapi/linux/mei.h b/libc/kernel/uapi/linux/mei.h
index ed37abdc0..f3528e66b 100644
--- a/libc/kernel/uapi/linux/mei.h
+++ b/libc/kernel/uapi/linux/mei.h
@@ -33,16 +33,4 @@ struct mei_connect_client_data {
};
#define IOCTL_MEI_NOTIFY_SET _IOW('H', 0x02, __u32)
#define IOCTL_MEI_NOTIFY_GET _IOR('H', 0x03, __u32)
-struct mei_connect_client_vtag {
- uuid_le in_client_uuid;
- __u8 vtag;
- __u8 reserved[3];
-};
-struct mei_connect_client_data_vtag {
- union {
- struct mei_connect_client_vtag connect;
- struct mei_client out_client_properties;
- };
-};
-#define IOCTL_MEI_CONNECT_CLIENT_VTAG _IOWR('H', 0x04, struct mei_connect_client_data_vtag)
#endif
diff --git a/libc/kernel/uapi/linux/membarrier.h b/libc/kernel/uapi/linux/membarrier.h
index 43c103b9d..19cfeb2f5 100644
--- a/libc/kernel/uapi/linux/membarrier.h
+++ b/libc/kernel/uapi/linux/membarrier.h
@@ -27,11 +27,6 @@ enum membarrier_cmd {
MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = (1 << 4),
MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 5),
MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = (1 << 6),
- MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = (1 << 7),
- MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = (1 << 8),
MEMBARRIER_CMD_SHARED = MEMBARRIER_CMD_GLOBAL,
};
-enum membarrier_cmd_flag {
- MEMBARRIER_CMD_FLAG_CPU = (1 << 0),
-};
#endif
diff --git a/libc/kernel/uapi/linux/mempolicy.h b/libc/kernel/uapi/linux/mempolicy.h
index 5425c0efa..6f721f6be 100644
--- a/libc/kernel/uapi/linux/mempolicy.h
+++ b/libc/kernel/uapi/linux/mempolicy.h
@@ -29,8 +29,7 @@ enum {
};
#define MPOL_F_STATIC_NODES (1 << 15)
#define MPOL_F_RELATIVE_NODES (1 << 14)
-#define MPOL_F_NUMA_BALANCING (1 << 13)
-#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES | MPOL_F_NUMA_BALANCING)
+#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
#define MPOL_F_NODE (1 << 0)
#define MPOL_F_ADDR (1 << 1)
#define MPOL_F_MEMS_ALLOWED (1 << 2)
diff --git a/libc/kernel/uapi/linux/mic_common.h b/libc/kernel/uapi/linux/mic_common.h
new file mode 100644
index 000000000..191e5d382
--- /dev/null
+++ b/libc/kernel/uapi/linux/mic_common.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __MIC_COMMON_H_
+#define __MIC_COMMON_H_
+#include <linux/virtio_ring.h>
+#define __mic_align(a,x) (((a) + (x) - 1) & ~((x) - 1))
+struct mic_device_desc {
+ __s8 type;
+ __u8 num_vq;
+ __u8 feature_len;
+ __u8 config_len;
+ __u8 status;
+ __le64 config[0];
+} __attribute__((aligned(8)));
+struct mic_device_ctrl {
+ __le64 vdev;
+ __u8 config_change;
+ __u8 vdev_reset;
+ __u8 guest_ack;
+ __u8 host_ack;
+ __u8 used_address_updated;
+ __s8 c2h_vdev_db;
+ __s8 h2c_vdev_db;
+} __attribute__((aligned(8)));
+struct mic_bootparam {
+ __le32 magic;
+ __s8 h2c_config_db;
+ __u8 node_id;
+ __u8 h2c_scif_db;
+ __u8 c2h_scif_db;
+ __u64 scif_host_dma_addr;
+ __u64 scif_card_dma_addr;
+} __attribute__((aligned(8)));
+struct mic_device_page {
+ struct mic_bootparam bootparam;
+ struct mic_device_desc desc[0];
+};
+struct mic_vqconfig {
+ __le64 address;
+ __le64 used_address;
+ __le16 num;
+} __attribute__((aligned(8)));
+#define MIC_VIRTIO_RING_ALIGN 4096
+#define MIC_MAX_VRINGS 4
+#define MIC_VRING_ENTRIES 128
+#define MIC_MAX_VRING_ENTRIES 128
+#define MIC_MAX_DESC_BLK_SIZE 256
+struct _mic_vring_info {
+ __u16 avail_idx;
+ __le32 magic;
+};
+struct mic_vring {
+ struct vring vr;
+ struct _mic_vring_info * info;
+ void * va;
+ int len;
+};
+#define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8)
+#ifndef INTEL_MIC_CARD
+#endif
+#define MIC_DP_SIZE 4096
+#define MIC_MAGIC 0xc0ffee00
+enum mic_states {
+ MIC_READY = 0,
+ MIC_BOOTING,
+ MIC_ONLINE,
+ MIC_SHUTTING_DOWN,
+ MIC_RESETTING,
+ MIC_RESET_FAILED,
+ MIC_LAST
+};
+enum mic_status {
+ MIC_NOP = 0,
+ MIC_CRASHED,
+ MIC_HALTED,
+ MIC_POWER_OFF,
+ MIC_RESTART,
+ MIC_STATUS_LAST
+};
+#endif
diff --git a/libc/kernel/uapi/misc/uacce/hisi_qm.h b/libc/kernel/uapi/linux/mic_ioctl.h
index 49d9f6ace..5fed13b25 100644
--- a/libc/kernel/uapi/misc/uacce/hisi_qm.h
+++ b/libc/kernel/uapi/linux/mic_ioctl.h
@@ -16,14 +16,17 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _UAPI_HISI_QM_H
-#define _UAPI_HISI_QM_H
+#ifndef _MIC_IOCTL_H_
+#define _MIC_IOCTL_H_
#include <linux/types.h>
-struct hisi_qp_ctx {
- __u16 id;
- __u16 qc_type;
+struct mic_copy_desc {
+ struct iovec * iov;
+ __u32 iovcnt;
+ __u8 vr_idx;
+ __u8 update_used;
+ __u32 out_len;
};
-#define HISI_QM_API_VER_BASE "hisi_qm_v1"
-#define HISI_QM_API_VER2_BASE "hisi_qm_v2"
-#define UACCE_CMD_QM_SET_QP_CTX _IOWR('H', 10, struct hisi_qp_ctx)
+#define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
+#define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *)
+#define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
#endif
diff --git a/libc/kernel/uapi/linux/mii.h b/libc/kernel/uapi/linux/mii.h
index a489015dc..3c6c56470 100644
--- a/libc/kernel/uapi/linux/mii.h
+++ b/libc/kernel/uapi/linux/mii.h
@@ -120,28 +120,11 @@
#define NWAYTEST_RESV1 0x00ff
#define NWAYTEST_LOOPBACK 0x0100
#define NWAYTEST_RESV2 0xfe00
-#define ADVERTISE_SGMII 0x0001
-#define LPA_SGMII 0x0001
-#define LPA_SGMII_SPD_MASK 0x0c00
-#define LPA_SGMII_FULL_DUPLEX 0x1000
-#define LPA_SGMII_DPX_SPD_MASK 0x1C00
-#define LPA_SGMII_10 0x0000
-#define LPA_SGMII_10HALF 0x0000
-#define LPA_SGMII_10FULL 0x1000
-#define LPA_SGMII_100 0x0400
-#define LPA_SGMII_100HALF 0x0400
-#define LPA_SGMII_100FULL 0x1400
-#define LPA_SGMII_1000 0x0800
-#define LPA_SGMII_1000HALF 0x0800
-#define LPA_SGMII_1000FULL 0x1800
-#define LPA_SGMII_LINK 0x8000
#define ADVERTISE_1000FULL 0x0200
#define ADVERTISE_1000HALF 0x0100
-#define CTL1000_PREFER_MASTER 0x0400
#define CTL1000_AS_MASTER 0x0800
#define CTL1000_ENABLE_MASTER 0x1000
#define LPA_1000MSFAIL 0x8000
-#define LPA_1000MSRES 0x4000
#define LPA_1000LOCALRXOK 0x2000
#define LPA_1000REMRXOK 0x1000
#define LPA_1000FULL 0x0800
diff --git a/libc/kernel/uapi/linux/misc/bcm_vk.h b/libc/kernel/uapi/linux/misc/bcm_vk.h
deleted file mode 100644
index b1b966d6a..000000000
--- a/libc/kernel/uapi/linux/misc/bcm_vk.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __UAPI_LINUX_MISC_BCM_VK_H
-#define __UAPI_LINUX_MISC_BCM_VK_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#define BCM_VK_MAX_FILENAME 64
-struct vk_image {
- __u32 type;
-#define VK_IMAGE_TYPE_BOOT1 1
-#define VK_IMAGE_TYPE_BOOT2 2
- __u8 filename[BCM_VK_MAX_FILENAME];
-};
-struct vk_reset {
- __u32 arg1;
- __u32 arg2;
-};
-#define VK_MAGIC 0x5e
-#define VK_IOCTL_LOAD_IMAGE _IOW(VK_MAGIC, 0x2, struct vk_image)
-#define VK_IOCTL_RESET _IOW(VK_MAGIC, 0x4, struct vk_reset)
-#define VK_BAR_FWSTS 0x41c
-#define VK_BAR_COP_FWSTS 0x428
-#define VK_FWSTS_RELOCATION_ENTRY (1UL << 0)
-#define VK_FWSTS_RELOCATION_EXIT (1UL << 1)
-#define VK_FWSTS_INIT_START (1UL << 2)
-#define VK_FWSTS_ARCH_INIT_DONE (1UL << 3)
-#define VK_FWSTS_PRE_KNL1_INIT_DONE (1UL << 4)
-#define VK_FWSTS_PRE_KNL2_INIT_DONE (1UL << 5)
-#define VK_FWSTS_POST_KNL_INIT_DONE (1UL << 6)
-#define VK_FWSTS_INIT_DONE (1UL << 7)
-#define VK_FWSTS_APP_INIT_START (1UL << 8)
-#define VK_FWSTS_APP_INIT_DONE (1UL << 9)
-#define VK_FWSTS_MASK 0xffffffff
-#define VK_FWSTS_READY (VK_FWSTS_INIT_START | VK_FWSTS_ARCH_INIT_DONE | VK_FWSTS_PRE_KNL1_INIT_DONE | VK_FWSTS_PRE_KNL2_INIT_DONE | VK_FWSTS_POST_KNL_INIT_DONE | VK_FWSTS_INIT_DONE | VK_FWSTS_APP_INIT_START | VK_FWSTS_APP_INIT_DONE)
-#define VK_FWSTS_APP_DEINIT_START (1UL << 23)
-#define VK_FWSTS_APP_DEINIT_DONE (1UL << 24)
-#define VK_FWSTS_DRV_DEINIT_START (1UL << 25)
-#define VK_FWSTS_DRV_DEINIT_DONE (1UL << 26)
-#define VK_FWSTS_RESET_DONE (1UL << 27)
-#define VK_FWSTS_DEINIT_TRIGGERED (VK_FWSTS_APP_DEINIT_START | VK_FWSTS_APP_DEINIT_DONE | VK_FWSTS_DRV_DEINIT_START | VK_FWSTS_DRV_DEINIT_DONE)
-#define VK_FWSTS_RESET_REASON_SHIFT 28
-#define VK_FWSTS_RESET_REASON_MASK (0xf << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_SYS_PWRUP (0x0 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_MBOX_DB (0x1 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_M7_WDOG (0x2 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_TEMP (0x3 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_PCI_FLR (0x4 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_PCI_HOT (0x5 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_PCI_WARM (0x6 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_PCI_COLD (0x7 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_L1 (0x8 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_L0 (0x9 << VK_FWSTS_RESET_REASON_SHIFT)
-#define VK_FWSTS_RESET_UNKNOWN (0xf << VK_FWSTS_RESET_REASON_SHIFT)
-#endif
diff --git a/libc/kernel/uapi/linux/mman.h b/libc/kernel/uapi/linux/mman.h
index 9fdccf630..e4693742d 100644
--- a/libc/kernel/uapi/linux/mman.h
+++ b/libc/kernel/uapi/linux/mman.h
@@ -22,7 +22,6 @@
#include <asm-generic/hugetlb_encode.h>
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
-#define MREMAP_DONTUNMAP 4
#define OVERCOMMIT_GUESS 0
#define OVERCOMMIT_ALWAYS 1
#define OVERCOMMIT_NEVER 2
@@ -31,7 +30,6 @@
#define MAP_SHARED_VALIDATE 0x03
#define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
#define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
-#define MAP_HUGE_16KB HUGETLB_FLAG_ENCODE_16KB
#define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
#define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
#define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
diff --git a/libc/kernel/uapi/linux/mmc/ioctl.h b/libc/kernel/uapi/linux/mmc/ioctl.h
index afea6a5b0..101eb8c02 100644
--- a/libc/kernel/uapi/linux/mmc/ioctl.h
+++ b/libc/kernel/uapi/linux/mmc/ioctl.h
@@ -19,7 +19,6 @@
#ifndef LINUX_MMC_IOCTL_H
#define LINUX_MMC_IOCTL_H
#include <linux/types.h>
-#include <linux/major.h>
struct mmc_ioc_cmd {
int write_flag;
int is_acmd;
diff --git a/libc/kernel/uapi/linux/mount.h b/libc/kernel/uapi/linux/mount.h
index 5a112c99e..10c53a506 100644
--- a/libc/kernel/uapi/linux/mount.h
+++ b/libc/kernel/uapi/linux/mount.h
@@ -18,7 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_MOUNT_H
#define _UAPI_LINUX_MOUNT_H
-#include <linux/types.h>
#define MS_RDONLY 1
#define MS_NOSUID 2
#define MS_NODEV 4
@@ -27,7 +26,6 @@
#define MS_REMOUNT 32
#define MS_MANDLOCK 64
#define MS_DIRSYNC 128
-#define MS_NOSYMFOLLOW 256
#define MS_NOATIME 1024
#define MS_NODIRATIME 2048
#define MS_BIND 4096
@@ -88,12 +86,4 @@ enum fsconfig_command {
#define MOUNT_ATTR_NOATIME 0x00000010
#define MOUNT_ATTR_STRICTATIME 0x00000020
#define MOUNT_ATTR_NODIRATIME 0x00000080
-#define MOUNT_ATTR_IDMAP 0x00100000
-struct mount_attr {
- __u64 attr_set;
- __u64 attr_clr;
- __u64 propagation;
- __u64 userns_fd;
-};
-#define MOUNT_ATTR_SIZE_VER0 32
#endif
diff --git a/libc/kernel/uapi/linux/mptcp.h b/libc/kernel/uapi/linux/mptcp.h
deleted file mode 100644
index b15adf52b..000000000
--- a/libc/kernel/uapi/linux/mptcp.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_MPTCP_H
-#define _UAPI_MPTCP_H
-#include <linux/const.h>
-#include <linux/types.h>
-#define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
-#define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
-#define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)
-#define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3)
-#define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4)
-#define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5)
-#define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6)
-#define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7)
-#define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8)
-enum {
- MPTCP_SUBFLOW_ATTR_UNSPEC,
- MPTCP_SUBFLOW_ATTR_TOKEN_REM,
- MPTCP_SUBFLOW_ATTR_TOKEN_LOC,
- MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ,
- MPTCP_SUBFLOW_ATTR_MAP_SEQ,
- MPTCP_SUBFLOW_ATTR_MAP_SFSEQ,
- MPTCP_SUBFLOW_ATTR_SSN_OFFSET,
- MPTCP_SUBFLOW_ATTR_MAP_DATALEN,
- MPTCP_SUBFLOW_ATTR_FLAGS,
- MPTCP_SUBFLOW_ATTR_ID_REM,
- MPTCP_SUBFLOW_ATTR_ID_LOC,
- MPTCP_SUBFLOW_ATTR_PAD,
- __MPTCP_SUBFLOW_ATTR_MAX
-};
-#define MPTCP_SUBFLOW_ATTR_MAX (__MPTCP_SUBFLOW_ATTR_MAX - 1)
-#define MPTCP_PM_NAME "mptcp_pm"
-#define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
-#define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
-#define MPTCP_PM_VER 0x1
-enum {
- MPTCP_PM_ATTR_UNSPEC,
- MPTCP_PM_ATTR_ADDR,
- MPTCP_PM_ATTR_RCV_ADD_ADDRS,
- MPTCP_PM_ATTR_SUBFLOWS,
- __MPTCP_PM_ATTR_MAX
-};
-#define MPTCP_PM_ATTR_MAX (__MPTCP_PM_ATTR_MAX - 1)
-enum {
- MPTCP_PM_ADDR_ATTR_UNSPEC,
- MPTCP_PM_ADDR_ATTR_FAMILY,
- MPTCP_PM_ADDR_ATTR_ID,
- MPTCP_PM_ADDR_ATTR_ADDR4,
- MPTCP_PM_ADDR_ATTR_ADDR6,
- MPTCP_PM_ADDR_ATTR_PORT,
- MPTCP_PM_ADDR_ATTR_FLAGS,
- MPTCP_PM_ADDR_ATTR_IF_IDX,
- __MPTCP_PM_ADDR_ATTR_MAX
-};
-#define MPTCP_PM_ADDR_ATTR_MAX (__MPTCP_PM_ADDR_ATTR_MAX - 1)
-#define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
-#define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
-#define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
-enum {
- MPTCP_PM_CMD_UNSPEC,
- MPTCP_PM_CMD_ADD_ADDR,
- MPTCP_PM_CMD_DEL_ADDR,
- MPTCP_PM_CMD_GET_ADDR,
- MPTCP_PM_CMD_FLUSH_ADDRS,
- MPTCP_PM_CMD_SET_LIMITS,
- MPTCP_PM_CMD_GET_LIMITS,
- MPTCP_PM_CMD_SET_FLAGS,
- __MPTCP_PM_CMD_AFTER_LAST
-};
-#define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
-#define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
-struct mptcp_info {
- __u8 mptcpi_subflows;
- __u8 mptcpi_add_addr_signal;
- __u8 mptcpi_add_addr_accepted;
- __u8 mptcpi_subflows_max;
- __u8 mptcpi_add_addr_signal_max;
- __u8 mptcpi_add_addr_accepted_max;
- __u32 mptcpi_flags;
- __u32 mptcpi_token;
- __u64 mptcpi_write_seq;
- __u64 mptcpi_snd_una;
- __u64 mptcpi_rcv_nxt;
- __u8 mptcpi_local_addr_used;
- __u8 mptcpi_local_addr_max;
-};
-enum mptcp_event_type {
- MPTCP_EVENT_UNSPEC = 0,
- MPTCP_EVENT_CREATED = 1,
- MPTCP_EVENT_ESTABLISHED = 2,
- MPTCP_EVENT_CLOSED = 3,
- MPTCP_EVENT_ANNOUNCED = 6,
- MPTCP_EVENT_REMOVED = 7,
- MPTCP_EVENT_SUB_ESTABLISHED = 10,
- MPTCP_EVENT_SUB_CLOSED = 11,
- MPTCP_EVENT_SUB_PRIORITY = 13,
-};
-enum mptcp_event_attr {
- MPTCP_ATTR_UNSPEC = 0,
- MPTCP_ATTR_TOKEN,
- MPTCP_ATTR_FAMILY,
- MPTCP_ATTR_LOC_ID,
- MPTCP_ATTR_REM_ID,
- MPTCP_ATTR_SADDR4,
- MPTCP_ATTR_SADDR6,
- MPTCP_ATTR_DADDR4,
- MPTCP_ATTR_DADDR6,
- MPTCP_ATTR_SPORT,
- MPTCP_ATTR_DPORT,
- MPTCP_ATTR_BACKUP,
- MPTCP_ATTR_ERROR,
- MPTCP_ATTR_FLAGS,
- MPTCP_ATTR_TIMEOUT,
- MPTCP_ATTR_IF_IDX,
- __MPTCP_ATTR_AFTER_LAST
-};
-#define MPTCP_ATTR_MAX (__MPTCP_ATTR_AFTER_LAST - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/mroute.h b/libc/kernel/uapi/linux/mroute.h
index e934d0912..7e0078f31 100644
--- a/libc/kernel/uapi/linux/mroute.h
+++ b/libc/kernel/uapi/linux/mroute.h
@@ -97,7 +97,7 @@ struct igmpmsg {
unsigned char im_msgtype;
unsigned char im_mbz;
unsigned char im_vif;
- unsigned char im_vif_hi;
+ unsigned char unused3;
struct in_addr im_src, im_dst;
};
enum {
@@ -140,7 +140,6 @@ enum {
IPMRA_CREPORT_SRC_ADDR,
IPMRA_CREPORT_DST_ADDR,
IPMRA_CREPORT_PKT,
- IPMRA_CREPORT_TABLE,
__IPMRA_CREPORT_MAX
};
#define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX - 1)
diff --git a/libc/kernel/uapi/linux/mroute6.h b/libc/kernel/uapi/linux/mroute6.h
index c73765c44..e6c83e981 100644
--- a/libc/kernel/uapi/linux/mroute6.h
+++ b/libc/kernel/uapi/linux/mroute6.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI__LINUX_MROUTE6_H
#define _UAPI__LINUX_MROUTE6_H
-#include <linux/const.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/sockios.h>
#include <linux/in6.h>
diff --git a/libc/kernel/uapi/linux/mrp_bridge.h b/libc/kernel/uapi/linux/mrp_bridge.h
deleted file mode 100644
index 0f935142b..000000000
--- a/libc/kernel/uapi/linux/mrp_bridge.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_MRP_BRIDGE_H_
-#define _UAPI_LINUX_MRP_BRIDGE_H_
-#include <linux/types.h>
-#include <linux/if_ether.h>
-#define MRP_MAX_FRAME_LENGTH 200
-#define MRP_DEFAULT_PRIO 0x8000
-#define MRP_DOMAIN_UUID_LENGTH 16
-#define MRP_VERSION 1
-#define MRP_FRAME_PRIO 7
-#define MRP_OUI_LENGTH 3
-#define MRP_MANUFACTURE_DATA_LENGTH 2
-enum br_mrp_ring_role_type {
- BR_MRP_RING_ROLE_DISABLED,
- BR_MRP_RING_ROLE_MRC,
- BR_MRP_RING_ROLE_MRM,
- BR_MRP_RING_ROLE_MRA,
-};
-enum br_mrp_in_role_type {
- BR_MRP_IN_ROLE_DISABLED,
- BR_MRP_IN_ROLE_MIC,
- BR_MRP_IN_ROLE_MIM,
-};
-enum br_mrp_ring_state_type {
- BR_MRP_RING_STATE_OPEN,
- BR_MRP_RING_STATE_CLOSED,
-};
-enum br_mrp_in_state_type {
- BR_MRP_IN_STATE_OPEN,
- BR_MRP_IN_STATE_CLOSED,
-};
-enum br_mrp_port_state_type {
- BR_MRP_PORT_STATE_DISABLED,
- BR_MRP_PORT_STATE_BLOCKED,
- BR_MRP_PORT_STATE_FORWARDING,
- BR_MRP_PORT_STATE_NOT_CONNECTED,
-};
-enum br_mrp_port_role_type {
- BR_MRP_PORT_ROLE_PRIMARY,
- BR_MRP_PORT_ROLE_SECONDARY,
- BR_MRP_PORT_ROLE_INTER,
-};
-enum br_mrp_tlv_header_type {
- BR_MRP_TLV_HEADER_END = 0x0,
- BR_MRP_TLV_HEADER_COMMON = 0x1,
- BR_MRP_TLV_HEADER_RING_TEST = 0x2,
- BR_MRP_TLV_HEADER_RING_TOPO = 0x3,
- BR_MRP_TLV_HEADER_RING_LINK_DOWN = 0x4,
- BR_MRP_TLV_HEADER_RING_LINK_UP = 0x5,
- BR_MRP_TLV_HEADER_IN_TEST = 0x6,
- BR_MRP_TLV_HEADER_IN_TOPO = 0x7,
- BR_MRP_TLV_HEADER_IN_LINK_DOWN = 0x8,
- BR_MRP_TLV_HEADER_IN_LINK_UP = 0x9,
- BR_MRP_TLV_HEADER_IN_LINK_STATUS = 0xa,
- BR_MRP_TLV_HEADER_OPTION = 0x7f,
-};
-enum br_mrp_sub_tlv_header_type {
- BR_MRP_SUB_TLV_HEADER_TEST_MGR_NACK = 0x1,
- BR_MRP_SUB_TLV_HEADER_TEST_PROPAGATE = 0x2,
- BR_MRP_SUB_TLV_HEADER_TEST_AUTO_MGR = 0x3,
-};
-#endif
diff --git a/libc/kernel/uapi/linux/ndctl.h b/libc/kernel/uapi/linux/ndctl.h
index 53f8ba4d2..e47091f13 100644
--- a/libc/kernel/uapi/linux/ndctl.h
+++ b/libc/kernel/uapi/linux/ndctl.h
@@ -158,10 +158,5 @@ struct nd_cmd_pkg {
#define NVDIMM_FAMILY_HPE2 2
#define NVDIMM_FAMILY_MSFT 3
#define NVDIMM_FAMILY_HYPERV 4
-#define NVDIMM_FAMILY_PAPR 5
-#define NVDIMM_FAMILY_MAX NVDIMM_FAMILY_PAPR
-#define NVDIMM_BUS_FAMILY_NFIT 0
-#define NVDIMM_BUS_FAMILY_INTEL 1
-#define NVDIMM_BUS_FAMILY_MAX NVDIMM_BUS_FAMILY_INTEL
#define ND_IOCTL_CALL _IOWR(ND_IOCTL, ND_CMD_CALL, struct nd_cmd_pkg)
#endif
diff --git a/libc/kernel/uapi/linux/neighbour.h b/libc/kernel/uapi/linux/neighbour.h
index e0e84aace..4ce473691 100644
--- a/libc/kernel/uapi/linux/neighbour.h
+++ b/libc/kernel/uapi/linux/neighbour.h
@@ -43,8 +43,6 @@ enum {
NDA_LINK_NETNSID,
NDA_SRC_VNI,
NDA_PROTOCOL,
- NDA_NH_ID,
- NDA_FDB_EXT_ATTRS,
__NDA_MAX
};
#define NDA_MAX (__NDA_MAX - 1)
@@ -137,15 +135,4 @@ enum {
__NDTA_MAX
};
#define NDTA_MAX (__NDTA_MAX - 1)
-enum {
- FDB_NOTIFY_BIT = (1 << 0),
- FDB_NOTIFY_INACTIVE_BIT = (1 << 1)
-};
-enum {
- NFEA_UNSPEC,
- NFEA_ACTIVITY_NOTIFY,
- NFEA_DONT_REFRESH,
- __NFEA_MAX
-};
-#define NFEA_MAX (__NFEA_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/net_dropmon.h b/libc/kernel/uapi/linux/net_dropmon.h
index 01b76cb10..a3d9119bc 100644
--- a/libc/kernel/uapi/linux/net_dropmon.h
+++ b/libc/kernel/uapi/linux/net_dropmon.h
@@ -86,7 +86,6 @@ enum net_dm_attr {
NET_DM_ATTR_HW_TRAP_COUNT,
NET_DM_ATTR_SW_DROPS,
NET_DM_ATTR_HW_DROPS,
- NET_DM_ATTR_FLOW_ACTION_COOKIE,
__NET_DM_ATTR_MAX,
NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/net_tstamp.h b/libc/kernel/uapi/linux/net_tstamp.h
index 373d1bb86..375906ae9 100644
--- a/libc/kernel/uapi/linux/net_tstamp.h
+++ b/libc/kernel/uapi/linux/net_tstamp.h
@@ -49,8 +49,6 @@ enum hwtstamp_tx_types {
HWTSTAMP_TX_OFF,
HWTSTAMP_TX_ON,
HWTSTAMP_TX_ONESTEP_SYNC,
- HWTSTAMP_TX_ONESTEP_P2P,
- __HWTSTAMP_TX_CNT
};
enum hwtstamp_rx_filters {
HWTSTAMP_FILTER_NONE,
@@ -69,7 +67,6 @@ enum hwtstamp_rx_filters {
HWTSTAMP_FILTER_PTP_V2_SYNC,
HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
HWTSTAMP_FILTER_NTP_ALL,
- __HWTSTAMP_FILTER_CNT
};
struct scm_ts_pktinfo {
__u32 if_index;
diff --git a/libc/kernel/uapi/linux/netfilter.h b/libc/kernel/uapi/linux/netfilter.h
index 261b979d2..345b197f0 100644
--- a/libc/kernel/uapi/linux/netfilter.h
+++ b/libc/kernel/uapi/linux/netfilter.h
@@ -42,8 +42,7 @@ enum nf_inet_hooks {
NF_INET_FORWARD,
NF_INET_LOCAL_OUT,
NF_INET_POST_ROUTING,
- NF_INET_NUMHOOKS,
- NF_INET_INGRESS = NF_INET_NUMHOOKS,
+ NF_INET_NUMHOOKS
};
enum nf_dev_hooks {
NF_NETDEV_INGRESS,
diff --git a/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h b/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
index 425253079..a6e1bce8d 100644
--- a/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
+++ b/libc/kernel/uapi/linux/netfilter/ipset/ip_set.h
@@ -81,11 +81,11 @@ enum {
IPSET_ATTR_MARK,
IPSET_ATTR_MARKMASK,
IPSET_ATTR_CADT_MAX = 16,
- IPSET_ATTR_INITVAL,
+ IPSET_ATTR_GC,
IPSET_ATTR_HASHSIZE,
IPSET_ATTR_MAXELEM,
IPSET_ATTR_NETMASK,
- IPSET_ATTR_BUCKETSIZE,
+ IPSET_ATTR_PROBES,
IPSET_ATTR_RESIZE,
IPSET_ATTR_SIZE,
IPSET_ATTR_ELEMENTS,
@@ -185,8 +185,6 @@ enum ipset_cadt_flags {
enum ipset_create_flags {
IPSET_CREATE_FLAG_BIT_FORCEADD = 0,
IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD),
- IPSET_CREATE_FLAG_BIT_BUCKETSIZE = 1,
- IPSET_CREATE_FLAG_BUCKETSIZE = (1 << IPSET_CREATE_FLAG_BIT_BUCKETSIZE),
IPSET_CREATE_FLAG_BIT_MAX = 7,
};
enum ipset_adt {
diff --git a/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h b/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
index 3ff603001..43d60ca26 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_conntrack_common.h
@@ -64,10 +64,8 @@ enum ip_conntrack_status {
IPS_HELPER = (1 << IPS_HELPER_BIT),
IPS_OFFLOAD_BIT = 14,
IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT),
- IPS_HW_OFFLOAD_BIT = 15,
- IPS_HW_OFFLOAD = (1 << IPS_HW_OFFLOAD_BIT),
- IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_UNTRACKED | IPS_OFFLOAD | IPS_HW_OFFLOAD),
- __IPS_MAX_BIT = 16,
+ IPS_UNCHANGEABLE_MASK = (IPS_NAT_DONE_MASK | IPS_NAT_MASK | IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD),
+ __IPS_MAX_BIT = 15,
};
enum ip_conntrack_events {
IPCT_NEW,
diff --git a/libc/kernel/uapi/linux/netfilter/nf_nat.h b/libc/kernel/uapi/linux/netfilter/nf_nat.h
index 84373ed74..f01669b57 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_nat.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_nat.h
@@ -26,9 +26,8 @@
#define NF_NAT_RANGE_PERSISTENT (1 << 3)
#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4)
#define NF_NAT_RANGE_PROTO_OFFSET (1 << 5)
-#define NF_NAT_RANGE_NETMAP (1 << 6)
#define NF_NAT_RANGE_PROTO_RANDOM_ALL (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
-#define NF_NAT_RANGE_MASK (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET | NF_NAT_RANGE_NETMAP)
+#define NF_NAT_RANGE_MASK (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET)
struct nf_nat_ipv4_range {
unsigned int flags;
__be32 min_ip;
diff --git a/libc/kernel/uapi/linux/netfilter/nf_tables.h b/libc/kernel/uapi/linux/netfilter/nf_tables.h
index 0023a9492..2fe11b0af 100644
--- a/libc/kernel/uapi/linux/netfilter/nf_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/nf_tables.h
@@ -52,7 +52,6 @@ enum nft_registers {
#define NFT_REG_MAX (__NFT_REG_MAX - 1)
#define NFT_REG_SIZE 16
#define NFT_REG32_SIZE 4
-#define NFT_REG32_COUNT (NFT_REG32_15 - NFT_REG32_00 + 1)
enum nft_verdicts {
NFT_CONTINUE = - 1,
NFT_BREAK = - 2,
@@ -89,7 +88,7 @@ enum nf_tables_msg_types {
NFT_MSG_MAX,
};
enum nft_list_attributes {
- NFTA_LIST_UNSPEC,
+ NFTA_LIST_UNPEC,
NFTA_LIST_ELEM,
__NFTA_LIST_MAX
};
@@ -105,9 +104,7 @@ enum nft_hook_attributes {
#define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
enum nft_table_flags {
NFT_TABLE_F_DORMANT = 0x1,
- NFT_TABLE_F_OWNER = 0x2,
};
-#define NFT_TABLE_F_MASK (NFT_TABLE_F_DORMANT | NFT_TABLE_F_OWNER)
enum nft_table_attributes {
NFTA_TABLE_UNSPEC,
NFTA_TABLE_NAME,
@@ -115,17 +112,9 @@ enum nft_table_attributes {
NFTA_TABLE_USE,
NFTA_TABLE_HANDLE,
NFTA_TABLE_PAD,
- NFTA_TABLE_USERDATA,
- NFTA_TABLE_OWNER,
__NFTA_TABLE_MAX
};
#define NFTA_TABLE_MAX (__NFTA_TABLE_MAX - 1)
-enum nft_chain_flags {
- NFT_CHAIN_BASE = (1 << 0),
- NFT_CHAIN_HW_OFFLOAD = (1 << 1),
- NFT_CHAIN_BINDING = (1 << 2),
-};
-#define NFT_CHAIN_FLAGS (NFT_CHAIN_BASE | NFT_CHAIN_HW_OFFLOAD | NFT_CHAIN_BINDING)
enum nft_chain_attributes {
NFTA_CHAIN_UNSPEC,
NFTA_CHAIN_TABLE,
@@ -138,8 +127,6 @@ enum nft_chain_attributes {
NFTA_CHAIN_COUNTERS,
NFTA_CHAIN_PAD,
NFTA_CHAIN_FLAGS,
- NFTA_CHAIN_ID,
- NFTA_CHAIN_USERDATA,
__NFTA_CHAIN_MAX
};
#define NFTA_CHAIN_MAX (__NFTA_CHAIN_MAX - 1)
@@ -155,7 +142,6 @@ enum nft_rule_attributes {
NFTA_RULE_PAD,
NFTA_RULE_ID,
NFTA_RULE_POSITION_ID,
- NFTA_RULE_CHAIN_ID,
__NFTA_RULE_MAX
};
#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
@@ -178,8 +164,6 @@ enum nft_set_flags {
NFT_SET_TIMEOUT = 0x10,
NFT_SET_EVAL = 0x20,
NFT_SET_OBJECT = 0x40,
- NFT_SET_CONCAT = 0x80,
- NFT_SET_EXPR = 0x100,
};
enum nft_set_policies {
NFT_SET_POL_PERFORMANCE,
@@ -188,16 +172,9 @@ enum nft_set_policies {
enum nft_set_desc_attributes {
NFTA_SET_DESC_UNSPEC,
NFTA_SET_DESC_SIZE,
- NFTA_SET_DESC_CONCAT,
__NFTA_SET_DESC_MAX
};
#define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
-enum nft_set_field_attributes {
- NFTA_SET_FIELD_UNSPEC,
- NFTA_SET_FIELD_LEN,
- __NFTA_SET_FIELD_MAX
-};
-#define NFTA_SET_FIELD_MAX (__NFTA_SET_FIELD_MAX - 1)
enum nft_set_attributes {
NFTA_SET_UNSPEC,
NFTA_SET_TABLE,
@@ -216,8 +193,6 @@ enum nft_set_attributes {
NFTA_SET_PAD,
NFTA_SET_OBJ_TYPE,
NFTA_SET_HANDLE,
- NFTA_SET_EXPR,
- NFTA_SET_EXPRESSIONS,
__NFTA_SET_MAX
};
#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -235,8 +210,6 @@ enum nft_set_elem_attributes {
NFTA_SET_ELEM_EXPR,
NFTA_SET_ELEM_PAD,
NFTA_SET_ELEM_OBJREF,
- NFTA_SET_ELEM_KEY_END,
- NFTA_SET_ELEM_EXPRESSIONS,
__NFTA_SET_ELEM_MAX
};
#define NFTA_SET_ELEM_MAX (__NFTA_SET_ELEM_MAX - 1)
@@ -266,7 +239,6 @@ enum nft_verdict_attributes {
NFTA_VERDICT_UNSPEC,
NFTA_VERDICT_CODE,
NFTA_VERDICT_CHAIN,
- NFTA_VERDICT_CHAIN_ID,
__NFTA_VERDICT_MAX
};
#define NFTA_VERDICT_MAX (__NFTA_VERDICT_MAX - 1)
@@ -284,11 +256,6 @@ enum nft_immediate_attributes {
__NFTA_IMMEDIATE_MAX
};
#define NFTA_IMMEDIATE_MAX (__NFTA_IMMEDIATE_MAX - 1)
-enum nft_bitwise_ops {
- NFT_BITWISE_BOOL,
- NFT_BITWISE_LSHIFT,
- NFT_BITWISE_RSHIFT,
-};
enum nft_bitwise_attributes {
NFTA_BITWISE_UNSPEC,
NFTA_BITWISE_SREG,
@@ -296,8 +263,6 @@ enum nft_bitwise_attributes {
NFTA_BITWISE_LEN,
NFTA_BITWISE_MASK,
NFTA_BITWISE_XOR,
- NFTA_BITWISE_OP,
- NFTA_BITWISE_DATA,
__NFTA_BITWISE_MAX
};
#define NFTA_BITWISE_MAX (__NFTA_BITWISE_MAX - 1)
@@ -364,7 +329,6 @@ enum nft_dynset_ops {
};
enum nft_dynset_flags {
NFT_DYNSET_F_INV = (1 << 0),
- NFT_DYNSET_F_EXPR = (1 << 1),
};
enum nft_dynset_attributes {
NFTA_DYNSET_UNSPEC,
@@ -377,7 +341,6 @@ enum nft_dynset_attributes {
NFTA_DYNSET_EXPR,
NFTA_DYNSET_PAD,
NFTA_DYNSET_FLAGS,
- NFTA_DYNSET_EXPRESSIONS,
__NFTA_DYNSET_MAX,
};
#define NFTA_DYNSET_MAX (__NFTA_DYNSET_MAX - 1)
@@ -389,7 +352,6 @@ enum nft_payload_bases {
enum nft_payload_csum_types {
NFT_PAYLOAD_CSUM_NONE,
NFT_PAYLOAD_CSUM_INET,
- NFT_PAYLOAD_CSUM_SCTP,
};
enum nft_payload_csum_flags {
NFT_PAYLOAD_L4CSUM_PSEUDOHDR = (1 << 0),
@@ -463,8 +425,6 @@ enum nft_meta_keys {
NFT_META_TIME_NS,
NFT_META_TIME_DAY,
NFT_META_TIME_HOUR,
- NFT_META_SDIF,
- NFT_META_SDIFNAME,
};
enum nft_rt_keys {
NFT_RT_CLASSID,
@@ -518,7 +478,6 @@ enum nft_socket_attributes {
enum nft_socket_keys {
NFT_SOCKET_TRANSPARENT,
NFT_SOCKET_MARK,
- NFT_SOCKET_WILDCARD,
__NFT_SOCKET_MAX
};
#define NFT_SOCKET_MAX (__NFT_SOCKET_MAX - 1)
@@ -822,15 +781,9 @@ enum nft_object_attributes {
NFTA_OBJ_USE,
NFTA_OBJ_HANDLE,
NFTA_OBJ_PAD,
- NFTA_OBJ_USERDATA,
__NFTA_OBJ_MAX
};
#define NFTA_OBJ_MAX (__NFTA_OBJ_MAX - 1)
-enum nft_flowtable_flags {
- NFT_FLOWTABLE_HW_OFFLOAD = 0x1,
- NFT_FLOWTABLE_COUNTER = 0x2,
- NFT_FLOWTABLE_MASK = (NFT_FLOWTABLE_HW_OFFLOAD | NFT_FLOWTABLE_COUNTER)
-};
enum nft_flowtable_attributes {
NFTA_FLOWTABLE_UNSPEC,
NFTA_FLOWTABLE_TABLE,
@@ -962,7 +915,6 @@ enum nft_tunnel_opts_attributes {
NFTA_TUNNEL_KEY_OPTS_UNSPEC,
NFTA_TUNNEL_KEY_OPTS_VXLAN,
NFTA_TUNNEL_KEY_OPTS_ERSPAN,
- NFTA_TUNNEL_KEY_OPTS_GENEVE,
__NFTA_TUNNEL_KEY_OPTS_MAX
};
#define NFTA_TUNNEL_KEY_OPTS_MAX (__NFTA_TUNNEL_KEY_OPTS_MAX - 1)
@@ -981,14 +933,6 @@ enum nft_tunnel_opts_erspan_attributes {
__NFTA_TUNNEL_KEY_ERSPAN_MAX
};
#define NFTA_TUNNEL_KEY_ERSPAN_MAX (__NFTA_TUNNEL_KEY_ERSPAN_MAX - 1)
-enum nft_tunnel_opts_geneve_attributes {
- NFTA_TUNNEL_KEY_GENEVE_UNSPEC,
- NFTA_TUNNEL_KEY_GENEVE_CLASS,
- NFTA_TUNNEL_KEY_GENEVE_TYPE,
- NFTA_TUNNEL_KEY_GENEVE_DATA,
- __NFTA_TUNNEL_KEY_GENEVE_MAX
-};
-#define NFTA_TUNNEL_KEY_GENEVE_MAX (__NFTA_TUNNEL_KEY_GENEVE_MAX - 1)
enum nft_tunnel_flags {
NFT_TUNNEL_F_ZERO_CSUM_TX = (1 << 0),
NFT_TUNNEL_F_DONT_FRAGMENT = (1 << 1),
diff --git a/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h b/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
index 4501e538d..4981fc14c 100644
--- a/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/libc/kernel/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -66,7 +66,6 @@ enum ctattr_type {
CTA_LABELS,
CTA_LABELS_MASK,
CTA_SYNPROXY,
- CTA_FILTER,
__CTA_MAX
};
#define CTA_MAX (__CTA_MAX - 1)
@@ -248,7 +247,6 @@ enum ctattr_stats_cpu {
CTA_STATS_EARLY_DROP,
CTA_STATS_ERROR,
CTA_STATS_SEARCH_RESTART,
- CTA_STATS_CLASH_RESOLVE,
__CTA_STATS_MAX,
};
#define CTA_STATS_MAX (__CTA_STATS_MAX - 1)
@@ -267,11 +265,4 @@ enum ctattr_expect_stats {
__CTA_STATS_EXP_MAX,
};
#define CTA_STATS_EXP_MAX (__CTA_STATS_EXP_MAX - 1)
-enum ctattr_filter {
- CTA_FILTER_UNSPEC,
- CTA_FILTER_ORIG_FLAGS,
- CTA_FILTER_REPLY_FLAGS,
- __CTA_FILTER_MAX
-};
-#define CTA_FILTER_MAX (__CTA_FILTER_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/netfilter/nfnetlink_cthelper.h b/libc/kernel/uapi/linux/netfilter/nfnetlink_cthelper.h
index e8c2825d4..0a8cd459b 100644
--- a/libc/kernel/uapi/linux/netfilter/nfnetlink_cthelper.h
+++ b/libc/kernel/uapi/linux/netfilter/nfnetlink_cthelper.h
@@ -20,7 +20,7 @@
#define _NFNL_CTHELPER_H_
#define NFCT_HELPER_STATUS_DISABLED 0
#define NFCT_HELPER_STATUS_ENABLED 1
-enum nfnl_cthelper_msg_types {
+enum nfnl_acct_msg_types {
NFNL_MSG_CTHELPER_NEW,
NFNL_MSG_CTHELPER_GET,
NFNL_MSG_CTHELPER_DEL,
diff --git a/libc/kernel/uapi/linux/netfilter/x_tables.h b/libc/kernel/uapi/linux/netfilter/x_tables.h
index 46bde5796..3d88cd17e 100644
--- a/libc/kernel/uapi/linux/netfilter/x_tables.h
+++ b/libc/kernel/uapi/linux/netfilter/x_tables.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI_X_TABLES_H
#define _UAPI_X_TABLES_H
-#include <linux/const.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#define XT_FUNCTION_MAXNAMELEN 30
#define XT_EXTENSION_MAXNAMELEN 29
diff --git a/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h b/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
index f4defb6cf..e1f0e332e 100644
--- a/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
+++ b/libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
@@ -20,17 +20,13 @@
#define _XT_IDLETIMER_H
#include <linux/types.h>
#define MAX_IDLETIMER_LABEL_SIZE 28
-#define XT_IDLETIMER_ALARM 0x01
+#define NLMSG_MAX_SIZE 64
+#define NL_EVENT_TYPE_INACTIVE 0
+#define NL_EVENT_TYPE_ACTIVE 1
struct idletimer_tg_info {
__u32 timeout;
char label[MAX_IDLETIMER_LABEL_SIZE];
- struct idletimer_tg * timer __attribute__((aligned(8)));
-};
-struct idletimer_tg_info_v1 {
- __u32 timeout;
- char label[MAX_IDLETIMER_LABEL_SIZE];
__u8 send_nl_msg;
- __u8 timer_type;
struct idletimer_tg * timer __attribute__((aligned(8)));
};
#endif
diff --git a/libc/kernel/uapi/linux/netlink.h b/libc/kernel/uapi/linux/netlink.h
index da6a46b32..4c0fd1fe6 100644
--- a/libc/kernel/uapi/linux/netlink.h
+++ b/libc/kernel/uapi/linux/netlink.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI__LINUX_NETLINK_H
#define _UAPI__LINUX_NETLINK_H
-#include <linux/const.h>
+#include <linux/kernel.h>
#include <linux/socket.h>
#include <linux/types.h>
#define NETLINK_ROUTE 0
@@ -98,7 +98,6 @@ enum nlmsgerr_attrs {
NLMSGERR_ATTR_MSG,
NLMSGERR_ATTR_OFFS,
NLMSGERR_ATTR_COOKIE,
- NLMSGERR_ATTR_POLICY,
__NLMSGERR_ATTR_MAX,
NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
};
@@ -160,39 +159,4 @@ struct nla_bitfield32 {
__u32 value;
__u32 selector;
};
-enum netlink_attribute_type {
- NL_ATTR_TYPE_INVALID,
- NL_ATTR_TYPE_FLAG,
- NL_ATTR_TYPE_U8,
- NL_ATTR_TYPE_U16,
- NL_ATTR_TYPE_U32,
- NL_ATTR_TYPE_U64,
- NL_ATTR_TYPE_S8,
- NL_ATTR_TYPE_S16,
- NL_ATTR_TYPE_S32,
- NL_ATTR_TYPE_S64,
- NL_ATTR_TYPE_BINARY,
- NL_ATTR_TYPE_STRING,
- NL_ATTR_TYPE_NUL_STRING,
- NL_ATTR_TYPE_NESTED,
- NL_ATTR_TYPE_NESTED_ARRAY,
- NL_ATTR_TYPE_BITFIELD32,
-};
-enum netlink_policy_type_attr {
- NL_POLICY_TYPE_ATTR_UNSPEC,
- NL_POLICY_TYPE_ATTR_TYPE,
- NL_POLICY_TYPE_ATTR_MIN_VALUE_S,
- NL_POLICY_TYPE_ATTR_MAX_VALUE_S,
- NL_POLICY_TYPE_ATTR_MIN_VALUE_U,
- NL_POLICY_TYPE_ATTR_MAX_VALUE_U,
- NL_POLICY_TYPE_ATTR_MIN_LENGTH,
- NL_POLICY_TYPE_ATTR_MAX_LENGTH,
- NL_POLICY_TYPE_ATTR_POLICY_IDX,
- NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE,
- NL_POLICY_TYPE_ATTR_BITFIELD32_MASK,
- NL_POLICY_TYPE_ATTR_PAD,
- NL_POLICY_TYPE_ATTR_MASK,
- __NL_POLICY_TYPE_ATTR_MAX,
- NL_POLICY_TYPE_ATTR_MAX = __NL_POLICY_TYPE_ATTR_MAX - 1
-};
#endif
diff --git a/libc/kernel/uapi/linux/nexthop.h b/libc/kernel/uapi/linux/nexthop.h
index f99a074d5..a2a959f66 100644
--- a/libc/kernel/uapi/linux/nexthop.h
+++ b/libc/kernel/uapi/linux/nexthop.h
@@ -49,7 +49,6 @@ enum {
NHA_ENCAP,
NHA_GROUPS,
NHA_MASTER,
- NHA_FDB,
__NHA_MAX,
};
#define NHA_MAX (__NHA_MAX - 1)
diff --git a/libc/kernel/uapi/linux/nfs3.h b/libc/kernel/uapi/linux/nfs3.h
index af0d66836..3972d0ba8 100644
--- a/libc/kernel/uapi/linux/nfs3.h
+++ b/libc/kernel/uapi/linux/nfs3.h
@@ -67,11 +67,6 @@ enum nfs3_ftype {
NF3FIFO = 7,
NF3BAD = 8
};
-enum nfs3_time_how {
- DONT_CHANGE = 0,
- SET_TO_SERVER_TIME = 1,
- SET_TO_CLIENT_TIME = 2,
-};
struct nfs3_fh {
unsigned short size;
unsigned char data[NFS3_FHSIZE];
diff --git a/libc/kernel/uapi/linux/nfs4.h b/libc/kernel/uapi/linux/nfs4.h
index 9d614ced2..e6118a637 100644
--- a/libc/kernel/uapi/linux/nfs4.h
+++ b/libc/kernel/uapi/linux/nfs4.h
@@ -35,9 +35,6 @@
#define NFS4_ACCESS_EXTEND 0x0008
#define NFS4_ACCESS_DELETE 0x0010
#define NFS4_ACCESS_EXECUTE 0x0020
-#define NFS4_ACCESS_XAREAD 0x0040
-#define NFS4_ACCESS_XAWRITE 0x0080
-#define NFS4_ACCESS_XALIST 0x0100
#define NFS4_FH_PERSISTENT 0x0000
#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
#define NFS4_FH_VOLATILE_ANY 0x0002
@@ -124,10 +121,8 @@
#define EXCHGID4_FLAG_MASK_PNFS 0x00070000
#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
-#define EXCHGID4_FLAG_SUPP_FENCE_OPS 0x00000004
#define EXCHGID4_FLAG_MASK_A 0x40070103
#define EXCHGID4_FLAG_MASK_R 0x80070103
-#define EXCHGID4_2_FLAG_MASK_R 0x80070107
#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
diff --git a/libc/kernel/uapi/linux/nfs_fs.h b/libc/kernel/uapi/linux/nfs_fs.h
index f8228eca8..8ff9305c2 100644
--- a/libc/kernel/uapi/linux/nfs_fs.h
+++ b/libc/kernel/uapi/linux/nfs_fs.h
@@ -49,6 +49,5 @@
#define NFSDBG_PNFS 0x1000
#define NFSDBG_PNFS_LD 0x2000
#define NFSDBG_STATE 0x4000
-#define NFSDBG_XATTRCACHE 0x8000
#define NFSDBG_ALL 0xFFFF
#endif
diff --git a/libc/kernel/uapi/linux/nfsacl.h b/libc/kernel/uapi/linux/nfsacl.h
index 65dccad4e..d8eceeb73 100644
--- a/libc/kernel/uapi/linux/nfsacl.h
+++ b/libc/kernel/uapi/linux/nfsacl.h
@@ -19,12 +19,10 @@
#ifndef _UAPI__LINUX_NFSACL_H
#define _UAPI__LINUX_NFSACL_H
#define NFS_ACL_PROGRAM 100227
-#define ACLPROC2_NULL 0
#define ACLPROC2_GETACL 1
#define ACLPROC2_SETACL 2
#define ACLPROC2_GETATTR 3
#define ACLPROC2_ACCESS 4
-#define ACLPROC3_NULL 0
#define ACLPROC3_GETACL 1
#define ACLPROC3_SETACL 2
#define NFS_ACL 0x0001
diff --git a/libc/kernel/uapi/linux/nitro_enclaves.h b/libc/kernel/uapi/linux/nitro_enclaves.h
deleted file mode 100644
index 20b26eff1..000000000
--- a/libc/kernel/uapi/linux/nitro_enclaves.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_NITRO_ENCLAVES_H_
-#define _UAPI_LINUX_NITRO_ENCLAVES_H_
-#include <linux/types.h>
-#define NE_CREATE_VM _IOR(0xAE, 0x20, __u64)
-#define NE_ADD_VCPU _IOWR(0xAE, 0x21, __u32)
-#define NE_GET_IMAGE_LOAD_INFO _IOWR(0xAE, 0x22, struct ne_image_load_info)
-#define NE_SET_USER_MEMORY_REGION _IOW(0xAE, 0x23, struct ne_user_memory_region)
-#define NE_START_ENCLAVE _IOWR(0xAE, 0x24, struct ne_enclave_start_info)
-#define NE_ERR_VCPU_ALREADY_USED (256)
-#define NE_ERR_VCPU_NOT_IN_CPU_POOL (257)
-#define NE_ERR_VCPU_INVALID_CPU_CORE (258)
-#define NE_ERR_INVALID_MEM_REGION_SIZE (259)
-#define NE_ERR_INVALID_MEM_REGION_ADDR (260)
-#define NE_ERR_UNALIGNED_MEM_REGION_ADDR (261)
-#define NE_ERR_MEM_REGION_ALREADY_USED (262)
-#define NE_ERR_MEM_NOT_HUGE_PAGE (263)
-#define NE_ERR_MEM_DIFFERENT_NUMA_NODE (264)
-#define NE_ERR_MEM_MAX_REGIONS (265)
-#define NE_ERR_NO_MEM_REGIONS_ADDED (266)
-#define NE_ERR_NO_VCPUS_ADDED (267)
-#define NE_ERR_ENCLAVE_MEM_MIN_SIZE (268)
-#define NE_ERR_FULL_CORES_NOT_USED (269)
-#define NE_ERR_NOT_IN_INIT_STATE (270)
-#define NE_ERR_INVALID_VCPU (271)
-#define NE_ERR_NO_CPUS_AVAIL_IN_POOL (272)
-#define NE_ERR_INVALID_PAGE_SIZE (273)
-#define NE_ERR_INVALID_FLAG_VALUE (274)
-#define NE_ERR_INVALID_ENCLAVE_CID (275)
-#define NE_EIF_IMAGE (0x01)
-#define NE_IMAGE_LOAD_MAX_FLAG_VAL (0x02)
-struct ne_image_load_info {
- __u64 flags;
- __u64 memory_offset;
-};
-#define NE_DEFAULT_MEMORY_REGION (0x00)
-#define NE_MEMORY_REGION_MAX_FLAG_VAL (0x01)
-struct ne_user_memory_region {
- __u64 flags;
- __u64 memory_size;
- __u64 userspace_addr;
-};
-#define NE_ENCLAVE_PRODUCTION_MODE (0x00)
-#define NE_ENCLAVE_DEBUG_MODE (0x01)
-#define NE_ENCLAVE_START_MAX_FLAG_VAL (0x02)
-struct ne_enclave_start_info {
- __u64 flags;
- __u64 enclave_cid;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/nl80211.h b/libc/kernel/uapi/linux/nl80211.h
index 5181160d8..92925711c 100644
--- a/libc/kernel/uapi/linux/nl80211.h
+++ b/libc/kernel/uapi/linux/nl80211.h
@@ -174,10 +174,6 @@ enum nl80211_commands {
NL80211_CMD_NOTIFY_RADAR,
NL80211_CMD_UPDATE_OWE_INFO,
NL80211_CMD_PROBE_MESH_LINK,
- NL80211_CMD_SET_TID_CONFIG,
- NL80211_CMD_UNPROT_BEACON,
- NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
- NL80211_CMD_SET_SAR_SPECS,
__NL80211_CMD_AFTER_LAST,
NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
};
@@ -380,8 +376,8 @@ enum nl80211_attrs {
NL80211_ATTR_CH_SWITCH_COUNT,
NL80211_ATTR_CH_SWITCH_BLOCK_TX,
NL80211_ATTR_CSA_IES,
- NL80211_ATTR_CNTDWN_OFFS_BEACON,
- NL80211_ATTR_CNTDWN_OFFS_PRESP,
+ NL80211_ATTR_CSA_C_OFF_BEACON,
+ NL80211_ATTR_CSA_C_OFF_PRESP,
NL80211_ATTR_RXMGMT_FLAGS,
NL80211_ATTR_STA_SUPPORTED_CHANNELS,
NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
@@ -477,25 +473,6 @@ enum nl80211_attrs {
NL80211_ATTR_WIPHY_EDMG_CHANNELS,
NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
NL80211_ATTR_VLAN_ID,
- NL80211_ATTR_HE_BSS_COLOR,
- NL80211_ATTR_IFTYPE_AKM_SUITES,
- NL80211_ATTR_TID_CONFIG,
- NL80211_ATTR_CONTROL_PORT_NO_PREAUTH,
- NL80211_ATTR_PMK_LIFETIME,
- NL80211_ATTR_PMK_REAUTH_THRESHOLD,
- NL80211_ATTR_RECEIVE_MULTICAST,
- NL80211_ATTR_WIPHY_FREQ_OFFSET,
- NL80211_ATTR_CENTER_FREQ1_OFFSET,
- NL80211_ATTR_SCAN_FREQ_KHZ,
- NL80211_ATTR_HE_6GHZ_CAPABILITY,
- NL80211_ATTR_FILS_DISCOVERY,
- NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
- NL80211_ATTR_S1G_CAPABILITY,
- NL80211_ATTR_S1G_CAPABILITY_MASK,
- NL80211_ATTR_SAE_PWE,
- NL80211_ATTR_RECONNECT_REQUESTED,
- NL80211_ATTR_SAR_SPEC,
- NL80211_ATTR_DISABLE_HE,
__NL80211_ATTR_AFTER_LAST,
NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
@@ -504,8 +481,6 @@ enum nl80211_attrs {
#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
-#define NL80211_ATTR_CSA_C_OFF_BEACON NL80211_ATTR_CNTDWN_OFFS_BEACON
-#define NL80211_ATTR_CSA_C_OFF_PRESP NL80211_ATTR_CNTDWN_OFFS_PRESP
#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
@@ -587,11 +562,6 @@ enum nl80211_he_gi {
NL80211_RATE_INFO_HE_GI_1_6,
NL80211_RATE_INFO_HE_GI_3_2,
};
-enum nl80211_he_ltf {
- NL80211_RATE_INFO_HE_1XLTF,
- NL80211_RATE_INFO_HE_2XLTF,
- NL80211_RATE_INFO_HE_4XLTF,
-};
enum nl80211_he_ru_alloc {
NL80211_RATE_INFO_HE_RU_ALLOC_26,
NL80211_RATE_INFO_HE_RU_ALLOC_52,
@@ -677,7 +647,6 @@ enum nl80211_sta_info {
NL80211_STA_INFO_AIRTIME_WEIGHT,
NL80211_STA_INFO_AIRTIME_LINK_METRIC,
NL80211_STA_INFO_ASSOC_AT_BOOTTIME,
- NL80211_STA_INFO_CONNECTED_TO_AS,
__NL80211_STA_INFO_AFTER_LAST,
NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
};
@@ -737,7 +706,6 @@ enum nl80211_band_iftype_attr {
NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
- NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA,
__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
};
@@ -787,13 +755,6 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_NO_20MHZ,
NL80211_FREQUENCY_ATTR_NO_10MHZ,
NL80211_FREQUENCY_ATTR_WMM,
- NL80211_FREQUENCY_ATTR_NO_HE,
- NL80211_FREQUENCY_ATTR_OFFSET,
- NL80211_FREQUENCY_ATTR_1MHZ,
- NL80211_FREQUENCY_ATTR_2MHZ,
- NL80211_FREQUENCY_ATTR_4MHZ,
- NL80211_FREQUENCY_ATTR_8MHZ,
- NL80211_FREQUENCY_ATTR_16MHZ,
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
};
@@ -861,7 +822,6 @@ enum nl80211_reg_rule_flags {
NL80211_RRF_NO_HT40PLUS = 1 << 14,
NL80211_RRF_NO_80MHZ = 1 << 15,
NL80211_RRF_NO_160MHZ = 1 << 16,
- NL80211_RRF_NO_HE = 1 << 17,
};
#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
@@ -893,7 +853,6 @@ enum nl80211_survey_info {
NL80211_SURVEY_INFO_TIME_SCAN,
NL80211_SURVEY_INFO_PAD,
NL80211_SURVEY_INFO_TIME_BSS_RX,
- NL80211_SURVEY_INFO_FREQUENCY_OFFSET,
__NL80211_SURVEY_INFO_AFTER_LAST,
NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1
};
@@ -952,8 +911,6 @@ enum nl80211_meshconf_params {
NL80211_MESHCONF_AWAKE_WINDOW,
NL80211_MESHCONF_PLINK_TIMEOUT,
NL80211_MESHCONF_CONNECTED_TO_GATE,
- NL80211_MESHCONF_NOLEARN,
- NL80211_MESHCONF_CONNECTED_TO_AS,
__NL80211_MESHCONF_ATTR_AFTER_LAST,
NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
};
@@ -1012,18 +969,11 @@ enum nl80211_chan_width {
NL80211_CHAN_WIDTH_160,
NL80211_CHAN_WIDTH_5,
NL80211_CHAN_WIDTH_10,
- NL80211_CHAN_WIDTH_1,
- NL80211_CHAN_WIDTH_2,
- NL80211_CHAN_WIDTH_4,
- NL80211_CHAN_WIDTH_8,
- NL80211_CHAN_WIDTH_16,
};
enum nl80211_bss_scan_width {
NL80211_BSS_CHAN_WIDTH_20,
NL80211_BSS_CHAN_WIDTH_10,
NL80211_BSS_CHAN_WIDTH_5,
- NL80211_BSS_CHAN_WIDTH_1,
- NL80211_BSS_CHAN_WIDTH_2,
};
enum nl80211_bss {
__NL80211_BSS_INVALID,
@@ -1046,7 +996,6 @@ enum nl80211_bss {
NL80211_BSS_PARENT_TSF,
NL80211_BSS_PARENT_BSSID,
NL80211_BSS_CHAIN_SIGNAL,
- NL80211_BSS_FREQUENCY_OFFSET,
__NL80211_BSS_AFTER_LAST,
NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
};
@@ -1101,7 +1050,6 @@ enum nl80211_key_attributes {
NL80211_KEY_TYPE,
NL80211_KEY_DEFAULT_TYPES,
NL80211_KEY_MODE,
- NL80211_KEY_DEFAULT_BEACON,
__NL80211_KEY_AFTER_LAST,
NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
};
@@ -1111,9 +1059,6 @@ enum nl80211_tx_rate_attributes {
NL80211_TXRATE_HT,
NL80211_TXRATE_VHT,
NL80211_TXRATE_GI,
- NL80211_TXRATE_HE,
- NL80211_TXRATE_HE_GI,
- NL80211_TXRATE_HE_LTF,
__NL80211_TXRATE_AFTER_LAST,
NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1
};
@@ -1122,10 +1067,6 @@ enum nl80211_tx_rate_attributes {
struct nl80211_txrate_vht {
__u16 mcs[NL80211_VHT_NSS_MAX];
};
-#define NL80211_HE_NSS_MAX 8
-struct nl80211_txrate_he {
- __u16 mcs[NL80211_HE_NSS_MAX];
-};
enum nl80211_txrate_gi {
NL80211_TXRATE_DEFAULT_GI,
NL80211_TXRATE_FORCE_SGI,
@@ -1136,7 +1077,6 @@ enum nl80211_band {
NL80211_BAND_5GHZ,
NL80211_BAND_60GHZ,
NL80211_BAND_6GHZ,
- NL80211_BAND_S1GHZ,
NUM_NL80211_BANDS,
};
enum nl80211_ps_state {
@@ -1167,33 +1107,6 @@ enum nl80211_tx_power_setting {
NL80211_TX_POWER_LIMITED,
NL80211_TX_POWER_FIXED,
};
-enum nl80211_tid_config {
- NL80211_TID_CONFIG_ENABLE,
- NL80211_TID_CONFIG_DISABLE,
-};
-enum nl80211_tx_rate_setting {
- NL80211_TX_RATE_AUTOMATIC,
- NL80211_TX_RATE_LIMITED,
- NL80211_TX_RATE_FIXED,
-};
-enum nl80211_tid_config_attr {
- __NL80211_TID_CONFIG_ATTR_INVALID,
- NL80211_TID_CONFIG_ATTR_PAD,
- NL80211_TID_CONFIG_ATTR_VIF_SUPP,
- NL80211_TID_CONFIG_ATTR_PEER_SUPP,
- NL80211_TID_CONFIG_ATTR_OVERRIDE,
- NL80211_TID_CONFIG_ATTR_TIDS,
- NL80211_TID_CONFIG_ATTR_NOACK,
- NL80211_TID_CONFIG_ATTR_RETRY_SHORT,
- NL80211_TID_CONFIG_ATTR_RETRY_LONG,
- NL80211_TID_CONFIG_ATTR_AMPDU_CTRL,
- NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL,
- NL80211_TID_CONFIG_ATTR_AMSDU_CTRL,
- NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE,
- NL80211_TID_CONFIG_ATTR_TX_RATE,
- __NL80211_TID_CONFIG_ATTR_AFTER_LAST,
- NL80211_TID_CONFIG_ATTR_MAX = __NL80211_TID_CONFIG_ATTR_AFTER_LAST - 1
-};
enum nl80211_packet_pattern_attr {
__NL80211_PKTPAT_INVALID,
NL80211_PKTPAT_MASK,
@@ -1320,15 +1233,12 @@ enum plink_actions {
};
#define NL80211_KCK_LEN 16
#define NL80211_KEK_LEN 16
-#define NL80211_KCK_EXT_LEN 24
-#define NL80211_KEK_EXT_LEN 32
#define NL80211_REPLAY_CTR_LEN 8
enum nl80211_rekey_data {
__NL80211_REKEY_DATA_INVALID,
NL80211_REKEY_DATA_KEK,
NL80211_REKEY_DATA_KCK,
NL80211_REKEY_DATA_REPLAY_CTR,
- NL80211_REKEY_DATA_AKM,
NUM_NL80211_REKEY_DATA,
MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
};
@@ -1435,20 +1345,6 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SAE_OFFLOAD,
NL80211_EXT_FEATURE_VLAN_OFFLOAD,
NL80211_EXT_FEATURE_AQL,
- NL80211_EXT_FEATURE_BEACON_PROTECTION,
- NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH,
- NL80211_EXT_FEATURE_PROTECTED_TWT,
- NL80211_EXT_FEATURE_DEL_IBSS_STA,
- NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
- NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
- NL80211_EXT_FEATURE_SCAN_FREQ_KHZ,
- NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS,
- NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION,
- NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK,
- NL80211_EXT_FEATURE_SAE_OFFLOAD_AP,
- NL80211_EXT_FEATURE_FILS_DISCOVERY,
- NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP,
- NL80211_EXT_FEATURE_BEACON_RATE_HE,
NUM_NL80211_EXT_FEATURES,
MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
};
@@ -1482,8 +1378,6 @@ enum nl80211_scan_flags {
NL80211_SCAN_FLAG_HIGH_ACCURACY = 1 << 10,
NL80211_SCAN_FLAG_RANDOM_SN = 1 << 11,
NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1 << 12,
- NL80211_SCAN_FLAG_FREQ_KHZ = 1 << 13,
- NL80211_SCAN_FLAG_COLOCATED_6GHZ = 1 << 14,
};
enum nl80211_acl_policy {
NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED,
@@ -1641,7 +1535,6 @@ enum nl80211_preamble {
NL80211_PREAMBLE_HT,
NL80211_PREAMBLE_VHT,
NL80211_PREAMBLE_DMG,
- NL80211_PREAMBLE_HE,
};
enum nl80211_peer_measurement_type {
NL80211_PMSR_TYPE_INVALID,
@@ -1702,8 +1595,6 @@ enum nl80211_peer_measurement_ftm_capa {
NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
- NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED,
- NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED,
NUM_NL80211_PMSR_FTM_CAPA_ATTR,
NL80211_PMSR_FTM_CAPA_ATTR_MAX = NUM_NL80211_PMSR_FTM_CAPA_ATTR - 1
};
@@ -1718,8 +1609,6 @@ enum nl80211_peer_measurement_ftm_req {
NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
- NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED,
- NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,
NUM_NL80211_PMSR_FTM_REQ_ATTR,
NL80211_PMSR_FTM_REQ_ATTR_MAX = NUM_NL80211_PMSR_FTM_REQ_ATTR - 1
};
@@ -1763,68 +1652,7 @@ enum nl80211_obss_pd_attributes {
__NL80211_HE_OBSS_PD_ATTR_INVALID,
NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
- NL80211_HE_OBSS_PD_ATTR_NON_SRG_MAX_OFFSET,
- NL80211_HE_OBSS_PD_ATTR_BSS_COLOR_BITMAP,
- NL80211_HE_OBSS_PD_ATTR_PARTIAL_BSSID_BITMAP,
- NL80211_HE_OBSS_PD_ATTR_SR_CTRL,
__NL80211_HE_OBSS_PD_ATTR_LAST,
NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
};
-enum nl80211_bss_color_attributes {
- __NL80211_HE_BSS_COLOR_ATTR_INVALID,
- NL80211_HE_BSS_COLOR_ATTR_COLOR,
- NL80211_HE_BSS_COLOR_ATTR_DISABLED,
- NL80211_HE_BSS_COLOR_ATTR_PARTIAL,
- __NL80211_HE_BSS_COLOR_ATTR_LAST,
- NL80211_HE_BSS_COLOR_ATTR_MAX = __NL80211_HE_BSS_COLOR_ATTR_LAST - 1,
-};
-enum nl80211_iftype_akm_attributes {
- __NL80211_IFTYPE_AKM_ATTR_INVALID,
- NL80211_IFTYPE_AKM_ATTR_IFTYPES,
- NL80211_IFTYPE_AKM_ATTR_SUITES,
- __NL80211_IFTYPE_AKM_ATTR_LAST,
- NL80211_IFTYPE_AKM_ATTR_MAX = __NL80211_IFTYPE_AKM_ATTR_LAST - 1,
-};
-enum nl80211_fils_discovery_attributes {
- __NL80211_FILS_DISCOVERY_ATTR_INVALID,
- NL80211_FILS_DISCOVERY_ATTR_INT_MIN,
- NL80211_FILS_DISCOVERY_ATTR_INT_MAX,
- NL80211_FILS_DISCOVERY_ATTR_TMPL,
- __NL80211_FILS_DISCOVERY_ATTR_LAST,
- NL80211_FILS_DISCOVERY_ATTR_MAX = __NL80211_FILS_DISCOVERY_ATTR_LAST - 1
-};
-#define NL80211_FILS_DISCOVERY_TMPL_MIN_LEN 42
-enum nl80211_unsol_bcast_probe_resp_attributes {
- __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INVALID,
- NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_INT,
- NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_TMPL,
- __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST,
- NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_MAX = __NL80211_UNSOL_BCAST_PROBE_RESP_ATTR_LAST - 1
-};
-enum nl80211_sae_pwe_mechanism {
- NL80211_SAE_PWE_UNSPECIFIED,
- NL80211_SAE_PWE_HUNT_AND_PECK,
- NL80211_SAE_PWE_HASH_TO_ELEMENT,
- NL80211_SAE_PWE_BOTH,
-};
-enum nl80211_sar_type {
- NL80211_SAR_TYPE_POWER,
- NUM_NL80211_SAR_TYPE,
-};
-enum nl80211_sar_attrs {
- __NL80211_SAR_ATTR_INVALID,
- NL80211_SAR_ATTR_TYPE,
- NL80211_SAR_ATTR_SPECS,
- __NL80211_SAR_ATTR_LAST,
- NL80211_SAR_ATTR_MAX = __NL80211_SAR_ATTR_LAST - 1,
-};
-enum nl80211_sar_specs_attrs {
- __NL80211_SAR_ATTR_SPECS_INVALID,
- NL80211_SAR_ATTR_SPECS_POWER,
- NL80211_SAR_ATTR_SPECS_RANGE_INDEX,
- NL80211_SAR_ATTR_SPECS_START_FREQ,
- NL80211_SAR_ATTR_SPECS_END_FREQ,
- __NL80211_SAR_ATTR_SPECS_LAST,
- NL80211_SAR_ATTR_SPECS_MAX = __NL80211_SAR_ATTR_SPECS_LAST - 1,
-};
#endif
diff --git a/libc/kernel/uapi/linux/openat2.h b/libc/kernel/uapi/linux/openat2.h
deleted file mode 100644
index d397a00e0..000000000
--- a/libc/kernel/uapi/linux/openat2.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_OPENAT2_H
-#define _UAPI_LINUX_OPENAT2_H
-#include <linux/types.h>
-struct open_how {
- __u64 flags;
- __u64 mode;
- __u64 resolve;
-};
-#define RESOLVE_NO_XDEV 0x01
-#define RESOLVE_NO_MAGICLINKS 0x02
-#define RESOLVE_NO_SYMLINKS 0x04
-#define RESOLVE_BENEATH 0x08
-#define RESOLVE_IN_ROOT 0x10
-#define RESOLVE_CACHED 0x20
-#endif
diff --git a/libc/kernel/uapi/linux/openvswitch.h b/libc/kernel/uapi/linux/openvswitch.h
index 7db5cd525..99a987df4 100644
--- a/libc/kernel/uapi/linux/openvswitch.h
+++ b/libc/kernel/uapi/linux/openvswitch.h
@@ -42,7 +42,6 @@ enum ovs_datapath_attr {
OVS_DP_ATTR_MEGAFLOW_STATS,
OVS_DP_ATTR_USER_FEATURES,
OVS_DP_ATTR_PAD,
- OVS_DP_ATTR_MASKS_CACHE_SIZE,
__OVS_DP_ATTR_MAX
};
#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
@@ -56,8 +55,8 @@ struct ovs_dp_megaflow_stats {
__u64 n_mask_hit;
__u32 n_masks;
__u32 pad0;
- __u64 n_cache_hit;
__u64 pad1;
+ __u64 pad2;
};
struct ovs_vport_stats {
__u64 rx_packets;
@@ -367,12 +366,6 @@ struct ovs_action_push_mpls {
__be32 mpls_lse;
__be16 mpls_ethertype;
};
-struct ovs_action_add_mpls {
- __be32 mpls_lse;
- __be16 mpls_ethertype;
- __u16 tun_flags;
-};
-#define OVS_MPLS_L3_TUNNEL_FLAG_MASK (1 << 0)
struct ovs_action_push_vlan {
__be16 vlan_tpid;
__be16 vlan_tci;
@@ -446,8 +439,6 @@ enum ovs_action_attr {
OVS_ACTION_ATTR_METER,
OVS_ACTION_ATTR_CLONE,
OVS_ACTION_ATTR_CHECK_PKT_LEN,
- OVS_ACTION_ATTR_ADD_MPLS,
- OVS_ACTION_ATTR_DEC_TTL,
__OVS_ACTION_ATTR_MAX,
};
#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
@@ -511,10 +502,4 @@ struct ovs_zone_limit {
__u32 limit;
__u32 count;
};
-enum ovs_dec_ttl_attr {
- OVS_DEC_TTL_ATTR_UNSPEC,
- OVS_DEC_TTL_ATTR_ACTION,
- __OVS_DEC_TTL_ATTR_MAX
-};
-#define OVS_DEC_TTL_ATTR_MAX (__OVS_DEC_TTL_ATTR_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/pci_regs.h b/libc/kernel/uapi/linux/pci_regs.h
index 81450a7db..5501de074 100644
--- a/libc/kernel/uapi/linux/pci_regs.h
+++ b/libc/kernel/uapi/linux/pci_regs.h
@@ -60,7 +60,6 @@
#define PCI_CACHE_LINE_SIZE 0x0c
#define PCI_LATENCY_TIMER 0x0d
#define PCI_HEADER_TYPE 0x0e
-#define PCI_HEADER_TYPE_MASK 0x7f
#define PCI_HEADER_TYPE_NORMAL 0
#define PCI_HEADER_TYPE_BRIDGE 1
#define PCI_HEADER_TYPE_CARDBUS 2
@@ -201,7 +200,7 @@
#define PCI_PM_CAP_PME_D0 0x0800
#define PCI_PM_CAP_PME_D1 0x1000
#define PCI_PM_CAP_PME_D2 0x2000
-#define PCI_PM_CAP_PME_D3hot 0x4000
+#define PCI_PM_CAP_PME_D3 0x4000
#define PCI_PM_CAP_PME_D3cold 0x8000
#define PCI_PM_CAP_PME_SHIFT 11
#define PCI_PM_CTRL 4
@@ -440,11 +439,8 @@
#define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003
#define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004
#define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005
-#define PCI_EXP_LNKCAP_SLS_64_0GB 0x00000006
#define PCI_EXP_LNKCAP_MLW 0x000003f0
#define PCI_EXP_LNKCAP_ASPMS 0x00000c00
-#define PCI_EXP_LNKCAP_ASPM_L0S 0x00000400
-#define PCI_EXP_LNKCAP_ASPM_L1 0x00000800
#define PCI_EXP_LNKCAP_L0SEL 0x00007000
#define PCI_EXP_LNKCAP_L1EL 0x00038000
#define PCI_EXP_LNKCAP_CLKPM 0x00040000
@@ -472,7 +468,6 @@
#define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003
#define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004
#define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005
-#define PCI_EXP_LNKSTA_CLS_64_0GB 0x0006
#define PCI_EXP_LNKSTA_NLW 0x03f0
#define PCI_EXP_LNKSTA_NLW_X1 0x0010
#define PCI_EXP_LNKSTA_NLW_X2 0x0020
@@ -519,7 +514,6 @@
#define PCI_EXP_SLTCTL_PWR_OFF 0x0400
#define PCI_EXP_SLTCTL_EIC 0x0800
#define PCI_EXP_SLTCTL_DLLSCE 0x1000
-#define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000
#define PCI_EXP_SLTSTA 26
#define PCI_EXP_SLTSTA_ABP 0x0001
#define PCI_EXP_SLTSTA_PFD 0x0002
@@ -573,7 +567,6 @@
#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008
#define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010
#define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020
-#define PCI_EXP_LNKCAP2_SLS_64_0GB 0x00000040
#define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100
#define PCI_EXP_LNKCTL2 48
#define PCI_EXP_LNKCTL2_TLS 0x000f
@@ -582,14 +575,11 @@
#define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003
#define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004
#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005
-#define PCI_EXP_LNKCTL2_TLS_64_0GT 0x0006
#define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010
#define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380
-#define PCI_EXP_LNKCTL2_HASD 0x0020
#define PCI_EXP_LNKSTA2 50
#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52
#define PCI_EXP_SLTCAP2 52
-#define PCI_EXP_SLTCAP2_IBPD 0x00000001
#define PCI_EXP_SLTCTL2 56
#define PCI_EXP_SLTSTA2 58
#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
@@ -625,7 +615,6 @@
#define PCI_EXT_CAP_ID_DPC 0x1D
#define PCI_EXT_CAP_ID_L1SS 0x1E
#define PCI_EXT_CAP_ID_PTM 0x1F
-#define PCI_EXT_CAP_ID_DVSEC 0x23
#define PCI_EXT_CAP_ID_DLF 0x25
#define PCI_EXT_CAP_ID_PL_16GT 0x26
#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
@@ -723,11 +712,6 @@
#define PCI_PWR_CAP 12
#define PCI_PWR_CAP_BUDGET(x) ((x) & 1)
#define PCI_EXT_CAP_PWR_SIZEOF 16
-#define PCI_RCEC_RCIEP_BITMAP 4
-#define PCI_RCEC_BUSN 8
-#define PCI_RCEC_BUSN_REG_VER 0x02
-#define PCI_RCEC_BUSN_NEXT(x) (((x) >> 8) & 0xff)
-#define PCI_RCEC_BUSN_LAST(x) (((x) >> 16) & 0xff)
#define PCI_VNDR_HEADER 4
#define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff)
#define PCI_VNDR_HEADER_REV(x) (((x) >> 16) & 0xf)
@@ -913,14 +897,11 @@
#define PCI_L1SS_CTL1_PCIPM_L1_1 0x00000002
#define PCI_L1SS_CTL1_ASPM_L1_2 0x00000004
#define PCI_L1SS_CTL1_ASPM_L1_1 0x00000008
-#define PCI_L1SS_CTL1_L1_2_MASK 0x00000005
#define PCI_L1SS_CTL1_L1SS_MASK 0x0000000f
#define PCI_L1SS_CTL1_CM_RESTORE_TIME 0x0000ff00
#define PCI_L1SS_CTL1_LTR_L12_TH_VALUE 0x03ff0000
#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000
#define PCI_L1SS_CTL2 0x0c
-#define PCI_DVSEC_HEADER1 0x4
-#define PCI_DVSEC_HEADER2 0x8
#define PCI_DLF_CAP 0x04
#define PCI_DLF_EXCHANGE_ENABLE 0x80000000
#define PCI_PL_16GT_LE_CTRL 0x20
diff --git a/libc/kernel/uapi/linux/pcitest.h b/libc/kernel/uapi/linux/pcitest.h
index 98248bd06..c6112d086 100644
--- a/libc/kernel/uapi/linux/pcitest.h
+++ b/libc/kernel/uapi/linux/pcitest.h
@@ -27,10 +27,4 @@
#define PCITEST_MSIX _IOW('P', 0x7, int)
#define PCITEST_SET_IRQTYPE _IOW('P', 0x8, int)
#define PCITEST_GET_IRQTYPE _IO('P', 0x9)
-#define PCITEST_CLEAR_IRQ _IO('P', 0x10)
-#define PCITEST_FLAGS_USE_DMA 0x00000001
-struct pci_endpoint_test_xfer_param {
- unsigned long size;
- unsigned char flags;
-};
#endif
diff --git a/libc/kernel/uapi/linux/perf_event.h b/libc/kernel/uapi/linux/perf_event.h
index b09c5d8fd..4e9e32ca8 100644
--- a/libc/kernel/uapi/linux/perf_event.h
+++ b/libc/kernel/uapi/linux/perf_event.h
@@ -100,14 +100,9 @@ enum perf_event_sample_format {
PERF_SAMPLE_REGS_INTR = 1U << 18,
PERF_SAMPLE_PHYS_ADDR = 1U << 19,
PERF_SAMPLE_AUX = 1U << 20,
- PERF_SAMPLE_CGROUP = 1U << 21,
- PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22,
- PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23,
- PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24,
- PERF_SAMPLE_MAX = 1U << 25,
+ PERF_SAMPLE_MAX = 1U << 21,
__PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63,
};
-#define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT)
enum perf_branch_sample_type_shift {
PERF_SAMPLE_BRANCH_USER_SHIFT = 0,
PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1,
@@ -126,7 +121,6 @@ enum perf_branch_sample_type_shift {
PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14,
PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15,
PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16,
- PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17,
PERF_SAMPLE_BRANCH_MAX_SHIFT
};
enum perf_branch_sample_type {
@@ -147,7 +141,6 @@ enum perf_branch_sample_type {
PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT,
PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
- PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
};
enum {
@@ -207,7 +200,7 @@ struct perf_event_attr {
};
__u64 sample_type;
__u64 read_format;
- __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, aux_output : 1, cgroup : 1, text_poke : 1, build_id : 1, __reserved_1 : 29;
+ __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, aux_output : 1, __reserved_1 : 32;
union {
__u32 wakeup_events;
__u32 wakeup_watermark;
@@ -267,7 +260,7 @@ struct perf_event_mmap_page {
union {
__u64 capabilities;
struct {
- __u64 cap_bit0 : 1, cap_bit0_is_deprecated : 1, cap_user_rdpmc : 1, cap_user_time : 1, cap_user_time_zero : 1, cap_user_time_short : 1, cap_____res : 58;
+ __u64 cap_bit0 : 1, cap_bit0_is_deprecated : 1, cap_user_rdpmc : 1, cap_user_time : 1, cap_user_time_zero : 1, cap_____res : 59;
};
};
__u16 pmc_width;
@@ -276,10 +269,7 @@ struct perf_event_mmap_page {
__u64 time_offset;
__u64 time_zero;
__u32 size;
- __u32 __reserved_1;
- __u64 time_cycles;
- __u64 time_mask;
- __u8 __reserved[116 * 8];
+ __u8 __reserved[118 * 8 + 4];
__u64 data_head;
__u64 data_tail;
__u64 data_offset;
@@ -303,7 +293,6 @@ struct perf_event_mmap_page {
#define PERF_RECORD_MISC_SWITCH_OUT (1 << 13)
#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
#define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14)
-#define PERF_RECORD_MISC_MMAP_BUILD_ID (1 << 14)
#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
struct perf_event_header {
__u32 type;
@@ -343,14 +332,11 @@ enum perf_event_type {
PERF_RECORD_NAMESPACES = 16,
PERF_RECORD_KSYMBOL = 17,
PERF_RECORD_BPF_EVENT = 18,
- PERF_RECORD_CGROUP = 19,
- PERF_RECORD_TEXT_POKE = 20,
PERF_RECORD_MAX,
};
enum perf_record_ksymbol_type {
PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0,
PERF_RECORD_KSYMBOL_TYPE_BPF = 1,
- PERF_RECORD_KSYMBOL_TYPE_OOL = 2,
PERF_RECORD_KSYMBOL_TYPE_MAX
};
#define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0)
@@ -383,14 +369,14 @@ enum perf_callchain_context {
union perf_mem_data_src {
__u64 val;
struct {
- __u64 mem_op : 5, mem_lvl : 14, mem_snoop : 5, mem_lock : 2, mem_dtlb : 7, mem_lvl_num : 4, mem_remote : 1, mem_snoopx : 2, mem_blk : 3, mem_rsvd : 21;
+ __u64 mem_op : 5, mem_lvl : 14, mem_snoop : 5, mem_lock : 2, mem_dtlb : 7, mem_lvl_num : 4, mem_remote : 1, mem_snoopx : 2, mem_rsvd : 24;
};
};
#elif defined(__BIG_ENDIAN_BITFIELD)
union perf_mem_data_src {
__u64 val;
struct {
- __u64 mem_rsvd : 21, mem_blk : 3, mem_snoopx : 2, mem_remote : 1, mem_lvl_num : 4, mem_dtlb : 7, mem_lock : 2, mem_snoop : 5, mem_lvl : 14, mem_op : 5;
+ __u64 mem_rsvd : 24, mem_snoopx : 2, mem_remote : 1, mem_lvl_num : 4, mem_dtlb : 7, mem_lock : 2, mem_snoop : 5, mem_lvl : 14, mem_op : 5;
};
};
#else
@@ -436,7 +422,7 @@ union perf_mem_data_src {
#define PERF_MEM_SNOOP_HITM 0x10
#define PERF_MEM_SNOOP_SHIFT 19
#define PERF_MEM_SNOOPX_FWD 0x01
-#define PERF_MEM_SNOOPX_SHIFT 38
+#define PERF_MEM_SNOOPX_SHIFT 37
#define PERF_MEM_LOCK_NA 0x01
#define PERF_MEM_LOCK_LOCKED 0x02
#define PERF_MEM_LOCK_SHIFT 24
@@ -448,32 +434,10 @@ union perf_mem_data_src {
#define PERF_MEM_TLB_WK 0x20
#define PERF_MEM_TLB_OS 0x40
#define PERF_MEM_TLB_SHIFT 26
-#define PERF_MEM_BLK_NA 0x01
-#define PERF_MEM_BLK_DATA 0x02
-#define PERF_MEM_BLK_ADDR 0x04
-#define PERF_MEM_BLK_SHIFT 40
#define PERF_MEM_S(a,s) (((__u64) PERF_MEM_ ##a ##_ ##s) << PERF_MEM_ ##a ##_SHIFT)
struct perf_branch_entry {
__u64 from;
__u64 to;
__u64 mispred : 1, predicted : 1, in_tx : 1, abort : 1, cycles : 16, type : 4, reserved : 40;
};
-union perf_sample_weight {
- __u64 full;
-#ifdef __LITTLE_ENDIAN_BITFIELD
- struct {
- __u32 var1_dw;
- __u16 var2_w;
- __u16 var3_w;
- };
-#elif defined(__BIG_ENDIAN_BITFIELD)
- struct {
- __u16 var3_w;
- __u16 var2_w;
- __u32 var1_dw;
- };
-#else
-#error "Unknown endianness"
-#endif
-};
#endif
diff --git a/libc/kernel/uapi/linux/pkt_cls.h b/libc/kernel/uapi/linux/pkt_cls.h
index 45dca35aa..dd096d941 100644
--- a/libc/kernel/uapi/linux/pkt_cls.h
+++ b/libc/kernel/uapi/linux/pkt_cls.h
@@ -30,13 +30,9 @@ enum {
TCA_ACT_PAD,
TCA_ACT_COOKIE,
TCA_ACT_FLAGS,
- TCA_ACT_HW_STATS,
- TCA_ACT_USED_HW_STATS,
__TCA_ACT_MAX
};
#define TCA_ACT_FLAGS_NO_PERCPU_STATS 1
-#define TCA_ACT_HW_STATS_IMMEDIATE (1 << 0)
-#define TCA_ACT_HW_STATS_DELAYED (1 << 1)
#define TCA_ACT_MAX __TCA_ACT_MAX
#define TCA_OLD_COMPAT (TCA_ACT_MAX + 1)
#define TCA_ACT_MAX_PRIO 32
@@ -103,7 +99,6 @@ enum tca_id {
TCA_ID_CTINFO,
TCA_ID_MPLS,
TCA_ID_CT,
- TCA_ID_GATE,
__TCA_ID_MAX = 255
};
#define TCA_ID_MAX __TCA_ID_MAX
@@ -451,9 +446,6 @@ enum {
TCA_FLOWER_KEY_CT_MARK_MASK,
TCA_FLOWER_KEY_CT_LABELS,
TCA_FLOWER_KEY_CT_LABELS_MASK,
- TCA_FLOWER_KEY_MPLS_OPTS,
- TCA_FLOWER_KEY_HASH,
- TCA_FLOWER_KEY_HASH_MASK,
__TCA_FLOWER_MAX,
};
#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
@@ -462,9 +454,6 @@ enum {
TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1,
TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2,
TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3,
- TCA_FLOWER_KEY_CT_FLAGS_INVALID = 1 << 4,
- TCA_FLOWER_KEY_CT_FLAGS_REPLY = 1 << 5,
- __TCA_FLOWER_KEY_CT_FLAGS_MAX,
};
enum {
TCA_FLOWER_KEY_ENC_OPTS_UNSPEC,
@@ -498,22 +487,6 @@ enum {
};
#define TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX (__TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX - 1)
enum {
- TCA_FLOWER_KEY_MPLS_OPTS_UNSPEC,
- TCA_FLOWER_KEY_MPLS_OPTS_LSE,
- __TCA_FLOWER_KEY_MPLS_OPTS_MAX,
-};
-#define TCA_FLOWER_KEY_MPLS_OPTS_MAX (__TCA_FLOWER_KEY_MPLS_OPTS_MAX - 1)
-enum {
- TCA_FLOWER_KEY_MPLS_OPT_LSE_UNSPEC,
- TCA_FLOWER_KEY_MPLS_OPT_LSE_DEPTH,
- TCA_FLOWER_KEY_MPLS_OPT_LSE_TTL,
- TCA_FLOWER_KEY_MPLS_OPT_LSE_BOS,
- TCA_FLOWER_KEY_MPLS_OPT_LSE_TC,
- TCA_FLOWER_KEY_MPLS_OPT_LSE_LABEL,
- __TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX,
-};
-#define TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX (__TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX - 1)
-enum {
TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
};
diff --git a/libc/kernel/uapi/linux/pkt_sched.h b/libc/kernel/uapi/linux/pkt_sched.h
index d0541fc72..c965928df 100644
--- a/libc/kernel/uapi/linux/pkt_sched.h
+++ b/libc/kernel/uapi/linux/pkt_sched.h
@@ -167,9 +167,6 @@ enum {
TCA_RED_PARMS,
TCA_RED_STAB,
TCA_RED_MAX_P,
- TCA_RED_FLAGS,
- TCA_RED_EARLY_DROP_BLOCK,
- TCA_RED_MARK_BLOCK,
__TCA_RED_MAX,
};
#define TCA_RED_MAX (__TCA_RED_MAX - 1)
@@ -184,9 +181,7 @@ struct tc_red_qopt {
#define TC_RED_ECN 1
#define TC_RED_HARDDROP 2
#define TC_RED_ADAPTATIVE 4
-#define TC_RED_NODROP 8
};
-#define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
struct tc_red_xstats {
__u32 early;
__u32 pdrop;
@@ -306,7 +301,6 @@ enum {
TCA_HTB_RATE64,
TCA_HTB_CEIL64,
TCA_HTB_PAD,
- TCA_HTB_OFFLOAD,
__TCA_HTB_MAX,
};
#define TCA_HTB_MAX (__TCA_HTB_MAX - 1)
@@ -671,9 +665,6 @@ enum {
TCA_FQ_ORPHAN_MASK,
TCA_FQ_LOW_RATE_THRESHOLD,
TCA_FQ_CE_THRESHOLD,
- TCA_FQ_TIMER_SLACK,
- TCA_FQ_HORIZON,
- TCA_FQ_HORIZON_DROP,
__TCA_FQ_MAX
};
#define TCA_FQ_MAX (__TCA_FQ_MAX - 1)
@@ -691,8 +682,6 @@ struct tc_fq_qd_stats {
__u32 throttled_flows;
__u32 unthrottle_latency_ns;
__u64 ce_mark;
- __u64 horizon_drops;
- __u64 horizon_caps;
};
enum {
TCA_HHF_UNSPEC,
@@ -736,34 +725,6 @@ struct tc_pie_xstats {
__u32 maxq;
__u32 ecn_mark;
};
-enum {
- TCA_FQ_PIE_UNSPEC,
- TCA_FQ_PIE_LIMIT,
- TCA_FQ_PIE_FLOWS,
- TCA_FQ_PIE_TARGET,
- TCA_FQ_PIE_TUPDATE,
- TCA_FQ_PIE_ALPHA,
- TCA_FQ_PIE_BETA,
- TCA_FQ_PIE_QUANTUM,
- TCA_FQ_PIE_MEMORY_LIMIT,
- TCA_FQ_PIE_ECN_PROB,
- TCA_FQ_PIE_ECN,
- TCA_FQ_PIE_BYTEMODE,
- TCA_FQ_PIE_DQ_RATE_ESTIMATOR,
- __TCA_FQ_PIE_MAX
-};
-#define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1)
-struct tc_fq_pie_xstats {
- __u32 packets_in;
- __u32 dropped;
- __u32 overlimit;
- __u32 overmemory;
- __u32 ecn_mark;
- __u32 new_flow_count;
- __u32 new_flows_len;
- __u32 old_flows_len;
- __u32 memory_usage;
-};
struct tc_cbs_qopt {
__u8 offload;
__u8 _pad[3];
@@ -918,8 +879,8 @@ enum {
__TCA_TAPRIO_SCHED_MAX,
};
#define TCA_TAPRIO_SCHED_MAX (__TCA_TAPRIO_SCHED_MAX - 1)
-#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0)
-#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1)
+#define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST BIT(0)
+#define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD BIT(1)
enum {
TCA_TAPRIO_ATTR_UNSPEC,
TCA_TAPRIO_ATTR_PRIOMAP,
@@ -936,16 +897,4 @@ enum {
__TCA_TAPRIO_ATTR_MAX,
};
#define TCA_TAPRIO_ATTR_MAX (__TCA_TAPRIO_ATTR_MAX - 1)
-#define TCQ_ETS_MAX_BANDS 16
-enum {
- TCA_ETS_UNSPEC,
- TCA_ETS_NBANDS,
- TCA_ETS_NSTRICT,
- TCA_ETS_QUANTA,
- TCA_ETS_QUANTA_BAND,
- TCA_ETS_PRIOMAP,
- TCA_ETS_PRIOMAP_BAND,
- __TCA_ETS_MAX,
-};
-#define TCA_ETS_MAX (__TCA_ETS_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/ppp-ioctl.h b/libc/kernel/uapi/linux/ppp-ioctl.h
index 69c6e6d95..f188dff84 100644
--- a/libc/kernel/uapi/linux/ppp-ioctl.h
+++ b/libc/kernel/uapi/linux/ppp-ioctl.h
@@ -105,8 +105,6 @@ struct pppol2tp_ioc_stats {
#define PPPIOCATTCHAN _IOW('t', 56, int)
#define PPPIOCGCHAN _IOR('t', 55, int)
#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
-#define PPPIOCBRIDGECHAN _IOW('t', 53, int)
-#define PPPIOCUNBRIDGECHAN _IO('t', 52)
#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
#define SIOCGPPPVER (SIOCDEVPRIVATE + 1)
#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
diff --git a/libc/kernel/uapi/linux/prctl.h b/libc/kernel/uapi/linux/prctl.h
index 609588143..6e3426ce6 100644
--- a/libc/kernel/uapi/linux/prctl.h
+++ b/libc/kernel/uapi/linux/prctl.h
@@ -153,20 +153,6 @@ struct prctl_mm_map {
#define PR_SET_TAGGED_ADDR_CTRL 55
#define PR_GET_TAGGED_ADDR_CTRL 56
#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
-#define PR_MTE_TCF_SHIFT 1
-#define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
-#define PR_MTE_TAG_SHIFT 3
-#define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
-#define PR_SET_IO_FLUSHER 57
-#define PR_GET_IO_FLUSHER 58
-#define PR_SET_SYSCALL_USER_DISPATCH 59
-#define PR_SYS_DISPATCH_OFF 0
-#define PR_SYS_DISPATCH_ON 1
-#define SYSCALL_DISPATCH_FILTER_ALLOW 0
-#define SYSCALL_DISPATCH_FILTER_BLOCK 1
#define PR_SET_VMA 0x53564d41
#define PR_SET_VMA_ANON_NAME 0
#endif
diff --git a/libc/kernel/uapi/linux/psample.h b/libc/kernel/uapi/linux/psample.h
index dc6744506..d90956bdf 100644
--- a/libc/kernel/uapi/linux/psample.h
+++ b/libc/kernel/uapi/linux/psample.h
@@ -27,7 +27,6 @@ enum {
PSAMPLE_ATTR_SAMPLE_RATE,
PSAMPLE_ATTR_DATA,
PSAMPLE_ATTR_GROUP_REFCOUNT,
- PSAMPLE_ATTR_TUNNEL,
__PSAMPLE_ATTR_MAX
};
enum psample_command {
@@ -36,26 +35,6 @@ enum psample_command {
PSAMPLE_CMD_NEW_GROUP,
PSAMPLE_CMD_DEL_GROUP,
};
-enum psample_tunnel_key_attr {
- PSAMPLE_TUNNEL_KEY_ATTR_ID,
- PSAMPLE_TUNNEL_KEY_ATTR_IPV4_SRC,
- PSAMPLE_TUNNEL_KEY_ATTR_IPV4_DST,
- PSAMPLE_TUNNEL_KEY_ATTR_TOS,
- PSAMPLE_TUNNEL_KEY_ATTR_TTL,
- PSAMPLE_TUNNEL_KEY_ATTR_DONT_FRAGMENT,
- PSAMPLE_TUNNEL_KEY_ATTR_CSUM,
- PSAMPLE_TUNNEL_KEY_ATTR_OAM,
- PSAMPLE_TUNNEL_KEY_ATTR_GENEVE_OPTS,
- PSAMPLE_TUNNEL_KEY_ATTR_TP_SRC,
- PSAMPLE_TUNNEL_KEY_ATTR_TP_DST,
- PSAMPLE_TUNNEL_KEY_ATTR_VXLAN_OPTS,
- PSAMPLE_TUNNEL_KEY_ATTR_IPV6_SRC,
- PSAMPLE_TUNNEL_KEY_ATTR_IPV6_DST,
- PSAMPLE_TUNNEL_KEY_ATTR_PAD,
- PSAMPLE_TUNNEL_KEY_ATTR_ERSPAN_OPTS,
- PSAMPLE_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE,
- __PSAMPLE_TUNNEL_KEY_ATTR_MAX
-};
#define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1)
#define PSAMPLE_NL_MCGRP_CONFIG_NAME "config"
#define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets"
diff --git a/libc/kernel/uapi/linux/psp-sev.h b/libc/kernel/uapi/linux/psp-sev.h
index 6c4f73d02..fcdb1023d 100644
--- a/libc/kernel/uapi/linux/psp-sev.h
+++ b/libc/kernel/uapi/linux/psp-sev.h
@@ -67,7 +67,6 @@ struct sev_user_data_status {
__u8 build;
__u32 guest_count;
} __packed;
-#define SEV_STATUS_FLAGS_CONFIG_ES 0x0100
struct sev_user_data_pek_csr {
__u64 address;
__u32 length;
diff --git a/libc/kernel/uapi/linux/ptp_clock.h b/libc/kernel/uapi/linux/ptp_clock.h
index ca6f3c3fd..861810198 100644
--- a/libc/kernel/uapi/linux/ptp_clock.h
+++ b/libc/kernel/uapi/linux/ptp_clock.h
@@ -28,9 +28,7 @@
#define PTP_EXTTS_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE | PTP_STRICT_FLAGS)
#define PTP_EXTTS_V1_VALID_FLAGS (PTP_ENABLE_FEATURE | PTP_RISING_EDGE | PTP_FALLING_EDGE)
#define PTP_PEROUT_ONE_SHOT (1 << 0)
-#define PTP_PEROUT_DUTY_CYCLE (1 << 1)
-#define PTP_PEROUT_PHASE (1 << 2)
-#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT | PTP_PEROUT_DUTY_CYCLE | PTP_PEROUT_PHASE)
+#define PTP_PEROUT_VALID_FLAGS (PTP_PEROUT_ONE_SHOT)
#define PTP_PEROUT_V1_VALID_FLAGS (0)
struct ptp_clock_time {
__s64 sec;
@@ -45,8 +43,7 @@ struct ptp_clock_caps {
int pps;
int n_pins;
int cross_timestamping;
- int adjust_phase;
- int rsv[12];
+ int rsv[13];
};
struct ptp_extts_request {
unsigned int index;
@@ -54,17 +51,11 @@ struct ptp_extts_request {
unsigned int rsv[2];
};
struct ptp_perout_request {
- union {
- struct ptp_clock_time start;
- struct ptp_clock_time phase;
- };
+ struct ptp_clock_time start;
struct ptp_clock_time period;
unsigned int index;
unsigned int flags;
- union {
- struct ptp_clock_time on;
- unsigned int rsv[4];
- };
+ unsigned int rsv[4];
};
#define PTP_MAX_SAMPLES 25
struct ptp_sys_offset {
diff --git a/libc/kernel/uapi/linux/ptrace.h b/libc/kernel/uapi/linux/ptrace.h
index 5de09986c..a1528dba1 100644
--- a/libc/kernel/uapi/linux/ptrace.h
+++ b/libc/kernel/uapi/linux/ptrace.h
@@ -62,8 +62,7 @@ struct seccomp_metadata {
#define PTRACE_SYSCALL_INFO_SECCOMP 3
struct ptrace_syscall_info {
__u8 op;
- __u8 pad[3];
- __u32 arch;
+ __u32 arch __attribute__((__aligned__(sizeof(__u32))));
__u64 instruction_pointer;
__u64 stack_pointer;
union {
diff --git a/libc/kernel/uapi/linux/random.h b/libc/kernel/uapi/linux/random.h
index 2d3cfeff2..3a5fbfdc9 100644
--- a/libc/kernel/uapi/linux/random.h
+++ b/libc/kernel/uapi/linux/random.h
@@ -35,5 +35,4 @@ struct rand_pool_info {
};
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
-#define GRND_INSECURE 0x0004
#endif
diff --git a/libc/kernel/uapi/linux/raw.h b/libc/kernel/uapi/linux/raw.h
index bb45c3dd9..86aea2b15 100644
--- a/libc/kernel/uapi/linux/raw.h
+++ b/libc/kernel/uapi/linux/raw.h
@@ -26,4 +26,5 @@ struct raw_config_request {
__u64 block_major;
__u64 block_minor;
};
+#define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS
#endif
diff --git a/libc/kernel/uapi/linux/rds.h b/libc/kernel/uapi/linux/rds.h
index bc2923344..537aab5d0 100644
--- a/libc/kernel/uapi/linux/rds.h
+++ b/libc/kernel/uapi/linux/rds.h
@@ -32,11 +32,10 @@
#define SO_RDS_TRANSPORT 8
#define SO_RDS_MSG_RXPATH_LATENCY 10
#define RDS_TRANS_IB 0
-#define RDS_TRANS_GAP 1
+#define RDS_TRANS_IWARP 1
#define RDS_TRANS_TCP 2
#define RDS_TRANS_COUNT 3
#define RDS_TRANS_NONE (~0)
-#define RDS_TRANS_IWARP RDS_TRANS_GAP
#define SIOCRDSSETTOS (SIOCPROTOPRIVATE)
#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1)
typedef __u8 rds_tos_t;
diff --git a/libc/kernel/uapi/linux/rfkill.h b/libc/kernel/uapi/linux/rfkill.h
index 6020bafaf..504f780f5 100644
--- a/libc/kernel/uapi/linux/rfkill.h
+++ b/libc/kernel/uapi/linux/rfkill.h
@@ -40,26 +40,13 @@ enum rfkill_operation {
RFKILL_OP_CHANGE,
RFKILL_OP_CHANGE_ALL,
};
-enum rfkill_hard_block_reasons {
- RFKILL_HARD_BLOCK_SIGNAL = 1 << 0,
- RFKILL_HARD_BLOCK_NOT_OWNER = 1 << 1,
-};
struct rfkill_event {
__u32 idx;
__u8 type;
__u8 op;
- __u8 soft;
- __u8 hard;
-} __attribute__((packed));
-struct rfkill_event_ext {
- __u32 idx;
- __u8 type;
- __u8 op;
- __u8 soft;
- __u8 hard;
- __u8 hard_block_reasons;
+ __u8 soft, hard;
} __attribute__((packed));
-#define RFKILL_EVENT_SIZE_V1 sizeof(struct rfkill_event)
+#define RFKILL_EVENT_SIZE_V1 8
#define RFKILL_IOC_MAGIC 'R'
#define RFKILL_IOC_NOINPUT 1
#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
diff --git a/libc/kernel/uapi/linux/rkisp1-config.h b/libc/kernel/uapi/linux/rkisp1-config.h
deleted file mode 100644
index cea14cd2b..000000000
--- a/libc/kernel/uapi/linux/rkisp1-config.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_RKISP1_CONFIG_H
-#define _UAPI_RKISP1_CONFIG_H
-#include <linux/types.h>
-#define RKISP1_CIF_ISP_MODULE_DPCC (1U << 0)
-#define RKISP1_CIF_ISP_MODULE_BLS (1U << 1)
-#define RKISP1_CIF_ISP_MODULE_SDG (1U << 2)
-#define RKISP1_CIF_ISP_MODULE_HST (1U << 3)
-#define RKISP1_CIF_ISP_MODULE_LSC (1U << 4)
-#define RKISP1_CIF_ISP_MODULE_AWB_GAIN (1U << 5)
-#define RKISP1_CIF_ISP_MODULE_FLT (1U << 6)
-#define RKISP1_CIF_ISP_MODULE_BDM (1U << 7)
-#define RKISP1_CIF_ISP_MODULE_CTK (1U << 8)
-#define RKISP1_CIF_ISP_MODULE_GOC (1U << 9)
-#define RKISP1_CIF_ISP_MODULE_CPROC (1U << 10)
-#define RKISP1_CIF_ISP_MODULE_AFC (1U << 11)
-#define RKISP1_CIF_ISP_MODULE_AWB (1U << 12)
-#define RKISP1_CIF_ISP_MODULE_IE (1U << 13)
-#define RKISP1_CIF_ISP_MODULE_AEC (1U << 14)
-#define RKISP1_CIF_ISP_MODULE_WDR (1U << 15)
-#define RKISP1_CIF_ISP_MODULE_DPF (1U << 16)
-#define RKISP1_CIF_ISP_MODULE_DPF_STRENGTH (1U << 17)
-#define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100
-#define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800
-#define RKISP1_CIF_ISP_AE_MEAN_MAX_V10 25
-#define RKISP1_CIF_ISP_AE_MEAN_MAX_V12 81
-#define RKISP1_CIF_ISP_AE_MEAN_MAX RKISP1_CIF_ISP_AE_MEAN_MAX_V12
-#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 16
-#define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 32
-#define RKISP1_CIF_ISP_HIST_BIN_N_MAX RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12
-#define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3
-#define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17
-#define RKISP1_CIF_ISP_BDM_MAX_TH 0xff
-#define RKISP1_CIF_ISP_BLS_START_H_MAX 0x00000fff
-#define RKISP1_CIF_ISP_BLS_STOP_H_MAX 0x00000fff
-#define RKISP1_CIF_ISP_BLS_START_V_MAX 0x00000fff
-#define RKISP1_CIF_ISP_BLS_STOP_V_MAX 0x00000fff
-#define RKISP1_CIF_ISP_BLS_SAMPLES_MAX 0x00000012
-#define RKISP1_CIF_ISP_BLS_FIX_SUB_MAX 0x00000fff
-#define RKISP1_CIF_ISP_BLS_FIX_SUB_MIN 0xfffff000
-#define RKISP1_CIF_ISP_BLS_FIX_MASK 0x00001fff
-#define RKISP1_CIF_ISP_AWB_MAX_GRID 1
-#define RKISP1_CIF_ISP_AWB_MAX_FRAMES 7
-#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10 17
-#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 34
-#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12
-#define RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE 8
-#define RKISP1_CIF_ISP_LSC_SAMPLES_MAX 17
-#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 25
-#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81
-#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
-#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3
-#define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17
-#define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6
-#define RKISP1_CIF_ISP_STAT_AWB (1U << 0)
-#define RKISP1_CIF_ISP_STAT_AUTOEXP (1U << 1)
-#define RKISP1_CIF_ISP_STAT_AFM (1U << 2)
-#define RKISP1_CIF_ISP_STAT_HIST (1U << 3)
-enum rkisp1_cif_isp_version {
- RKISP1_V10 = 10,
- RKISP1_V11,
- RKISP1_V12,
- RKISP1_V13,
-};
-enum rkisp1_cif_isp_histogram_mode {
- RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
- RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
- RKISP1_CIF_ISP_HISTOGRAM_MODE_R_HISTOGRAM,
- RKISP1_CIF_ISP_HISTOGRAM_MODE_G_HISTOGRAM,
- RKISP1_CIF_ISP_HISTOGRAM_MODE_B_HISTOGRAM,
- RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM
-};
-enum rkisp1_cif_isp_awb_mode_type {
- RKISP1_CIF_ISP_AWB_MODE_MANUAL,
- RKISP1_CIF_ISP_AWB_MODE_RGB,
- RKISP1_CIF_ISP_AWB_MODE_YCBCR
-};
-enum rkisp1_cif_isp_flt_mode {
- RKISP1_CIF_ISP_FLT_STATIC_MODE,
- RKISP1_CIF_ISP_FLT_DYNAMIC_MODE
-};
-enum rkisp1_cif_isp_exp_ctrl_autostop {
- RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0 = 0,
- RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1 = 1,
-};
-enum rkisp1_cif_isp_exp_meas_mode {
- RKISP1_CIF_ISP_EXP_MEASURING_MODE_0,
- RKISP1_CIF_ISP_EXP_MEASURING_MODE_1,
-};
-struct rkisp1_cif_isp_window {
- __u16 h_offs;
- __u16 v_offs;
- __u16 h_size;
- __u16 v_size;
-};
-struct rkisp1_cif_isp_bls_fixed_val {
- __s16 r;
- __s16 gr;
- __s16 gb;
- __s16 b;
-};
-struct rkisp1_cif_isp_bls_config {
- __u8 enable_auto;
- __u8 en_windows;
- struct rkisp1_cif_isp_window bls_window1;
- struct rkisp1_cif_isp_window bls_window2;
- __u8 bls_samples;
- struct rkisp1_cif_isp_bls_fixed_val fixed_val;
-};
-struct rkisp1_cif_isp_dpcc_methods_config {
- __u32 method;
- __u32 line_thresh;
- __u32 line_mad_fac;
- __u32 pg_fac;
- __u32 rnd_thresh;
- __u32 rg_fac;
-};
-struct rkisp1_cif_isp_dpcc_config {
- __u32 mode;
- __u32 output_mode;
- __u32 set_use;
- struct rkisp1_cif_isp_dpcc_methods_config methods[RKISP1_CIF_ISP_DPCC_METHODS_MAX];
- __u32 ro_limits;
- __u32 rnd_offs;
-};
-struct rkisp1_cif_isp_gamma_corr_curve {
- __u16 gamma_y[RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE];
-};
-struct rkisp1_cif_isp_gamma_curve_x_axis_pnts {
- __u32 gamma_dx0;
- __u32 gamma_dx1;
-};
-struct rkisp1_cif_isp_sdg_config {
- struct rkisp1_cif_isp_gamma_corr_curve curve_r;
- struct rkisp1_cif_isp_gamma_corr_curve curve_g;
- struct rkisp1_cif_isp_gamma_corr_curve curve_b;
- struct rkisp1_cif_isp_gamma_curve_x_axis_pnts xa_pnts;
-};
-struct rkisp1_cif_isp_lsc_config {
- __u16 r_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
- __u16 gr_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
- __u16 gb_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
- __u16 b_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
- __u16 x_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
- __u16 y_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
- __u16 x_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
- __u16 y_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
- __u16 config_width;
- __u16 config_height;
-};
-struct rkisp1_cif_isp_ie_config {
- __u16 effect;
- __u16 color_sel;
- __u16 eff_mat_1;
- __u16 eff_mat_2;
- __u16 eff_mat_3;
- __u16 eff_mat_4;
- __u16 eff_mat_5;
- __u16 eff_tint;
-};
-struct rkisp1_cif_isp_cproc_config {
- __u8 c_out_range;
- __u8 y_in_range;
- __u8 y_out_range;
- __u8 contrast;
- __u8 brightness;
- __u8 sat;
- __u8 hue;
-};
-struct rkisp1_cif_isp_awb_meas_config {
- struct rkisp1_cif_isp_window awb_wnd;
- __u32 awb_mode;
- __u8 max_y;
- __u8 min_y;
- __u8 max_csum;
- __u8 min_c;
- __u8 frames;
- __u8 awb_ref_cr;
- __u8 awb_ref_cb;
- __u8 enable_ymax_cmp;
-};
-struct rkisp1_cif_isp_awb_gain_config {
- __u16 gain_red;
- __u16 gain_green_r;
- __u16 gain_blue;
- __u16 gain_green_b;
-};
-struct rkisp1_cif_isp_flt_config {
- __u32 mode;
- __u8 grn_stage1;
- __u8 chr_h_mode;
- __u8 chr_v_mode;
- __u32 thresh_bl0;
- __u32 thresh_bl1;
- __u32 thresh_sh0;
- __u32 thresh_sh1;
- __u32 lum_weight;
- __u32 fac_sh1;
- __u32 fac_sh0;
- __u32 fac_mid;
- __u32 fac_bl0;
- __u32 fac_bl1;
-};
-struct rkisp1_cif_isp_bdm_config {
- __u8 demosaic_th;
-};
-struct rkisp1_cif_isp_ctk_config {
- __u16 coeff[3][3];
- __u16 ct_offset[3];
-};
-enum rkisp1_cif_isp_goc_mode {
- RKISP1_CIF_ISP_GOC_MODE_LOGARITHMIC,
- RKISP1_CIF_ISP_GOC_MODE_EQUIDISTANT
-};
-struct rkisp1_cif_isp_goc_config {
- __u32 mode;
- __u16 gamma_y[RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES];
-};
-struct rkisp1_cif_isp_hst_config {
- __u32 mode;
- __u8 histogram_predivider;
- struct rkisp1_cif_isp_window meas_window;
- __u8 hist_weight[RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];
-};
-struct rkisp1_cif_isp_aec_config {
- __u32 mode;
- __u32 autostop;
- struct rkisp1_cif_isp_window meas_window;
-};
-struct rkisp1_cif_isp_afc_config {
- __u8 num_afm_win;
- struct rkisp1_cif_isp_window afm_win[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
- __u32 thres;
- __u32 var_shift;
-};
-enum rkisp1_cif_isp_dpf_gain_usage {
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,
- RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX
-};
-enum rkisp1_cif_isp_dpf_rb_filtersize {
- RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9,
- RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9,
-};
-enum rkisp1_cif_isp_dpf_nll_scale_mode {
- RKISP1_CIF_ISP_NLL_SCALE_LINEAR,
- RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC,
-};
-struct rkisp1_cif_isp_dpf_nll {
- __u16 coeff[RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS];
- __u32 scale_mode;
-};
-struct rkisp1_cif_isp_dpf_rb_flt {
- __u32 fltsize;
- __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
- __u8 r_enable;
- __u8 b_enable;
-};
-struct rkisp1_cif_isp_dpf_g_flt {
- __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
- __u8 gr_enable;
- __u8 gb_enable;
-};
-struct rkisp1_cif_isp_dpf_gain {
- __u32 mode;
- __u16 nf_r_gain;
- __u16 nf_b_gain;
- __u16 nf_gr_gain;
- __u16 nf_gb_gain;
-};
-struct rkisp1_cif_isp_dpf_config {
- struct rkisp1_cif_isp_dpf_gain gain;
- struct rkisp1_cif_isp_dpf_g_flt g_flt;
- struct rkisp1_cif_isp_dpf_rb_flt rb_flt;
- struct rkisp1_cif_isp_dpf_nll nll;
-};
-struct rkisp1_cif_isp_dpf_strength_config {
- __u8 r;
- __u8 g;
- __u8 b;
-};
-struct rkisp1_cif_isp_isp_other_cfg {
- struct rkisp1_cif_isp_dpcc_config dpcc_config;
- struct rkisp1_cif_isp_bls_config bls_config;
- struct rkisp1_cif_isp_sdg_config sdg_config;
- struct rkisp1_cif_isp_lsc_config lsc_config;
- struct rkisp1_cif_isp_awb_gain_config awb_gain_config;
- struct rkisp1_cif_isp_flt_config flt_config;
- struct rkisp1_cif_isp_bdm_config bdm_config;
- struct rkisp1_cif_isp_ctk_config ctk_config;
- struct rkisp1_cif_isp_goc_config goc_config;
- struct rkisp1_cif_isp_dpf_config dpf_config;
- struct rkisp1_cif_isp_dpf_strength_config dpf_strength_config;
- struct rkisp1_cif_isp_cproc_config cproc_config;
- struct rkisp1_cif_isp_ie_config ie_config;
-};
-struct rkisp1_cif_isp_isp_meas_cfg {
- struct rkisp1_cif_isp_awb_meas_config awb_meas_config;
- struct rkisp1_cif_isp_hst_config hst_config;
- struct rkisp1_cif_isp_aec_config aec_config;
- struct rkisp1_cif_isp_afc_config afc_config;
-};
-struct rkisp1_params_cfg {
- __u32 module_en_update;
- __u32 module_ens;
- __u32 module_cfg_update;
- struct rkisp1_cif_isp_isp_meas_cfg meas;
- struct rkisp1_cif_isp_isp_other_cfg others;
-};
-struct rkisp1_cif_isp_awb_meas {
- __u32 cnt;
- __u8 mean_y_or_g;
- __u8 mean_cb_or_b;
- __u8 mean_cr_or_r;
-};
-struct rkisp1_cif_isp_awb_stat {
- struct rkisp1_cif_isp_awb_meas awb_mean[RKISP1_CIF_ISP_AWB_MAX_GRID];
-};
-struct rkisp1_cif_isp_bls_meas_val {
- __u16 meas_r;
- __u16 meas_gr;
- __u16 meas_gb;
- __u16 meas_b;
-};
-struct rkisp1_cif_isp_ae_stat {
- __u8 exp_mean[RKISP1_CIF_ISP_AE_MEAN_MAX];
- struct rkisp1_cif_isp_bls_meas_val bls_val;
-};
-struct rkisp1_cif_isp_af_meas_val {
- __u32 sum;
- __u32 lum;
-};
-struct rkisp1_cif_isp_af_stat {
- struct rkisp1_cif_isp_af_meas_val window[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
-};
-struct rkisp1_cif_isp_hist_stat {
- __u32 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX];
-};
-struct rkisp1_cif_isp_stat {
- struct rkisp1_cif_isp_awb_stat awb;
- struct rkisp1_cif_isp_ae_stat ae;
- struct rkisp1_cif_isp_af_stat af;
- struct rkisp1_cif_isp_hist_stat hist;
-};
-struct rkisp1_stat_buffer {
- __u32 meas_type;
- __u32 frame_id;
- struct rkisp1_cif_isp_stat params;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/rpl.h b/libc/kernel/uapi/linux/rpl.h
deleted file mode 100644
index 3648bfcb7..000000000
--- a/libc/kernel/uapi/linux/rpl.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_RPL_H
-#define _UAPI_LINUX_RPL_H
-#include <asm/byteorder.h>
-#include <linux/types.h>
-#include <linux/in6.h>
-struct ipv6_rpl_sr_hdr {
- __u8 nexthdr;
- __u8 hdrlen;
- __u8 type;
- __u8 segments_left;
-#ifdef __LITTLE_ENDIAN_BITFIELD
- __u32 cmpre : 4, cmpri : 4, reserved : 4, pad : 4, reserved1 : 16;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- __u32 cmpri : 4, cmpre : 4, pad : 4, reserved : 20;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
- union {
- struct in6_addr addr[0];
- __u8 data[0];
- } segments;
-} __attribute__((packed));
-#define rpl_segaddr segments.addr
-#define rpl_segdata segments.data
-#endif
diff --git a/libc/kernel/uapi/linux/rpl_iptunnel.h b/libc/kernel/uapi/linux/rpl_iptunnel.h
deleted file mode 100644
index c61725ded..000000000
--- a/libc/kernel/uapi/linux/rpl_iptunnel.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_RPL_IPTUNNEL_H
-#define _UAPI_LINUX_RPL_IPTUNNEL_H
-enum {
- RPL_IPTUNNEL_UNSPEC,
- RPL_IPTUNNEL_SRH,
- __RPL_IPTUNNEL_MAX,
-};
-#define RPL_IPTUNNEL_MAX (__RPL_IPTUNNEL_MAX - 1)
-#define RPL_IPTUNNEL_SRH_SIZE(srh) (((srh)->hdrlen + 1) << 3)
-#endif
diff --git a/libc/kernel/uapi/linux/rpmsg_types.h b/libc/kernel/uapi/linux/rpmsg_types.h
deleted file mode 100644
index 6599f4ccb..000000000
--- a/libc/kernel/uapi/linux/rpmsg_types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_RPMSG_TYPES_H
-#define _UAPI_LINUX_RPMSG_TYPES_H
-#include <linux/types.h>
-typedef __u16 __bitwise __rpmsg16;
-typedef __u32 __bitwise __rpmsg32;
-typedef __u64 __bitwise __rpmsg64;
-#endif
diff --git a/libc/kernel/uapi/linux/rtc.h b/libc/kernel/uapi/linux/rtc.h
index 7f38483f9..a0472935a 100644
--- a/libc/kernel/uapi/linux/rtc.h
+++ b/libc/kernel/uapi/linux/rtc.h
@@ -18,8 +18,6 @@
****************************************************************************/
#ifndef _UAPI_LINUX_RTC_H_
#define _UAPI_LINUX_RTC_H_
-#include <linux/const.h>
-#include <linux/ioctl.h>
struct rtc_time {
int tm_sec;
int tm_min;
@@ -65,20 +63,11 @@ struct rtc_pll_info {
#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)
#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info)
#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info)
-#define RTC_VL_DATA_INVALID _BITUL(0)
-#define RTC_VL_BACKUP_LOW _BITUL(1)
-#define RTC_VL_BACKUP_EMPTY _BITUL(2)
-#define RTC_VL_ACCURACY_LOW _BITUL(3)
-#define RTC_VL_BACKUP_SWITCH _BITUL(4)
-#define RTC_VL_READ _IOR('p', 0x13, unsigned int)
+#define RTC_VL_READ _IOR('p', 0x13, int)
#define RTC_VL_CLR _IO('p', 0x14)
#define RTC_IRQF 0x80
#define RTC_PF 0x40
#define RTC_AF 0x20
#define RTC_UF 0x10
-#define RTC_FEATURE_ALARM 0
-#define RTC_FEATURE_ALARM_RES_MINUTE 1
-#define RTC_FEATURE_NEED_WEEK_DAY 2
-#define RTC_FEATURE_CNT 3
#define RTC_MAX_FREQ 8192
#endif
diff --git a/libc/kernel/uapi/linux/rtnetlink.h b/libc/kernel/uapi/linux/rtnetlink.h
index 22f8f1c4e..14366de38 100644
--- a/libc/kernel/uapi/linux/rtnetlink.h
+++ b/libc/kernel/uapi/linux/rtnetlink.h
@@ -151,12 +151,6 @@ enum {
#define RTM_DELLINKPROP RTM_DELLINKPROP
RTM_GETLINKPROP,
#define RTM_GETLINKPROP RTM_GETLINKPROP
- RTM_NEWVLAN = 112,
-#define RTM_NEWNVLAN RTM_NEWVLAN
- RTM_DELVLAN,
-#define RTM_DELVLAN RTM_DELVLAN
- RTM_GETVLAN,
-#define RTM_GETVLAN RTM_GETVLAN
__RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
};
@@ -217,7 +211,6 @@ enum {
#define RTPROT_NTK 15
#define RTPROT_DHCP 16
#define RTPROT_MROUTED 17
-#define RTPROT_KEEPALIVED 18
#define RTPROT_BABEL 42
#define RTPROT_BGP 186
#define RTPROT_ISIS 187
@@ -237,9 +230,6 @@ enum rt_scope_t {
#define RTM_F_PREFIX 0x800
#define RTM_F_LOOKUP_TABLE 0x1000
#define RTM_F_FIB_MATCH 0x2000
-#define RTM_F_OFFLOAD 0x4000
-#define RTM_F_TRAP 0x8000
-#define RTM_F_OFFLOAD_FAILED 0x20000000
enum rt_class_t {
RT_TABLE_UNSPEC = 0,
RT_TABLE_COMPAT = 252,
@@ -297,8 +287,7 @@ struct rtnexthop {
#define RTNH_F_OFFLOAD 8
#define RTNH_F_LINKDOWN 16
#define RTNH_F_UNRESOLVED 32
-#define RTNH_F_TRAP 64
-#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD | RTNH_F_TRAP)
+#define RTNH_COMPARE_MASK (RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD)
#define RTNH_ALIGNTO 4
#define RTNH_ALIGN(len) (((len) + RTNH_ALIGNTO - 1) & ~(RTNH_ALIGNTO - 1))
#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && ((int) (rtnh)->rtnh_len) <= (len))
@@ -447,11 +436,9 @@ enum {
TCA_HW_OFFLOAD,
TCA_INGRESS_BLOCK,
TCA_EGRESS_BLOCK,
- TCA_DUMP_FLAGS,
__TCA_MAX
};
#define TCA_MAX (__TCA_MAX - 1)
-#define TCA_DUMP_FLAGS_TERSE (1 << 0)
#define TCA_RTA(r) ((struct rtattr *) (((char *) (r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct tcmsg))
struct nduseroptmsg {
@@ -550,8 +537,6 @@ enum rtnetlink_groups {
#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R
RTNLGRP_NEXTHOP,
#define RTNLGRP_NEXTHOP RTNLGRP_NEXTHOP
- RTNLGRP_BRVLAN,
-#define RTNLGRP_BRVLAN RTNLGRP_BRVLAN
__RTNLGRP_MAX
};
#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -574,13 +559,8 @@ enum {
#define TA_RTA(r) ((struct rtattr *) (((char *) (r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct tcamsg))
#define TCA_FLAG_LARGE_DUMP_ON (1 << 0)
-#define TCA_ACT_FLAG_LARGE_DUMP_ON TCA_FLAG_LARGE_DUMP_ON
-#define TCA_ACT_FLAG_TERSE_DUMP (1 << 1)
#define RTEXT_FILTER_VF (1 << 0)
#define RTEXT_FILTER_BRVLAN (1 << 1)
#define RTEXT_FILTER_BRVLAN_COMPRESSED (1 << 2)
#define RTEXT_FILTER_SKIP_STATS (1 << 3)
-#define RTEXT_FILTER_MRP (1 << 4)
-#define RTEXT_FILTER_CFM_CONFIG (1 << 5)
-#define RTEXT_FILTER_CFM_STATUS (1 << 6)
#endif
diff --git a/libc/kernel/uapi/linux/rxrpc.h b/libc/kernel/uapi/linux/rxrpc.h
index 16207dd62..1690111da 100644
--- a/libc/kernel/uapi/linux/rxrpc.h
+++ b/libc/kernel/uapi/linux/rxrpc.h
@@ -46,11 +46,11 @@ enum rxrpc_cmsg_type {
RXRPC_BUSY = 6,
RXRPC_LOCAL_ERROR = 7,
RXRPC_NEW_CALL = 8,
+ RXRPC_ACCEPT = 9,
RXRPC_EXCLUSIVE_CALL = 10,
RXRPC_UPGRADE_SERVICE = 11,
RXRPC_TX_LENGTH = 12,
RXRPC_SET_CALL_TIMEOUT = 13,
- RXRPC_CHARGE_ACCEPT = 14,
RXRPC__SUPPORTED
};
#define RXRPC_SECURITY_PLAIN 0
diff --git a/libc/kernel/uapi/linux/sched.h b/libc/kernel/uapi/linux/sched.h
index f9c00df28..b8f39ddd0 100644
--- a/libc/kernel/uapi/linux/sched.h
+++ b/libc/kernel/uapi/linux/sched.h
@@ -45,8 +45,6 @@
#define CLONE_NEWNET 0x40000000
#define CLONE_IO 0x80000000
#define CLONE_CLEAR_SIGHAND 0x100000000ULL
-#define CLONE_INTO_CGROUP 0x200000000ULL
-#define CLONE_NEWTIME 0x00000080
#ifndef __ASSEMBLY__
struct clone_args {
__aligned_u64 flags;
@@ -59,12 +57,10 @@ struct clone_args {
__aligned_u64 tls;
__aligned_u64 set_tid;
__aligned_u64 set_tid_size;
- __aligned_u64 cgroup;
};
#endif
#define CLONE_ARGS_SIZE_VER0 64
#define CLONE_ARGS_SIZE_VER1 80
-#define CLONE_ARGS_SIZE_VER2 88
#define SCHED_NORMAL 0
#define SCHED_FIFO 1
#define SCHED_RR 2
diff --git a/libc/kernel/uapi/linux/sctp.h b/libc/kernel/uapi/linux/sctp.h
index 883920bee..e3fc7bfc3 100644
--- a/libc/kernel/uapi/linux/sctp.h
+++ b/libc/kernel/uapi/linux/sctp.h
@@ -93,7 +93,6 @@ typedef __s32 sctp_assoc_t;
#define SCTP_ECN_SUPPORTED 130
#define SCTP_EXPOSE_POTENTIALLY_FAILED_STATE 131
#define SCTP_EXPOSE_PF_STATE SCTP_EXPOSE_POTENTIALLY_FAILED_STATE
-#define SCTP_REMOTE_UDP_ENCAPS_PORT 132
#define SCTP_PR_SCTP_NONE 0x0000
#define SCTP_PR_SCTP_TTL 0x0010
#define SCTP_PR_SCTP_RTX 0x0020
@@ -698,11 +697,6 @@ struct sctp_event {
uint16_t se_type;
uint8_t se_on;
};
-struct sctp_udpencaps {
- sctp_assoc_t sue_assoc_id;
- struct sockaddr_storage sue_address;
- uint16_t sue_port;
-};
enum sctp_sched_type {
SCTP_SS_FCFS,
SCTP_SS_DEFAULT = SCTP_SS_FCFS,
diff --git a/libc/kernel/uapi/linux/sdla.h b/libc/kernel/uapi/linux/sdla.h
new file mode 100644
index 000000000..acdfb6b83
--- /dev/null
+++ b/libc/kernel/uapi/linux/sdla.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPISDLA_H
+#define _UAPISDLA_H
+#define SDLA_TYPES
+#define SDLA_S502A 5020
+#define SDLA_S502E 5021
+#define SDLA_S503 5030
+#define SDLA_S507 5070
+#define SDLA_S508 5080
+#define SDLA_S509 5090
+#define SDLA_UNKNOWN - 1
+#define SDLA_S508_PORT_V35 0x00
+#define SDLA_S508_PORT_RS232 0x02
+#define SDLA_CPU_3M 0x00
+#define SDLA_CPU_5M 0x01
+#define SDLA_CPU_7M 0x02
+#define SDLA_CPU_8M 0x03
+#define SDLA_CPU_10M 0x04
+#define SDLA_CPU_16M 0x05
+#define SDLA_CPU_12M 0x06
+#define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1)
+#define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2)
+#define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3)
+#define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4)
+#define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5)
+#define SDLA_READMEM (FRAD_LAST_IOCTL + 6)
+struct sdla_mem {
+ int addr;
+ int len;
+ void __user * data;
+};
+#define SDLA_START (FRAD_LAST_IOCTL + 7)
+#define SDLA_STOP (FRAD_LAST_IOCTL + 8)
+#define SDLA_NMIADDR 0x0000
+#define SDLA_CONF_ADDR 0x0010
+#define SDLA_S502A_NMIADDR 0x0066
+#define SDLA_CODE_BASEADDR 0x0100
+#define SDLA_WINDOW_SIZE 0x2000
+#define SDLA_ADDR_MASK 0x1FFF
+#define SDLA_MAX_DATA 4080
+#define SDLA_MAX_MTU 4072
+#define SDLA_MAX_DLCI 24
+struct sdla_conf {
+ short station;
+ short config;
+ short kbaud;
+ short clocking;
+ short max_frm;
+ short T391;
+ short T392;
+ short N391;
+ short N392;
+ short N393;
+ short CIR_fwd;
+ short Bc_fwd;
+ short Be_fwd;
+ short CIR_bwd;
+ short Bc_bwd;
+ short Be_bwd;
+};
+struct sdla_dlci_conf {
+ short config;
+ short CIR_fwd;
+ short Bc_fwd;
+ short Be_fwd;
+ short CIR_bwd;
+ short Bc_bwd;
+ short Be_bwd;
+ short Tc_fwd;
+ short Tc_bwd;
+ short Tf_max;
+ short Tb_max;
+};
+#endif
diff --git a/libc/kernel/uapi/linux/seccomp.h b/libc/kernel/uapi/linux/seccomp.h
index 0ae0e1226..6f7cbbedb 100644
--- a/libc/kernel/uapi/linux/seccomp.h
+++ b/libc/kernel/uapi/linux/seccomp.h
@@ -31,7 +31,6 @@
#define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
-#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
#define SECCOMP_RET_KILL_PROCESS 0x80000000U
#define SECCOMP_RET_KILL_THREAD 0x00000000U
#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
@@ -68,14 +67,6 @@ struct seccomp_notif_resp {
__s32 error;
__u32 flags;
};
-#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0)
-struct seccomp_notif_addfd {
- __u64 id;
- __u32 flags;
- __u32 srcfd;
- __u32 newfd;
- __u32 newfd_flags;
-};
#define SECCOMP_IOC_MAGIC '!'
#define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
#define SECCOMP_IOR(nr,type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
@@ -83,6 +74,5 @@ struct seccomp_notif_addfd {
#define SECCOMP_IOWR(nr,type) _IOWR(SECCOMP_IOC_MAGIC, nr, type)
#define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif)
#define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, struct seccomp_notif_resp)
-#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64)
-#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, struct seccomp_notif_addfd)
+#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64)
#endif
diff --git a/libc/kernel/uapi/linux/seg6_local.h b/libc/kernel/uapi/linux/seg6_local.h
index 9508eca75..73873a809 100644
--- a/libc/kernel/uapi/linux/seg6_local.h
+++ b/libc/kernel/uapi/linux/seg6_local.h
@@ -29,7 +29,6 @@ enum {
SEG6_LOCAL_IIF,
SEG6_LOCAL_OIF,
SEG6_LOCAL_BPF,
- SEG6_LOCAL_VRFTABLE,
__SEG6_LOCAL_MAX,
};
#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
diff --git a/libc/kernel/uapi/linux/serial_core.h b/libc/kernel/uapi/linux/serial_core.h
index 0caf698ea..37dfc1614 100644
--- a/libc/kernel/uapi/linux/serial_core.h
+++ b/libc/kernel/uapi/linux/serial_core.h
@@ -19,6 +19,20 @@
#ifndef _UAPILINUX_SERIAL_CORE_H
#define _UAPILINUX_SERIAL_CORE_H
#include <linux/serial.h>
+#define PORT_UNKNOWN 0
+#define PORT_8250 1
+#define PORT_16450 2
+#define PORT_16550 3
+#define PORT_16550A 4
+#define PORT_CIRRUS 5
+#define PORT_16650 6
+#define PORT_16650V2 7
+#define PORT_16750 8
+#define PORT_STARTECH 9
+#define PORT_16C950 10
+#define PORT_16654 11
+#define PORT_16850 12
+#define PORT_RSA 13
#define PORT_NS16550A 14
#define PORT_XSCALE 15
#define PORT_RM9000 16
@@ -73,6 +87,7 @@
#define PORT_S3C2400 67
#define PORT_M32R_SIO 68
#define PORT_JSM 69
+#define PORT_PNX8XXX 70
#define PORT_SUNHV 72
#define PORT_S3C2412 73
#define PORT_UARTLITE 74
@@ -100,6 +115,7 @@
#define PORT_VT8500 97
#define PORT_XUARTPS 98
#define PORT_AR933X 99
+#define PORT_EFMUART 100
#define PORT_ARC 101
#define PORT_RP2 102
#define PORT_LPUART 103
diff --git a/libc/kernel/uapi/linux/serio.h b/libc/kernel/uapi/linux/serio.h
index 605a4e450..5ef9de4b4 100644
--- a/libc/kernel/uapi/linux/serio.h
+++ b/libc/kernel/uapi/linux/serio.h
@@ -18,13 +18,12 @@
****************************************************************************/
#ifndef _UAPI_SERIO_H
#define _UAPI_SERIO_H
-#include <linux/const.h>
#include <linux/ioctl.h>
#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
-#define SERIO_TIMEOUT _BITUL(0)
-#define SERIO_PARITY _BITUL(1)
-#define SERIO_FRAME _BITUL(2)
-#define SERIO_OOB_DATA _BITUL(3)
+#define SERIO_TIMEOUT BIT(0)
+#define SERIO_PARITY BIT(1)
+#define SERIO_FRAME BIT(2)
+#define SERIO_OOB_DATA BIT(3)
#define SERIO_XT 0x00
#define SERIO_8042 0x01
#define SERIO_RS232 0x02
diff --git a/libc/kernel/uapi/linux/smc.h b/libc/kernel/uapi/linux/smc.h
index 88eef62b7..824a29db9 100644
--- a/libc/kernel/uapi/linux/smc.h
+++ b/libc/kernel/uapi/linux/smc.h
@@ -35,109 +35,4 @@ enum {
};
#define SMCR_GENL_FAMILY_NAME "SMC_PNETID"
#define SMCR_GENL_FAMILY_VERSION 1
-#define SMC_GENL_FAMILY_NAME "SMC_GEN_NETLINK"
-#define SMC_GENL_FAMILY_VERSION 1
-#define SMC_PCI_ID_STR_LEN 16
-enum {
- SMC_NETLINK_GET_SYS_INFO = 1,
- SMC_NETLINK_GET_LGR_SMCR,
- SMC_NETLINK_GET_LINK_SMCR,
- SMC_NETLINK_GET_LGR_SMCD,
- SMC_NETLINK_GET_DEV_SMCD,
- SMC_NETLINK_GET_DEV_SMCR,
-};
-enum {
- SMC_GEN_UNSPEC,
- SMC_GEN_SYS_INFO,
- SMC_GEN_LGR_SMCR,
- SMC_GEN_LINK_SMCR,
- SMC_GEN_LGR_SMCD,
- SMC_GEN_DEV_SMCD,
- SMC_GEN_DEV_SMCR,
- __SMC_GEN_MAX,
- SMC_GEN_MAX = __SMC_GEN_MAX - 1
-};
-enum {
- SMC_NLA_SYS_UNSPEC,
- SMC_NLA_SYS_VER,
- SMC_NLA_SYS_REL,
- SMC_NLA_SYS_IS_ISM_V2,
- SMC_NLA_SYS_LOCAL_HOST,
- SMC_NLA_SYS_SEID,
- __SMC_NLA_SYS_MAX,
- SMC_NLA_SYS_MAX = __SMC_NLA_SYS_MAX - 1
-};
-enum {
- SMC_NLA_LGR_V2_VER,
- SMC_NLA_LGR_V2_REL,
- SMC_NLA_LGR_V2_OS,
- SMC_NLA_LGR_V2_NEG_EID,
- SMC_NLA_LGR_V2_PEER_HOST,
-};
-enum {
- SMC_NLA_LGR_R_UNSPEC,
- SMC_NLA_LGR_R_ID,
- SMC_NLA_LGR_R_ROLE,
- SMC_NLA_LGR_R_TYPE,
- SMC_NLA_LGR_R_PNETID,
- SMC_NLA_LGR_R_VLAN_ID,
- SMC_NLA_LGR_R_CONNS_NUM,
- __SMC_NLA_LGR_R_MAX,
- SMC_NLA_LGR_R_MAX = __SMC_NLA_LGR_R_MAX - 1
-};
-enum {
- SMC_NLA_LINK_UNSPEC,
- SMC_NLA_LINK_ID,
- SMC_NLA_LINK_IB_DEV,
- SMC_NLA_LINK_IB_PORT,
- SMC_NLA_LINK_GID,
- SMC_NLA_LINK_PEER_GID,
- SMC_NLA_LINK_CONN_CNT,
- SMC_NLA_LINK_NET_DEV,
- SMC_NLA_LINK_UID,
- SMC_NLA_LINK_PEER_UID,
- SMC_NLA_LINK_STATE,
- __SMC_NLA_LINK_MAX,
- SMC_NLA_LINK_MAX = __SMC_NLA_LINK_MAX - 1
-};
-enum {
- SMC_NLA_LGR_D_UNSPEC,
- SMC_NLA_LGR_D_ID,
- SMC_NLA_LGR_D_GID,
- SMC_NLA_LGR_D_PEER_GID,
- SMC_NLA_LGR_D_VLAN_ID,
- SMC_NLA_LGR_D_CONNS_NUM,
- SMC_NLA_LGR_D_PNETID,
- SMC_NLA_LGR_D_CHID,
- SMC_NLA_LGR_D_PAD,
- SMC_NLA_LGR_V2,
- __SMC_NLA_LGR_D_MAX,
- SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1
-};
-enum {
- SMC_NLA_DEV_PORT_UNSPEC,
- SMC_NLA_DEV_PORT_PNET_USR,
- SMC_NLA_DEV_PORT_PNETID,
- SMC_NLA_DEV_PORT_NETDEV,
- SMC_NLA_DEV_PORT_STATE,
- SMC_NLA_DEV_PORT_VALID,
- SMC_NLA_DEV_PORT_LNK_CNT,
- __SMC_NLA_DEV_PORT_MAX,
- SMC_NLA_DEV_PORT_MAX = __SMC_NLA_DEV_PORT_MAX - 1
-};
-enum {
- SMC_NLA_DEV_UNSPEC,
- SMC_NLA_DEV_USE_CNT,
- SMC_NLA_DEV_IS_CRIT,
- SMC_NLA_DEV_PCI_FID,
- SMC_NLA_DEV_PCI_CHID,
- SMC_NLA_DEV_PCI_VENDOR,
- SMC_NLA_DEV_PCI_DEVICE,
- SMC_NLA_DEV_PCI_ID,
- SMC_NLA_DEV_PORT,
- SMC_NLA_DEV_PORT2,
- SMC_NLA_DEV_IB_NAME,
- __SMC_NLA_DEV_MAX,
- SMC_NLA_DEV_MAX = __SMC_NLA_DEV_MAX - 1
-};
#endif
diff --git a/libc/kernel/uapi/linux/snmp.h b/libc/kernel/uapi/linux/snmp.h
index 40e8fa5c4..3ec299af3 100644
--- a/libc/kernel/uapi/linux/snmp.h
+++ b/libc/kernel/uapi/linux/snmp.h
@@ -129,7 +129,6 @@ enum {
UDP_MIB_SNDBUFERRORS,
UDP_MIB_CSUMERRORS,
UDP_MIB_IGNOREDMULTI,
- UDP_MIB_MEMERRORS,
__UDP_MIB_MAX
};
enum {
@@ -253,10 +252,6 @@ enum {
LINUX_MIB_TCPRCVQDROP,
LINUX_MIB_TCPWQUEUETOOBIG,
LINUX_MIB_TCPFASTOPENPASSIVEALTKEY,
- LINUX_MIB_TCPTIMEOUTREHASH,
- LINUX_MIB_TCPDUPLICATEDATAREHASH,
- LINUX_MIB_TCPDSACKRECVSEGS,
- LINUX_MIB_TCPDSACKIGNOREDDUBIOUS,
__LINUX_MIB_MAX
};
enum {
diff --git a/libc/kernel/uapi/linux/sock_diag.h b/libc/kernel/uapi/linux/sock_diag.h
index a4e40d951..01825974e 100644
--- a/libc/kernel/uapi/linux/sock_diag.h
+++ b/libc/kernel/uapi/linux/sock_diag.h
@@ -46,24 +46,4 @@ enum sknetlink_groups {
__SKNLGRP_MAX,
};
#define SKNLGRP_MAX (__SKNLGRP_MAX - 1)
-enum {
- SK_DIAG_BPF_STORAGE_REQ_NONE,
- SK_DIAG_BPF_STORAGE_REQ_MAP_FD,
- __SK_DIAG_BPF_STORAGE_REQ_MAX,
-};
-#define SK_DIAG_BPF_STORAGE_REQ_MAX (__SK_DIAG_BPF_STORAGE_REQ_MAX - 1)
-enum {
- SK_DIAG_BPF_STORAGE_REP_NONE,
- SK_DIAG_BPF_STORAGE,
- __SK_DIAG_BPF_STORAGE_REP_MAX,
-};
-#define SK_DIAB_BPF_STORAGE_REP_MAX (__SK_DIAG_BPF_STORAGE_REP_MAX - 1)
-enum {
- SK_DIAG_BPF_STORAGE_NONE,
- SK_DIAG_BPF_STORAGE_PAD,
- SK_DIAG_BPF_STORAGE_MAP_ID,
- SK_DIAG_BPF_STORAGE_MAP_VALUE,
- __SK_DIAG_BPF_STORAGE_MAX,
-};
-#define SK_DIAG_BPF_STORAGE_MAX (__SK_DIAG_BPF_STORAGE_MAX - 1)
#endif
diff --git a/libc/kernel/uapi/linux/spi/spi.h b/libc/kernel/uapi/linux/spi/spi.h
deleted file mode 100644
index 39267a21a..000000000
--- a/libc/kernel/uapi/linux/spi/spi.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_SPI_H
-#define _UAPI_SPI_H
-#include <linux/const.h>
-#define SPI_CPHA _BITUL(0)
-#define SPI_CPOL _BITUL(1)
-#define SPI_MODE_0 (0 | 0)
-#define SPI_MODE_1 (0 | SPI_CPHA)
-#define SPI_MODE_2 (SPI_CPOL | 0)
-#define SPI_MODE_3 (SPI_CPOL | SPI_CPHA)
-#define SPI_MODE_X_MASK (SPI_CPOL | SPI_CPHA)
-#define SPI_CS_HIGH _BITUL(2)
-#define SPI_LSB_FIRST _BITUL(3)
-#define SPI_3WIRE _BITUL(4)
-#define SPI_LOOP _BITUL(5)
-#define SPI_NO_CS _BITUL(6)
-#define SPI_READY _BITUL(7)
-#define SPI_TX_DUAL _BITUL(8)
-#define SPI_TX_QUAD _BITUL(9)
-#define SPI_RX_DUAL _BITUL(10)
-#define SPI_RX_QUAD _BITUL(11)
-#define SPI_CS_WORD _BITUL(12)
-#define SPI_TX_OCTAL _BITUL(13)
-#define SPI_RX_OCTAL _BITUL(14)
-#define SPI_3WIRE_HIZ _BITUL(15)
-#define SPI_MODE_USER_MASK (_BITUL(16) - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/spi/spidev.h b/libc/kernel/uapi/linux/spi/spidev.h
index 19d1d84ec..343285b20 100644
--- a/libc/kernel/uapi/linux/spi/spidev.h
+++ b/libc/kernel/uapi/linux/spi/spidev.h
@@ -20,7 +20,22 @@
#define SPIDEV_H
#include <linux/types.h>
#include <linux/ioctl.h>
-#include <linux/spi/spi.h>
+#define SPI_CPHA 0x01
+#define SPI_CPOL 0x02
+#define SPI_MODE_0 (0 | 0)
+#define SPI_MODE_1 (0 | SPI_CPHA)
+#define SPI_MODE_2 (SPI_CPOL | 0)
+#define SPI_MODE_3 (SPI_CPOL | SPI_CPHA)
+#define SPI_CS_HIGH 0x04
+#define SPI_LSB_FIRST 0x08
+#define SPI_3WIRE 0x10
+#define SPI_LOOP 0x20
+#define SPI_NO_CS 0x40
+#define SPI_READY 0x80
+#define SPI_TX_DUAL 0x100
+#define SPI_TX_QUAD 0x200
+#define SPI_RX_DUAL 0x400
+#define SPI_RX_QUAD 0x800
#define SPI_IOC_MAGIC 'k'
struct spi_ioc_transfer {
__u64 tx_buf;
diff --git a/libc/kernel/uapi/linux/stat.h b/libc/kernel/uapi/linux/stat.h
index a15b9b578..98fdbeaa9 100644
--- a/libc/kernel/uapi/linux/stat.h
+++ b/libc/kernel/uapi/linux/stat.h
@@ -77,9 +77,7 @@ struct statx {
__u32 stx_rdev_minor;
__u32 stx_dev_major;
__u32 stx_dev_minor;
- __u64 stx_mnt_id;
- __u64 __spare2;
- __u64 __spare3[12];
+ __u64 __spare2[14];
};
#define STATX_TYPE 0x00000001U
#define STATX_MODE 0x00000002U
@@ -94,16 +92,13 @@ struct statx {
#define STATX_BLOCKS 0x00000400U
#define STATX_BASIC_STATS 0x000007ffU
#define STATX_BTIME 0x00000800U
-#define STATX_MNT_ID 0x00001000U
-#define STATX__RESERVED 0x80000000U
#define STATX_ALL 0x00000fffU
+#define STATX__RESERVED 0x80000000U
#define STATX_ATTR_COMPRESSED 0x00000004
#define STATX_ATTR_IMMUTABLE 0x00000010
#define STATX_ATTR_APPEND 0x00000020
#define STATX_ATTR_NODUMP 0x00000040
#define STATX_ATTR_ENCRYPTED 0x00000800
#define STATX_ATTR_AUTOMOUNT 0x00001000
-#define STATX_ATTR_MOUNT_ROOT 0x00002000
#define STATX_ATTR_VERITY 0x00100000
-#define STATX_ATTR_DAX 0x00200000
#endif
diff --git a/libc/kernel/uapi/linux/surface_aggregator/cdev.h b/libc/kernel/uapi/linux/surface_aggregator/cdev.h
deleted file mode 100644
index 25bfd8ddd..000000000
--- a/libc/kernel/uapi/linux/surface_aggregator/cdev.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_SURFACE_AGGREGATOR_CDEV_H
-#define _UAPI_LINUX_SURFACE_AGGREGATOR_CDEV_H
-#include <linux/ioctl.h>
-#include <linux/types.h>
-enum ssam_cdev_request_flags {
- SSAM_CDEV_REQUEST_HAS_RESPONSE = 0x01,
- SSAM_CDEV_REQUEST_UNSEQUENCED = 0x02,
-};
-struct ssam_cdev_request {
- __u8 target_category;
- __u8 target_id;
- __u8 command_id;
- __u8 instance_id;
- __u16 flags;
- __s16 status;
- struct {
- __u64 data;
- __u16 length;
- __u8 __pad[6];
- } payload;
- struct {
- __u64 data;
- __u16 length;
- __u8 __pad[6];
- } response;
-} __attribute__((__packed__));
-#define SSAM_CDEV_REQUEST _IOWR(0xA5, 1, struct ssam_cdev_request)
-#endif
diff --git a/libc/kernel/uapi/linux/swab.h b/libc/kernel/uapi/linux/swab.h
index e96085e4e..da949db61 100644
--- a/libc/kernel/uapi/linux/swab.h
+++ b/libc/kernel/uapi/linux/swab.h
@@ -20,7 +20,6 @@
#define _UAPI_LINUX_SWAB_H
#include <linux/types.h>
#include <linux/compiler.h>
-#include <asm/bitsperlong.h>
#include <asm/swab.h>
#define ___constant_swab16(x) ((__u16) ((((__u16) (x) & (__u16) 0x00ffU) << 8) | (((__u16) (x) & (__u16) 0xff00U) >> 8)))
#define ___constant_swab32(x) ((__u32) ((((__u32) (x) & (__u32) 0x000000ffUL) << 24) | (((__u32) (x) & (__u32) 0x0000ff00UL) << 8) | (((__u32) (x) & (__u32) 0x00ff0000UL) >> 8) | (((__u32) (x) & (__u32) 0xff000000UL) >> 24)))
@@ -54,9 +53,6 @@ static inline __attribute__((__const__)) __u32 __fswahb32(__u32 val) {
#define __swab16(x) (__u16) __builtin_bswap16((__u16) (x))
#define __swab32(x) (__u32) __builtin_bswap32((__u32) (x))
#define __swab64(x) (__u64) __builtin_bswap64((__u64) (x))
-#if __BITS_PER_LONG == 64
-#else
-#endif
#define __swahw32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahw32(x) : __fswahw32(x))
#define __swahb32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahb32(x) : __fswahb32(x))
static __always_inline __u16 __swab16p(const __u16 * p) {
diff --git a/libc/kernel/uapi/linux/switchtec_ioctl.h b/libc/kernel/uapi/linux/switchtec_ioctl.h
index 204839dbe..2143148e6 100644
--- a/libc/kernel/uapi/linux/switchtec_ioctl.h
+++ b/libc/kernel/uapi/linux/switchtec_ioctl.h
@@ -32,15 +32,7 @@
#define SWITCHTEC_IOCTL_PART_VENDOR5 10
#define SWITCHTEC_IOCTL_PART_VENDOR6 11
#define SWITCHTEC_IOCTL_PART_VENDOR7 12
-#define SWITCHTEC_IOCTL_PART_BL2_0 13
-#define SWITCHTEC_IOCTL_PART_BL2_1 14
-#define SWITCHTEC_IOCTL_PART_MAP_0 15
-#define SWITCHTEC_IOCTL_PART_MAP_1 16
-#define SWITCHTEC_IOCTL_PART_KEY_0 17
-#define SWITCHTEC_IOCTL_PART_KEY_1 18
-#define SWITCHTEC_NUM_PARTITIONS_GEN3 13
-#define SWITCHTEC_NUM_PARTITIONS_GEN4 19
-#define SWITCHTEC_IOCTL_NUM_PARTITIONS SWITCHTEC_NUM_PARTITIONS_GEN3
+#define SWITCHTEC_IOCTL_NUM_PARTITIONS 13
struct switchtec_ioctl_flash_info {
__u64 flash_length;
__u32 num_partitions;
@@ -100,9 +92,7 @@ struct switchtec_ioctl_event_summary {
#define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27
#define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28
#define SWITCHTEC_IOCTL_EVENT_GFMS 29
-#define SWITCHTEC_IOCTL_EVENT_INTERCOMM_REQ_NOTIFY 30
-#define SWITCHTEC_IOCTL_EVENT_UEC 31
-#define SWITCHTEC_IOCTL_MAX_EVENTS 32
+#define SWITCHTEC_IOCTL_MAX_EVENTS 30
#define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX - 1
#define SWITCHTEC_IOCTL_EVENT_IDX_ALL - 2
#define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0)
diff --git a/libc/kernel/uapi/linux/sysctl.h b/libc/kernel/uapi/linux/sysctl.h
index ebaf8a993..ae0f44ade 100644
--- a/libc/kernel/uapi/linux/sysctl.h
+++ b/libc/kernel/uapi/linux/sysctl.h
@@ -18,7 +18,7 @@
****************************************************************************/
#ifndef _UAPI_LINUX_SYSCTL_H
#define _UAPI_LINUX_SYSCTL_H
-#include <linux/const.h>
+#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/compiler.h>
#define CTL_MAXNAME 10
@@ -489,7 +489,6 @@ enum {
NET_IPV6_ACCEPT_SOURCE_ROUTE = 25,
NET_IPV6_ACCEPT_RA_FROM_LOCAL = 26,
NET_IPV6_ACCEPT_RA_RT_INFO_MIN_PLEN = 27,
- NET_IPV6_RA_DEFRTR_METRIC = 28,
__NET_IPV6_MAX
};
enum {
diff --git a/libc/kernel/uapi/linux/target_core_user.h b/libc/kernel/uapi/linux/target_core_user.h
index e0b9f2200..7c997d102 100644
--- a/libc/kernel/uapi/linux/target_core_user.h
+++ b/libc/kernel/uapi/linux/target_core_user.h
@@ -25,7 +25,6 @@
#define ALIGN_SIZE 64
#define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0)
#define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1)
-#define TCMU_MAILBOX_FLAG_CAP_TMR (1 << 2)
struct tcmu_mailbox {
__u16 version;
__u16 flags;
@@ -37,7 +36,6 @@ struct tcmu_mailbox {
enum tcmu_opcode {
TCMU_OP_PAD = 0,
TCMU_OP_CMD,
- TCMU_OP_TMR,
};
struct tcmu_cmd_entry_hdr {
__u32 len_op;
@@ -70,25 +68,6 @@ struct tcmu_cmd_entry {
} rsp;
};
} __packed;
-struct tcmu_tmr_entry {
- struct tcmu_cmd_entry_hdr hdr;
-#define TCMU_TMR_UNKNOWN 0
-#define TCMU_TMR_ABORT_TASK 1
-#define TCMU_TMR_ABORT_TASK_SET 2
-#define TCMU_TMR_CLEAR_ACA 3
-#define TCMU_TMR_CLEAR_TASK_SET 4
-#define TCMU_TMR_LUN_RESET 5
-#define TCMU_TMR_TARGET_WARM_RESET 6
-#define TCMU_TMR_TARGET_COLD_RESET 7
-#define TCMU_TMR_LUN_RESET_PRO 128
- __u8 tmr_type;
- __u8 __pad1;
- __u16 __pad2;
- __u32 cmd_cnt;
- __u64 __pad3;
- __u64 __pad4;
- __u16 cmd_ids[0];
-} __packed;
#define TCMU_OP_ALIGN_SIZE sizeof(__u64)
enum tcmu_genl_cmd {
TCMU_CMD_UNSPEC,
diff --git a/libc/kernel/uapi/linux/taskstats.h b/libc/kernel/uapi/linux/taskstats.h
index 5f9d0cc48..dc7791ddf 100644
--- a/libc/kernel/uapi/linux/taskstats.h
+++ b/libc/kernel/uapi/linux/taskstats.h
@@ -19,7 +19,7 @@
#ifndef _LINUX_TASKSTATS_H
#define _LINUX_TASKSTATS_H
#include <linux/types.h>
-#define TASKSTATS_VERSION 10
+#define TASKSTATS_VERSION 9
#define TS_COMM_LEN 32
struct taskstats {
__u16 version;
@@ -68,7 +68,6 @@ struct taskstats {
__u64 freepages_delay_total;
__u64 thrashing_count;
__u64 thrashing_delay_total;
- __u64 ac_btime64;
};
enum {
TASKSTATS_CMD_UNSPEC = 0,
diff --git a/libc/kernel/uapi/linux/tc_act/tc_gate.h b/libc/kernel/uapi/linux/tc_act/tc_gate.h
deleted file mode 100644
index f0a64127e..000000000
--- a/libc/kernel/uapi/linux/tc_act/tc_gate.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __LINUX_TC_GATE_H
-#define __LINUX_TC_GATE_H
-#include <linux/pkt_cls.h>
-struct tc_gate {
- tc_gen;
-};
-enum {
- TCA_GATE_ENTRY_UNSPEC,
- TCA_GATE_ENTRY_INDEX,
- TCA_GATE_ENTRY_GATE,
- TCA_GATE_ENTRY_INTERVAL,
- TCA_GATE_ENTRY_IPV,
- TCA_GATE_ENTRY_MAX_OCTETS,
- __TCA_GATE_ENTRY_MAX,
-};
-#define TCA_GATE_ENTRY_MAX (__TCA_GATE_ENTRY_MAX - 1)
-enum {
- TCA_GATE_ONE_ENTRY_UNSPEC,
- TCA_GATE_ONE_ENTRY,
- __TCA_GATE_ONE_ENTRY_MAX,
-};
-#define TCA_GATE_ONE_ENTRY_MAX (__TCA_GATE_ONE_ENTRY_MAX - 1)
-enum {
- TCA_GATE_UNSPEC,
- TCA_GATE_TM,
- TCA_GATE_PARMS,
- TCA_GATE_PAD,
- TCA_GATE_PRIORITY,
- TCA_GATE_ENTRY_LIST,
- TCA_GATE_BASE_TIME,
- TCA_GATE_CYCLE_TIME,
- TCA_GATE_CYCLE_TIME_EXT,
- TCA_GATE_FLAGS,
- TCA_GATE_CLOCKID,
- __TCA_GATE_MAX,
-};
-#define TCA_GATE_MAX (__TCA_GATE_MAX - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/tc_act/tc_mpls.h b/libc/kernel/uapi/linux/tc_act/tc_mpls.h
index 5e23fde19..e1a4905f0 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_mpls.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_mpls.h
@@ -23,7 +23,6 @@
#define TCA_MPLS_ACT_PUSH 2
#define TCA_MPLS_ACT_MODIFY 3
#define TCA_MPLS_ACT_DEC_TTL 4
-#define TCA_MPLS_ACT_MAC_PUSH 5
struct tc_mpls {
tc_gen;
int m_action;
diff --git a/libc/kernel/uapi/linux/tc_act/tc_vlan.h b/libc/kernel/uapi/linux/tc_act/tc_vlan.h
index 004c7ae03..ecd445d14 100644
--- a/libc/kernel/uapi/linux/tc_act/tc_vlan.h
+++ b/libc/kernel/uapi/linux/tc_act/tc_vlan.h
@@ -22,8 +22,6 @@
#define TCA_VLAN_ACT_POP 1
#define TCA_VLAN_ACT_PUSH 2
#define TCA_VLAN_ACT_MODIFY 3
-#define TCA_VLAN_ACT_POP_ETH 4
-#define TCA_VLAN_ACT_PUSH_ETH 5
struct tc_vlan {
tc_gen;
int v_action;
@@ -36,8 +34,6 @@ enum {
TCA_VLAN_PUSH_VLAN_PROTOCOL,
TCA_VLAN_PAD,
TCA_VLAN_PUSH_VLAN_PRIORITY,
- TCA_VLAN_PUSH_ETH_DST,
- TCA_VLAN_PUSH_ETH_SRC,
__TCA_VLAN_MAX,
};
#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1)
diff --git a/libc/kernel/uapi/linux/tcp.h b/libc/kernel/uapi/linux/tcp.h
index 99c5bff4c..823583dc8 100644
--- a/libc/kernel/uapi/linux/tcp.h
+++ b/libc/kernel/uapi/linux/tcp.h
@@ -217,20 +217,15 @@ enum {
TCP_NLA_DSACK_DUPS,
TCP_NLA_REORD_SEEN,
TCP_NLA_SRTT,
- TCP_NLA_TIMEOUT_REHASH,
- TCP_NLA_BYTES_NOTSENT,
- TCP_NLA_EDT,
- TCP_NLA_TTL,
};
#define TCP_MD5SIG_MAXKEYLEN 80
-#define TCP_MD5SIG_FLAG_PREFIX 0x1
-#define TCP_MD5SIG_FLAG_IFINDEX 0x2
+#define TCP_MD5SIG_FLAG_PREFIX 1
struct tcp_md5sig {
struct sockaddr_storage tcpm_addr;
__u8 tcpm_flags;
__u8 tcpm_prefixlen;
__u16 tcpm_keylen;
- int tcpm_ifindex;
+ __u32 __tcpm_pad;
__u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
};
struct tcp_diag_md5sig {
@@ -240,19 +235,9 @@ struct tcp_diag_md5sig {
__be32 tcpm_addr[4];
__u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
};
-#define TCP_RECEIVE_ZEROCOPY_FLAG_TLB_CLEAN_HINT 0x1
struct tcp_zerocopy_receive {
__u64 address;
__u32 length;
__u32 recv_skip_hint;
- __u32 inq;
- __s32 err;
- __u64 copybuf_address;
- __s32 copybuf_len;
- __u32 flags;
- __u64 msg_control;
- __u64 msg_controllen;
- __u32 msg_flags;
- __u32 reserved;
};
#endif
diff --git a/libc/kernel/uapi/linux/tee.h b/libc/kernel/uapi/linux/tee.h
index 5cfe713a2..e13c2313f 100644
--- a/libc/kernel/uapi/linux/tee.h
+++ b/libc/kernel/uapi/linux/tee.h
@@ -28,10 +28,7 @@
#define TEE_GEN_CAP_GP (1 << 0)
#define TEE_GEN_CAP_PRIVILEGED (1 << 1)
#define TEE_GEN_CAP_REG_MEM (1 << 2)
-#define TEE_GEN_CAP_MEMREF_NULL (1 << 3)
-#define TEE_MEMREF_NULL (__u64) (- 1)
#define TEE_IMPL_ID_OPTEE 1
-#define TEE_IMPL_ID_AMDTEE 2
#define TEE_OPTEE_CAP_TZ (1 << 0)
struct tee_ioctl_version_data {
__u32 impl_id;
@@ -65,9 +62,6 @@ struct tee_ioctl_buf_data {
#define TEE_IOCTL_LOGIN_APPLICATION 4
#define TEE_IOCTL_LOGIN_USER_APPLICATION 5
#define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6
-#define TEE_IOCTL_LOGIN_REE_KERNEL_MIN 0x80000000
-#define TEE_IOCTL_LOGIN_REE_KERNEL_MAX 0xBFFFFFFF
-#define TEE_IOCTL_LOGIN_REE_KERNEL 0x80000000
struct tee_ioctl_param {
__u64 attr;
__u64 a;
diff --git a/libc/kernel/uapi/linux/termios.h b/libc/kernel/uapi/linux/termios.h
index cde4099b3..a66573570 100644
--- a/libc/kernel/uapi/linux/termios.h
+++ b/libc/kernel/uapi/linux/termios.h
@@ -20,4 +20,15 @@
#define _LINUX_TERMIOS_H
#include <linux/types.h>
#include <asm/termios.h>
+#define NFF 5
+struct termiox {
+ __u16 x_hflag;
+ __u16 x_cflag;
+ __u16 x_rflag[NFF];
+ __u16 x_sflag;
+};
+#define RTSXOFF 0x0001
+#define CTSXON 0x0002
+#define DTRXOFF 0x0004
+#define DSRXON 0x0008
#endif
diff --git a/libc/kernel/uapi/linux/thermal.h b/libc/kernel/uapi/linux/thermal.h
index 72ea378c6..c78f17ead 100644
--- a/libc/kernel/uapi/linux/thermal.h
+++ b/libc/kernel/uapi/linux/thermal.h
@@ -19,75 +19,24 @@
#ifndef _UAPI_LINUX_THERMAL_H
#define _UAPI_LINUX_THERMAL_H
#define THERMAL_NAME_LENGTH 20
-enum thermal_device_mode {
- THERMAL_DEVICE_DISABLED = 0,
- THERMAL_DEVICE_ENABLED,
-};
-enum thermal_trip_type {
- THERMAL_TRIP_ACTIVE = 0,
- THERMAL_TRIP_PASSIVE,
- THERMAL_TRIP_HOT,
- THERMAL_TRIP_CRITICAL,
-};
-#define THERMAL_GENL_FAMILY_NAME "thermal"
+#define THERMAL_GENL_FAMILY_NAME "thermal_event"
#define THERMAL_GENL_VERSION 0x01
-#define THERMAL_GENL_SAMPLING_GROUP_NAME "sampling"
-#define THERMAL_GENL_EVENT_GROUP_NAME "event"
-enum thermal_genl_attr {
+#define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp"
+enum events {
+ THERMAL_AUX0,
+ THERMAL_AUX1,
+ THERMAL_CRITICAL,
+ THERMAL_DEV_FAULT,
+};
+enum {
THERMAL_GENL_ATTR_UNSPEC,
- THERMAL_GENL_ATTR_TZ,
- THERMAL_GENL_ATTR_TZ_ID,
- THERMAL_GENL_ATTR_TZ_TEMP,
- THERMAL_GENL_ATTR_TZ_TRIP,
- THERMAL_GENL_ATTR_TZ_TRIP_ID,
- THERMAL_GENL_ATTR_TZ_TRIP_TYPE,
- THERMAL_GENL_ATTR_TZ_TRIP_TEMP,
- THERMAL_GENL_ATTR_TZ_TRIP_HYST,
- THERMAL_GENL_ATTR_TZ_MODE,
- THERMAL_GENL_ATTR_TZ_NAME,
- THERMAL_GENL_ATTR_TZ_CDEV_WEIGHT,
- THERMAL_GENL_ATTR_TZ_GOV,
- THERMAL_GENL_ATTR_TZ_GOV_NAME,
- THERMAL_GENL_ATTR_CDEV,
- THERMAL_GENL_ATTR_CDEV_ID,
- THERMAL_GENL_ATTR_CDEV_CUR_STATE,
- THERMAL_GENL_ATTR_CDEV_MAX_STATE,
- THERMAL_GENL_ATTR_CDEV_NAME,
- THERMAL_GENL_ATTR_GOV_NAME,
+ THERMAL_GENL_ATTR_EVENT,
__THERMAL_GENL_ATTR_MAX,
};
#define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
-enum thermal_genl_sampling {
- THERMAL_GENL_SAMPLING_TEMP,
- __THERMAL_GENL_SAMPLING_MAX,
-};
-#define THERMAL_GENL_SAMPLING_MAX (__THERMAL_GENL_SAMPLING_MAX - 1)
-enum thermal_genl_event {
- THERMAL_GENL_EVENT_UNSPEC,
- THERMAL_GENL_EVENT_TZ_CREATE,
- THERMAL_GENL_EVENT_TZ_DELETE,
- THERMAL_GENL_EVENT_TZ_DISABLE,
- THERMAL_GENL_EVENT_TZ_ENABLE,
- THERMAL_GENL_EVENT_TZ_TRIP_UP,
- THERMAL_GENL_EVENT_TZ_TRIP_DOWN,
- THERMAL_GENL_EVENT_TZ_TRIP_CHANGE,
- THERMAL_GENL_EVENT_TZ_TRIP_ADD,
- THERMAL_GENL_EVENT_TZ_TRIP_DELETE,
- THERMAL_GENL_EVENT_CDEV_ADD,
- THERMAL_GENL_EVENT_CDEV_DELETE,
- THERMAL_GENL_EVENT_CDEV_STATE_UPDATE,
- THERMAL_GENL_EVENT_TZ_GOV_CHANGE,
- __THERMAL_GENL_EVENT_MAX,
-};
-#define THERMAL_GENL_EVENT_MAX (__THERMAL_GENL_EVENT_MAX - 1)
-enum thermal_genl_cmd {
+enum {
THERMAL_GENL_CMD_UNSPEC,
- THERMAL_GENL_CMD_TZ_GET_ID,
- THERMAL_GENL_CMD_TZ_GET_TRIP,
- THERMAL_GENL_CMD_TZ_GET_TEMP,
- THERMAL_GENL_CMD_TZ_GET_GOV,
- THERMAL_GENL_CMD_TZ_GET_MODE,
- THERMAL_GENL_CMD_CDEV_GET,
+ THERMAL_GENL_CMD_EVENT,
__THERMAL_GENL_CMD_MAX,
};
#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
diff --git a/libc/kernel/uapi/linux/time.h b/libc/kernel/uapi/linux/time.h
index df52295db..eed430b5f 100644
--- a/libc/kernel/uapi/linux/time.h
+++ b/libc/kernel/uapi/linux/time.h
@@ -31,6 +31,13 @@ struct timeval {
__kernel_old_time_t tv_sec;
__kernel_suseconds_t tv_usec;
};
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
@@ -39,13 +46,6 @@ struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
-#define ITIMER_PROF 2
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_PROCESS_CPUTIME_ID 2
diff --git a/libc/kernel/uapi/linux/tipc.h b/libc/kernel/uapi/linux/tipc.h
index c66754c37..1d092ccee 100644
--- a/libc/kernel/uapi/linux/tipc.h
+++ b/libc/kernel/uapi/linux/tipc.h
@@ -146,7 +146,6 @@ struct tipc_aead_key {
#define TIPC_AEAD_KEYLEN_MIN (16 + 4)
#define TIPC_AEAD_KEYLEN_MAX (32 + 4)
#define TIPC_AEAD_KEY_SIZE_MAX (sizeof(struct tipc_aead_key) + TIPC_AEAD_KEYLEN_MAX)
-#define TIPC_REKEYING_NOW (~0U)
#define TIPC_CFG_SRV 0
#define TIPC_ZONE_SCOPE 1
#define TIPC_ADDR_NAMESEQ 1
diff --git a/libc/kernel/uapi/linux/tipc_netlink.h b/libc/kernel/uapi/linux/tipc_netlink.h
index 39be94847..61577fad9 100644
--- a/libc/kernel/uapi/linux/tipc_netlink.h
+++ b/libc/kernel/uapi/linux/tipc_netlink.h
@@ -46,7 +46,6 @@ enum {
TIPC_NL_UDP_GET_REMOTEIP,
TIPC_NL_KEY_SET,
TIPC_NL_KEY_FLUSH,
- TIPC_NL_ADDR_LEGACY_GET,
__TIPC_NL_CMD_MAX,
TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
};
@@ -127,8 +126,6 @@ enum {
TIPC_NLA_NODE_UP,
TIPC_NLA_NODE_ID,
TIPC_NLA_NODE_KEY,
- TIPC_NLA_NODE_KEY_MASTER,
- TIPC_NLA_NODE_REKEYING,
__TIPC_NLA_NODE_MAX,
TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1
};
@@ -138,7 +135,6 @@ enum {
TIPC_NLA_NET_ADDR,
TIPC_NLA_NET_NODEID,
TIPC_NLA_NET_NODEID_W1,
- TIPC_NLA_NET_ADDR_LEGACY,
__TIPC_NLA_NET_MAX,
TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1
};
diff --git a/libc/kernel/uapi/linux/tls.h b/libc/kernel/uapi/linux/tls.h
index c765f3088..6949d650c 100644
--- a/libc/kernel/uapi/linux/tls.h
+++ b/libc/kernel/uapi/linux/tls.h
@@ -48,12 +48,6 @@
#define TLS_CIPHER_AES_CCM_128_SALT_SIZE 4
#define TLS_CIPHER_AES_CCM_128_TAG_SIZE 16
#define TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE 8
-#define TLS_CIPHER_CHACHA20_POLY1305 54
-#define TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE 12
-#define TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE 32
-#define TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE 0
-#define TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE 16
-#define TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE 8
#define TLS_SET_RECORD_TYPE 1
#define TLS_GET_RECORD_TYPE 2
struct tls_crypto_info {
@@ -81,13 +75,6 @@ struct tls12_crypto_info_aes_ccm_128 {
unsigned char salt[TLS_CIPHER_AES_CCM_128_SALT_SIZE];
unsigned char rec_seq[TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE];
};
-struct tls12_crypto_info_chacha20_poly1305 {
- struct tls_crypto_info info;
- unsigned char iv[TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE];
- unsigned char key[TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE];
- unsigned char salt[TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE];
- unsigned char rec_seq[TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE];
-};
enum {
TLS_INFO_UNSPEC,
TLS_INFO_VERSION,
diff --git a/libc/kernel/uapi/linux/udp.h b/libc/kernel/uapi/linux/udp.h
index 802c686c4..278cf6c11 100644
--- a/libc/kernel/uapi/linux/udp.h
+++ b/libc/kernel/uapi/linux/udp.h
@@ -37,5 +37,4 @@ struct __kernel_udphdr {
#define UDP_ENCAP_GTP0 4
#define UDP_ENCAP_GTP1U 5
#define UDP_ENCAP_RXRPC 6
-#define TCP_ENCAP_ESPINTCP 7
#endif
diff --git a/libc/kernel/uapi/linux/um_timetravel.h b/libc/kernel/uapi/linux/um_timetravel.h
deleted file mode 100644
index 220324fc6..000000000
--- a/libc/kernel/uapi/linux/um_timetravel.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_UM_TIMETRAVEL_H
-#define _UAPI_LINUX_UM_TIMETRAVEL_H
-#include <linux/types.h>
-struct um_timetravel_msg {
- __u32 op;
- __u32 seq;
- __u64 time;
-};
-enum um_timetravel_ops {
- UM_TIMETRAVEL_ACK = 0,
- UM_TIMETRAVEL_START = 1,
- UM_TIMETRAVEL_REQUEST = 2,
- UM_TIMETRAVEL_WAIT = 3,
- UM_TIMETRAVEL_GET = 4,
- UM_TIMETRAVEL_UPDATE = 5,
- UM_TIMETRAVEL_RUN = 6,
- UM_TIMETRAVEL_FREE_UNTIL = 7,
- UM_TIMETRAVEL_GET_TOD = 8,
-};
-#endif
diff --git a/libc/kernel/uapi/linux/usb/ch9.h b/libc/kernel/uapi/linux/usb/ch9.h
index f1dade98c..2d69abdc8 100644
--- a/libc/kernel/uapi/linux/usb/ch9.h
+++ b/libc/kernel/uapi/linux/usb/ch9.h
@@ -74,11 +74,11 @@
#define USB_DEVICE_A_HNP_SUPPORT 4
#define USB_DEVICE_A_ALT_HNP_SUPPORT 5
#define USB_DEVICE_DEBUG_MODE 6
-#define USB_TEST_J 1
-#define USB_TEST_K 2
-#define USB_TEST_SE0_NAK 3
-#define USB_TEST_PACKET 4
-#define USB_TEST_FORCE_ENABLE 5
+#define TEST_J 1
+#define TEST_K 2
+#define TEST_SE0_NAK 3
+#define TEST_PACKET 4
+#define TEST_FORCE_EN 5
#define USB_STATUS_TYPE_STANDARD 0
#define USB_STATUS_TYPE_PTM 1
#define USB_DEVICE_U1_ENABLE 48
@@ -176,10 +176,6 @@ struct usb_device_descriptor {
#define USB_CLASS_CONTENT_SEC 0x0d
#define USB_CLASS_VIDEO 0x0e
#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
-#define USB_CLASS_PERSONAL_HEALTHCARE 0x0f
-#define USB_CLASS_AUDIO_VIDEO 0x10
-#define USB_CLASS_BILLBOARD 0x11
-#define USB_CLASS_USB_TYPE_C_BRIDGE 0x12
#define USB_CLASS_MISC 0xef
#define USB_CLASS_APP_SPEC 0xfe
#define USB_CLASS_VENDOR_SPEC 0xff
@@ -199,7 +195,6 @@ struct usb_config_descriptor {
#define USB_CONFIG_ATT_SELFPOWER (1 << 6)
#define USB_CONFIG_ATT_WAKEUP (1 << 5)
#define USB_CONFIG_ATT_BATTERY (1 << 4)
-#define USB_MAX_STRING_LEN 126
struct usb_string_descriptor {
__u8 bLength;
__u8 bDescriptorType;
@@ -434,19 +429,9 @@ struct usb_ssp_cap_descriptor {
__le32 bmSublinkSpeedAttr[1];
#define USB_SSP_SUBLINK_SPEED_SSID (0xf)
#define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4)
-#define USB_SSP_SUBLINK_SPEED_LSE_BPS 0
-#define USB_SSP_SUBLINK_SPEED_LSE_KBPS 1
-#define USB_SSP_SUBLINK_SPEED_LSE_MBPS 2
-#define USB_SSP_SUBLINK_SPEED_LSE_GBPS 3
#define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6)
-#define USB_SSP_SUBLINK_SPEED_ST_SYM_RX 0
-#define USB_SSP_SUBLINK_SPEED_ST_ASYM_RX 1
-#define USB_SSP_SUBLINK_SPEED_ST_SYM_TX 2
-#define USB_SSP_SUBLINK_SPEED_ST_ASYM_TX 3
#define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8)
#define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14)
-#define USB_SSP_SUBLINK_SPEED_LP_SS 0
-#define USB_SSP_SUBLINK_SPEED_LP_SSP 1
#define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16)
} __attribute__((packed));
#define USB_PD_POWER_DELIVERY_CAPABILITY 0x06
diff --git a/libc/kernel/uapi/linux/usb/charger.h b/libc/kernel/uapi/linux/usb/charger.h
index e53f7d62f..0810aab1a 100644
--- a/libc/kernel/uapi/linux/usb/charger.h
+++ b/libc/kernel/uapi/linux/usb/charger.h
@@ -19,15 +19,15 @@
#ifndef _UAPI__LINUX_USB_CHARGER_H
#define _UAPI__LINUX_USB_CHARGER_H
enum usb_charger_type {
- UNKNOWN_TYPE = 0,
- SDP_TYPE = 1,
- DCP_TYPE = 2,
- CDP_TYPE = 3,
- ACA_TYPE = 4,
+ UNKNOWN_TYPE,
+ SDP_TYPE,
+ DCP_TYPE,
+ CDP_TYPE,
+ ACA_TYPE,
};
enum usb_charger_state {
- USB_CHARGER_DEFAULT = 0,
- USB_CHARGER_PRESENT = 1,
- USB_CHARGER_ABSENT = 2,
+ USB_CHARGER_DEFAULT,
+ USB_CHARGER_PRESENT,
+ USB_CHARGER_ABSENT,
};
#endif
diff --git a/libc/kernel/uapi/linux/usb/raw_gadget.h b/libc/kernel/uapi/linux/usb/raw_gadget.h
deleted file mode 100644
index 70d5a26e8..000000000
--- a/libc/kernel/uapi/linux/usb/raw_gadget.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI__LINUX_USB_RAW_GADGET_H
-#define _UAPI__LINUX_USB_RAW_GADGET_H
-#include <asm/ioctl.h>
-#include <linux/types.h>
-#include <linux/usb/ch9.h>
-#define UDC_NAME_LENGTH_MAX 128
-struct usb_raw_init {
- __u8 driver_name[UDC_NAME_LENGTH_MAX];
- __u8 device_name[UDC_NAME_LENGTH_MAX];
- __u8 speed;
-};
-enum usb_raw_event_type {
- USB_RAW_EVENT_INVALID = 0,
- USB_RAW_EVENT_CONNECT = 1,
- USB_RAW_EVENT_CONTROL = 2,
-};
-struct usb_raw_event {
- __u32 type;
- __u32 length;
- __u8 data[0];
-};
-#define USB_RAW_IO_FLAGS_ZERO 0x0001
-#define USB_RAW_IO_FLAGS_MASK 0x0001
-struct usb_raw_ep_io {
- __u16 ep;
- __u16 flags;
- __u32 length;
- __u8 data[0];
-};
-#define USB_RAW_EPS_NUM_MAX 30
-#define USB_RAW_EP_NAME_MAX 16
-#define USB_RAW_EP_ADDR_ANY 0xff
-struct usb_raw_ep_caps {
- __u32 type_control : 1;
- __u32 type_iso : 1;
- __u32 type_bulk : 1;
- __u32 type_int : 1;
- __u32 dir_in : 1;
- __u32 dir_out : 1;
-};
-struct usb_raw_ep_limits {
- __u16 maxpacket_limit;
- __u16 max_streams;
- __u32 reserved;
-};
-struct usb_raw_ep_info {
- __u8 name[USB_RAW_EP_NAME_MAX];
- __u32 addr;
- struct usb_raw_ep_caps caps;
- struct usb_raw_ep_limits limits;
-};
-struct usb_raw_eps_info {
- struct usb_raw_ep_info eps[USB_RAW_EPS_NUM_MAX];
-};
-#define USB_RAW_IOCTL_INIT _IOW('U', 0, struct usb_raw_init)
-#define USB_RAW_IOCTL_RUN _IO('U', 1)
-#define USB_RAW_IOCTL_EVENT_FETCH _IOR('U', 2, struct usb_raw_event)
-#define USB_RAW_IOCTL_EP0_WRITE _IOW('U', 3, struct usb_raw_ep_io)
-#define USB_RAW_IOCTL_EP0_READ _IOWR('U', 4, struct usb_raw_ep_io)
-#define USB_RAW_IOCTL_EP_ENABLE _IOW('U', 5, struct usb_endpoint_descriptor)
-#define USB_RAW_IOCTL_EP_DISABLE _IOW('U', 6, __u32)
-#define USB_RAW_IOCTL_EP_WRITE _IOW('U', 7, struct usb_raw_ep_io)
-#define USB_RAW_IOCTL_EP_READ _IOWR('U', 8, struct usb_raw_ep_io)
-#define USB_RAW_IOCTL_CONFIGURE _IO('U', 9)
-#define USB_RAW_IOCTL_VBUS_DRAW _IOW('U', 10, __u32)
-#define USB_RAW_IOCTL_EPS_INFO _IOR('U', 11, struct usb_raw_eps_info)
-#define USB_RAW_IOCTL_EP0_STALL _IO('U', 12)
-#define USB_RAW_IOCTL_EP_SET_HALT _IOW('U', 13, __u32)
-#define USB_RAW_IOCTL_EP_CLEAR_HALT _IOW('U', 14, __u32)
-#define USB_RAW_IOCTL_EP_SET_WEDGE _IOW('U', 15, __u32)
-#endif
diff --git a/libc/kernel/uapi/linux/usb/tmc.h b/libc/kernel/uapi/linux/usb/tmc.h
index 6d0add1e8..20c061b5e 100644
--- a/libc/kernel/uapi/linux/usb/tmc.h
+++ b/libc/kernel/uapi/linux/usb/tmc.h
@@ -86,8 +86,6 @@ struct usbtmc_message {
#define USBTMC488_IOCTL_WAIT_SRQ _IOW(USBTMC_IOC_NR, 23, __u32)
#define USBTMC_IOCTL_MSG_IN_ATTR _IOR(USBTMC_IOC_NR, 24, __u8)
#define USBTMC_IOCTL_AUTO_ABORT _IOW(USBTMC_IOC_NR, 25, __u8)
-#define USBTMC_IOCTL_GET_STB _IOR(USBTMC_IOC_NR, 26, __u8)
-#define USBTMC_IOCTL_GET_SRQ_STB _IOR(USBTMC_IOC_NR, 27, __u8)
#define USBTMC_IOCTL_CANCEL_IO _IO(USBTMC_IOC_NR, 35)
#define USBTMC_IOCTL_CLEANUP_IO _IO(USBTMC_IOC_NR, 36)
#define USBTMC488_CAPABILITY_TRIGGER 1
diff --git a/libc/kernel/uapi/linux/userfaultfd.h b/libc/kernel/uapi/linux/userfaultfd.h
index fc100aebb..ecc630229 100644
--- a/libc/kernel/uapi/linux/userfaultfd.h
+++ b/libc/kernel/uapi/linux/userfaultfd.h
@@ -20,16 +20,15 @@
#define _LINUX_USERFAULTFD_H
#include <linux/types.h>
#define UFFD_API ((__u64) 0xAA)
-#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID)
+#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | UFFD_FEATURE_EVENT_REMAP | UFFD_FEATURE_EVENT_REMOVE | UFFD_FEATURE_EVENT_UNMAP | UFFD_FEATURE_MISSING_HUGETLBFS | UFFD_FEATURE_MISSING_SHMEM | UFFD_FEATURE_SIGBUS | UFFD_FEATURE_THREAD_ID)
#define UFFD_API_IOCTLS ((__u64) 1 << _UFFDIO_REGISTER | (__u64) 1 << _UFFDIO_UNREGISTER | (__u64) 1 << _UFFDIO_API)
-#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE | (__u64) 1 << _UFFDIO_WRITEPROTECT)
+#define UFFD_API_RANGE_IOCTLS ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY | (__u64) 1 << _UFFDIO_ZEROPAGE)
#define UFFD_API_RANGE_IOCTLS_BASIC ((__u64) 1 << _UFFDIO_WAKE | (__u64) 1 << _UFFDIO_COPY)
#define _UFFDIO_REGISTER (0x00)
#define _UFFDIO_UNREGISTER (0x01)
#define _UFFDIO_WAKE (0x02)
#define _UFFDIO_COPY (0x03)
#define _UFFDIO_ZEROPAGE (0x04)
-#define _UFFDIO_WRITEPROTECT (0x06)
#define _UFFDIO_API (0x3F)
#define UFFDIO 0xAA
#define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, struct uffdio_api)
@@ -38,7 +37,6 @@
#define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, struct uffdio_range)
#define UFFDIO_COPY _IOWR(UFFDIO, _UFFDIO_COPY, struct uffdio_copy)
#define UFFDIO_ZEROPAGE _IOWR(UFFDIO, _UFFDIO_ZEROPAGE, struct uffdio_zeropage)
-#define UFFDIO_WRITEPROTECT _IOWR(UFFDIO, _UFFDIO_WRITEPROTECT, struct uffdio_writeprotect)
struct uffd_msg {
__u8 event;
__u8 reserved1;
@@ -108,7 +106,6 @@ struct uffdio_copy {
__u64 src;
__u64 len;
#define UFFDIO_COPY_MODE_DONTWAKE ((__u64) 1 << 0)
-#define UFFDIO_COPY_MODE_WP ((__u64) 1 << 1)
__u64 mode;
__s64 copy;
};
@@ -118,11 +115,4 @@ struct uffdio_zeropage {
__u64 mode;
__s64 zeropage;
};
-struct uffdio_writeprotect {
- struct uffdio_range range;
-#define UFFDIO_WRITEPROTECT_MODE_WP ((__u64) 1 << 0)
-#define UFFDIO_WRITEPROTECT_MODE_DONTWAKE ((__u64) 1 << 1)
- __u64 mode;
-};
-#define UFFD_USER_MODE_ONLY 1
#endif
diff --git a/libc/kernel/uapi/linux/v4l2-controls.h b/libc/kernel/uapi/linux/v4l2-controls.h
index 75e5ccdd2..85f3a8bd3 100644
--- a/libc/kernel/uapi/linux/v4l2-controls.h
+++ b/libc/kernel/uapi/linux/v4l2-controls.h
@@ -20,7 +20,7 @@
#define __LINUX_V4L2_CONTROLS_H
#include <linux/types.h>
#define V4L2_CTRL_CLASS_USER 0x00980000
-#define V4L2_CTRL_CLASS_CODEC 0x00990000
+#define V4L2_CTRL_CLASS_MPEG 0x00990000
#define V4L2_CTRL_CLASS_CAMERA 0x009a0000
#define V4L2_CTRL_CLASS_FM_TX 0x009b0000
#define V4L2_CTRL_CLASS_FLASH 0x009c0000
@@ -31,7 +31,6 @@
#define V4L2_CTRL_CLASS_FM_RX 0x00a10000
#define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000
#define V4L2_CTRL_CLASS_DETECT 0x00a30000
-#define V4L2_CTRL_CLASS_CODEC_STATELESS 0x00a40000
#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
#define V4L2_CID_USER_BASE V4L2_CID_BASE
#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
@@ -111,12 +110,9 @@ enum v4l2_colorfx {
#define V4L2_CID_USER_TC358743_BASE (V4L2_CID_USER_BASE + 0x1080)
#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090)
#define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x10b0)
-#define V4L2_CID_USER_ATMEL_ISC_BASE (V4L2_CID_USER_BASE + 0x10c0)
-#define V4L2_CID_USER_CODA_BASE (V4L2_CID_USER_BASE + 0x10e0)
-#define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0)
-#define V4L2_CID_CODEC_BASE (V4L2_CTRL_CLASS_CODEC | 0x900)
-#define V4L2_CID_CODEC_CLASS (V4L2_CTRL_CLASS_CODEC | 1)
-#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_CODEC_BASE + 0)
+#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
+#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
+#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE + 0)
enum v4l2_mpeg_stream_type {
V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0,
V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1,
@@ -125,24 +121,24 @@ enum v4l2_mpeg_stream_type {
V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4,
V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5,
};
-#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_CODEC_BASE + 1)
-#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_CODEC_BASE + 2)
-#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_CODEC_BASE + 3)
-#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_CODEC_BASE + 4)
-#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_CODEC_BASE + 5)
-#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_CODEC_BASE + 6)
-#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_CODEC_BASE + 7)
+#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE + 1)
+#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE + 2)
+#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE + 3)
+#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE + 4)
+#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE + 5)
+#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE + 6)
+#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE + 7)
enum v4l2_mpeg_stream_vbi_fmt {
V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,
V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,
};
-#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_CODEC_BASE + 100)
+#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE + 100)
enum v4l2_mpeg_audio_sampling_freq {
V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
};
-#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_CODEC_BASE + 101)
+#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE + 101)
enum v4l2_mpeg_audio_encoding {
V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
@@ -150,7 +146,7 @@ enum v4l2_mpeg_audio_encoding {
V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
};
-#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_CODEC_BASE + 102)
+#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE + 102)
enum v4l2_mpeg_audio_l1_bitrate {
V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
@@ -167,7 +163,7 @@ enum v4l2_mpeg_audio_l1_bitrate {
V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
};
-#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_CODEC_BASE + 103)
+#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE + 103)
enum v4l2_mpeg_audio_l2_bitrate {
V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
@@ -184,7 +180,7 @@ enum v4l2_mpeg_audio_l2_bitrate {
V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
};
-#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_CODEC_BASE + 104)
+#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE + 104)
enum v4l2_mpeg_audio_l3_bitrate {
V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
@@ -201,34 +197,34 @@ enum v4l2_mpeg_audio_l3_bitrate {
V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
};
-#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_CODEC_BASE + 105)
+#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE + 105)
enum v4l2_mpeg_audio_mode {
V4L2_MPEG_AUDIO_MODE_STEREO = 0,
V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
V4L2_MPEG_AUDIO_MODE_DUAL = 2,
V4L2_MPEG_AUDIO_MODE_MONO = 3,
};
-#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_CODEC_BASE + 106)
+#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE + 106)
enum v4l2_mpeg_audio_mode_extension {
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
};
-#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_CODEC_BASE + 107)
+#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE + 107)
enum v4l2_mpeg_audio_emphasis {
V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
};
-#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_CODEC_BASE + 108)
+#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE + 108)
enum v4l2_mpeg_audio_crc {
V4L2_MPEG_AUDIO_CRC_NONE = 0,
V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
};
-#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_CODEC_BASE + 109)
-#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_CODEC_BASE + 110)
-#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_CODEC_BASE + 111)
+#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE + 109)
+#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE + 110)
+#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE + 111)
enum v4l2_mpeg_audio_ac3_bitrate {
V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
@@ -250,7 +246,7 @@ enum v4l2_mpeg_audio_ac3_bitrate {
V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
};
-#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_CODEC_BASE + 112)
+#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE + 112)
enum v4l2_mpeg_audio_dec_playback {
V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
@@ -259,49 +255,48 @@ enum v4l2_mpeg_audio_dec_playback {
V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
};
-#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_CODEC_BASE + 113)
-#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_CODEC_BASE + 200)
+#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE + 113)
+#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE + 200)
enum v4l2_mpeg_video_encoding {
V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
};
-#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_CODEC_BASE + 201)
+#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE + 201)
enum v4l2_mpeg_video_aspect {
V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
};
-#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_CODEC_BASE + 202)
-#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_CODEC_BASE + 203)
-#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_CODEC_BASE + 204)
-#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_CODEC_BASE + 205)
-#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_CODEC_BASE + 206)
+#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE + 202)
+#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE + 203)
+#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE + 204)
+#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE + 205)
+#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE + 206)
enum v4l2_mpeg_video_bitrate_mode {
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
- V4L2_MPEG_VIDEO_BITRATE_MODE_CQ = 2,
-};
-#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_CODEC_BASE + 207)
-#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_CODEC_BASE + 208)
-#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_CODEC_BASE + 209)
-#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_CODEC_BASE + 210)
-#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_CODEC_BASE + 211)
-#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_CODEC_BASE + 212)
-#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_CODEC_BASE + 213)
-#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_CODEC_BASE + 214)
-#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_CODEC_BASE + 215)
-#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_CODEC_BASE + 216)
+};
+#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE + 207)
+#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE + 208)
+#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE + 209)
+#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE + 210)
+#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE + 211)
+#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE + 212)
+#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE + 213)
+#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE + 214)
+#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE + 215)
+#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE + 216)
enum v4l2_mpeg_video_header_mode {
V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
};
-#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_CODEC_BASE + 217)
-#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_CODEC_BASE + 218)
-#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_CODEC_BASE + 219)
-#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_CODEC_BASE + 220)
-#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_CODEC_BASE + 221)
+#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE + 217)
+#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE + 218)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE + 219)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE + 220)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE + 221)
enum v4l2_mpeg_video_multi_slice_mode {
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_MB = 1,
@@ -309,23 +304,22 @@ enum v4l2_mpeg_video_multi_slice_mode {
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
};
-#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_CODEC_BASE + 222)
-#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_CODEC_BASE + 223)
-#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_CODEC_BASE + 224)
-#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_CODEC_BASE + 225)
-#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_CODEC_BASE + 226)
-#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_CODEC_BASE + 227)
-#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_CODEC_BASE + 228)
-#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_CODEC_BASE + 229)
-#define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID (V4L2_CID_CODEC_BASE + 230)
-#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE + 270)
+#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE + 222)
+#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE + 223)
+#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE + 224)
+#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE + 225)
+#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE + 226)
+#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 227)
+#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE + 228)
+#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE + 229)
+#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE + 270)
enum v4l2_mpeg_video_mpeg2_level {
V4L2_MPEG_VIDEO_MPEG2_LEVEL_LOW = 0,
V4L2_MPEG_VIDEO_MPEG2_LEVEL_MAIN = 1,
V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH_1440 = 2,
V4L2_MPEG_VIDEO_MPEG2_LEVEL_HIGH = 3,
};
-#define V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE (V4L2_CID_CODEC_BASE + 271)
+#define V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE (V4L2_CID_MPEG_BASE + 271)
enum v4l2_mpeg_video_mpeg2_profile {
V4L2_MPEG_VIDEO_MPEG2_PROFILE_SIMPLE = 0,
V4L2_MPEG_VIDEO_MPEG2_PROFILE_MAIN = 1,
@@ -334,27 +328,27 @@ enum v4l2_mpeg_video_mpeg2_profile {
V4L2_MPEG_VIDEO_MPEG2_PROFILE_HIGH = 4,
V4L2_MPEG_VIDEO_MPEG2_PROFILE_MULTIVIEW = 5,
};
-#define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_CODEC_BASE + 290)
-#define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_CODEC_BASE + 291)
-#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_CODEC_BASE + 300)
-#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_CODEC_BASE + 301)
-#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_CODEC_BASE + 302)
-#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_CODEC_BASE + 303)
-#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_CODEC_BASE + 304)
-#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_CODEC_BASE + 350)
-#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_CODEC_BASE + 351)
-#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_CODEC_BASE + 352)
-#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_CODEC_BASE + 353)
-#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_CODEC_BASE + 354)
-#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_CODEC_BASE + 355)
-#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_CODEC_BASE + 356)
-#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_CODEC_BASE + 357)
+#define V4L2_CID_FWHT_I_FRAME_QP (V4L2_CID_MPEG_BASE + 290)
+#define V4L2_CID_FWHT_P_FRAME_QP (V4L2_CID_MPEG_BASE + 291)
+#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE + 300)
+#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE + 301)
+#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE + 302)
+#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE + 303)
+#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE + 304)
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE + 350)
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE + 351)
+#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE + 352)
+#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE + 353)
+#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE + 354)
+#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE + 355)
+#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE + 356)
+#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE + 357)
enum v4l2_mpeg_video_h264_entropy_mode {
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
};
-#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_CODEC_BASE + 358)
-#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_CODEC_BASE + 359)
+#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE + 358)
+#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE + 359)
enum v4l2_mpeg_video_h264_level {
V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
@@ -372,20 +366,16 @@ enum v4l2_mpeg_video_h264_level {
V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
- V4L2_MPEG_VIDEO_H264_LEVEL_5_2 = 16,
- V4L2_MPEG_VIDEO_H264_LEVEL_6_0 = 17,
- V4L2_MPEG_VIDEO_H264_LEVEL_6_1 = 18,
- V4L2_MPEG_VIDEO_H264_LEVEL_6_2 = 19,
-};
-#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_CODEC_BASE + 360)
-#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_CODEC_BASE + 361)
-#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_CODEC_BASE + 362)
+};
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE + 360)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE + 361)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE + 362)
enum v4l2_mpeg_video_h264_loop_filter_mode {
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
};
-#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_CODEC_BASE + 363)
+#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE + 363)
enum v4l2_mpeg_video_h264_profile {
V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
@@ -404,12 +394,11 @@ enum v4l2_mpeg_video_h264_profile {
V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
- V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH = 17,
};
-#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_CODEC_BASE + 364)
-#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_CODEC_BASE + 365)
-#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_CODEC_BASE + 366)
-#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_CODEC_BASE + 367)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE + 364)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE + 365)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE + 366)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE + 367)
enum v4l2_mpeg_video_h264_vui_sar_idc {
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
@@ -430,9 +419,9 @@ enum v4l2_mpeg_video_h264_vui_sar_idc {
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
};
-#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_CODEC_BASE + 368)
-#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_CODEC_BASE + 369)
-#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_CODEC_BASE + 370)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE + 368)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE + 369)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE + 370)
enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHECKERBOARD = 0,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1,
@@ -441,8 +430,8 @@ enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4,
V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5,
};
-#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_CODEC_BASE + 371)
-#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_CODEC_BASE + 372)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE + 371)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE + 372)
enum v4l2_mpeg_video_h264_fmo_map_type {
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
@@ -452,45 +441,36 @@ enum v4l2_mpeg_video_h264_fmo_map_type {
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
};
-#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_CODEC_BASE + 373)
-#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_CODEC_BASE + 374)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE + 373)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE + 374)
enum v4l2_mpeg_video_h264_fmo_change_dir {
V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
};
-#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_CODEC_BASE + 375)
-#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_CODEC_BASE + 376)
-#define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_CODEC_BASE + 377)
-#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_CODEC_BASE + 378)
-#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_CODEC_BASE + 379)
-#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_CODEC_BASE + 380)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE + 375)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE + 376)
+#define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE + 377)
+#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE + 378)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE + 379)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE + 380)
enum v4l2_mpeg_video_h264_hierarchical_coding_type {
V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
};
-#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_CODEC_BASE + 381)
-#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_CODEC_BASE + 382)
-#define V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION (V4L2_CID_CODEC_BASE + 383)
-#define V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET (V4L2_CID_CODEC_BASE + 384)
-#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 385)
-#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 386)
-#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 387)
-#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 388)
-#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 389)
-#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 390)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L0_BR (V4L2_CID_CODEC_BASE + 391)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L1_BR (V4L2_CID_CODEC_BASE + 392)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L2_BR (V4L2_CID_CODEC_BASE + 393)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L3_BR (V4L2_CID_CODEC_BASE + 394)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L4_BR (V4L2_CID_CODEC_BASE + 395)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L5_BR (V4L2_CID_CODEC_BASE + 396)
-#define V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L6_BR (V4L2_CID_CODEC_BASE + 397)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_CODEC_BASE + 400)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_CODEC_BASE + 401)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_CODEC_BASE + 402)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_CODEC_BASE + 403)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_CODEC_BASE + 404)
-#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_CODEC_BASE + 405)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE + 381)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE + 382)
+#define V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION (V4L2_CID_MPEG_BASE + 383)
+#define V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET (V4L2_CID_MPEG_BASE + 384)
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP (V4L2_CID_MPEG_BASE + 385)
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP (V4L2_CID_MPEG_BASE + 386)
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP (V4L2_CID_MPEG_BASE + 387)
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP (V4L2_CID_MPEG_BASE + 388)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE + 400)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE + 401)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE + 402)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE + 403)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE + 404)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE + 405)
enum v4l2_mpeg_video_mpeg4_level {
V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
@@ -501,7 +481,7 @@ enum v4l2_mpeg_video_mpeg4_level {
V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
};
-#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_CODEC_BASE + 406)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE + 406)
enum v4l2_mpeg_video_mpeg4_profile {
V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
@@ -509,34 +489,34 @@ enum v4l2_mpeg_video_mpeg4_profile {
V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
};
-#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_CODEC_BASE + 407)
-#define V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS (V4L2_CID_CODEC_BASE + 500)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE + 407)
+#define V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS (V4L2_CID_MPEG_BASE + 500)
enum v4l2_vp8_num_partitions {
V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION = 0,
V4L2_CID_MPEG_VIDEO_VPX_2_PARTITIONS = 1,
V4L2_CID_MPEG_VIDEO_VPX_4_PARTITIONS = 2,
V4L2_CID_MPEG_VIDEO_VPX_8_PARTITIONS = 3,
};
-#define V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4 (V4L2_CID_CODEC_BASE + 501)
-#define V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES (V4L2_CID_CODEC_BASE + 502)
+#define V4L2_CID_MPEG_VIDEO_VPX_IMD_DISABLE_4X4 (V4L2_CID_MPEG_BASE + 501)
+#define V4L2_CID_MPEG_VIDEO_VPX_NUM_REF_FRAMES (V4L2_CID_MPEG_BASE + 502)
enum v4l2_vp8_num_ref_frames {
V4L2_CID_MPEG_VIDEO_VPX_1_REF_FRAME = 0,
V4L2_CID_MPEG_VIDEO_VPX_2_REF_FRAME = 1,
V4L2_CID_MPEG_VIDEO_VPX_3_REF_FRAME = 2,
};
-#define V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL (V4L2_CID_CODEC_BASE + 503)
-#define V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS (V4L2_CID_CODEC_BASE + 504)
-#define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD (V4L2_CID_CODEC_BASE + 505)
-#define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (V4L2_CID_CODEC_BASE + 506)
+#define V4L2_CID_MPEG_VIDEO_VPX_FILTER_LEVEL (V4L2_CID_MPEG_BASE + 503)
+#define V4L2_CID_MPEG_VIDEO_VPX_FILTER_SHARPNESS (V4L2_CID_MPEG_BASE + 504)
+#define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD (V4L2_CID_MPEG_BASE + 505)
+#define V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_SEL (V4L2_CID_MPEG_BASE + 506)
enum v4l2_vp8_golden_frame_sel {
V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_PREV = 0,
V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_USE_REF_PERIOD = 1,
};
-#define V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (V4L2_CID_CODEC_BASE + 507)
-#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_CODEC_BASE + 508)
-#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_CODEC_BASE + 509)
-#define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_CODEC_BASE + 510)
-#define V4L2_CID_MPEG_VIDEO_VP8_PROFILE (V4L2_CID_CODEC_BASE + 511)
+#define V4L2_CID_MPEG_VIDEO_VPX_MIN_QP (V4L2_CID_MPEG_BASE + 507)
+#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE + 508)
+#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE + 509)
+#define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE + 510)
+#define V4L2_CID_MPEG_VIDEO_VP8_PROFILE (V4L2_CID_MPEG_BASE + 511)
enum v4l2_mpeg_video_vp8_profile {
V4L2_MPEG_VIDEO_VP8_PROFILE_0 = 0,
V4L2_MPEG_VIDEO_VP8_PROFILE_1 = 1,
@@ -544,56 +524,39 @@ enum v4l2_mpeg_video_vp8_profile {
V4L2_MPEG_VIDEO_VP8_PROFILE_3 = 3,
};
#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE V4L2_CID_MPEG_VIDEO_VP8_PROFILE
-#define V4L2_CID_MPEG_VIDEO_VP9_PROFILE (V4L2_CID_CODEC_BASE + 512)
+#define V4L2_CID_MPEG_VIDEO_VP9_PROFILE (V4L2_CID_MPEG_BASE + 512)
enum v4l2_mpeg_video_vp9_profile {
V4L2_MPEG_VIDEO_VP9_PROFILE_0 = 0,
V4L2_MPEG_VIDEO_VP9_PROFILE_1 = 1,
V4L2_MPEG_VIDEO_VP9_PROFILE_2 = 2,
V4L2_MPEG_VIDEO_VP9_PROFILE_3 = 3,
};
-#define V4L2_CID_MPEG_VIDEO_VP9_LEVEL (V4L2_CID_CODEC_BASE + 513)
-enum v4l2_mpeg_video_vp9_level {
- V4L2_MPEG_VIDEO_VP9_LEVEL_1_0 = 0,
- V4L2_MPEG_VIDEO_VP9_LEVEL_1_1 = 1,
- V4L2_MPEG_VIDEO_VP9_LEVEL_2_0 = 2,
- V4L2_MPEG_VIDEO_VP9_LEVEL_2_1 = 3,
- V4L2_MPEG_VIDEO_VP9_LEVEL_3_0 = 4,
- V4L2_MPEG_VIDEO_VP9_LEVEL_3_1 = 5,
- V4L2_MPEG_VIDEO_VP9_LEVEL_4_0 = 6,
- V4L2_MPEG_VIDEO_VP9_LEVEL_4_1 = 7,
- V4L2_MPEG_VIDEO_VP9_LEVEL_5_0 = 8,
- V4L2_MPEG_VIDEO_VP9_LEVEL_5_1 = 9,
- V4L2_MPEG_VIDEO_VP9_LEVEL_5_2 = 10,
- V4L2_MPEG_VIDEO_VP9_LEVEL_6_0 = 11,
- V4L2_MPEG_VIDEO_VP9_LEVEL_6_1 = 12,
- V4L2_MPEG_VIDEO_VP9_LEVEL_6_2 = 13,
-};
-#define V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP (V4L2_CID_CODEC_BASE + 600)
-#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP (V4L2_CID_CODEC_BASE + 601)
-#define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP (V4L2_CID_CODEC_BASE + 602)
-#define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP (V4L2_CID_CODEC_BASE + 603)
-#define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP (V4L2_CID_CODEC_BASE + 604)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP (V4L2_CID_CODEC_BASE + 605)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE (V4L2_CID_CODEC_BASE + 606)
+#define V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP (V4L2_CID_MPEG_BASE + 600)
+#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP (V4L2_CID_MPEG_BASE + 601)
+#define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP (V4L2_CID_MPEG_BASE + 602)
+#define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP (V4L2_CID_MPEG_BASE + 603)
+#define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP (V4L2_CID_MPEG_BASE + 604)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_QP (V4L2_CID_MPEG_BASE + 605)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_TYPE (V4L2_CID_MPEG_BASE + 606)
enum v4l2_mpeg_video_hevc_hier_coding_type {
V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B = 0,
V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P = 1,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER (V4L2_CID_CODEC_BASE + 607)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP (V4L2_CID_CODEC_BASE + 608)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP (V4L2_CID_CODEC_BASE + 609)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP (V4L2_CID_CODEC_BASE + 610)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP (V4L2_CID_CODEC_BASE + 611)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP (V4L2_CID_CODEC_BASE + 612)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP (V4L2_CID_CODEC_BASE + 613)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP (V4L2_CID_CODEC_BASE + 614)
-#define V4L2_CID_MPEG_VIDEO_HEVC_PROFILE (V4L2_CID_CODEC_BASE + 615)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER (V4L2_CID_MPEG_BASE + 607)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_QP (V4L2_CID_MPEG_BASE + 608)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_QP (V4L2_CID_MPEG_BASE + 609)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_QP (V4L2_CID_MPEG_BASE + 610)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_QP (V4L2_CID_MPEG_BASE + 611)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_QP (V4L2_CID_MPEG_BASE + 612)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_QP (V4L2_CID_MPEG_BASE + 613)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_QP (V4L2_CID_MPEG_BASE + 614)
+#define V4L2_CID_MPEG_VIDEO_HEVC_PROFILE (V4L2_CID_MPEG_BASE + 615)
enum v4l2_mpeg_video_hevc_profile {
V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN = 0,
V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE = 1,
V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10 = 2,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_LEVEL (V4L2_CID_CODEC_BASE + 616)
+#define V4L2_CID_MPEG_VIDEO_HEVC_LEVEL (V4L2_CID_MPEG_BASE + 616)
enum v4l2_mpeg_video_hevc_level {
V4L2_MPEG_VIDEO_HEVC_LEVEL_1 = 0,
V4L2_MPEG_VIDEO_HEVC_LEVEL_2 = 1,
@@ -609,75 +572,62 @@ enum v4l2_mpeg_video_hevc_level {
V4L2_MPEG_VIDEO_HEVC_LEVEL_6_1 = 11,
V4L2_MPEG_VIDEO_HEVC_LEVEL_6_2 = 12,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION (V4L2_CID_CODEC_BASE + 617)
-#define V4L2_CID_MPEG_VIDEO_HEVC_TIER (V4L2_CID_CODEC_BASE + 618)
+#define V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION (V4L2_CID_MPEG_BASE + 617)
+#define V4L2_CID_MPEG_VIDEO_HEVC_TIER (V4L2_CID_MPEG_BASE + 618)
enum v4l2_mpeg_video_hevc_tier {
V4L2_MPEG_VIDEO_HEVC_TIER_MAIN = 0,
V4L2_MPEG_VIDEO_HEVC_TIER_HIGH = 1,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH (V4L2_CID_CODEC_BASE + 619)
-#define V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE (V4L2_CID_CODEC_BASE + 620)
+#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH (V4L2_CID_MPEG_BASE + 619)
+#define V4L2_CID_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE + 620)
enum v4l2_cid_mpeg_video_hevc_loop_filter_mode {
V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED = 0,
V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_ENABLED = 1,
V4L2_MPEG_VIDEO_HEVC_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2 (V4L2_CID_CODEC_BASE + 621)
-#define V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2 (V4L2_CID_CODEC_BASE + 622)
-#define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE (V4L2_CID_CODEC_BASE + 623)
+#define V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 621)
+#define V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2 (V4L2_CID_MPEG_BASE + 622)
+#define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE (V4L2_CID_MPEG_BASE + 623)
enum v4l2_cid_mpeg_video_hevc_refresh_type {
V4L2_MPEG_VIDEO_HEVC_REFRESH_NONE = 0,
V4L2_MPEG_VIDEO_HEVC_REFRESH_CRA = 1,
V4L2_MPEG_VIDEO_HEVC_REFRESH_IDR = 2,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD (V4L2_CID_CODEC_BASE + 624)
-#define V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU (V4L2_CID_CODEC_BASE + 625)
-#define V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED (V4L2_CID_CODEC_BASE + 626)
-#define V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT (V4L2_CID_CODEC_BASE + 627)
-#define V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB (V4L2_CID_CODEC_BASE + 628)
-#define V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID (V4L2_CID_CODEC_BASE + 629)
-#define V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING (V4L2_CID_CODEC_BASE + 630)
-#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1 (V4L2_CID_CODEC_BASE + 631)
-#define V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT (V4L2_CID_CODEC_BASE + 632)
-#define V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION (V4L2_CID_CODEC_BASE + 633)
-#define V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE (V4L2_CID_CODEC_BASE + 634)
-#define V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD (V4L2_CID_CODEC_BASE + 635)
+#define V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD (V4L2_CID_MPEG_BASE + 624)
+#define V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU (V4L2_CID_MPEG_BASE + 625)
+#define V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED (V4L2_CID_MPEG_BASE + 626)
+#define V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT (V4L2_CID_MPEG_BASE + 627)
+#define V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB (V4L2_CID_MPEG_BASE + 628)
+#define V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID (V4L2_CID_MPEG_BASE + 629)
+#define V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING (V4L2_CID_MPEG_BASE + 630)
+#define V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1 (V4L2_CID_MPEG_BASE + 631)
+#define V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT (V4L2_CID_MPEG_BASE + 632)
+#define V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION (V4L2_CID_MPEG_BASE + 633)
+#define V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE (V4L2_CID_MPEG_BASE + 634)
+#define V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD (V4L2_CID_MPEG_BASE + 635)
enum v4l2_cid_mpeg_video_hevc_size_of_length_field {
V4L2_MPEG_VIDEO_HEVC_SIZE_0 = 0,
V4L2_MPEG_VIDEO_HEVC_SIZE_1 = 1,
V4L2_MPEG_VIDEO_HEVC_SIZE_2 = 2,
V4L2_MPEG_VIDEO_HEVC_SIZE_4 = 3,
};
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BR (V4L2_CID_CODEC_BASE + 636)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BR (V4L2_CID_CODEC_BASE + 637)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BR (V4L2_CID_CODEC_BASE + 638)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BR (V4L2_CID_CODEC_BASE + 639)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BR (V4L2_CID_CODEC_BASE + 640)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BR (V4L2_CID_CODEC_BASE + 641)
-#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_CODEC_BASE + 642)
-#define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_CODEC_BASE + 643)
-#define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_CODEC_BASE + 644)
-#define V4L2_CID_MPEG_VIDEO_CONSTANT_QUALITY (V4L2_CID_CODEC_BASE + 645)
-#define V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE (V4L2_CID_CODEC_BASE + 646)
-enum v4l2_mpeg_video_frame_skip_mode {
- V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
- V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
- V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
-};
-#define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 647)
-#define V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 648)
-#define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 649)
-#define V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 650)
-#define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QP (V4L2_CID_CODEC_BASE + 651)
-#define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QP (V4L2_CID_CODEC_BASE + 652)
-#define V4L2_CID_CODEC_CX2341X_BASE (V4L2_CTRL_CLASS_CODEC | 0x1000)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_CODEC_CX2341X_BASE + 0)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L0_BR (V4L2_CID_MPEG_BASE + 636)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L1_BR (V4L2_CID_MPEG_BASE + 637)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L2_BR (V4L2_CID_MPEG_BASE + 638)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L3_BR (V4L2_CID_MPEG_BASE + 639)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L4_BR (V4L2_CID_MPEG_BASE + 640)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L5_BR (V4L2_CID_MPEG_BASE + 641)
+#define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_MPEG_BASE + 642)
+#define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643)
+#define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644)
+#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE + 0)
enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
};
-#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_CODEC_CX2341X_BASE + 1)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_CODEC_CX2341X_BASE + 2)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE + 1)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE + 2)
enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
@@ -685,18 +635,18 @@ enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
};
-#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_CODEC_CX2341X_BASE + 3)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE + 3)
enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
};
-#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_CODEC_CX2341X_BASE + 4)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE + 4)
enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
};
-#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_CODEC_CX2341X_BASE + 5)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_CODEC_CX2341X_BASE + 6)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE + 5)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE + 6)
enum v4l2_mpeg_cx2341x_video_median_filter_type {
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
@@ -704,35 +654,35 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
};
-#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_CODEC_CX2341X_BASE + 7)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_CODEC_CX2341X_BASE + 8)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_CODEC_CX2341X_BASE + 9)
-#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_CODEC_CX2341X_BASE + 10)
-#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_CODEC_CX2341X_BASE + 11)
-#define V4L2_CID_CODEC_MFC51_BASE (V4L2_CTRL_CLASS_CODEC | 0x1100)
-#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_CODEC_MFC51_BASE + 0)
-#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_CODEC_MFC51_BASE + 1)
-#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_CODEC_MFC51_BASE + 2)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE + 7)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE + 8)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE + 9)
+#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE + 10)
+#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE + 11)
+#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE + 0)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE + 1)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE + 2)
enum v4l2_mpeg_mfc51_video_frame_skip_mode {
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
};
-#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_CODEC_MFC51_BASE + 3)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE + 3)
enum v4l2_mpeg_mfc51_video_force_frame_type {
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
};
-#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_CODEC_MFC51_BASE + 4)
-#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_CODEC_MFC51_BASE + 5)
-#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_CODEC_MFC51_BASE + 6)
-#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_CODEC_MFC51_BASE + 7)
-#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_CODEC_MFC51_BASE + 50)
-#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_CODEC_MFC51_BASE + 51)
-#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_CODEC_MFC51_BASE + 52)
-#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_CODEC_MFC51_BASE + 53)
-#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_CODEC_MFC51_BASE + 54)
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE + 4)
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE + 5)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE + 6)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE + 7)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE + 50)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE + 51)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE + 52)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE + 53)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE + 54)
#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE + 1)
@@ -825,11 +775,6 @@ enum v4l2_auto_focus_range {
};
#define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE + 32)
#define V4L2_CID_TILT_SPEED (V4L2_CID_CAMERA_CLASS_BASE + 33)
-#define V4L2_CID_CAMERA_ORIENTATION (V4L2_CID_CAMERA_CLASS_BASE + 34)
-#define V4L2_CAMERA_ORIENTATION_FRONT 0
-#define V4L2_CAMERA_ORIENTATION_BACK 1
-#define V4L2_CAMERA_ORIENTATION_EXTERNAL 2
-#define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE + 35)
#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
@@ -999,198 +944,4 @@ enum v4l2_detect_md_mode {
#define V4L2_CID_DETECT_MD_GLOBAL_THRESHOLD (V4L2_CID_DETECT_CLASS_BASE + 2)
#define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)
#define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4)
-#define V4L2_CID_CODEC_STATELESS_BASE (V4L2_CTRL_CLASS_CODEC_STATELESS | 0x900)
-#define V4L2_CID_CODEC_STATELESS_CLASS (V4L2_CTRL_CLASS_CODEC_STATELESS | 1)
-#define V4L2_CID_STATELESS_H264_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 0)
-enum v4l2_stateless_h264_decode_mode {
- V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED,
- V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED,
-};
-#define V4L2_CID_STATELESS_H264_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 1)
-enum v4l2_stateless_h264_start_code {
- V4L2_STATELESS_H264_START_CODE_NONE,
- V4L2_STATELESS_H264_START_CODE_ANNEX_B,
-};
-#define V4L2_H264_SPS_CONSTRAINT_SET0_FLAG 0x01
-#define V4L2_H264_SPS_CONSTRAINT_SET1_FLAG 0x02
-#define V4L2_H264_SPS_CONSTRAINT_SET2_FLAG 0x04
-#define V4L2_H264_SPS_CONSTRAINT_SET3_FLAG 0x08
-#define V4L2_H264_SPS_CONSTRAINT_SET4_FLAG 0x10
-#define V4L2_H264_SPS_CONSTRAINT_SET5_FLAG 0x20
-#define V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE 0x01
-#define V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS 0x02
-#define V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO 0x04
-#define V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED 0x08
-#define V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY 0x10
-#define V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD 0x20
-#define V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE 0x40
-#define V4L2_H264_SPS_HAS_CHROMA_FORMAT(sps) ((sps)->profile_idc == 100 || (sps)->profile_idc == 110 || (sps)->profile_idc == 122 || (sps)->profile_idc == 244 || (sps)->profile_idc == 44 || (sps)->profile_idc == 83 || (sps)->profile_idc == 86 || (sps)->profile_idc == 118 || (sps)->profile_idc == 128 || (sps)->profile_idc == 138 || (sps)->profile_idc == 139 || (sps)->profile_idc == 134 || (sps)->profile_idc == 135)
-#define V4L2_CID_STATELESS_H264_SPS (V4L2_CID_CODEC_STATELESS_BASE + 2)
-struct v4l2_ctrl_h264_sps {
- __u8 profile_idc;
- __u8 constraint_set_flags;
- __u8 level_idc;
- __u8 seq_parameter_set_id;
- __u8 chroma_format_idc;
- __u8 bit_depth_luma_minus8;
- __u8 bit_depth_chroma_minus8;
- __u8 log2_max_frame_num_minus4;
- __u8 pic_order_cnt_type;
- __u8 log2_max_pic_order_cnt_lsb_minus4;
- __u8 max_num_ref_frames;
- __u8 num_ref_frames_in_pic_order_cnt_cycle;
- __s32 offset_for_ref_frame[255];
- __s32 offset_for_non_ref_pic;
- __s32 offset_for_top_to_bottom_field;
- __u16 pic_width_in_mbs_minus1;
- __u16 pic_height_in_map_units_minus1;
- __u32 flags;
-};
-#define V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE 0x0001
-#define V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT 0x0002
-#define V4L2_H264_PPS_FLAG_WEIGHTED_PRED 0x0004
-#define V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT 0x0008
-#define V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED 0x0010
-#define V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT 0x0020
-#define V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE 0x0040
-#define V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT 0x0080
-#define V4L2_CID_STATELESS_H264_PPS (V4L2_CID_CODEC_STATELESS_BASE + 3)
-struct v4l2_ctrl_h264_pps {
- __u8 pic_parameter_set_id;
- __u8 seq_parameter_set_id;
- __u8 num_slice_groups_minus1;
- __u8 num_ref_idx_l0_default_active_minus1;
- __u8 num_ref_idx_l1_default_active_minus1;
- __u8 weighted_bipred_idc;
- __s8 pic_init_qp_minus26;
- __s8 pic_init_qs_minus26;
- __s8 chroma_qp_index_offset;
- __s8 second_chroma_qp_index_offset;
- __u16 flags;
-};
-#define V4L2_CID_STATELESS_H264_SCALING_MATRIX (V4L2_CID_CODEC_STATELESS_BASE + 4)
-struct v4l2_ctrl_h264_scaling_matrix {
- __u8 scaling_list_4x4[6][16];
- __u8 scaling_list_8x8[6][64];
-};
-struct v4l2_h264_weight_factors {
- __s16 luma_weight[32];
- __s16 luma_offset[32];
- __s16 chroma_weight[32][2];
- __s16 chroma_offset[32][2];
-};
-#define V4L2_H264_CTRL_PRED_WEIGHTS_REQUIRED(pps,slice) ((((pps)->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) && ((slice)->slice_type == V4L2_H264_SLICE_TYPE_P || (slice)->slice_type == V4L2_H264_SLICE_TYPE_SP)) || ((pps)->weighted_bipred_idc == 1 && (slice)->slice_type == V4L2_H264_SLICE_TYPE_B))
-#define V4L2_CID_STATELESS_H264_PRED_WEIGHTS (V4L2_CID_CODEC_STATELESS_BASE + 5)
-struct v4l2_ctrl_h264_pred_weights {
- __u16 luma_log2_weight_denom;
- __u16 chroma_log2_weight_denom;
- struct v4l2_h264_weight_factors weight_factors[2];
-};
-#define V4L2_H264_SLICE_TYPE_P 0
-#define V4L2_H264_SLICE_TYPE_B 1
-#define V4L2_H264_SLICE_TYPE_I 2
-#define V4L2_H264_SLICE_TYPE_SP 3
-#define V4L2_H264_SLICE_TYPE_SI 4
-#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01
-#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02
-#define V4L2_H264_TOP_FIELD_REF 0x1
-#define V4L2_H264_BOTTOM_FIELD_REF 0x2
-#define V4L2_H264_FRAME_REF 0x3
-struct v4l2_h264_reference {
- __u8 fields;
- __u8 index;
-};
-#define V4L2_H264_NUM_DPB_ENTRIES 16
-#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES)
-#define V4L2_CID_STATELESS_H264_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 6)
-struct v4l2_ctrl_h264_slice_params {
- __u32 header_bit_size;
- __u32 first_mb_in_slice;
- __u8 slice_type;
- __u8 colour_plane_id;
- __u8 redundant_pic_cnt;
- __u8 cabac_init_idc;
- __s8 slice_qp_delta;
- __s8 slice_qs_delta;
- __u8 disable_deblocking_filter_idc;
- __s8 slice_alpha_c0_offset_div2;
- __s8 slice_beta_offset_div2;
- __u8 num_ref_idx_l0_active_minus1;
- __u8 num_ref_idx_l1_active_minus1;
- __u8 reserved;
- struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_LIST_LEN];
- struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_LIST_LEN];
- __u32 flags;
-};
-#define V4L2_H264_DPB_ENTRY_FLAG_VALID 0x01
-#define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x02
-#define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x04
-#define V4L2_H264_DPB_ENTRY_FLAG_FIELD 0x08
-struct v4l2_h264_dpb_entry {
- __u64 reference_ts;
- __u32 pic_num;
- __u16 frame_num;
- __u8 fields;
- __u8 reserved[5];
- __s32 top_field_order_cnt;
- __s32 bottom_field_order_cnt;
- __u32 flags;
-};
-#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01
-#define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02
-#define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04
-#define V4L2_CID_STATELESS_H264_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 7)
-struct v4l2_ctrl_h264_decode_params {
- struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES];
- __u16 nal_ref_idc;
- __u16 frame_num;
- __s32 top_field_order_cnt;
- __s32 bottom_field_order_cnt;
- __u16 idr_pic_id;
- __u16 pic_order_cnt_lsb;
- __s32 delta_pic_order_cnt_bottom;
- __s32 delta_pic_order_cnt0;
- __s32 delta_pic_order_cnt1;
- __u32 dec_ref_pic_marking_bit_size;
- __u32 pic_order_cnt_bit_size;
- __u32 slice_group_change_cycle;
- __u32 reserved;
- __u32 flags;
-};
-#define V4L2_FWHT_VERSION 3
-#define V4L2_FWHT_FL_IS_INTERLACED BIT(0)
-#define V4L2_FWHT_FL_IS_BOTTOM_FIRST BIT(1)
-#define V4L2_FWHT_FL_IS_ALTERNATE BIT(2)
-#define V4L2_FWHT_FL_IS_BOTTOM_FIELD BIT(3)
-#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED BIT(4)
-#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED BIT(5)
-#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED BIT(6)
-#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT BIT(7)
-#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH BIT(8)
-#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED BIT(9)
-#define V4L2_FWHT_FL_I_FRAME BIT(10)
-#define V4L2_FWHT_FL_COMPONENTS_NUM_MSK GENMASK(18, 16)
-#define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET 16
-#define V4L2_FWHT_FL_PIXENC_MSK GENMASK(20, 19)
-#define V4L2_FWHT_FL_PIXENC_OFFSET 19
-#define V4L2_FWHT_FL_PIXENC_YUV (1 << V4L2_FWHT_FL_PIXENC_OFFSET)
-#define V4L2_FWHT_FL_PIXENC_RGB (2 << V4L2_FWHT_FL_PIXENC_OFFSET)
-#define V4L2_FWHT_FL_PIXENC_HSV (3 << V4L2_FWHT_FL_PIXENC_OFFSET)
-#define V4L2_CID_STATELESS_FWHT_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 100)
-struct v4l2_ctrl_fwht_params {
- __u64 backward_ref_ts;
- __u32 version;
- __u32 width;
- __u32 height;
- __u32 flags;
- __u32 colorspace;
- __u32 xfer_func;
- __u32 ycbcr_enc;
- __u32 quantization;
-};
-#define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC
-#define V4L2_CID_MPEG_CLASS V4L2_CID_CODEC_CLASS
-#define V4L2_CID_MPEG_BASE V4L2_CID_CODEC_BASE
-#define V4L2_CID_MPEG_CX2341X_BASE V4L2_CID_CODEC_CX2341X_BASE
-#define V4L2_CID_MPEG_MFC51_BASE V4L2_CID_CODEC_MFC51_BASE
#endif
diff --git a/libc/kernel/uapi/linux/v4l2-mediabus.h b/libc/kernel/uapi/linux/v4l2-mediabus.h
index 157c0ac61..252860f75 100644
--- a/libc/kernel/uapi/linux/v4l2-mediabus.h
+++ b/libc/kernel/uapi/linux/v4l2-mediabus.h
@@ -21,21 +21,16 @@
#include <linux/media-bus-format.h>
#include <linux/types.h>
#include <linux/videodev2.h>
-#define V4L2_MBUS_FRAMEFMT_SET_CSC 0x0001
struct v4l2_mbus_framefmt {
__u32 width;
__u32 height;
__u32 code;
__u32 field;
__u32 colorspace;
- union {
- __u16 ycbcr_enc;
- __u16 hsv_enc;
- };
+ __u16 ycbcr_enc;
__u16 quantization;
__u16 xfer_func;
- __u16 flags;
- __u16 reserved[10];
+ __u16 reserved[11];
};
#define V4L2_MBUS_FROM_MEDIA_BUS_FMT(name) V4L2_MBUS_FMT_ ##name = MEDIA_BUS_FMT_ ##name
enum v4l2_mbus_pixelcode {
diff --git a/libc/kernel/uapi/linux/v4l2-subdev.h b/libc/kernel/uapi/linux/v4l2-subdev.h
index 2954dc308..303d167c3 100644
--- a/libc/kernel/uapi/linux/v4l2-subdev.h
+++ b/libc/kernel/uapi/linux/v4l2-subdev.h
@@ -38,18 +38,12 @@ struct v4l2_subdev_crop {
struct v4l2_rect rect;
__u32 reserved[8];
};
-#define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001
-#define V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC 0x00000002
-#define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC 0x00000004
-#define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
-#define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION 0x00000008
struct v4l2_subdev_mbus_code_enum {
__u32 pad;
__u32 index;
__u32 code;
__u32 which;
- __u32 flags;
- __u32 reserved[7];
+ __u32 reserved[8];
};
struct v4l2_subdev_frame_size_enum {
__u32 index;
@@ -85,14 +79,7 @@ struct v4l2_subdev_selection {
struct v4l2_rect r;
__u32 reserved[8];
};
-struct v4l2_subdev_capability {
- __u32 version;
- __u32 capabilities;
- __u32 reserved[14];
-};
-#define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001
#define v4l2_subdev_edid v4l2_edid
-#define VIDIOC_SUBDEV_QUERYCAP _IOR('V', 0, struct v4l2_subdev_capability)
#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
diff --git a/libc/kernel/uapi/linux/vbox_vmmdev_types.h b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
index 009f9a6b8..3b270295e 100644
--- a/libc/kernel/uapi/linux/vbox_vmmdev_types.h
+++ b/libc/kernel/uapi/linux/vbox_vmmdev_types.h
@@ -48,7 +48,6 @@ enum vmmdev_request_type {
VMMDEVREQ_SET_GUEST_CAPABILITIES = 56,
VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57,
VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80,
- VMMDEVREQ_GET_DISPLAY_CHANGE_REQ_MULTI = 81,
VMMDEVREQ_HGCM_CONNECT = 60,
VMMDEVREQ_HGCM_DISCONNECT = 61,
VMMDEVREQ_HGCM_CALL32 = 62,
@@ -78,8 +77,6 @@ enum vmmdev_request_type {
VMMDEVREQ_WRITE_COREDUMP = 218,
VMMDEVREQ_GUEST_HEARTBEAT = 219,
VMMDEVREQ_HEARTBEAT_CONFIGURE = 220,
- VMMDEVREQ_NT_BUG_CHECK = 221,
- VMMDEVREQ_VIDEO_UPDATE_MONITOR_POSITIONS = 222,
VMMDEVREQ_SIZEHACK = 0x7fffffff
};
#if __BITS_PER_LONG == 64
diff --git a/libc/kernel/uapi/linux/vboxguest.h b/libc/kernel/uapi/linux/vboxguest.h
index 342c02027..2eb80ef6b 100644
--- a/libc/kernel/uapi/linux/vboxguest.h
+++ b/libc/kernel/uapi/linux/vboxguest.h
@@ -53,7 +53,7 @@ struct vbg_ioctl_driver_version_info {
};
#define VBG_IOCTL_DRIVER_VERSION_INFO _IOWR('V', 0, struct vbg_ioctl_driver_version_info)
#define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 2, s)
-#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V', 3)
+#define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0)
struct vbg_ioctl_hgcm_connect {
struct vbg_ioctl_hdr hdr;
union {
@@ -99,7 +99,7 @@ struct vbg_ioctl_log {
} in;
} u;
};
-#define VBG_IOCTL_LOG(s) _IO('V', 9)
+#define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s)
struct vbg_ioctl_wait_for_events {
struct vbg_ioctl_hdr hdr;
union {
@@ -124,19 +124,6 @@ struct vbg_ioctl_change_filter {
} u;
};
#define VBG_IOCTL_CHANGE_FILTER_MASK _IOWR('V', 12, struct vbg_ioctl_change_filter)
-struct vbg_ioctl_acquire_guest_caps {
- struct vbg_ioctl_hdr hdr;
- union {
- struct {
- __u32 flags;
- __u32 or_mask;
- __u32 not_mask;
- } in;
- } u;
-};
-#define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE 0x00000001
-#define VBGL_IOC_AGC_FLAGS_VALID_MASK 0x00000001
-#define VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES _IOWR('V', 13, struct vbg_ioctl_acquire_guest_caps)
struct vbg_ioctl_set_guest_caps {
struct vbg_ioctl_hdr hdr;
union {
diff --git a/libc/kernel/uapi/linux/vdpa.h b/libc/kernel/uapi/linux/vdpa.h
deleted file mode 100644
index bee6618c3..000000000
--- a/libc/kernel/uapi/linux/vdpa.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_VDPA_H_
-#define _UAPI_LINUX_VDPA_H_
-#define VDPA_GENL_NAME "vdpa"
-#define VDPA_GENL_VERSION 0x1
-enum vdpa_command {
- VDPA_CMD_UNSPEC,
- VDPA_CMD_MGMTDEV_NEW,
- VDPA_CMD_MGMTDEV_GET,
- VDPA_CMD_DEV_NEW,
- VDPA_CMD_DEV_DEL,
- VDPA_CMD_DEV_GET,
-};
-enum vdpa_attr {
- VDPA_ATTR_UNSPEC,
- VDPA_ATTR_MGMTDEV_BUS_NAME,
- VDPA_ATTR_MGMTDEV_DEV_NAME,
- VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
- VDPA_ATTR_DEV_NAME,
- VDPA_ATTR_DEV_ID,
- VDPA_ATTR_DEV_VENDOR_ID,
- VDPA_ATTR_DEV_MAX_VQS,
- VDPA_ATTR_DEV_MAX_VQ_SIZE,
- VDPA_ATTR_MAX,
-};
-#endif
diff --git a/libc/kernel/uapi/linux/version.h b/libc/kernel/uapi/linux/version.h
index 86c00704a..471dcd7ba 100644
--- a/libc/kernel/uapi/linux/version.h
+++ b/libc/kernel/uapi/linux/version.h
@@ -16,8 +16,5 @@
***
****************************************************************************
****************************************************************************/
-#define LINUX_VERSION_CODE 330752
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
-#define LINUX_VERSION_MAJOR 5
-#define LINUX_VERSION_PATCHLEVEL 12
-#define LINUX_VERSION_SUBLEVEL 0
+#define LINUX_VERSION_CODE 328960
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/libc/kernel/uapi/linux/vfio.h b/libc/kernel/uapi/linux/vfio.h
index e0f322bb0..b9e7243b5 100644
--- a/libc/kernel/uapi/linux/vfio.h
+++ b/libc/kernel/uapi/linux/vfio.h
@@ -29,8 +29,6 @@
#define VFIO_TYPE1_NESTING_IOMMU 6
#define VFIO_SPAPR_TCE_v2_IOMMU 7
#define VFIO_NOIOMMU_IOMMU 8
-#define VFIO_UNMAP_ALL 9
-#define VFIO_UPDATE_VADDR 10
#define VFIO_TYPE (';')
#define VFIO_BASE 100
struct vfio_info_cap_header {
@@ -60,11 +58,8 @@ struct vfio_device_info {
#define VFIO_DEVICE_FLAGS_AMBA (1 << 3)
#define VFIO_DEVICE_FLAGS_CCW (1 << 4)
#define VFIO_DEVICE_FLAGS_AP (1 << 5)
-#define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6)
-#define VFIO_DEVICE_FLAGS_CAPS (1 << 7)
__u32 num_regions;
__u32 num_irqs;
- __u32 cap_offset;
};
#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
#define VFIO_DEVICE_API_PCI_STRING "vfio-pci"
@@ -72,10 +67,6 @@ struct vfio_device_info {
#define VFIO_DEVICE_API_AMBA_STRING "vfio-amba"
#define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
#define VFIO_DEVICE_API_AP_STRING "vfio-ap"
-#define VFIO_DEVICE_INFO_CAP_ZPCI_BASE 1
-#define VFIO_DEVICE_INFO_CAP_ZPCI_GROUP 2
-#define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3
-#define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4
struct vfio_region_info {
__u32 argsz;
__u32 flags;
@@ -110,7 +101,6 @@ struct vfio_region_info_cap_type {
#define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff)
#define VFIO_REGION_TYPE_GFX (1)
#define VFIO_REGION_TYPE_CCW (2)
-#define VFIO_REGION_TYPE_MIGRATION (3)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2)
#define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3)
@@ -128,24 +118,6 @@ struct vfio_region_gfx_edid {
#define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2
};
#define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1)
-#define VFIO_REGION_SUBTYPE_CCW_SCHIB (2)
-#define VFIO_REGION_SUBTYPE_CCW_CRW (3)
-#define VFIO_REGION_SUBTYPE_MIGRATION (1)
-struct vfio_device_migration_info {
- __u32 device_state;
-#define VFIO_DEVICE_STATE_STOP (0)
-#define VFIO_DEVICE_STATE_RUNNING (1 << 0)
-#define VFIO_DEVICE_STATE_SAVING (1 << 1)
-#define VFIO_DEVICE_STATE_RESUMING (1 << 2)
-#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING)
-#define VFIO_DEVICE_STATE_VALID(state) (state & VFIO_DEVICE_STATE_RESUMING ? (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_RESUMING : 1)
-#define VFIO_DEVICE_STATE_IS_ERROR(state) ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING))
-#define VFIO_DEVICE_STATE_SET_ERROR(state) ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_SATE_SAVING | VFIO_DEVICE_STATE_RESUMING)
- __u32 reserved;
- __u64 pending_bytes;
- __u64 data_offset;
- __u64 data_size;
-};
#define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3
#define VFIO_REGION_INFO_CAP_NVLINK2_SSATGT 4
struct vfio_region_info_cap_nvlink2_ssatgt {
@@ -213,8 +185,6 @@ enum {
};
enum {
VFIO_CCW_IO_IRQ_INDEX,
- VFIO_CCW_CRW_IRQ_INDEX,
- VFIO_CCW_REQ_IRQ_INDEX,
VFIO_CCW_NUM_IRQS
};
struct vfio_pci_dependent_device {
@@ -274,17 +244,6 @@ struct vfio_device_ioeventfd {
__s32 fd;
};
#define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16)
-struct vfio_device_feature {
- __u32 argsz;
- __u32 flags;
-#define VFIO_DEVICE_FEATURE_MASK (0xffff)
-#define VFIO_DEVICE_FEATURE_GET (1 << 16)
-#define VFIO_DEVICE_FEATURE_SET (1 << 17)
-#define VFIO_DEVICE_FEATURE_PROBE (1 << 18)
- __u8 data[];
-};
-#define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17)
-#define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0)
struct vfio_iommu_type1_info {
__u32 argsz;
__u32 flags;
@@ -304,62 +263,26 @@ struct vfio_iommu_type1_info_cap_iova_range {
__u32 reserved;
struct vfio_iova_range iova_ranges[];
};
-#define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2
-struct vfio_iommu_type1_info_cap_migration {
- struct vfio_info_cap_header header;
- __u32 flags;
- __u64 pgsize_bitmap;
- __u64 max_dirty_bitmap_size;
-};
-#define VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL 3
-struct vfio_iommu_type1_info_dma_avail {
- struct vfio_info_cap_header header;
- __u32 avail;
-};
#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
struct vfio_iommu_type1_dma_map {
__u32 argsz;
__u32 flags;
#define VFIO_DMA_MAP_FLAG_READ (1 << 0)
#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)
-#define VFIO_DMA_MAP_FLAG_VADDR (1 << 2)
__u64 vaddr;
__u64 iova;
__u64 size;
};
#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
-struct vfio_bitmap {
- __u64 pgsize;
- __u64 size;
- __u64 __user * data;
-};
struct vfio_iommu_type1_dma_unmap {
__u32 argsz;
__u32 flags;
-#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
-#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1)
-#define VFIO_DMA_UNMAP_FLAG_VADDR (1 << 2)
__u64 iova;
__u64 size;
- __u8 data[];
};
#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
#define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15)
#define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16)
-struct vfio_iommu_type1_dirty_bitmap {
- __u32 argsz;
- __u32 flags;
-#define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0)
-#define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1)
-#define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2)
- __u8 data[];
-};
-struct vfio_iommu_type1_dirty_bitmap_get {
- __u64 iova;
- __u64 size;
- struct vfio_bitmap bitmap;
-};
-#define VFIO_IOMMU_DIRTY_PAGES _IO(VFIO_TYPE, VFIO_BASE + 17)
struct vfio_iommu_spapr_tce_ddw_info {
__u64 pgsizes;
__u32 max_dynamic_windows_supported;
diff --git a/libc/kernel/uapi/linux/vfio_ccw.h b/libc/kernel/uapi/linux/vfio_ccw.h
index a6defc543..6ed6830e4 100644
--- a/libc/kernel/uapi/linux/vfio_ccw.h
+++ b/libc/kernel/uapi/linux/vfio_ccw.h
@@ -34,12 +34,4 @@ struct ccw_cmd_region {
__u32 command;
__u32 ret_code;
} __packed;
-struct ccw_schib_region {
-#define SCHIB_AREA_SIZE 52
- __u8 schib_area[SCHIB_AREA_SIZE];
-} __packed;
-struct ccw_crw_region {
- __u32 crw;
- __u32 pad;
-} __packed;
#endif
diff --git a/libc/kernel/uapi/linux/vhost.h b/libc/kernel/uapi/linux/vhost.h
index 53b01c415..9e87e6eb8 100644
--- a/libc/kernel/uapi/linux/vhost.h
+++ b/libc/kernel/uapi/linux/vhost.h
@@ -21,7 +21,6 @@
#include <linux/vhost_types.h>
#include <linux/types.h>
#include <linux/ioctl.h>
-#define VHOST_FILE_UNBIND - 1
#define VHOST_VIRTIO 0xAF
#define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64)
#define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64)
@@ -44,7 +43,6 @@
#define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, struct vhost_vring_state)
#define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, struct vhost_vring_state)
#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
-#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
@@ -55,13 +53,4 @@
#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
#define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64)
#define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int)
-#define VHOST_VDPA_GET_DEVICE_ID _IOR(VHOST_VIRTIO, 0x70, __u32)
-#define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8)
-#define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8)
-#define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, struct vhost_vdpa_config)
-#define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, struct vhost_vdpa_config)
-#define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, struct vhost_vring_state)
-#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
-#define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int)
-#define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, struct vhost_vdpa_iova_range)
#endif
diff --git a/libc/kernel/uapi/linux/vhost_types.h b/libc/kernel/uapi/linux/vhost_types.h
index 6b4cc7758..646fcdc87 100644
--- a/libc/kernel/uapi/linux/vhost_types.h
+++ b/libc/kernel/uapi/linux/vhost_types.h
@@ -51,8 +51,6 @@ struct vhost_iotlb_msg {
#define VHOST_IOTLB_UPDATE 2
#define VHOST_IOTLB_INVALIDATE 3
#define VHOST_IOTLB_ACCESS_FAIL 4
-#define VHOST_IOTLB_BATCH_BEGIN 5
-#define VHOST_IOTLB_BATCH_END 6
__u8 type;
};
#define VHOST_IOTLB_MSG 0x1
@@ -91,15 +89,6 @@ struct vhost_scsi_target {
unsigned short vhost_tpgt;
unsigned short reserved;
};
-struct vhost_vdpa_config {
- __u32 off;
- __u32 len;
- __u8 buf[0];
-};
-struct vhost_vdpa_iova_range {
- __u64 first;
- __u64 last;
-};
#define VHOST_F_LOG_ALL 26
#define VHOST_NET_F_VIRTIO_NET_HDR 27
#endif
diff --git a/libc/kernel/uapi/linux/videodev2.h b/libc/kernel/uapi/linux/videodev2.h
index 76d9af9a3..aaf5a70fd 100644
--- a/libc/kernel/uapi/linux/videodev2.h
+++ b/libc/kernel/uapi/linux/videodev2.h
@@ -65,7 +65,6 @@ enum v4l2_buf_type {
};
#define V4L2_TYPE_IS_MULTIPLANAR(type) ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
#define V4L2_TYPE_IS_OUTPUT(type) ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY || (type) == V4L2_BUF_TYPE_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT || (type) == V4L2_BUF_TYPE_SDR_OUTPUT || (type) == V4L2_BUF_TYPE_META_OUTPUT)
-#define V4L2_TYPE_IS_CAPTURE(type) (! V4L2_TYPE_IS_OUTPUT(type))
enum v4l2_tuner_type {
V4L2_TUNER_RADIO = 1,
V4L2_TUNER_ANALOG_TV = 2,
@@ -128,7 +127,7 @@ enum v4l2_quantization {
V4L2_QUANTIZATION_FULL_RANGE = 1,
V4L2_QUANTIZATION_LIM_RANGE = 2,
};
-#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv,colsp,ycbcr_enc) (((is_rgb_or_hsv) || (colsp) == V4L2_COLORSPACE_JPEG) ? V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)
+#define V4L2_MAP_QUANTIZATION_DEFAULT(is_rgb_or_hsv,colsp,ycbcr_enc) (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? V4L2_QUANTIZATION_LIM_RANGE : (((is_rgb_or_hsv) || (colsp) == V4L2_COLORSPACE_JPEG) ? V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE))
#define V4L2_COLORSPACE_ADOBERGB V4L2_COLORSPACE_OPRGB
#define V4L2_XFER_FUNC_ADOBERGB V4L2_XFER_FUNC_OPRGB
enum v4l2_priority {
@@ -189,7 +188,6 @@ struct v4l2_capability {
#define V4L2_CAP_STREAMING 0x04000000
#define V4L2_CAP_META_OUTPUT 0x08000000
#define V4L2_CAP_TOUCH 0x10000000
-#define V4L2_CAP_IO_MC 0x20000000
#define V4L2_CAP_DEVICE_CAPS 0x80000000
struct v4l2_pix_format {
__u32 width;
@@ -250,7 +248,6 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ')
#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ')
#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ')
-#define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ')
#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ')
#define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ')
#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B')
@@ -271,6 +268,8 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_XYUV32 v4l2_fourcc('X', 'Y', 'U', 'V')
#define V4L2_PIX_FMT_VUYA32 v4l2_fourcc('V', 'U', 'Y', 'A')
#define V4L2_PIX_FMT_VUYX32 v4l2_fourcc('V', 'U', 'Y', 'X')
+#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4')
+#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2')
#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0')
#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2')
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1')
@@ -278,7 +277,6 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1')
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4')
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2')
-#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2')
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2')
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')
#define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6')
@@ -325,10 +323,6 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
#define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
#define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
-#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4')
-#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4')
-#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('G', 'R', '1', '4')
-#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4')
#define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E')
#define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E')
#define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E')
@@ -359,7 +353,6 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C')
#define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T')
#define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H')
-#define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4')
#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A')
#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A')
#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0')
@@ -393,7 +386,6 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I')
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2')
#define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4')
-#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4')
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b')
#define V4L2_PIX_FMT_IPU3_SGBRG10 v4l2_fourcc('i', 'p', '3', 'g')
#define V4L2_PIX_FMT_IPU3_SGRBG10 v4l2_fourcc('i', 'p', '3', 'G')
@@ -415,30 +407,20 @@ struct v4l2_pix_format {
#define V4L2_META_FMT_UVC v4l2_fourcc('U', 'V', 'C', 'H')
#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')
#define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')
-#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P')
-#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S')
#define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
-#define V4L2_PIX_FMT_FLAG_SET_CSC 0x00000002
struct v4l2_fmtdesc {
__u32 index;
__u32 type;
__u32 flags;
__u8 description[32];
__u32 pixelformat;
- __u32 mbus_code;
- __u32 reserved[3];
+ __u32 reserved[4];
};
#define V4L2_FMT_FLAG_COMPRESSED 0x0001
#define V4L2_FMT_FLAG_EMULATED 0x0002
#define V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM 0x0004
#define V4L2_FMT_FLAG_DYN_RESOLUTION 0x0008
-#define V4L2_FMT_FLAG_ENC_CAP_FRAME_INTERVAL 0x0010
-#define V4L2_FMT_FLAG_CSC_COLORSPACE 0x0020
-#define V4L2_FMT_FLAG_CSC_XFER_FUNC 0x0040
-#define V4L2_FMT_FLAG_CSC_YCBCR_ENC 0x0080
-#define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_ENC
-#define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100
enum v4l2_frmsizetypes {
V4L2_FRMSIZE_TYPE_DISCRETE = 1,
V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
@@ -534,7 +516,6 @@ struct v4l2_requestbuffers {
#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)
#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)
#define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5)
-#define V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS (1 << 6)
struct v4l2_plane {
__u32 bytesused;
__u32 length;
@@ -637,7 +618,7 @@ struct v4l2_window {
struct v4l2_rect w;
__u32 field;
__u32 chromakey;
- struct v4l2_clip * clips;
+ struct v4l2_clip __user * clips;
__u32 clipcount;
void __user * bitmap;
__u8 global_alpha;
@@ -881,13 +862,6 @@ struct v4l2_ext_control {
__u16 __user * p_u16;
__u32 __user * p_u32;
struct v4l2_area __user * p_area;
- struct v4l2_ctrl_h264_sps __user * p_h264_sps;
- struct v4l2_ctrl_h264_pps * p_h264_pps;
- struct v4l2_ctrl_h264_scaling_matrix __user * p_h264_scaling_matrix;
- struct v4l2_ctrl_h264_pred_weights __user * p_h264_pred_weights;
- struct v4l2_ctrl_h264_slice_params __user * p_h264_slice_params;
- struct v4l2_ctrl_h264_decode_params __user * p_h264_decode_params;
- struct v4l2_ctrl_fwht_params __user * p_fwht_params;
void __user * ptr;
};
} __attribute__((packed));
@@ -925,13 +899,6 @@ enum v4l2_ctrl_type {
V4L2_CTRL_TYPE_U16 = 0x0101,
V4L2_CTRL_TYPE_U32 = 0x0102,
V4L2_CTRL_TYPE_AREA = 0x0106,
- V4L2_CTRL_TYPE_H264_SPS = 0x0200,
- V4L2_CTRL_TYPE_H264_PPS = 0x0201,
- V4L2_CTRL_TYPE_H264_SCALING_MATRIX = 0x0202,
- V4L2_CTRL_TYPE_H264_SLICE_PARAMS = 0x0203,
- V4L2_CTRL_TYPE_H264_DECODE_PARAMS = 0x0204,
- V4L2_CTRL_TYPE_H264_PRED_WEIGHTS = 0x0205,
- V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0220,
};
struct v4l2_queryctrl {
__u32 id;
diff --git a/libc/kernel/uapi/linux/virtio_9p.h b/libc/kernel/uapi/linux/virtio_9p.h
index 1d9dfb182..f5933537c 100644
--- a/libc/kernel/uapi/linux/virtio_9p.h
+++ b/libc/kernel/uapi/linux/virtio_9p.h
@@ -18,12 +18,12 @@
****************************************************************************/
#ifndef _LINUX_VIRTIO_9P_H
#define _LINUX_VIRTIO_9P_H
-#include <linux/virtio_types.h>
+#include <linux/types.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
#define VIRTIO_9P_MOUNT_TAG 0
struct virtio_9p_config {
- __virtio16 tag_len;
+ __u16 tag_len;
__u8 tag[0];
} __attribute__((packed));
#endif
diff --git a/libc/kernel/uapi/linux/virtio_balloon.h b/libc/kernel/uapi/linux/virtio_balloon.h
index d145caa7b..806e757b2 100644
--- a/libc/kernel/uapi/linux/virtio_balloon.h
+++ b/libc/kernel/uapi/linux/virtio_balloon.h
@@ -27,18 +27,14 @@
#define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2
#define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3
#define VIRTIO_BALLOON_F_PAGE_POISON 4
-#define VIRTIO_BALLOON_F_REPORTING 5
#define VIRTIO_BALLOON_PFN_SHIFT 12
#define VIRTIO_BALLOON_CMD_ID_STOP 0
#define VIRTIO_BALLOON_CMD_ID_DONE 1
struct virtio_balloon_config {
- __le32 num_pages;
- __le32 actual;
- union {
- __le32 free_page_hint_cmd_id;
- __le32 free_page_report_cmd_id;
- };
- __le32 poison_val;
+ __u32 num_pages;
+ __u32 actual;
+ __u32 free_page_report_cmd_id;
+ __u32 poison_val;
};
#define VIRTIO_BALLOON_S_SWAP_IN 0
#define VIRTIO_BALLOON_S_SWAP_OUT 1
diff --git a/libc/kernel/uapi/linux/virtio_blk.h b/libc/kernel/uapi/linux/virtio_blk.h
index f2f0381a5..519743430 100644
--- a/libc/kernel/uapi/linux/virtio_blk.h
+++ b/libc/kernel/uapi/linux/virtio_blk.h
@@ -40,27 +40,27 @@
#endif
#define VIRTIO_BLK_ID_BYTES 20
struct virtio_blk_config {
- __virtio64 capacity;
- __virtio32 size_max;
- __virtio32 seg_max;
+ __u64 capacity;
+ __u32 size_max;
+ __u32 seg_max;
struct virtio_blk_geometry {
- __virtio16 cylinders;
+ __u16 cylinders;
__u8 heads;
__u8 sectors;
} geometry;
- __virtio32 blk_size;
+ __u32 blk_size;
__u8 physical_block_exp;
__u8 alignment_offset;
- __virtio16 min_io_size;
- __virtio32 opt_io_size;
+ __u16 min_io_size;
+ __u32 opt_io_size;
__u8 wce;
__u8 unused;
- __virtio16 num_queues;
- __virtio32 max_discard_sectors;
- __virtio32 max_discard_seg;
- __virtio32 discard_sector_alignment;
- __virtio32 max_write_zeroes_sectors;
- __virtio32 max_write_zeroes_seg;
+ __u16 num_queues;
+ __u32 max_discard_sectors;
+ __u32 max_discard_seg;
+ __u32 discard_sector_alignment;
+ __u32 max_write_zeroes_sectors;
+ __u32 max_write_zeroes_seg;
__u8 write_zeroes_may_unmap;
__u8 unused1[3];
} __attribute__((packed));
diff --git a/libc/kernel/uapi/linux/virtio_config.h b/libc/kernel/uapi/linux/virtio_config.h
index 6198fd170..c9ec83f48 100644
--- a/libc/kernel/uapi/linux/virtio_config.h
+++ b/libc/kernel/uapi/linux/virtio_config.h
@@ -32,8 +32,7 @@
#define VIRTIO_F_ANY_LAYOUT 27
#endif
#define VIRTIO_F_VERSION_1 32
-#define VIRTIO_F_ACCESS_PLATFORM 33
-#define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM
+#define VIRTIO_F_IOMMU_PLATFORM 33
#define VIRTIO_F_RING_PACKED 34
#define VIRTIO_F_ORDER_PLATFORM 36
#define VIRTIO_F_SR_IOV 37
diff --git a/libc/kernel/uapi/linux/virtio_console.h b/libc/kernel/uapi/linux/virtio_console.h
index 6eb4d2aec..bf9888a1c 100644
--- a/libc/kernel/uapi/linux/virtio_console.h
+++ b/libc/kernel/uapi/linux/virtio_console.h
@@ -27,10 +27,10 @@
#define VIRTIO_CONSOLE_F_EMERG_WRITE 2
#define VIRTIO_CONSOLE_BAD_ID (~(__u32) 0)
struct virtio_console_config {
- __virtio16 cols;
- __virtio16 rows;
- __virtio32 max_nr_ports;
- __virtio32 emerg_wr;
+ __u16 cols;
+ __u16 rows;
+ __u32 max_nr_ports;
+ __u32 emerg_wr;
} __attribute__((packed));
struct virtio_console_control {
__virtio32 id;
diff --git a/libc/kernel/uapi/linux/virtio_crypto.h b/libc/kernel/uapi/linux/virtio_crypto.h
index 2ce760fe2..03727dc9d 100644
--- a/libc/kernel/uapi/linux/virtio_crypto.h
+++ b/libc/kernel/uapi/linux/virtio_crypto.h
@@ -273,19 +273,19 @@ struct virtio_crypto_op_data_req {
#define VIRTIO_CRYPTO_INVSESS 4
#define VIRTIO_CRYPTO_S_HW_READY (1 << 0)
struct virtio_crypto_config {
- __le32 status;
- __le32 max_dataqueues;
- __le32 crypto_services;
- __le32 cipher_algo_l;
- __le32 cipher_algo_h;
- __le32 hash_algo;
- __le32 mac_algo_l;
- __le32 mac_algo_h;
- __le32 aead_algo;
- __le32 max_cipher_key_len;
- __le32 max_auth_key_len;
- __le32 reserve;
- __le64 max_size;
+ __u32 status;
+ __u32 max_dataqueues;
+ __u32 crypto_services;
+ __u32 cipher_algo_l;
+ __u32 cipher_algo_h;
+ __u32 hash_algo;
+ __u32 mac_algo_l;
+ __u32 mac_algo_h;
+ __u32 aead_algo;
+ __u32 max_cipher_key_len;
+ __u32 max_auth_key_len;
+ __u32 reserve;
+ __u64 max_size;
};
struct virtio_crypto_inhdr {
__u8 status;
diff --git a/libc/kernel/uapi/linux/virtio_fs.h b/libc/kernel/uapi/linux/virtio_fs.h
index 62c57cfc9..41946e76a 100644
--- a/libc/kernel/uapi/linux/virtio_fs.h
+++ b/libc/kernel/uapi/linux/virtio_fs.h
@@ -24,7 +24,6 @@
#include <linux/virtio_types.h>
struct virtio_fs_config {
__u8 tag[36];
- __le32 num_request_queues;
+ __u32 num_request_queues;
} __attribute__((packed));
-#define VIRTIO_FS_SHMCAP_ID_CACHE 0
#endif
diff --git a/libc/kernel/uapi/linux/virtio_gpu.h b/libc/kernel/uapi/linux/virtio_gpu.h
index 83ad5a7f9..0ac74952e 100644
--- a/libc/kernel/uapi/linux/virtio_gpu.h
+++ b/libc/kernel/uapi/linux/virtio_gpu.h
@@ -21,8 +21,6 @@
#include <linux/types.h>
#define VIRTIO_GPU_F_VIRGL 0
#define VIRTIO_GPU_F_EDID 1
-#define VIRTIO_GPU_F_RESOURCE_UUID 2
-#define VIRTIO_GPU_F_RESOURCE_BLOB 3
enum virtio_gpu_ctrl_type {
VIRTIO_GPU_UNDEFINED = 0,
VIRTIO_GPU_CMD_GET_DISPLAY_INFO = 0x0100,
@@ -36,9 +34,6 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_CMD_GET_CAPSET_INFO,
VIRTIO_GPU_CMD_GET_CAPSET,
VIRTIO_GPU_CMD_GET_EDID,
- VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID,
- VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB,
- VIRTIO_GPU_CMD_SET_SCANOUT_BLOB,
VIRTIO_GPU_CMD_CTX_CREATE = 0x0200,
VIRTIO_GPU_CMD_CTX_DESTROY,
VIRTIO_GPU_CMD_CTX_ATTACH_RESOURCE,
@@ -47,8 +42,6 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_CMD_TRANSFER_TO_HOST_3D,
VIRTIO_GPU_CMD_TRANSFER_FROM_HOST_3D,
VIRTIO_GPU_CMD_SUBMIT_3D,
- VIRTIO_GPU_CMD_RESOURCE_MAP_BLOB,
- VIRTIO_GPU_CMD_RESOURCE_UNMAP_BLOB,
VIRTIO_GPU_CMD_UPDATE_CURSOR = 0x0300,
VIRTIO_GPU_CMD_MOVE_CURSOR,
VIRTIO_GPU_RESP_OK_NODATA = 0x1100,
@@ -56,8 +49,6 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_RESP_OK_CAPSET_INFO,
VIRTIO_GPU_RESP_OK_CAPSET,
VIRTIO_GPU_RESP_OK_EDID,
- VIRTIO_GPU_RESP_OK_RESOURCE_UUID,
- VIRTIO_GPU_RESP_OK_MAP_INFO,
VIRTIO_GPU_RESP_ERR_UNSPEC = 0x1200,
VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY,
VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID,
@@ -65,10 +56,6 @@ enum virtio_gpu_ctrl_type {
VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID,
VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER,
};
-enum virtio_gpu_shm_id {
- VIRTIO_GPU_SHM_ID_UNDEFINED = 0,
- VIRTIO_GPU_SHM_ID_HOST_VISIBLE = 1
-};
#define VIRTIO_GPU_FLAG_FENCE (1 << 0)
struct virtio_gpu_ctrl_hdr {
__le32 type;
@@ -236,10 +223,10 @@ struct virtio_gpu_resp_edid {
};
#define VIRTIO_GPU_EVENT_DISPLAY (1 << 0)
struct virtio_gpu_config {
- __le32 events_read;
- __le32 events_clear;
- __le32 num_scanouts;
- __le32 num_capsets;
+ __u32 events_read;
+ __u32 events_clear;
+ __u32 num_scanouts;
+ __u32 num_capsets;
};
enum virtio_gpu_formats {
VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM = 1,
@@ -251,61 +238,4 @@ enum virtio_gpu_formats {
VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM = 121,
VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM = 134,
};
-struct virtio_gpu_resource_assign_uuid {
- struct virtio_gpu_ctrl_hdr hdr;
- __le32 resource_id;
- __le32 padding;
-};
-struct virtio_gpu_resp_resource_uuid {
- struct virtio_gpu_ctrl_hdr hdr;
- __u8 uuid[16];
-};
-struct virtio_gpu_resource_create_blob {
- struct virtio_gpu_ctrl_hdr hdr;
- __le32 resource_id;
-#define VIRTIO_GPU_BLOB_MEM_GUEST 0x0001
-#define VIRTIO_GPU_BLOB_MEM_HOST3D 0x0002
-#define VIRTIO_GPU_BLOB_MEM_HOST3D_GUEST 0x0003
-#define VIRTIO_GPU_BLOB_FLAG_USE_MAPPABLE 0x0001
-#define VIRTIO_GPU_BLOB_FLAG_USE_SHAREABLE 0x0002
-#define VIRTIO_GPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004
- __le32 blob_mem;
- __le32 blob_flags;
- __le32 nr_entries;
- __le64 blob_id;
- __le64 size;
-};
-struct virtio_gpu_set_scanout_blob {
- struct virtio_gpu_ctrl_hdr hdr;
- struct virtio_gpu_rect r;
- __le32 scanout_id;
- __le32 resource_id;
- __le32 width;
- __le32 height;
- __le32 format;
- __le32 padding;
- __le32 strides[4];
- __le32 offsets[4];
-};
-struct virtio_gpu_resource_map_blob {
- struct virtio_gpu_ctrl_hdr hdr;
- __le32 resource_id;
- __le32 padding;
- __le64 offset;
-};
-#define VIRTIO_GPU_MAP_CACHE_MASK 0x0f
-#define VIRTIO_GPU_MAP_CACHE_NONE 0x00
-#define VIRTIO_GPU_MAP_CACHE_CACHED 0x01
-#define VIRTIO_GPU_MAP_CACHE_UNCACHED 0x02
-#define VIRTIO_GPU_MAP_CACHE_WC 0x03
-struct virtio_gpu_resp_map_info {
- struct virtio_gpu_ctrl_hdr hdr;
- __u32 map_info;
- __u32 padding;
-};
-struct virtio_gpu_resource_unmap_blob {
- struct virtio_gpu_ctrl_hdr hdr;
- __le32 resource_id;
- __le32 padding;
-};
#endif
diff --git a/libc/kernel/uapi/linux/virtio_ids.h b/libc/kernel/uapi/linux/virtio_ids.h
index bae26a013..8e6712a81 100644
--- a/libc/kernel/uapi/linux/virtio_ids.h
+++ b/libc/kernel/uapi/linux/virtio_ids.h
@@ -23,24 +23,16 @@
#define VIRTIO_ID_CONSOLE 3
#define VIRTIO_ID_RNG 4
#define VIRTIO_ID_BALLOON 5
-#define VIRTIO_ID_IOMEM 6
#define VIRTIO_ID_RPMSG 7
#define VIRTIO_ID_SCSI 8
#define VIRTIO_ID_9P 9
-#define VIRTIO_ID_MAC80211_WLAN 10
#define VIRTIO_ID_RPROC_SERIAL 11
#define VIRTIO_ID_CAIF 12
-#define VIRTIO_ID_MEMORY_BALLOON 13
#define VIRTIO_ID_GPU 16
-#define VIRTIO_ID_CLOCK 17
#define VIRTIO_ID_INPUT 18
#define VIRTIO_ID_VSOCK 19
#define VIRTIO_ID_CRYPTO 20
-#define VIRTIO_ID_SIGNAL_DIST 21
-#define VIRTIO_ID_PSTORE 22
#define VIRTIO_ID_IOMMU 23
-#define VIRTIO_ID_MEM 24
#define VIRTIO_ID_FS 26
#define VIRTIO_ID_PMEM 27
-#define VIRTIO_ID_MAC80211_HWSIM 29
#endif
diff --git a/libc/kernel/uapi/linux/virtio_input.h b/libc/kernel/uapi/linux/virtio_input.h
index 188b0bbd0..e1fc3e58b 100644
--- a/libc/kernel/uapi/linux/virtio_input.h
+++ b/libc/kernel/uapi/linux/virtio_input.h
@@ -29,17 +29,17 @@ enum virtio_input_config_select {
VIRTIO_INPUT_CFG_ABS_INFO = 0x12,
};
struct virtio_input_absinfo {
- __le32 min;
- __le32 max;
- __le32 fuzz;
- __le32 flat;
- __le32 res;
+ __u32 min;
+ __u32 max;
+ __u32 fuzz;
+ __u32 flat;
+ __u32 res;
};
struct virtio_input_devids {
- __le16 bustype;
- __le16 vendor;
- __le16 product;
- __le16 version;
+ __u16 bustype;
+ __u16 vendor;
+ __u16 product;
+ __u16 version;
};
struct virtio_input_config {
__u8 select;
diff --git a/libc/kernel/uapi/linux/virtio_mem.h b/libc/kernel/uapi/linux/virtio_mem.h
deleted file mode 100644
index d6542b7b3..000000000
--- a/libc/kernel/uapi/linux/virtio_mem.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _LINUX_VIRTIO_MEM_H
-#define _LINUX_VIRTIO_MEM_H
-#include <linux/types.h>
-#include <linux/virtio_types.h>
-#include <linux/virtio_ids.h>
-#include <linux/virtio_config.h>
-#define VIRTIO_MEM_F_ACPI_PXM 0
-#define VIRTIO_MEM_REQ_PLUG 0
-#define VIRTIO_MEM_REQ_UNPLUG 1
-#define VIRTIO_MEM_REQ_UNPLUG_ALL 2
-#define VIRTIO_MEM_REQ_STATE 3
-struct virtio_mem_req_plug {
- __virtio64 addr;
- __virtio16 nb_blocks;
- __virtio16 padding[3];
-};
-struct virtio_mem_req_unplug {
- __virtio64 addr;
- __virtio16 nb_blocks;
- __virtio16 padding[3];
-};
-struct virtio_mem_req_state {
- __virtio64 addr;
- __virtio16 nb_blocks;
- __virtio16 padding[3];
-};
-struct virtio_mem_req {
- __virtio16 type;
- __virtio16 padding[3];
- union {
- struct virtio_mem_req_plug plug;
- struct virtio_mem_req_unplug unplug;
- struct virtio_mem_req_state state;
- } u;
-};
-#define VIRTIO_MEM_RESP_ACK 0
-#define VIRTIO_MEM_RESP_NACK 1
-#define VIRTIO_MEM_RESP_BUSY 2
-#define VIRTIO_MEM_RESP_ERROR 3
-#define VIRTIO_MEM_STATE_PLUGGED 0
-#define VIRTIO_MEM_STATE_UNPLUGGED 1
-#define VIRTIO_MEM_STATE_MIXED 2
-struct virtio_mem_resp_state {
- __virtio16 state;
-};
-struct virtio_mem_resp {
- __virtio16 type;
- __virtio16 padding[3];
- union {
- struct virtio_mem_resp_state state;
- } u;
-};
-struct virtio_mem_config {
- __le64 block_size;
- __le16 node_id;
- __u8 padding[6];
- __le64 addr;
- __le64 region_size;
- __le64 usable_region_size;
- __le64 plugged_size;
- __le64 requested_size;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/virtio_mmio.h b/libc/kernel/uapi/linux/virtio_mmio.h
index a420fdcd4..a11de1c83 100644
--- a/libc/kernel/uapi/linux/virtio_mmio.h
+++ b/libc/kernel/uapi/linux/virtio_mmio.h
@@ -47,11 +47,6 @@
#define VIRTIO_MMIO_QUEUE_AVAIL_HIGH 0x094
#define VIRTIO_MMIO_QUEUE_USED_LOW 0x0a0
#define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4
-#define VIRTIO_MMIO_SHM_SEL 0x0ac
-#define VIRTIO_MMIO_SHM_LEN_LOW 0x0b0
-#define VIRTIO_MMIO_SHM_LEN_HIGH 0x0b4
-#define VIRTIO_MMIO_SHM_BASE_LOW 0x0b8
-#define VIRTIO_MMIO_SHM_BASE_HIGH 0x0bc
#define VIRTIO_MMIO_CONFIG_GENERATION 0x0fc
#define VIRTIO_MMIO_CONFIG 0x100
#define VIRTIO_MMIO_INT_VRING (1 << 0)
diff --git a/libc/kernel/uapi/linux/virtio_net.h b/libc/kernel/uapi/linux/virtio_net.h
index 2d92904e3..07afd06cc 100644
--- a/libc/kernel/uapi/linux/virtio_net.h
+++ b/libc/kernel/uapi/linux/virtio_net.h
@@ -45,9 +45,6 @@
#define VIRTIO_NET_F_GUEST_ANNOUNCE 21
#define VIRTIO_NET_F_MQ 22
#define VIRTIO_NET_F_CTRL_MAC_ADDR 23
-#define VIRTIO_NET_F_HASH_REPORT 57
-#define VIRTIO_NET_F_RSS 60
-#define VIRTIO_NET_F_RSC_EXT 61
#define VIRTIO_NET_F_STANDBY 62
#define VIRTIO_NET_F_SPEED_DUPLEX 63
#ifndef VIRTIO_NET_NO_LEGACY
@@ -55,30 +52,17 @@
#endif
#define VIRTIO_NET_S_LINK_UP 1
#define VIRTIO_NET_S_ANNOUNCE 2
-#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0)
-#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1)
-#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2)
-#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3)
-#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4)
-#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5)
-#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6)
-#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7)
-#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8)
struct virtio_net_config {
__u8 mac[ETH_ALEN];
- __virtio16 status;
- __virtio16 max_virtqueue_pairs;
- __virtio16 mtu;
- __le32 speed;
+ __u16 status;
+ __u16 max_virtqueue_pairs;
+ __u16 mtu;
+ __u32 speed;
__u8 duplex;
- __u8 rss_max_key_size;
- __le16 rss_max_indirection_table_length;
- __le32 supported_hash_types;
} __attribute__((packed));
struct virtio_net_hdr_v1 {
#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
#define VIRTIO_NET_HDR_F_DATA_VALID 2
-#define VIRTIO_NET_HDR_F_RSC_INFO 4
__u8 flags;
#define VIRTIO_NET_HDR_GSO_NONE 0
#define VIRTIO_NET_HDR_GSO_TCPV4 1
@@ -88,38 +72,10 @@ struct virtio_net_hdr_v1 {
__u8 gso_type;
__virtio16 hdr_len;
__virtio16 gso_size;
- union {
- struct {
- __virtio16 csum_start;
- __virtio16 csum_offset;
- };
- struct {
- __virtio16 start;
- __virtio16 offset;
- } csum;
- struct {
- __le16 segments;
- __le16 dup_acks;
- } rsc;
- };
+ __virtio16 csum_start;
+ __virtio16 csum_offset;
__virtio16 num_buffers;
};
-struct virtio_net_hdr_v1_hash {
- struct virtio_net_hdr_v1 hdr;
- __le32 hash_value;
-#define VIRTIO_NET_HASH_REPORT_NONE 0
-#define VIRTIO_NET_HASH_REPORT_IPv4 1
-#define VIRTIO_NET_HASH_REPORT_TCPv4 2
-#define VIRTIO_NET_HASH_REPORT_UDPv4 3
-#define VIRTIO_NET_HASH_REPORT_IPv6 4
-#define VIRTIO_NET_HASH_REPORT_TCPv6 5
-#define VIRTIO_NET_HASH_REPORT_UDPv6 6
-#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7
-#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8
-#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9
- __le16 hash_report;
- __le16 padding;
-};
#ifndef VIRTIO_NET_NO_LEGACY
struct virtio_net_hdr {
__u8 flags;
@@ -160,30 +116,13 @@ struct virtio_net_ctrl_mac {
#define VIRTIO_NET_CTRL_VLAN_DEL 1
#define VIRTIO_NET_CTRL_ANNOUNCE 3
#define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
-#define VIRTIO_NET_CTRL_MQ 4
struct virtio_net_ctrl_mq {
__virtio16 virtqueue_pairs;
};
+#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000
-struct virtio_net_rss_config {
- __le32 hash_types;
- __le16 indirection_table_mask;
- __le16 unclassified_queue;
- __le16 indirection_table[1];
- __le16 max_tx_vq;
- __u8 hash_key_length;
- __u8 hash_key_data[];
-};
-#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1
-struct virtio_net_hash_config {
- __le32 hash_types;
- __le16 reserved[4];
- __u8 hash_key_length;
- __u8 hash_key_data[];
-};
-#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
#endif
diff --git a/libc/kernel/uapi/linux/virtio_pci.h b/libc/kernel/uapi/linux/virtio_pci.h
index e6d2731f4..2258607a9 100644
--- a/libc/kernel/uapi/linux/virtio_pci.h
+++ b/libc/kernel/uapi/linux/virtio_pci.h
@@ -44,23 +44,16 @@
#define VIRTIO_PCI_CAP_ISR_CFG 3
#define VIRTIO_PCI_CAP_DEVICE_CFG 4
#define VIRTIO_PCI_CAP_PCI_CFG 5
-#define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8
struct virtio_pci_cap {
__u8 cap_vndr;
__u8 cap_next;
__u8 cap_len;
__u8 cfg_type;
__u8 bar;
- __u8 id;
- __u8 padding[2];
+ __u8 padding[3];
__le32 offset;
__le32 length;
};
-struct virtio_pci_cap64 {
- struct virtio_pci_cap cap;
- __le32 offset_hi;
- __le32 length_hi;
-};
struct virtio_pci_notify_cap {
struct virtio_pci_cap cap;
__le32 notify_off_multiplier;
diff --git a/libc/kernel/uapi/linux/virtio_pmem.h b/libc/kernel/uapi/linux/virtio_pmem.h
index 838f9d649..38740f34f 100644
--- a/libc/kernel/uapi/linux/virtio_pmem.h
+++ b/libc/kernel/uapi/linux/virtio_pmem.h
@@ -22,8 +22,8 @@
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
struct virtio_pmem_config {
- __le64 start;
- __le64 size;
+ __u64 start;
+ __u64 size;
};
#define VIRTIO_PMEM_REQ_TYPE_FLUSH 0
struct virtio_pmem_resp {
diff --git a/libc/kernel/uapi/linux/virtio_ring.h b/libc/kernel/uapi/linux/virtio_ring.h
index 24cf671f1..ba75940f7 100644
--- a/libc/kernel/uapi/linux/virtio_ring.h
+++ b/libc/kernel/uapi/linux/virtio_ring.h
@@ -34,9 +34,6 @@
#define VRING_PACKED_EVENT_F_WRAP_CTR 15
#define VIRTIO_RING_F_INDIRECT_DESC 28
#define VIRTIO_RING_F_EVENT_IDX 29
-#define VRING_AVAIL_ALIGN_SIZE 2
-#define VRING_USED_ALIGN_SIZE 4
-#define VRING_DESC_ALIGN_SIZE 16
struct vring_desc {
__virtio64 addr;
__virtio32 len;
@@ -52,25 +49,22 @@ struct vring_used_elem {
__virtio32 id;
__virtio32 len;
};
-typedef struct vring_used_elem __attribute__((aligned(VRING_USED_ALIGN_SIZE))) vring_used_elem_t;
struct vring_used {
__virtio16 flags;
__virtio16 idx;
- vring_used_elem_t ring[];
+ struct vring_used_elem ring[];
};
-typedef struct vring_desc __attribute__((aligned(VRING_DESC_ALIGN_SIZE))) vring_desc_t;
-typedef struct vring_avail __attribute__((aligned(VRING_AVAIL_ALIGN_SIZE))) vring_avail_t;
-typedef struct vring_used __attribute__((aligned(VRING_USED_ALIGN_SIZE))) vring_used_t;
struct vring {
unsigned int num;
- vring_desc_t * desc;
- vring_avail_t * avail;
- vring_used_t * used;
+ struct vring_desc * desc;
+ struct vring_avail * avail;
+ struct vring_used * used;
};
-#ifndef VIRTIO_RING_NO_LEGACY
+#define VRING_AVAIL_ALIGN_SIZE 2
+#define VRING_USED_ALIGN_SIZE 4
+#define VRING_DESC_ALIGN_SIZE 16
#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
#define vring_avail_event(vr) (* (__virtio16 *) & (vr)->used->ring[(vr)->num])
-#endif
struct vring_packed_desc_event {
__le16 off_wrap;
__le16 flags;
diff --git a/libc/kernel/uapi/linux/virtio_scsi.h b/libc/kernel/uapi/linux/virtio_scsi.h
index 74e6ac848..b809e08d0 100644
--- a/libc/kernel/uapi/linux/virtio_scsi.h
+++ b/libc/kernel/uapi/linux/virtio_scsi.h
@@ -77,16 +77,16 @@ struct virtio_scsi_event {
__virtio32 reason;
} __attribute__((packed));
struct virtio_scsi_config {
- __virtio32 num_queues;
- __virtio32 seg_max;
- __virtio32 max_sectors;
- __virtio32 cmd_per_lun;
- __virtio32 event_info_size;
- __virtio32 sense_size;
- __virtio32 cdb_size;
- __virtio16 max_channel;
- __virtio16 max_target;
- __virtio32 max_lun;
+ __u32 num_queues;
+ __u32 seg_max;
+ __u32 max_sectors;
+ __u32 cmd_per_lun;
+ __u32 event_info_size;
+ __u32 sense_size;
+ __u32 cdb_size;
+ __u16 max_channel;
+ __u16 max_target;
+ __u32 max_lun;
} __attribute__((packed));
#define VIRTIO_SCSI_F_INOUT 0
#define VIRTIO_SCSI_F_HOTPLUG 1
diff --git a/libc/kernel/uapi/linux/vm_sockets.h b/libc/kernel/uapi/linux/vm_sockets.h
index 50e84566b..87e4ba023 100644
--- a/libc/kernel/uapi/linux/vm_sockets.h
+++ b/libc/kernel/uapi/linux/vm_sockets.h
@@ -19,7 +19,6 @@
#ifndef _UAPI_VM_SOCKETS_H
#define _UAPI_VM_SOCKETS_H
#include <linux/socket.h>
-#include <linux/types.h>
#define SO_VM_SOCKETS_BUFFER_SIZE 0
#define SO_VM_SOCKETS_BUFFER_MIN_SIZE 1
#define SO_VM_SOCKETS_BUFFER_MAX_SIZE 2
@@ -30,9 +29,8 @@
#define VMADDR_CID_ANY - 1U
#define VMADDR_PORT_ANY - 1U
#define VMADDR_CID_HYPERVISOR 0
-#define VMADDR_CID_LOCAL 1
+#define VMADDR_CID_RESERVED 1
#define VMADDR_CID_HOST 2
-#define VMADDR_FLAG_TO_HOST 0x01
#define VM_SOCKETS_INVALID_VERSION - 1U
#define VM_SOCKETS_VERSION_EPOCH(_v) (((_v) & 0xFF000000) >> 24)
#define VM_SOCKETS_VERSION_MAJOR(_v) (((_v) & 0x00FF0000) >> 16)
@@ -42,8 +40,7 @@ struct sockaddr_vm {
unsigned short svm_reserved1;
unsigned int svm_port;
unsigned int svm_cid;
- __u8 svm_flags;
- unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) - sizeof(unsigned int) - sizeof(unsigned int) - sizeof(__u8)];
+ unsigned char svm_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - sizeof(unsigned short) - sizeof(unsigned int) - sizeof(unsigned int)];
};
#define IOCTL_VM_SOCKETS_GET_LOCAL_CID _IO(7, 0xb9)
#endif
diff --git a/libc/kernel/uapi/linux/vsoc_shm.h b/libc/kernel/uapi/linux/vsoc_shm.h
new file mode 100644
index 000000000..467b89bba
--- /dev/null
+++ b/libc/kernel/uapi/linux/vsoc_shm.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef _UAPI_LINUX_VSOC_SHM_H
+#define _UAPI_LINUX_VSOC_SHM_H
+#include <linux/types.h>
+struct fd_scoped_permission {
+ __u32 begin_offset;
+ __u32 end_offset;
+ __u32 owner_offset;
+ __u32 owned_value;
+};
+#define VSOC_REGION_FREE ((__u32) 0)
+struct fd_scoped_permission_arg {
+ struct fd_scoped_permission perm;
+ __s32 managed_region_fd;
+};
+#define VSOC_NODE_FREE ((__u32) 0)
+struct vsoc_signal_table_layout {
+ __u32 num_nodes_lg2;
+ __u32 futex_uaddr_table_offset;
+ __u32 interrupt_signalled_offset;
+};
+#define VSOC_REGION_WHOLE ((__s32) 0)
+#define VSOC_DEVICE_NAME_SZ 16
+struct vsoc_device_region {
+ __u16 current_version;
+ __u16 min_compatible_version;
+ __u32 region_begin_offset;
+ __u32 region_end_offset;
+ __u32 offset_of_region_data;
+ struct vsoc_signal_table_layout guest_to_host_signal_table;
+ struct vsoc_signal_table_layout host_to_guest_signal_table;
+ char device_name[VSOC_DEVICE_NAME_SZ];
+ __u32 managed_by;
+};
+struct vsoc_shm_layout_descriptor {
+ __u16 major_version;
+ __u16 minor_version;
+ __u32 size;
+ __u32 region_count;
+ __u32 vsoc_region_desc_offset;
+};
+#define CURRENT_VSOC_LAYOUT_MAJOR_VERSION 2
+#define CURRENT_VSOC_LAYOUT_MINOR_VERSION 0
+#define VSOC_CREATE_FD_SCOPED_PERMISSION _IOW(0xF5, 0, struct fd_scoped_permission)
+#define VSOC_GET_FD_SCOPED_PERMISSION _IOR(0xF5, 1, struct fd_scoped_permission)
+#define VSOC_MAYBE_SEND_INTERRUPT_TO_HOST _IO(0xF5, 2)
+#define VSOC_WAIT_FOR_INCOMING_INTERRUPT _IO(0xF5, 3)
+#define VSOC_DESCRIBE_REGION _IOR(0xF5, 4, struct vsoc_device_region)
+#define VSOC_SELF_INTERRUPT _IO(0xF5, 5)
+#define VSOC_SEND_INTERRUPT_TO_HOST _IO(0xF5, 6)
+enum wait_types {
+ VSOC_WAIT_UNDEFINED = 0,
+ VSOC_WAIT_IF_EQUAL = 1,
+ VSOC_WAIT_IF_EQUAL_TIMEOUT = 2
+};
+struct vsoc_cond_wait {
+ __u32 offset;
+ __u32 value;
+ __u64 wake_time_sec;
+ __u32 wake_time_nsec;
+ __u32 wait_type;
+ __u32 wakes;
+ __u32 reserved_1;
+};
+#define VSOC_COND_WAIT _IOWR(0xF5, 7, struct vsoc_cond_wait)
+#define VSOC_COND_WAKE _IO(0xF5, 8)
+#endif
diff --git a/libc/kernel/uapi/linux/watch_queue.h b/libc/kernel/uapi/linux/watch_queue.h
deleted file mode 100644
index 4c4fd01af..000000000
--- a/libc/kernel/uapi/linux/watch_queue.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPI_LINUX_WATCH_QUEUE_H
-#define _UAPI_LINUX_WATCH_QUEUE_H
-#include <linux/types.h>
-#include <linux/fcntl.h>
-#include <linux/ioctl.h>
-#define O_NOTIFICATION_PIPE O_EXCL
-#define IOC_WATCH_QUEUE_SET_SIZE _IO('W', 0x60)
-#define IOC_WATCH_QUEUE_SET_FILTER _IO('W', 0x61)
-enum watch_notification_type {
- WATCH_TYPE_META = 0,
- WATCH_TYPE_KEY_NOTIFY = 1,
- WATCH_TYPE__NR = 2
-};
-enum watch_meta_notification_subtype {
- WATCH_META_REMOVAL_NOTIFICATION = 0,
- WATCH_META_LOSS_NOTIFICATION = 1,
-};
-struct watch_notification {
- __u32 type : 24;
- __u32 subtype : 8;
- __u32 info;
-#define WATCH_INFO_LENGTH 0x0000007f
-#define WATCH_INFO_LENGTH__SHIFT 0
-#define WATCH_INFO_ID 0x0000ff00
-#define WATCH_INFO_ID__SHIFT 8
-#define WATCH_INFO_TYPE_INFO 0xffff0000
-#define WATCH_INFO_TYPE_INFO__SHIFT 16
-#define WATCH_INFO_FLAG_0 0x00010000
-#define WATCH_INFO_FLAG_1 0x00020000
-#define WATCH_INFO_FLAG_2 0x00040000
-#define WATCH_INFO_FLAG_3 0x00080000
-#define WATCH_INFO_FLAG_4 0x00100000
-#define WATCH_INFO_FLAG_5 0x00200000
-#define WATCH_INFO_FLAG_6 0x00400000
-#define WATCH_INFO_FLAG_7 0x00800000
-};
-struct watch_notification_type_filter {
- __u32 type;
- __u32 info_filter;
- __u32 info_mask;
- __u32 subtype_filter[8];
-};
-struct watch_notification_filter {
- __u32 nr_filters;
- __u32 __reserved;
- struct watch_notification_type_filter filters[];
-};
-struct watch_notification_removal {
- struct watch_notification watch;
- __u64 id;
-};
-enum key_notification_subtype {
- NOTIFY_KEY_INSTANTIATED = 0,
- NOTIFY_KEY_UPDATED = 1,
- NOTIFY_KEY_LINKED = 2,
- NOTIFY_KEY_UNLINKED = 3,
- NOTIFY_KEY_CLEARED = 4,
- NOTIFY_KEY_REVOKED = 5,
- NOTIFY_KEY_INVALIDATED = 6,
- NOTIFY_KEY_SETATTR = 7,
-};
-struct key_notification {
- struct watch_notification watch;
- __u32 key_id;
- __u32 aux;
-};
-#endif
diff --git a/libc/kernel/uapi/linux/vfio_zdev.h b/libc/kernel/uapi/linux/wimax.h
index c678e9a71..b35096c0e 100644
--- a/libc/kernel/uapi/linux/vfio_zdev.h
+++ b/libc/kernel/uapi/linux/wimax.h
@@ -16,39 +16,57 @@
***
****************************************************************************
****************************************************************************/
-#ifndef _VFIO_ZDEV_H_
-#define _VFIO_ZDEV_H_
+#ifndef __LINUX__WIMAX_H__
+#define __LINUX__WIMAX_H__
#include <linux/types.h>
-#include <linux/vfio.h>
-struct vfio_device_info_cap_zpci_base {
- struct vfio_info_cap_header header;
- __u64 start_dma;
- __u64 end_dma;
- __u16 pchid;
- __u16 vfn;
- __u16 fmb_length;
- __u8 pft;
- __u8 gid;
-};
-struct vfio_device_info_cap_zpci_group {
- struct vfio_info_cap_header header;
- __u64 dasm;
- __u64 msi_addr;
- __u64 flags;
-#define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1
- __u16 mui;
- __u16 noi;
- __u16 maxstbl;
- __u8 version;
-};
-struct vfio_device_info_cap_zpci_util {
- struct vfio_info_cap_header header;
- __u32 size;
- __u8 util_str[];
-};
-struct vfio_device_info_cap_zpci_pfip {
- struct vfio_info_cap_header header;
- __u32 size;
- __u8 pfip[];
+enum {
+ WIMAX_GNL_VERSION = 01,
+ WIMAX_GNL_ATTR_INVALID = 0x00,
+ WIMAX_GNL_ATTR_MAX = 10,
+};
+enum {
+ WIMAX_GNL_OP_MSG_FROM_USER,
+ WIMAX_GNL_OP_MSG_TO_USER,
+ WIMAX_GNL_OP_RFKILL,
+ WIMAX_GNL_OP_RESET,
+ WIMAX_GNL_RE_STATE_CHANGE,
+ WIMAX_GNL_OP_STATE_GET,
+};
+enum {
+ WIMAX_GNL_MSG_IFIDX = 1,
+ WIMAX_GNL_MSG_PIPE_NAME,
+ WIMAX_GNL_MSG_DATA,
+};
+enum wimax_rf_state {
+ WIMAX_RF_OFF = 0,
+ WIMAX_RF_ON = 1,
+ WIMAX_RF_QUERY = 2,
+};
+enum {
+ WIMAX_GNL_RFKILL_IFIDX = 1,
+ WIMAX_GNL_RFKILL_STATE,
+};
+enum {
+ WIMAX_GNL_RESET_IFIDX = 1,
+};
+enum {
+ WIMAX_GNL_STGET_IFIDX = 1,
+};
+enum {
+ WIMAX_GNL_STCH_IFIDX = 1,
+ WIMAX_GNL_STCH_STATE_OLD,
+ WIMAX_GNL_STCH_STATE_NEW,
+};
+enum wimax_st {
+ __WIMAX_ST_NULL = 0,
+ WIMAX_ST_DOWN,
+ __WIMAX_ST_QUIESCING,
+ WIMAX_ST_UNINITIALIZED,
+ WIMAX_ST_RADIO_OFF,
+ WIMAX_ST_READY,
+ WIMAX_ST_SCANNING,
+ WIMAX_ST_CONNECTING,
+ WIMAX_ST_CONNECTED,
+ __WIMAX_ST_INVALID
};
#endif
diff --git a/libc/kernel/uapi/linux/wimax/i2400m.h b/libc/kernel/uapi/linux/wimax/i2400m.h
new file mode 100644
index 000000000..446b6619b
--- /dev/null
+++ b/libc/kernel/uapi/linux/wimax/i2400m.h
@@ -0,0 +1,309 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ *** This header was automatically generated from a Linux kernel header
+ *** of the same name, to make information necessary for userspace to
+ *** call into the kernel available to libc. It contains only constants,
+ *** structures, and macros generated from the original header, and thus,
+ *** contains no copyrightable information.
+ ***
+ *** To edit the content of this header, modify the corresponding
+ *** source file (e.g. under external/kernel-headers/original/) then
+ *** run bionic/libc/kernel/tools/update_all.py
+ ***
+ *** Any manual change here will be lost the next time this script will
+ *** be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX__WIMAX__I2400M_H__
+#define __LINUX__WIMAX__I2400M_H__
+#include <linux/types.h>
+#include <linux/if_ether.h>
+struct i2400m_bcf_hdr {
+ __le32 module_type;
+ __le32 header_len;
+ __le32 header_version;
+ __le32 module_id;
+ __le32 module_vendor;
+ __le32 date;
+ __le32 size;
+ __le32 key_size;
+ __le32 modulus_size;
+ __le32 exponent_size;
+ __u8 reserved[88];
+} __attribute__((packed));
+enum i2400m_brh_opcode {
+ I2400M_BRH_READ = 1,
+ I2400M_BRH_WRITE = 2,
+ I2400M_BRH_JUMP = 3,
+ I2400M_BRH_SIGNED_JUMP = 8,
+ I2400M_BRH_HASH_PAYLOAD_ONLY = 9,
+};
+enum i2400m_brh {
+ I2400M_BRH_SIGNATURE = 0xcbbc0000,
+ I2400M_BRH_SIGNATURE_MASK = 0xffff0000,
+ I2400M_BRH_SIGNATURE_SHIFT = 16,
+ I2400M_BRH_OPCODE_MASK = 0x0000000f,
+ I2400M_BRH_RESPONSE_MASK = 0x000000f0,
+ I2400M_BRH_RESPONSE_SHIFT = 4,
+ I2400M_BRH_DIRECT_ACCESS = 0x00000400,
+ I2400M_BRH_RESPONSE_REQUIRED = 0x00000200,
+ I2400M_BRH_USE_CHECKSUM = 0x00000100,
+};
+struct i2400m_bootrom_header {
+ __le32 command;
+ __le32 target_addr;
+ __le32 data_size;
+ __le32 block_checksum;
+ char payload[0];
+} __attribute__((packed));
+enum i2400m_pt {
+ I2400M_PT_DATA = 0,
+ I2400M_PT_CTRL,
+ I2400M_PT_TRACE,
+ I2400M_PT_RESET_WARM,
+ I2400M_PT_RESET_COLD,
+ I2400M_PT_EDATA,
+ I2400M_PT_ILLEGAL
+};
+struct i2400m_pl_data_hdr {
+ __le32 reserved;
+} __attribute__((packed));
+struct i2400m_pl_edata_hdr {
+ __le32 reorder;
+ __u8 cs;
+ __u8 reserved[11];
+} __attribute__((packed));
+enum i2400m_cs {
+ I2400M_CS_IPV4_0 = 0,
+ I2400M_CS_IPV4 = 2,
+};
+enum i2400m_ro {
+ I2400M_RO_NEEDED = 0x01,
+ I2400M_RO_TYPE = 0x03,
+ I2400M_RO_TYPE_SHIFT = 1,
+ I2400M_RO_CIN = 0x0f,
+ I2400M_RO_CIN_SHIFT = 4,
+ I2400M_RO_FBN = 0x07ff,
+ I2400M_RO_FBN_SHIFT = 8,
+ I2400M_RO_SN = 0x07ff,
+ I2400M_RO_SN_SHIFT = 21,
+};
+enum i2400m_ro_type {
+ I2400M_RO_TYPE_RESET = 0,
+ I2400M_RO_TYPE_PACKET,
+ I2400M_RO_TYPE_WS,
+ I2400M_RO_TYPE_PACKET_WS,
+};
+enum {
+ I2400M_PL_ALIGN = 16,
+ I2400M_PL_SIZE_MAX = 0x3EFF,
+ I2400M_MAX_PLS_IN_MSG = 60,
+ I2400M_H2D_PREVIEW_BARKER = 0xcafe900d,
+ I2400M_COLD_RESET_BARKER = 0xc01dc01d,
+ I2400M_WARM_RESET_BARKER = 0x50f750f7,
+ I2400M_NBOOT_BARKER = 0xdeadbeef,
+ I2400M_SBOOT_BARKER = 0x0ff1c1a1,
+ I2400M_SBOOT_BARKER_6050 = 0x80000001,
+ I2400M_ACK_BARKER = 0xfeedbabe,
+ I2400M_D2H_MSG_BARKER = 0xbeefbabe,
+};
+struct i2400m_pld {
+ __le32 val;
+} __attribute__((packed));
+#define I2400M_PLD_SIZE_MASK 0x00003fff
+#define I2400M_PLD_TYPE_SHIFT 16
+#define I2400M_PLD_TYPE_MASK 0x000f0000
+struct i2400m_msg_hdr {
+ union {
+ __le32 barker;
+ __u32 size;
+ };
+ union {
+ __le32 sequence;
+ __u32 offset;
+ };
+ __le16 num_pls;
+ __le16 rsv1;
+ __le16 padding;
+ __le16 rsv2;
+ struct i2400m_pld pld[0];
+} __attribute__((packed));
+enum {
+ I2400M_L3L4_VERSION = 0x0100,
+};
+enum i2400m_mt {
+ I2400M_MT_RESERVED = 0x0000,
+ I2400M_MT_INVALID = 0xffff,
+ I2400M_MT_REPORT_MASK = 0x8000,
+ I2400M_MT_GET_SCAN_RESULT = 0x4202,
+ I2400M_MT_SET_SCAN_PARAM = 0x4402,
+ I2400M_MT_CMD_RF_CONTROL = 0x4602,
+ I2400M_MT_CMD_SCAN = 0x4603,
+ I2400M_MT_CMD_CONNECT = 0x4604,
+ I2400M_MT_CMD_DISCONNECT = 0x4605,
+ I2400M_MT_CMD_EXIT_IDLE = 0x4606,
+ I2400M_MT_GET_LM_VERSION = 0x5201,
+ I2400M_MT_GET_DEVICE_INFO = 0x5202,
+ I2400M_MT_GET_LINK_STATUS = 0x5203,
+ I2400M_MT_GET_STATISTICS = 0x5204,
+ I2400M_MT_GET_STATE = 0x5205,
+ I2400M_MT_GET_MEDIA_STATUS = 0x5206,
+ I2400M_MT_SET_INIT_CONFIG = 0x5404,
+ I2400M_MT_CMD_INIT = 0x5601,
+ I2400M_MT_CMD_TERMINATE = 0x5602,
+ I2400M_MT_CMD_MODE_OF_OP = 0x5603,
+ I2400M_MT_CMD_RESET_DEVICE = 0x5604,
+ I2400M_MT_CMD_MONITOR_CONTROL = 0x5605,
+ I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606,
+ I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201,
+ I2400M_MT_SET_EAP_SUCCESS = 0x6402,
+ I2400M_MT_SET_EAP_FAIL = 0x6403,
+ I2400M_MT_SET_EAP_KEY = 0x6404,
+ I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602,
+ I2400M_MT_REPORT_SCAN_RESULT = 0xc002,
+ I2400M_MT_REPORT_STATE = 0xd002,
+ I2400M_MT_REPORT_POWERSAVE_READY = 0xd005,
+ I2400M_MT_REPORT_EAP_REQUEST = 0xe002,
+ I2400M_MT_REPORT_EAP_RESTART = 0xe003,
+ I2400M_MT_REPORT_ALT_ACCEPT = 0xe004,
+ I2400M_MT_REPORT_KEY_REQUEST = 0xe005,
+};
+enum i2400m_ms {
+ I2400M_MS_DONE_OK = 0,
+ I2400M_MS_DONE_IN_PROGRESS = 1,
+ I2400M_MS_INVALID_OP = 2,
+ I2400M_MS_BAD_STATE = 3,
+ I2400M_MS_ILLEGAL_VALUE = 4,
+ I2400M_MS_MISSING_PARAMS = 5,
+ I2400M_MS_VERSION_ERROR = 6,
+ I2400M_MS_ACCESSIBILITY_ERROR = 7,
+ I2400M_MS_BUSY = 8,
+ I2400M_MS_CORRUPTED_TLV = 9,
+ I2400M_MS_UNINITIALIZED = 10,
+ I2400M_MS_UNKNOWN_ERROR = 11,
+ I2400M_MS_PRODUCTION_ERROR = 12,
+ I2400M_MS_NO_RF = 13,
+ I2400M_MS_NOT_READY_FOR_POWERSAVE = 14,
+ I2400M_MS_THERMAL_CRITICAL = 15,
+ I2400M_MS_MAX
+};
+enum i2400m_tlv {
+ I2400M_TLV_L4_MESSAGE_VERSIONS = 129,
+ I2400M_TLV_SYSTEM_STATE = 141,
+ I2400M_TLV_MEDIA_STATUS = 161,
+ I2400M_TLV_RF_OPERATION = 162,
+ I2400M_TLV_RF_STATUS = 163,
+ I2400M_TLV_DEVICE_RESET_TYPE = 132,
+ I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
+ I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611,
+ I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614,
+ I2400M_TLV_CONFIG_DL_HOST_REORDER = 615,
+};
+struct i2400m_tlv_hdr {
+ __le16 type;
+ __le16 length;
+ __u8 pl[0];
+} __attribute__((packed));
+struct i2400m_l3l4_hdr {
+ __le16 type;
+ __le16 length;
+ __le16 version;
+ __le16 resv1;
+ __le16 status;
+ __le16 resv2;
+ struct i2400m_tlv_hdr pl[0];
+} __attribute__((packed));
+enum i2400m_system_state {
+ I2400M_SS_UNINITIALIZED = 1,
+ I2400M_SS_INIT,
+ I2400M_SS_READY,
+ I2400M_SS_SCAN,
+ I2400M_SS_STANDBY,
+ I2400M_SS_CONNECTING,
+ I2400M_SS_WIMAX_CONNECTED,
+ I2400M_SS_DATA_PATH_CONNECTED,
+ I2400M_SS_IDLE,
+ I2400M_SS_DISCONNECTING,
+ I2400M_SS_OUT_OF_ZONE,
+ I2400M_SS_SLEEPACTIVE,
+ I2400M_SS_PRODUCTION,
+ I2400M_SS_CONFIG,
+ I2400M_SS_RF_OFF,
+ I2400M_SS_RF_SHUTDOWN,
+ I2400M_SS_DEVICE_DISCONNECT,
+ I2400M_SS_MAX,
+};
+struct i2400m_tlv_system_state {
+ struct i2400m_tlv_hdr hdr;
+ __le32 state;
+} __attribute__((packed));
+struct i2400m_tlv_l4_message_versions {
+ struct i2400m_tlv_hdr hdr;
+ __le16 major;
+ __le16 minor;
+ __le16 branch;
+ __le16 reserved;
+} __attribute__((packed));
+struct i2400m_tlv_detailed_device_info {
+ struct i2400m_tlv_hdr hdr;
+ __u8 reserved1[400];
+ __u8 mac_address[ETH_ALEN];
+ __u8 reserved2[2];
+} __attribute__((packed));
+enum i2400m_rf_switch_status {
+ I2400M_RF_SWITCH_ON = 1,
+ I2400M_RF_SWITCH_OFF = 2,
+};
+struct i2400m_tlv_rf_switches_status {
+ struct i2400m_tlv_hdr hdr;
+ __u8 sw_rf_switch;
+ __u8 hw_rf_switch;
+ __u8 reserved[2];
+} __attribute__((packed));
+enum {
+ i2400m_rf_operation_on = 1,
+ i2400m_rf_operation_off = 2
+};
+struct i2400m_tlv_rf_operation {
+ struct i2400m_tlv_hdr hdr;
+ __le32 status;
+} __attribute__((packed));
+enum i2400m_tlv_reset_type {
+ I2400M_RESET_TYPE_COLD = 1,
+ I2400M_RESET_TYPE_WARM
+};
+struct i2400m_tlv_device_reset_type {
+ struct i2400m_tlv_hdr hdr;
+ __le32 reset_type;
+} __attribute__((packed));
+struct i2400m_tlv_config_idle_parameters {
+ struct i2400m_tlv_hdr hdr;
+ __le32 idle_timeout;
+ __le32 idle_paging_interval;
+} __attribute__((packed));
+enum i2400m_media_status {
+ I2400M_MEDIA_STATUS_LINK_UP = 1,
+ I2400M_MEDIA_STATUS_LINK_DOWN,
+ I2400M_MEDIA_STATUS_LINK_RENEW,
+};
+struct i2400m_tlv_media_status {
+ struct i2400m_tlv_hdr hdr;
+ __le32 media_status;
+} __attribute__((packed));
+struct i2400m_tlv_config_idle_timeout {
+ struct i2400m_tlv_hdr hdr;
+ __le32 timeout;
+} __attribute__((packed));
+struct i2400m_tlv_config_d2h_data_format {
+ struct i2400m_tlv_hdr hdr;
+ __u8 format;
+ __u8 reserved[3];
+} __attribute__((packed));
+struct i2400m_tlv_config_dl_host_reorder {
+ struct i2400m_tlv_hdr hdr;
+ __u8 reorder;
+ __u8 reserved[3];
+} __attribute__((packed));
+#endif
diff --git a/libc/kernel/uapi/linux/wireguard.h b/libc/kernel/uapi/linux/wireguard.h
deleted file mode 100644
index 6a4128baa..000000000
--- a/libc/kernel/uapi/linux/wireguard.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _WG_UAPI_WIREGUARD_H
-#define _WG_UAPI_WIREGUARD_H
-#define WG_GENL_NAME "wireguard"
-#define WG_GENL_VERSION 1
-#define WG_KEY_LEN 32
-enum wg_cmd {
- WG_CMD_GET_DEVICE,
- WG_CMD_SET_DEVICE,
- __WG_CMD_MAX
-};
-#define WG_CMD_MAX (__WG_CMD_MAX - 1)
-enum wgdevice_flag {
- WGDEVICE_F_REPLACE_PEERS = 1U << 0,
- __WGDEVICE_F_ALL = WGDEVICE_F_REPLACE_PEERS
-};
-enum wgdevice_attribute {
- WGDEVICE_A_UNSPEC,
- WGDEVICE_A_IFINDEX,
- WGDEVICE_A_IFNAME,
- WGDEVICE_A_PRIVATE_KEY,
- WGDEVICE_A_PUBLIC_KEY,
- WGDEVICE_A_FLAGS,
- WGDEVICE_A_LISTEN_PORT,
- WGDEVICE_A_FWMARK,
- WGDEVICE_A_PEERS,
- __WGDEVICE_A_LAST
-};
-#define WGDEVICE_A_MAX (__WGDEVICE_A_LAST - 1)
-enum wgpeer_flag {
- WGPEER_F_REMOVE_ME = 1U << 0,
- WGPEER_F_REPLACE_ALLOWEDIPS = 1U << 1,
- WGPEER_F_UPDATE_ONLY = 1U << 2,
- __WGPEER_F_ALL = WGPEER_F_REMOVE_ME | WGPEER_F_REPLACE_ALLOWEDIPS | WGPEER_F_UPDATE_ONLY
-};
-enum wgpeer_attribute {
- WGPEER_A_UNSPEC,
- WGPEER_A_PUBLIC_KEY,
- WGPEER_A_PRESHARED_KEY,
- WGPEER_A_FLAGS,
- WGPEER_A_ENDPOINT,
- WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL,
- WGPEER_A_LAST_HANDSHAKE_TIME,
- WGPEER_A_RX_BYTES,
- WGPEER_A_TX_BYTES,
- WGPEER_A_ALLOWEDIPS,
- WGPEER_A_PROTOCOL_VERSION,
- __WGPEER_A_LAST
-};
-#define WGPEER_A_MAX (__WGPEER_A_LAST - 1)
-enum wgallowedip_attribute {
- WGALLOWEDIP_A_UNSPEC,
- WGALLOWEDIP_A_FAMILY,
- WGALLOWEDIP_A_IPADDR,
- WGALLOWEDIP_A_CIDR_MASK,
- __WGALLOWEDIP_A_LAST
-};
-#define WGALLOWEDIP_A_MAX (__WGALLOWEDIP_A_LAST - 1)
-#endif
diff --git a/libc/kernel/uapi/linux/wireless.h b/libc/kernel/uapi/linux/wireless.h
index ca31dd235..6d41b9482 100644
--- a/libc/kernel/uapi/linux/wireless.h
+++ b/libc/kernel/uapi/linux/wireless.h
@@ -21,7 +21,6 @@
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/if.h>
-#include <stddef.h>
#define WIRELESS_EXT 22
#define SIOCSIWCOMMIT 0x8B00
#define SIOCGIWNAME 0x8B01
@@ -436,7 +435,7 @@ struct iw_event {
#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
-#define IW_EV_POINT_OFF offsetof(struct iw_point, length)
+#define IW_EV_POINT_OFF (((char *) & (((struct iw_point *) NULL)->length)) - (char *) NULL)
#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - IW_EV_POINT_OFF)
#define IW_EV_LCP_PK_LEN (4)
#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
diff --git a/libc/kernel/uapi/linux/xattr.h b/libc/kernel/uapi/linux/xattr.h
index fd021596f..7c098f49e 100644
--- a/libc/kernel/uapi/linux/xattr.h
+++ b/libc/kernel/uapi/linux/xattr.h
@@ -30,8 +30,6 @@
#define XATTR_MAC_OSX_PREFIX_LEN (sizeof(XATTR_MAC_OSX_PREFIX) - 1)
#define XATTR_BTRFS_PREFIX "btrfs."
#define XATTR_BTRFS_PREFIX_LEN (sizeof(XATTR_BTRFS_PREFIX) - 1)
-#define XATTR_HURD_PREFIX "gnu."
-#define XATTR_HURD_PREFIX_LEN (sizeof(XATTR_HURD_PREFIX) - 1)
#define XATTR_SECURITY_PREFIX "security."
#define XATTR_SECURITY_PREFIX_LEN (sizeof(XATTR_SECURITY_PREFIX) - 1)
#define XATTR_SYSTEM_PREFIX "system."
diff --git a/libc/kernel/uapi/linux/xdp_diag.h b/libc/kernel/uapi/linux/xdp_diag.h
index 1fe9d49b9..f7d203f2b 100644
--- a/libc/kernel/uapi/linux/xdp_diag.h
+++ b/libc/kernel/uapi/linux/xdp_diag.h
@@ -38,7 +38,6 @@ struct xdp_diag_msg {
#define XDP_SHOW_RING_CFG (1 << 1)
#define XDP_SHOW_UMEM (1 << 2)
#define XDP_SHOW_MEMINFO (1 << 3)
-#define XDP_SHOW_STATS (1 << 4)
enum {
XDP_DIAG_NONE,
XDP_DIAG_INFO,
@@ -49,7 +48,6 @@ enum {
XDP_DIAG_UMEM_FILL_RING,
XDP_DIAG_UMEM_COMPLETION_RING,
XDP_DIAG_MEMINFO,
- XDP_DIAG_STATS,
__XDP_DIAG_MAX,
};
#define XDP_DIAG_MAX (__XDP_DIAG_MAX - 1)
@@ -72,12 +70,4 @@ struct xdp_diag_umem {
__u32 flags;
__u32 refs;
};
-struct xdp_diag_stats {
- __u64 n_rx_dropped;
- __u64 n_rx_invalid;
- __u64 n_rx_full;
- __u64 n_fill_ring_empty;
- __u64 n_tx_invalid;
- __u64 n_tx_ring_empty;
-};
#endif
diff --git a/libc/kernel/uapi/linux/xfrm.h b/libc/kernel/uapi/linux/xfrm.h
index b0e930c94..ea0ef5ee6 100644
--- a/libc/kernel/uapi/linux/xfrm.h
+++ b/libc/kernel/uapi/linux/xfrm.h
@@ -328,7 +328,6 @@ struct xfrm_usersa_info {
#define XFRM_STATE_ESN 128
};
#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP 1
-#define XFRM_SA_XFLAG_OSEQ_MAY_WRAP 2
struct xfrm_usersa_id {
xfrm_address_t daddr;
__be32 spi;
diff --git a/libc/kernel/uapi/misc/fastrpc.h b/libc/kernel/uapi/misc/fastrpc.h
index 62955ec6c..762eefc83 100644
--- a/libc/kernel/uapi/misc/fastrpc.h
+++ b/libc/kernel/uapi/misc/fastrpc.h
@@ -26,7 +26,6 @@
#define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)
#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)
#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap)
-#define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8)
struct fastrpc_invoke_args {
__u64 ptr;
__u64 length;
diff --git a/libc/kernel/uapi/misc/habanalabs.h b/libc/kernel/uapi/misc/habanalabs.h
index b00902393..91849ec5a 100644
--- a/libc/kernel/uapi/misc/habanalabs.h
+++ b/libc/kernel/uapi/misc/habanalabs.h
@@ -21,9 +21,6 @@
#include <linux/types.h>
#include <linux/ioctl.h>
#define GOYA_KMD_SRAM_RESERVED_SIZE_FROM_START 0x8000
-#define GAUDI_DRIVER_SRAM_RESERVED_SIZE_FROM_START 0x80
-#define GAUDI_FIRST_AVAILABLE_W_S_SYNC_OBJECT 144
-#define GAUDI_FIRST_AVAILABLE_W_S_MONITOR 72
enum goya_queue_id {
GOYA_QUEUE_ID_DMA_0 = 0,
GOYA_QUEUE_ID_DMA_1 = 1,
@@ -42,122 +39,6 @@ enum goya_queue_id {
GOYA_QUEUE_ID_TPC7 = 14,
GOYA_QUEUE_ID_SIZE
};
-enum gaudi_queue_id {
- GAUDI_QUEUE_ID_DMA_0_0 = 0,
- GAUDI_QUEUE_ID_DMA_0_1 = 1,
- GAUDI_QUEUE_ID_DMA_0_2 = 2,
- GAUDI_QUEUE_ID_DMA_0_3 = 3,
- GAUDI_QUEUE_ID_DMA_1_0 = 4,
- GAUDI_QUEUE_ID_DMA_1_1 = 5,
- GAUDI_QUEUE_ID_DMA_1_2 = 6,
- GAUDI_QUEUE_ID_DMA_1_3 = 7,
- GAUDI_QUEUE_ID_CPU_PQ = 8,
- GAUDI_QUEUE_ID_DMA_2_0 = 9,
- GAUDI_QUEUE_ID_DMA_2_1 = 10,
- GAUDI_QUEUE_ID_DMA_2_2 = 11,
- GAUDI_QUEUE_ID_DMA_2_3 = 12,
- GAUDI_QUEUE_ID_DMA_3_0 = 13,
- GAUDI_QUEUE_ID_DMA_3_1 = 14,
- GAUDI_QUEUE_ID_DMA_3_2 = 15,
- GAUDI_QUEUE_ID_DMA_3_3 = 16,
- GAUDI_QUEUE_ID_DMA_4_0 = 17,
- GAUDI_QUEUE_ID_DMA_4_1 = 18,
- GAUDI_QUEUE_ID_DMA_4_2 = 19,
- GAUDI_QUEUE_ID_DMA_4_3 = 20,
- GAUDI_QUEUE_ID_DMA_5_0 = 21,
- GAUDI_QUEUE_ID_DMA_5_1 = 22,
- GAUDI_QUEUE_ID_DMA_5_2 = 23,
- GAUDI_QUEUE_ID_DMA_5_3 = 24,
- GAUDI_QUEUE_ID_DMA_6_0 = 25,
- GAUDI_QUEUE_ID_DMA_6_1 = 26,
- GAUDI_QUEUE_ID_DMA_6_2 = 27,
- GAUDI_QUEUE_ID_DMA_6_3 = 28,
- GAUDI_QUEUE_ID_DMA_7_0 = 29,
- GAUDI_QUEUE_ID_DMA_7_1 = 30,
- GAUDI_QUEUE_ID_DMA_7_2 = 31,
- GAUDI_QUEUE_ID_DMA_7_3 = 32,
- GAUDI_QUEUE_ID_MME_0_0 = 33,
- GAUDI_QUEUE_ID_MME_0_1 = 34,
- GAUDI_QUEUE_ID_MME_0_2 = 35,
- GAUDI_QUEUE_ID_MME_0_3 = 36,
- GAUDI_QUEUE_ID_MME_1_0 = 37,
- GAUDI_QUEUE_ID_MME_1_1 = 38,
- GAUDI_QUEUE_ID_MME_1_2 = 39,
- GAUDI_QUEUE_ID_MME_1_3 = 40,
- GAUDI_QUEUE_ID_TPC_0_0 = 41,
- GAUDI_QUEUE_ID_TPC_0_1 = 42,
- GAUDI_QUEUE_ID_TPC_0_2 = 43,
- GAUDI_QUEUE_ID_TPC_0_3 = 44,
- GAUDI_QUEUE_ID_TPC_1_0 = 45,
- GAUDI_QUEUE_ID_TPC_1_1 = 46,
- GAUDI_QUEUE_ID_TPC_1_2 = 47,
- GAUDI_QUEUE_ID_TPC_1_3 = 48,
- GAUDI_QUEUE_ID_TPC_2_0 = 49,
- GAUDI_QUEUE_ID_TPC_2_1 = 50,
- GAUDI_QUEUE_ID_TPC_2_2 = 51,
- GAUDI_QUEUE_ID_TPC_2_3 = 52,
- GAUDI_QUEUE_ID_TPC_3_0 = 53,
- GAUDI_QUEUE_ID_TPC_3_1 = 54,
- GAUDI_QUEUE_ID_TPC_3_2 = 55,
- GAUDI_QUEUE_ID_TPC_3_3 = 56,
- GAUDI_QUEUE_ID_TPC_4_0 = 57,
- GAUDI_QUEUE_ID_TPC_4_1 = 58,
- GAUDI_QUEUE_ID_TPC_4_2 = 59,
- GAUDI_QUEUE_ID_TPC_4_3 = 60,
- GAUDI_QUEUE_ID_TPC_5_0 = 61,
- GAUDI_QUEUE_ID_TPC_5_1 = 62,
- GAUDI_QUEUE_ID_TPC_5_2 = 63,
- GAUDI_QUEUE_ID_TPC_5_3 = 64,
- GAUDI_QUEUE_ID_TPC_6_0 = 65,
- GAUDI_QUEUE_ID_TPC_6_1 = 66,
- GAUDI_QUEUE_ID_TPC_6_2 = 67,
- GAUDI_QUEUE_ID_TPC_6_3 = 68,
- GAUDI_QUEUE_ID_TPC_7_0 = 69,
- GAUDI_QUEUE_ID_TPC_7_1 = 70,
- GAUDI_QUEUE_ID_TPC_7_2 = 71,
- GAUDI_QUEUE_ID_TPC_7_3 = 72,
- GAUDI_QUEUE_ID_NIC_0_0 = 73,
- GAUDI_QUEUE_ID_NIC_0_1 = 74,
- GAUDI_QUEUE_ID_NIC_0_2 = 75,
- GAUDI_QUEUE_ID_NIC_0_3 = 76,
- GAUDI_QUEUE_ID_NIC_1_0 = 77,
- GAUDI_QUEUE_ID_NIC_1_1 = 78,
- GAUDI_QUEUE_ID_NIC_1_2 = 79,
- GAUDI_QUEUE_ID_NIC_1_3 = 80,
- GAUDI_QUEUE_ID_NIC_2_0 = 81,
- GAUDI_QUEUE_ID_NIC_2_1 = 82,
- GAUDI_QUEUE_ID_NIC_2_2 = 83,
- GAUDI_QUEUE_ID_NIC_2_3 = 84,
- GAUDI_QUEUE_ID_NIC_3_0 = 85,
- GAUDI_QUEUE_ID_NIC_3_1 = 86,
- GAUDI_QUEUE_ID_NIC_3_2 = 87,
- GAUDI_QUEUE_ID_NIC_3_3 = 88,
- GAUDI_QUEUE_ID_NIC_4_0 = 89,
- GAUDI_QUEUE_ID_NIC_4_1 = 90,
- GAUDI_QUEUE_ID_NIC_4_2 = 91,
- GAUDI_QUEUE_ID_NIC_4_3 = 92,
- GAUDI_QUEUE_ID_NIC_5_0 = 93,
- GAUDI_QUEUE_ID_NIC_5_1 = 94,
- GAUDI_QUEUE_ID_NIC_5_2 = 95,
- GAUDI_QUEUE_ID_NIC_5_3 = 96,
- GAUDI_QUEUE_ID_NIC_6_0 = 97,
- GAUDI_QUEUE_ID_NIC_6_1 = 98,
- GAUDI_QUEUE_ID_NIC_6_2 = 99,
- GAUDI_QUEUE_ID_NIC_6_3 = 100,
- GAUDI_QUEUE_ID_NIC_7_0 = 101,
- GAUDI_QUEUE_ID_NIC_7_1 = 102,
- GAUDI_QUEUE_ID_NIC_7_2 = 103,
- GAUDI_QUEUE_ID_NIC_7_3 = 104,
- GAUDI_QUEUE_ID_NIC_8_0 = 105,
- GAUDI_QUEUE_ID_NIC_8_1 = 106,
- GAUDI_QUEUE_ID_NIC_8_2 = 107,
- GAUDI_QUEUE_ID_NIC_8_3 = 108,
- GAUDI_QUEUE_ID_NIC_9_0 = 109,
- GAUDI_QUEUE_ID_NIC_9_1 = 110,
- GAUDI_QUEUE_ID_NIC_9_2 = 111,
- GAUDI_QUEUE_ID_NIC_9_3 = 112,
- GAUDI_QUEUE_ID_SIZE
-};
enum goya_engine_id {
GOYA_ENGINE_ID_DMA_0 = 0,
GOYA_ENGINE_ID_DMA_1,
@@ -175,44 +56,10 @@ enum goya_engine_id {
GOYA_ENGINE_ID_TPC_7,
GOYA_ENGINE_ID_SIZE
};
-enum gaudi_engine_id {
- GAUDI_ENGINE_ID_DMA_0 = 0,
- GAUDI_ENGINE_ID_DMA_1,
- GAUDI_ENGINE_ID_DMA_2,
- GAUDI_ENGINE_ID_DMA_3,
- GAUDI_ENGINE_ID_DMA_4,
- GAUDI_ENGINE_ID_DMA_5,
- GAUDI_ENGINE_ID_DMA_6,
- GAUDI_ENGINE_ID_DMA_7,
- GAUDI_ENGINE_ID_MME_0,
- GAUDI_ENGINE_ID_MME_1,
- GAUDI_ENGINE_ID_MME_2,
- GAUDI_ENGINE_ID_MME_3,
- GAUDI_ENGINE_ID_TPC_0,
- GAUDI_ENGINE_ID_TPC_1,
- GAUDI_ENGINE_ID_TPC_2,
- GAUDI_ENGINE_ID_TPC_3,
- GAUDI_ENGINE_ID_TPC_4,
- GAUDI_ENGINE_ID_TPC_5,
- GAUDI_ENGINE_ID_TPC_6,
- GAUDI_ENGINE_ID_TPC_7,
- GAUDI_ENGINE_ID_NIC_0,
- GAUDI_ENGINE_ID_NIC_1,
- GAUDI_ENGINE_ID_NIC_2,
- GAUDI_ENGINE_ID_NIC_3,
- GAUDI_ENGINE_ID_NIC_4,
- GAUDI_ENGINE_ID_NIC_5,
- GAUDI_ENGINE_ID_NIC_6,
- GAUDI_ENGINE_ID_NIC_7,
- GAUDI_ENGINE_ID_NIC_8,
- GAUDI_ENGINE_ID_NIC_9,
- GAUDI_ENGINE_ID_SIZE
-};
enum hl_device_status {
HL_DEVICE_STATUS_OPERATIONAL,
HL_DEVICE_STATUS_IN_RESET,
- HL_DEVICE_STATUS_MALFUNCTION,
- HL_DEVICE_STATUS_NEEDS_RESET
+ HL_DEVICE_STATUS_MALFUNCTION
};
#define HL_INFO_HW_IP_INFO 0
#define HL_INFO_HW_EVENTS 1
@@ -223,13 +70,6 @@ enum hl_device_status {
#define HL_INFO_HW_EVENTS_AGGREGATE 7
#define HL_INFO_CLK_RATE 8
#define HL_INFO_RESET_COUNT 9
-#define HL_INFO_TIME_SYNC 10
-#define HL_INFO_CS_COUNTERS 11
-#define HL_INFO_PCI_COUNTERS 12
-#define HL_INFO_CLK_THROTTLE_REASON 13
-#define HL_INFO_SYNC_MANAGER 14
-#define HL_INFO_TOTAL_ENERGY 15
-#define HL_INFO_PLL_FREQUENCY 16
#define HL_INFO_VERSION_MAX_LEN 128
#define HL_INFO_CARD_NAME_MAX_LEN 16
struct hl_info_hw_ip_info {
@@ -239,11 +79,8 @@ struct hl_info_hw_ip_info {
__u32 sram_size;
__u32 num_of_events;
__u32 device_id;
- __u32 module_id;
- __u32 reserved;
- __u16 first_available_interrupt_id;
- __u16 reserved2;
- __u32 cpld_version;
+ __u32 reserved[3];
+ __u32 armcp_cpld_version;
__u32 psoc_pci_pll_nr;
__u32 psoc_pci_pll_nf;
__u32 psoc_pci_pll_od;
@@ -251,20 +88,16 @@ struct hl_info_hw_ip_info {
__u8 tpc_enabled_mask;
__u8 dram_enabled;
__u8 pad[2];
- __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
+ __u8 armcp_version[HL_INFO_VERSION_MAX_LEN];
__u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
- __u64 reserved3;
- __u64 dram_page_size;
};
struct hl_info_dram_usage {
__u64 dram_free_mem;
__u64 ctx_dram_mem;
};
-#define HL_BUSY_ENGINES_MASK_EXT_SIZE 2
struct hl_info_hw_idle {
__u32 is_idle;
__u32 busy_engines_mask;
- __u64 busy_engines_mask_ext[HL_BUSY_ENGINES_MASK_EXT_SIZE];
};
struct hl_info_device_status {
__u32 status;
@@ -282,122 +115,47 @@ struct hl_info_reset_count {
__u32 hard_reset_cnt;
__u32 soft_reset_cnt;
};
-struct hl_info_time_sync {
- __u64 device_time;
- __u64 host_time;
-};
-struct hl_info_pci_counters {
- __u64 rx_throughput;
- __u64 tx_throughput;
- __u64 replay_cnt;
-};
-#define HL_CLK_THROTTLE_POWER 0x1
-#define HL_CLK_THROTTLE_THERMAL 0x2
-struct hl_info_clk_throttle {
- __u32 clk_throttling_reason;
-};
-struct hl_info_energy {
- __u64 total_energy_consumption;
-};
-#define HL_PLL_NUM_OUTPUTS 4
-struct hl_pll_frequency_info {
- __u16 output[HL_PLL_NUM_OUTPUTS];
-};
-struct hl_info_sync_manager {
- __u32 first_available_sync_object;
- __u32 first_available_monitor;
- __u32 first_available_cq;
- __u32 reserved;
-};
-struct hl_info_cs_counters {
- __u64 total_out_of_mem_drop_cnt;
- __u64 ctx_out_of_mem_drop_cnt;
- __u64 total_parsing_drop_cnt;
- __u64 ctx_parsing_drop_cnt;
- __u64 total_queue_full_drop_cnt;
- __u64 ctx_queue_full_drop_cnt;
- __u64 total_device_in_reset_drop_cnt;
- __u64 ctx_device_in_reset_drop_cnt;
- __u64 total_max_cs_in_flight_drop_cnt;
- __u64 ctx_max_cs_in_flight_drop_cnt;
- __u64 total_validation_drop_cnt;
- __u64 ctx_validation_drop_cnt;
-};
-enum gaudi_dcores {
- HL_GAUDI_WS_DCORE,
- HL_GAUDI_WN_DCORE,
- HL_GAUDI_EN_DCORE,
- HL_GAUDI_ES_DCORE
-};
struct hl_info_args {
__u64 return_pointer;
__u32 return_size;
__u32 op;
union {
- __u32 dcore_id;
__u32 ctx_id;
__u32 period_ms;
- __u32 pll_index;
};
__u32 pad;
};
#define HL_CB_OP_CREATE 0
#define HL_CB_OP_DESTROY 1
-#define HL_CB_OP_INFO 2
-#define HL_MAX_CB_SIZE (0x200000 - 32)
-#define HL_CB_FLAGS_MAP 0x1
+#define HL_MAX_CB_SIZE 0x200000
struct hl_cb_in {
__u64 cb_handle;
__u32 op;
__u32 cb_size;
__u32 ctx_id;
- __u32 flags;
+ __u32 pad;
};
struct hl_cb_out {
- union {
- __u64 cb_handle;
- struct {
- __u32 usage_cnt;
- __u32 pad;
- };
- };
+ __u64 cb_handle;
};
union hl_cb_args {
struct hl_cb_in in;
struct hl_cb_out out;
};
-#define HL_CS_CHUNK_FLAGS_USER_ALLOC_CB 0x1
struct hl_cs_chunk {
- union {
- __u64 cb_handle;
- __u64 signal_seq_arr;
- };
+ __u64 cb_handle;
__u32 queue_index;
- union {
- __u32 cb_size;
- __u32 num_signal_seq_arr;
- };
+ __u32 cb_size;
__u32 cs_chunk_flags;
- __u32 collective_engine_id;
- __u32 pad[10];
+ __u32 pad[11];
};
#define HL_CS_FLAGS_FORCE_RESTORE 0x1
-#define HL_CS_FLAGS_SIGNAL 0x2
-#define HL_CS_FLAGS_WAIT 0x4
-#define HL_CS_FLAGS_COLLECTIVE_WAIT 0x8
-#define HL_CS_FLAGS_TIMESTAMP 0x20
-#define HL_CS_FLAGS_STAGED_SUBMISSION 0x40
-#define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80
-#define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100
#define HL_CS_STATUS_SUCCESS 0
#define HL_MAX_JOBS_PER_CS 512
struct hl_cs_in {
__u64 chunks_restore;
__u64 chunks_execute;
- union {
- __u64 chunks_store;
- __u64 seq;
- };
+ __u64 chunks_store;
__u32 num_chunks_restore;
__u32 num_chunks_execute;
__u32 num_chunks_store;
@@ -424,12 +182,9 @@ struct hl_wait_cs_in {
#define HL_WAIT_CS_STATUS_TIMEDOUT 2
#define HL_WAIT_CS_STATUS_ABORTED 3
#define HL_WAIT_CS_STATUS_INTERRUPTED 4
-#define HL_WAIT_CS_STATUS_FLAG_GONE 0x1
-#define HL_WAIT_CS_STATUS_FLAG_TIMESTAMP_VLD 0x2
struct hl_wait_cs_out {
__u32 status;
- __u32 flags;
- __s64 timestamp_nsec;
+ __u32 pad;
};
union hl_wait_cs_args {
struct hl_wait_cs_in in;
@@ -439,7 +194,6 @@ union hl_wait_cs_args {
#define HL_MEM_OP_FREE 1
#define HL_MEM_OP_MAP 2
#define HL_MEM_OP_UNMAP 3
-#define HL_MEM_OP_MAP_BLOCK 4
#define HL_MEM_CONTIGUOUS 0x1
#define HL_MEM_SHARED 0x2
#define HL_MEM_USERPTR 0x4
@@ -461,9 +215,6 @@ struct hl_mem_in {
__u64 mem_size;
} map_host;
struct {
- __u64 block_addr;
- } map_block;
- struct {
__u64 device_virt_addr;
} unmap;
};
@@ -476,11 +227,6 @@ struct hl_mem_out {
union {
__u64 device_virt_addr;
__u64 handle;
- struct {
- __u64 block_handle;
- __u32 block_size;
- __u32 pad;
- };
};
};
union hl_mem_args {
diff --git a/libc/kernel/uapi/misc/pvpanic.h b/libc/kernel/uapi/misc/pvpanic.h
deleted file mode 100644
index 18edcd8eb..000000000
--- a/libc/kernel/uapi/misc/pvpanic.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef __PVPANIC_H__
-#define __PVPANIC_H__
-#define PVPANIC_PANICKED (1 << 0)
-#define PVPANIC_CRASH_LOADED (1 << 1)
-#endif
diff --git a/libc/kernel/uapi/misc/uacce/uacce.h b/libc/kernel/uapi/misc/uacce/uacce.h
deleted file mode 100644
index 469d188ac..000000000
--- a/libc/kernel/uapi/misc/uacce/uacce.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- *** To edit the content of this header, modify the corresponding
- *** source file (e.g. under external/kernel-headers/original/) then
- *** run bionic/libc/kernel/tools/update_all.py
- ***
- *** Any manual change here will be lost the next time this script will
- *** be run. You've been warned!
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _UAPIUUACCE_H
-#define _UAPIUUACCE_H
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#define UACCE_CMD_START_Q _IO('W', 0)
-#define UACCE_CMD_PUT_Q _IO('W', 1)
-#define UACCE_DEV_SVA BIT(0)
-enum uacce_qfrt {
- UACCE_QFRT_MMIO = 0,
- UACCE_QFRT_DUS = 1,
-};
-#endif
diff --git a/libc/kernel/uapi/mtd/mtd-abi.h b/libc/kernel/uapi/mtd/mtd-abi.h
index 680ac1e38..e1e0d59e5 100644
--- a/libc/kernel/uapi/mtd/mtd-abi.h
+++ b/libc/kernel/uapi/mtd/mtd-abi.h
@@ -64,7 +64,6 @@ struct mtd_write_req {
#define MTD_BIT_WRITEABLE 0x800
#define MTD_NO_ERASE 0x1000
#define MTD_POWERUP_LOCK 0x2000
-#define MTD_SLC_ON_MLC_EMULATION 0x4000
#define MTD_CAP_ROM 0
#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
diff --git a/libc/kernel/uapi/rdma/efa-abi.h b/libc/kernel/uapi/rdma/efa-abi.h
index f20e3e00f..39fd55be0 100644
--- a/libc/kernel/uapi/rdma/efa-abi.h
+++ b/libc/kernel/uapi/rdma/efa-abi.h
@@ -20,14 +20,6 @@
#define EFA_ABI_USER_H
#include <linux/types.h>
#define EFA_UVERBS_ABI_VERSION 1
-enum {
- EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH = 1 << 0,
- EFA_ALLOC_UCONTEXT_CMD_COMP_MIN_SQ_WR = 1 << 1,
-};
-struct efa_ibv_alloc_ucontext_cmd {
- __u32 comp_mask;
- __u8 reserved_20[4];
-};
enum efa_ibv_user_cmds_supp_udata {
EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0,
EFA_USER_CMDS_SUPP_UDATA_CREATE_AH = 1 << 1,
@@ -38,9 +30,6 @@ struct efa_ibv_alloc_ucontext_resp {
__u16 sub_cqs_per_cq;
__u16 inline_buf_size;
__u32 max_llq_size;
- __u16 max_tx_batch;
- __u16 min_sq_wr;
- __u8 reserved_a0[4];
};
struct efa_ibv_alloc_pd_resp {
__u32 comp_mask;
@@ -91,7 +80,6 @@ struct efa_ibv_create_ah_resp {
};
enum {
EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
- EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
};
struct efa_ibv_ex_query_device_resp {
__u32 comp_mask;
diff --git a/libc/kernel/uapi/rdma/hfi/hfi1_user.h b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
index 33529076e..e74d8378f 100644
--- a/libc/kernel/uapi/rdma/hfi/hfi1_user.h
+++ b/libc/kernel/uapi/rdma/hfi/hfi1_user.h
@@ -42,7 +42,6 @@
#define HFI1_CAP_OPFN (1UL << 16)
#define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17)
#define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18)
-#define HFI1_CAP_AIP (1UL << 19)
#define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0)
#define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1)
#define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2)
diff --git a/libc/kernel/uapi/rdma/hns-abi.h b/libc/kernel/uapi/rdma/hns-abi.h
index ad3e4607f..0bae0d4c9 100644
--- a/libc/kernel/uapi/rdma/hns-abi.h
+++ b/libc/kernel/uapi/rdma/hns-abi.h
@@ -22,11 +22,6 @@
struct hns_roce_ib_create_cq {
__aligned_u64 buf_addr;
__aligned_u64 db_addr;
- __u32 cqe_size;
- __u32 reserved;
-};
-enum hns_roce_cq_cap_flags {
- HNS_ROCE_CQ_FLAG_RECORD_DB = 1 << 0,
};
struct hns_roce_ib_create_cq_resp {
__aligned_u64 cqn;
@@ -50,17 +45,12 @@ struct hns_roce_ib_create_qp {
__u8 reserved[5];
__aligned_u64 sdb_addr;
};
-enum hns_roce_qp_cap_flags {
- HNS_ROCE_QP_CAP_RQ_RECORD_DB = 1 << 0,
- HNS_ROCE_QP_CAP_SQ_RECORD_DB = 1 << 1,
- HNS_ROCE_QP_CAP_OWNER_DB = 1 << 2,
-};
struct hns_roce_ib_create_qp_resp {
__aligned_u64 cap_flags;
};
struct hns_roce_ib_alloc_ucontext_resp {
__u32 qp_tab_size;
- __u32 cqe_size;
+ __u32 reserved;
};
struct hns_roce_ib_alloc_pd_resp {
__u32 pdn;
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
index f96b4e80a..ebf8b7c8d 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_cmds.h
@@ -39,7 +39,6 @@ enum uverbs_default_objects {
UVERBS_OBJECT_FLOW_ACTION,
UVERBS_OBJECT_DM,
UVERBS_OBJECT_COUNTERS,
- UVERBS_OBJECT_ASYNC_EVENT,
};
enum {
UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
@@ -49,10 +48,6 @@ enum uverbs_methods_device {
UVERBS_METHOD_INVOKE_WRITE,
UVERBS_METHOD_INFO_HANDLES,
UVERBS_METHOD_QUERY_PORT,
- UVERBS_METHOD_GET_CONTEXT,
- UVERBS_METHOD_QUERY_CONTEXT,
- UVERBS_METHOD_QUERY_GID_TABLE,
- UVERBS_METHOD_QUERY_GID_ENTRY,
};
enum uverbs_attrs_invoke_write_cmd_attr_ids {
UVERBS_ATTR_CORE_IN,
@@ -63,14 +58,6 @@ enum uverbs_attrs_query_port_cmd_attr_ids {
UVERBS_ATTR_QUERY_PORT_PORT_NUM,
UVERBS_ATTR_QUERY_PORT_RESP,
};
-enum uverbs_attrs_get_context_attr_ids {
- UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
- UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
-};
-enum uverbs_attrs_query_context_attr_ids {
- UVERBS_ATTR_QUERY_CONTEXT_NUM_COMP_VECTORS,
- UVERBS_ATTR_QUERY_CONTEXT_CORE_SUPPORT,
-};
enum uverbs_attrs_create_cq_cmd_attr_ids {
UVERBS_ATTR_CREATE_CQ_HANDLE,
UVERBS_ATTR_CREATE_CQ_CQE,
@@ -79,7 +66,6 @@ enum uverbs_attrs_create_cq_cmd_attr_ids {
UVERBS_ATTR_CREATE_CQ_COMP_VECTOR,
UVERBS_ATTR_CREATE_CQ_FLAGS,
UVERBS_ATTR_CREATE_CQ_RESP_CQE,
- UVERBS_ATTR_CREATE_CQ_EVENT_FD,
};
enum uverbs_attrs_destroy_cq_cmd_attr_ids {
UVERBS_ATTR_DESTROY_CQ_HANDLE,
@@ -99,81 +85,10 @@ enum uverbs_attrs_modify_flow_action_esp {
enum uverbs_attrs_destroy_flow_action_esp {
UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
};
-enum uverbs_attrs_create_qp_cmd_attr_ids {
- UVERBS_ATTR_CREATE_QP_HANDLE,
- UVERBS_ATTR_CREATE_QP_XRCD_HANDLE,
- UVERBS_ATTR_CREATE_QP_PD_HANDLE,
- UVERBS_ATTR_CREATE_QP_SRQ_HANDLE,
- UVERBS_ATTR_CREATE_QP_SEND_CQ_HANDLE,
- UVERBS_ATTR_CREATE_QP_RECV_CQ_HANDLE,
- UVERBS_ATTR_CREATE_QP_IND_TABLE_HANDLE,
- UVERBS_ATTR_CREATE_QP_USER_HANDLE,
- UVERBS_ATTR_CREATE_QP_CAP,
- UVERBS_ATTR_CREATE_QP_TYPE,
- UVERBS_ATTR_CREATE_QP_FLAGS,
- UVERBS_ATTR_CREATE_QP_SOURCE_QPN,
- UVERBS_ATTR_CREATE_QP_EVENT_FD,
- UVERBS_ATTR_CREATE_QP_RESP_CAP,
- UVERBS_ATTR_CREATE_QP_RESP_QP_NUM,
-};
-enum uverbs_attrs_destroy_qp_cmd_attr_ids {
- UVERBS_ATTR_DESTROY_QP_HANDLE,
- UVERBS_ATTR_DESTROY_QP_RESP,
-};
-enum uverbs_methods_qp {
- UVERBS_METHOD_QP_CREATE,
- UVERBS_METHOD_QP_DESTROY,
-};
-enum uverbs_attrs_create_srq_cmd_attr_ids {
- UVERBS_ATTR_CREATE_SRQ_HANDLE,
- UVERBS_ATTR_CREATE_SRQ_PD_HANDLE,
- UVERBS_ATTR_CREATE_SRQ_XRCD_HANDLE,
- UVERBS_ATTR_CREATE_SRQ_CQ_HANDLE,
- UVERBS_ATTR_CREATE_SRQ_USER_HANDLE,
- UVERBS_ATTR_CREATE_SRQ_MAX_WR,
- UVERBS_ATTR_CREATE_SRQ_MAX_SGE,
- UVERBS_ATTR_CREATE_SRQ_LIMIT,
- UVERBS_ATTR_CREATE_SRQ_MAX_NUM_TAGS,
- UVERBS_ATTR_CREATE_SRQ_TYPE,
- UVERBS_ATTR_CREATE_SRQ_EVENT_FD,
- UVERBS_ATTR_CREATE_SRQ_RESP_MAX_WR,
- UVERBS_ATTR_CREATE_SRQ_RESP_MAX_SGE,
- UVERBS_ATTR_CREATE_SRQ_RESP_SRQ_NUM,
-};
-enum uverbs_attrs_destroy_srq_cmd_attr_ids {
- UVERBS_ATTR_DESTROY_SRQ_HANDLE,
- UVERBS_ATTR_DESTROY_SRQ_RESP,
-};
-enum uverbs_methods_srq {
- UVERBS_METHOD_SRQ_CREATE,
- UVERBS_METHOD_SRQ_DESTROY,
-};
enum uverbs_methods_cq {
UVERBS_METHOD_CQ_CREATE,
UVERBS_METHOD_CQ_DESTROY,
};
-enum uverbs_attrs_create_wq_cmd_attr_ids {
- UVERBS_ATTR_CREATE_WQ_HANDLE,
- UVERBS_ATTR_CREATE_WQ_PD_HANDLE,
- UVERBS_ATTR_CREATE_WQ_CQ_HANDLE,
- UVERBS_ATTR_CREATE_WQ_USER_HANDLE,
- UVERBS_ATTR_CREATE_WQ_TYPE,
- UVERBS_ATTR_CREATE_WQ_EVENT_FD,
- UVERBS_ATTR_CREATE_WQ_MAX_WR,
- UVERBS_ATTR_CREATE_WQ_MAX_SGE,
- UVERBS_ATTR_CREATE_WQ_FLAGS,
- UVERBS_ATTR_CREATE_WQ_RESP_MAX_WR,
- UVERBS_ATTR_CREATE_WQ_RESP_MAX_SGE,
- UVERBS_ATTR_CREATE_WQ_RESP_WQ_NUM,
-};
-enum uverbs_attrs_destroy_wq_cmd_attr_ids {
- UVERBS_ATTR_DESTROY_WQ_HANDLE,
- UVERBS_ATTR_DESTROY_WQ_RESP,
-};
-enum uverbs_methods_wq {
- UVERBS_METHOD_WQ_CREATE,
- UVERBS_METHOD_WQ_DESTROY,
-};
enum uverbs_methods_actions_flow_action_ops {
UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
UVERBS_METHOD_FLOW_ACTION_DESTROY,
@@ -205,8 +120,6 @@ enum uverbs_methods_mr {
UVERBS_METHOD_DM_MR_REG,
UVERBS_METHOD_MR_DESTROY,
UVERBS_METHOD_ADVISE_MR,
- UVERBS_METHOD_QUERY_MR,
- UVERBS_METHOD_REG_DMABUF_MR,
};
enum uverbs_attrs_mr_destroy_ids {
UVERBS_ATTR_DESTROY_MR_HANDLE,
@@ -217,24 +130,6 @@ enum uverbs_attrs_advise_mr_cmd_attr_ids {
UVERBS_ATTR_ADVISE_MR_FLAGS,
UVERBS_ATTR_ADVISE_MR_SGE_LIST,
};
-enum uverbs_attrs_query_mr_cmd_attr_ids {
- UVERBS_ATTR_QUERY_MR_HANDLE,
- UVERBS_ATTR_QUERY_MR_RESP_LKEY,
- UVERBS_ATTR_QUERY_MR_RESP_RKEY,
- UVERBS_ATTR_QUERY_MR_RESP_LENGTH,
- UVERBS_ATTR_QUERY_MR_RESP_IOVA,
-};
-enum uverbs_attrs_reg_dmabuf_mr_cmd_attr_ids {
- UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
- UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
- UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
- UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
- UVERBS_ATTR_REG_DMABUF_MR_IOVA,
- UVERBS_ATTR_REG_DMABUF_MR_FD,
- UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
- UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
- UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
-};
enum uverbs_attrs_create_counters_cmd_attr_ids {
UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
};
@@ -292,22 +187,4 @@ enum uverbs_methods_flow {
enum uverbs_attrs_flow_destroy_ids {
UVERBS_ATTR_DESTROY_FLOW_HANDLE,
};
-enum uverbs_method_async_event {
- UVERBS_METHOD_ASYNC_EVENT_ALLOC,
-};
-enum uverbs_attrs_async_event_create {
- UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE,
-};
-enum uverbs_attrs_query_gid_table_cmd_attr_ids {
- UVERBS_ATTR_QUERY_GID_TABLE_ENTRY_SIZE,
- UVERBS_ATTR_QUERY_GID_TABLE_FLAGS,
- UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES,
- UVERBS_ATTR_QUERY_GID_TABLE_RESP_NUM_ENTRIES,
-};
-enum uverbs_attrs_query_gid_entry_cmd_attr_ids {
- UVERBS_ATTR_QUERY_GID_ENTRY_PORT,
- UVERBS_ATTR_QUERY_GID_ENTRY_GID_INDEX,
- UVERBS_ATTR_QUERY_GID_ENTRY_FLAGS,
- UVERBS_ATTR_QUERY_GID_ENTRY_RESP_ENTRY,
-};
#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
index c443738eb..1394ed7a0 100644
--- a/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_ioctl_verbs.h
@@ -23,11 +23,6 @@
#ifndef RDMA_UAPI_PTR
#define RDMA_UAPI_PTR(_type,_name) __aligned_u64 _name
#endif
-#define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20)
-#define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29)
-enum ib_uverbs_core_support {
- IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0,
-};
enum ib_uverbs_access_flags {
IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0,
IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1,
@@ -37,38 +32,6 @@ enum ib_uverbs_access_flags {
IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5,
IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6,
IB_UVERBS_ACCESS_HUGETLB = 1 << 7,
- IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
- IB_UVERBS_ACCESS_OPTIONAL_RANGE = ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) & ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
-};
-enum ib_uverbs_srq_type {
- IB_UVERBS_SRQT_BASIC,
- IB_UVERBS_SRQT_XRC,
- IB_UVERBS_SRQT_TM,
-};
-enum ib_uverbs_wq_type {
- IB_UVERBS_WQT_RQ,
-};
-enum ib_uverbs_wq_flags {
- IB_UVERBS_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0,
- IB_UVERBS_WQ_FLAGS_SCATTER_FCS = 1 << 1,
- IB_UVERBS_WQ_FLAGS_DELAY_DROP = 1 << 2,
- IB_UVERBS_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3,
-};
-enum ib_uverbs_qp_type {
- IB_UVERBS_QPT_RC = 2,
- IB_UVERBS_QPT_UC,
- IB_UVERBS_QPT_UD,
- IB_UVERBS_QPT_RAW_PACKET = 8,
- IB_UVERBS_QPT_XRC_INI,
- IB_UVERBS_QPT_XRC_TGT,
- IB_UVERBS_QPT_DRIVER = 0xFF,
-};
-enum ib_uverbs_qp_create_flags {
- IB_UVERBS_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
- IB_UVERBS_QP_CREATE_SCATTER_FCS = 1 << 8,
- IB_UVERBS_QP_CREATE_CVLAN_STRIPPING = 1 << 9,
- IB_UVERBS_QP_CREATE_PCI_WRITE_END_PADDING = 1 << 11,
- IB_UVERBS_QP_CREATE_SQ_SIG_ALL = 1 << 12,
};
enum ib_uverbs_query_port_cap_flags {
IB_UVERBS_PCF_SM = 1 << 1,
@@ -153,7 +116,6 @@ enum ib_uverbs_read_counters_flags {
enum ib_uverbs_advise_mr_advice {
IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH,
IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE,
- IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_NO_FAULT,
};
enum ib_uverbs_advise_mr_flag {
IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0,
@@ -163,13 +125,6 @@ struct ib_uverbs_query_port_resp_ex {
__u16 port_cap_flags2;
__u8 reserved[6];
};
-struct ib_uverbs_qp_cap {
- __u32 max_send_wr;
- __u32 max_recv_wr;
- __u32 max_send_sge;
- __u32 max_recv_sge;
- __u32 max_inline_data;
-};
enum rdma_driver_id {
RDMA_DRIVER_UNKNOWN,
RDMA_DRIVER_MLX5,
@@ -191,16 +146,4 @@ enum rdma_driver_id {
RDMA_DRIVER_EFA,
RDMA_DRIVER_SIW,
};
-enum ib_uverbs_gid_type {
- IB_UVERBS_GID_TYPE_IB,
- IB_UVERBS_GID_TYPE_ROCE_V1,
- IB_UVERBS_GID_TYPE_ROCE_V2,
-};
-struct ib_uverbs_gid_entry {
- __aligned_u64 gid[2];
- __u32 gid_index;
- __u32 port_num;
- __u32 gid_type;
- __u32 netdev_ifindex;
-};
#endif
diff --git a/libc/kernel/uapi/rdma/ib_user_verbs.h b/libc/kernel/uapi/rdma/ib_user_verbs.h
index d9ac9e0a2..25df6e2dd 100644
--- a/libc/kernel/uapi/rdma/ib_user_verbs.h
+++ b/libc/kernel/uapi/rdma/ib_user_verbs.h
@@ -361,16 +361,6 @@ struct ib_uverbs_poll_cq {
__u32 cq_handle;
__u32 ne;
};
-enum ib_uverbs_wc_opcode {
- IB_UVERBS_WC_SEND = 0,
- IB_UVERBS_WC_RDMA_WRITE = 1,
- IB_UVERBS_WC_RDMA_READ = 2,
- IB_UVERBS_WC_COMP_SWAP = 3,
- IB_UVERBS_WC_FETCH_ADD = 4,
- IB_UVERBS_WC_BIND_MW = 5,
- IB_UVERBS_WC_LOCAL_INV = 6,
- IB_UVERBS_WC_TSO = 7,
-};
struct ib_uverbs_wc {
__aligned_u64 wr_id;
__u32 status;
@@ -484,6 +474,12 @@ enum ib_uverbs_create_qp_mask {
enum {
IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
};
+enum {
+ IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
+};
+enum {
+ IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
+};
struct ib_uverbs_ex_create_qp {
__aligned_u64 user_handle;
__u32 pd_handle;
diff --git a/libc/kernel/uapi/rdma/mlx5-abi.h b/libc/kernel/uapi/rdma/mlx5-abi.h
index 59a9f53bb..e01b6d377 100644
--- a/libc/kernel/uapi/rdma/mlx5-abi.h
+++ b/libc/kernel/uapi/rdma/mlx5-abi.h
@@ -32,7 +32,6 @@ enum {
MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC = 1 << 7,
MLX5_QP_FLAG_ALLOW_SCATTER_CQE = 1 << 8,
MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE = 1 << 9,
- MLX5_QP_FLAG_UAR_PAGE_INDEX = 1 << 10,
};
enum {
MLX5_SRQ_FLAG_SIGNATURE = 1 << 0,
@@ -47,7 +46,6 @@ struct mlx5_ib_alloc_ucontext_req {
};
enum mlx5_lib_caps {
MLX5_LIB_CAP_4K_UAR = (__u64) 1 << 0,
- MLX5_LIB_CAP_DYN_UAR = (__u64) 1 << 1,
};
enum mlx5_ib_alloc_uctx_v2_flags {
MLX5_IB_ALLOC_UCTX_DEVX = 1 << 0,
@@ -66,7 +64,6 @@ struct mlx5_ib_alloc_ucontext_req_v2 {
enum mlx5_ib_alloc_ucontext_resp_mask {
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET = 1UL << 0,
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_DUMP_FILL_MKEY = 1UL << 1,
- MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2,
};
enum mlx5_user_cmds_supp_uhw {
MLX5_USER_CMDS_SUPP_UHW_QUERY_DEVICE = 1 << 0,
@@ -192,7 +189,6 @@ struct mlx5_ib_query_device_resp {
};
enum mlx5_ib_create_cq_flags {
MLX5_IB_CREATE_CQ_FLAGS_CQE_128B_PAD = 1 << 0,
- MLX5_IB_CREATE_CQ_FLAGS_UAR_PAGE_INDEX = 1 << 1,
};
struct mlx5_ib_create_cq {
__aligned_u64 buf_addr;
@@ -201,9 +197,6 @@ struct mlx5_ib_create_cq {
__u8 cqe_comp_en;
__u8 cqe_comp_res_format;
__u16 flags;
- __u16 uar_page_index;
- __u16 reserved0;
- __u32 reserved1;
};
struct mlx5_ib_create_cq_resp {
__u32 cqn;
@@ -240,8 +233,6 @@ struct mlx5_ib_create_qp {
__aligned_u64 sq_buf_addr;
__aligned_u64 access_key;
};
- __u32 ece_options;
- __u32 reserved;
};
enum mlx5_rx_hash_function_flags {
MLX5_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
@@ -276,7 +267,7 @@ enum mlx5_ib_create_qp_resp_mask {
};
struct mlx5_ib_create_qp_resp {
__u32 bfreg_index;
- __u32 ece_options;
+ __u32 reserved;
__u32 comp_mask;
__u32 tirn;
__u32 tisn;
@@ -319,13 +310,11 @@ struct mlx5_ib_burst_info {
struct mlx5_ib_modify_qp {
__u32 comp_mask;
struct mlx5_ib_burst_info burst_info;
- __u32 ece_options;
+ __u32 reserved;
};
struct mlx5_ib_modify_qp_resp {
__u32 response_length;
__u32 dctn;
- __u32 ece_options;
- __u32 reserved;
};
struct mlx5_ib_create_wq_resp {
__u32 response_length;
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
index 804a90b6c..1cd333959 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_cmds.h
@@ -85,33 +85,6 @@ enum mlx5_ib_devx_obj_methods {
MLX5_IB_METHOD_DEVX_OBJ_QUERY,
MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY,
};
-enum mlx5_ib_var_alloc_attrs {
- MLX5_IB_ATTR_VAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_OFFSET,
- MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_LENGTH,
- MLX5_IB_ATTR_VAR_OBJ_ALLOC_PAGE_ID,
-};
-enum mlx5_ib_var_obj_destroy_attrs {
- MLX5_IB_ATTR_VAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-};
-enum mlx5_ib_var_obj_methods {
- MLX5_IB_METHOD_VAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_METHOD_VAR_OBJ_DESTROY,
-};
-enum mlx5_ib_uar_alloc_attrs {
- MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE,
- MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET,
- MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH,
- MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID,
-};
-enum mlx5_ib_uar_obj_destroy_attrs {
- MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-};
-enum mlx5_ib_uar_obj_methods {
- MLX5_IB_METHOD_UAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_METHOD_UAR_OBJ_DESTROY,
-};
enum mlx5_ib_devx_umem_reg_attrs {
MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR,
@@ -122,19 +95,6 @@ enum mlx5_ib_devx_umem_reg_attrs {
enum mlx5_ib_devx_umem_dereg_attrs {
MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
};
-enum mlx5_ib_pp_obj_methods {
- MLX5_IB_METHOD_PP_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_METHOD_PP_OBJ_DESTROY,
-};
-enum mlx5_ib_pp_alloc_attrs {
- MLX5_IB_ATTR_PP_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX,
- MLX5_IB_ATTR_PP_OBJ_ALLOC_FLAGS,
- MLX5_IB_ATTR_PP_OBJ_ALLOC_INDEX,
-};
-enum mlx5_ib_pp_obj_destroy_attrs {
- MLX5_IB_ATTR_PP_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
-};
enum mlx5_ib_devx_umem_methods {
MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_METHOD_DEVX_UMEM_DEREG,
@@ -159,9 +119,6 @@ enum mlx5_ib_objects {
MLX5_IB_OBJECT_FLOW_MATCHER,
MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD,
MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD,
- MLX5_IB_OBJECT_VAR,
- MLX5_IB_OBJECT_PP,
- MLX5_IB_OBJECT_UAR,
};
enum mlx5_ib_flow_matcher_create_attrs {
MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
@@ -178,10 +135,7 @@ enum mlx5_ib_flow_matcher_methods {
MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_METHOD_FLOW_MATCHER_DESTROY,
};
-enum mlx5_ib_device_query_context_attrs {
- MLX5_IB_ATTR_QUERY_CONTEXT_RESP_UCTX = (1U << UVERBS_ID_NS_SHIFT),
-};
-#define MLX5_IB_DW_MATCH_PARAM 0x90
+#define MLX5_IB_DW_MATCH_PARAM 0x80
struct mlx5_ib_match_params {
__u32 match_params[MLX5_IB_DW_MATCH_PARAM];
};
@@ -191,10 +145,6 @@ enum mlx5_ib_flow_type {
MLX5_IB_FLOW_TYPE_ALL_DEFAULT,
MLX5_IB_FLOW_TYPE_MC_DEFAULT,
};
-enum mlx5_ib_create_flow_flags {
- MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DEFAULT_MISS = 1 << 0,
- MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP = 1 << 1,
-};
enum mlx5_ib_create_flow_attrs {
MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE,
@@ -205,9 +155,8 @@ enum mlx5_ib_create_flow_attrs {
MLX5_IB_ATTR_CREATE_FLOW_TAG,
MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX,
MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET,
- MLX5_IB_ATTR_CREATE_FLOW_FLAGS,
};
-enum mlx5_ib_destroy_flow_attrs {
+enum mlx5_ib_destoy_flow_attrs {
MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
};
enum mlx5_ib_flow_methods {
@@ -229,11 +178,4 @@ enum mlx5_ib_create_flow_action_create_packet_reformat_attrs {
MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_FT_TYPE,
MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_DATA_BUF,
};
-enum mlx5_ib_query_pd_attrs {
- MLX5_IB_ATTR_QUERY_PD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
- MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
-};
-enum mlx5_ib_pd_methods {
- MLX5_IB_METHOD_PD_QUERY = (1U << UVERBS_ID_NS_SHIFT),
-};
#endif
diff --git a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
index bfbfd76e0..dc2e69d36 100644
--- a/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
+++ b/libc/kernel/uapi/rdma/mlx5_user_ioctl_verbs.h
@@ -27,7 +27,6 @@ enum mlx5_ib_uapi_flow_table_type {
MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX = 0x1,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_FDB = 0x2,
MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_RX = 0x3,
- MLX5_IB_UAPI_FLOW_TABLE_TYPE_RDMA_TX = 0x4,
};
enum mlx5_ib_uapi_flow_action_packet_reformat_type {
MLX5_IB_UAPI_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 = 0x0,
@@ -51,11 +50,4 @@ struct mlx5_ib_uapi_devx_async_event_hdr {
__aligned_u64 cookie;
__u8 out_data[];
};
-enum mlx5_ib_uapi_pp_alloc_flags {
- MLX5_IB_UAPI_PP_ALLOC_FLAGS_DEDICATED_INDEX = 1 << 0,
-};
-enum mlx5_ib_uapi_uar_alloc_type {
- MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF = 0x0,
- MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC = 0x1,
-};
#endif
diff --git a/libc/kernel/uapi/rdma/qedr-abi.h b/libc/kernel/uapi/rdma/qedr-abi.h
index bf6dc7609..fd963097f 100644
--- a/libc/kernel/uapi/rdma/qedr-abi.h
+++ b/libc/kernel/uapi/rdma/qedr-abi.h
@@ -21,25 +21,13 @@
#include <linux/types.h>
#define QEDR_ABI_VERSION (8)
enum qedr_alloc_ucontext_flags {
- QEDR_ALLOC_UCTX_EDPM_MODE = 1 << 0,
- QEDR_ALLOC_UCTX_DB_REC = 1 << 1,
- QEDR_SUPPORT_DPM_SIZES = 1 << 2,
+ QEDR_ALLOC_UCTX_RESERVED = 1 << 0,
+ QEDR_ALLOC_UCTX_DB_REC = 1 << 1
};
struct qedr_alloc_ucontext_req {
__u32 context_flags;
__u32 reserved;
};
-#define QEDR_LDPM_MAX_SIZE (8192)
-#define QEDR_EDPM_TRANS_SIZE (64)
-#define QEDR_EDPM_MAX_SIZE (ROCE_REQ_MAX_INLINE_DATA_SIZE)
-enum qedr_rdma_dpm_type {
- QEDR_DPM_TYPE_NONE = 0,
- QEDR_DPM_TYPE_ROCE_ENHANCED = 1 << 0,
- QEDR_DPM_TYPE_ROCE_LEGACY = 1 << 1,
- QEDR_DPM_TYPE_IWARP_LEGACY = 1 << 2,
- QEDR_DPM_TYPE_ROCE_EDPM_MODE = 1 << 3,
- QEDR_DPM_SIZES_SET = 1 << 4,
-};
struct qedr_alloc_ucontext_resp {
__aligned_u64 db_pa;
__u32 db_size;
@@ -50,14 +38,10 @@ struct qedr_alloc_ucontext_resp {
__u32 sges_per_recv_wr;
__u32 sges_per_srq_wr;
__u32 max_cqes;
- __u8 dpm_flags;
+ __u8 dpm_enabled;
__u8 wids_enabled;
__u16 wid_count;
- __u16 ldpm_limit_size;
- __u8 edpm_trans_size;
- __u8 reserved;
- __u16 edpm_limit_size;
- __u8 padding[6];
+ __u32 reserved;
};
struct qedr_alloc_pd_ureq {
__aligned_u64 rsvd1;
diff --git a/libc/kernel/uapi/rdma/rdma_netlink.h b/libc/kernel/uapi/rdma/rdma_netlink.h
index 48444da43..ed585cf16 100644
--- a/libc/kernel/uapi/rdma/rdma_netlink.h
+++ b/libc/kernel/uapi/rdma/rdma_netlink.h
@@ -204,9 +204,6 @@ enum rdma_nldev_command {
RDMA_NLDEV_CMD_STAT_SET,
RDMA_NLDEV_CMD_STAT_GET,
RDMA_NLDEV_CMD_STAT_DEL,
- RDMA_NLDEV_CMD_RES_QP_GET_RAW,
- RDMA_NLDEV_CMD_RES_CQ_GET_RAW,
- RDMA_NLDEV_CMD_RES_MR_GET_RAW,
RDMA_NLDEV_NUM_OPS
};
enum rdma_nldev_print_type {
@@ -300,7 +297,6 @@ enum rdma_nldev_attr {
RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME,
RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE,
RDMA_NLDEV_ATTR_DEV_DIM,
- RDMA_NLDEV_ATTR_RES_RAW,
RDMA_NLDEV_ATTR_MAX
};
enum rdma_nl_counter_mode {
@@ -311,6 +307,5 @@ enum rdma_nl_counter_mode {
};
enum rdma_nl_counter_mask {
RDMA_COUNTER_MASK_QP_TYPE = 1,
- RDMA_COUNTER_MASK_PID = 1 << 1,
};
#endif
diff --git a/libc/kernel/uapi/rdma/rdma_user_cm.h b/libc/kernel/uapi/rdma/rdma_user_cm.h
index 96187345a..9042b6fa4 100644
--- a/libc/kernel/uapi/rdma/rdma_user_cm.h
+++ b/libc/kernel/uapi/rdma/rdma_user_cm.h
@@ -127,8 +127,6 @@ struct rdma_ucm_query_route_resp {
__u32 num_paths;
__u8 port_num;
__u8 reserved[3];
- __u32 ibdev_index;
- __u32 reserved1;
};
struct rdma_ucm_query_addr_resp {
__aligned_u64 node_guid;
@@ -139,8 +137,6 @@ struct rdma_ucm_query_addr_resp {
__u16 dst_size;
struct sockaddr_storage src_addr;
struct sockaddr_storage dst_addr;
- __u32 ibdev_index;
- __u32 reserved1;
};
struct rdma_ucm_query_path_resp {
__u32 num_paths;
@@ -168,15 +164,10 @@ struct rdma_ucm_ud_param {
__u8 private_data_len;
__u8 reserved[7];
};
-struct rdma_ucm_ece {
- __u32 vendor_id;
- __u32 attr_mod;
-};
struct rdma_ucm_connect {
struct rdma_ucm_conn_param conn_param;
__u32 id;
__u32 reserved;
- struct rdma_ucm_ece ece;
};
struct rdma_ucm_listen {
__u32 id;
@@ -187,13 +178,11 @@ struct rdma_ucm_accept {
struct rdma_ucm_conn_param conn_param;
__u32 id;
__u32 reserved;
- struct rdma_ucm_ece ece;
};
struct rdma_ucm_reject {
__u32 id;
__u8 private_data_len;
- __u8 reason;
- __u8 reserved[2];
+ __u8 reserved[3];
__u8 private_data[RDMA_MAX_PRIVATE_DATA];
};
struct rdma_ucm_disconnect {
@@ -240,7 +229,6 @@ struct rdma_ucm_event_resp {
struct rdma_ucm_ud_param ud;
} param;
__u32 reserved;
- struct rdma_ucm_ece ece;
};
enum {
RDMA_OPTION_ID = 0,
diff --git a/libc/kernel/uapi/rdma/rdma_user_rxe.h b/libc/kernel/uapi/rdma/rdma_user_rxe.h
index 9fd21d7eb..e4a2f40a9 100644
--- a/libc/kernel/uapi/rdma/rdma_user_rxe.h
+++ b/libc/kernel/uapi/rdma/rdma_user_rxe.h
@@ -22,10 +22,6 @@
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
-enum {
- RXE_NETWORK_TYPE_IPV4 = 1,
- RXE_NETWORK_TYPE_IPV6 = 2,
-};
union rxe_gid {
__u8 raw[16];
struct {
@@ -147,14 +143,4 @@ struct rxe_create_srq_resp {
struct rxe_modify_srq_cmd {
__aligned_u64 mmap_info_addr;
};
-struct rxe_queue_buf {
- __u32 log2_elem_size;
- __u32 index_mask;
- __u32 pad_1[30];
- __u32 producer_index;
- __u32 pad_2[31];
- __u32 consumer_index;
- __u32 pad_3[31];
- __u8 data[];
-};
#endif
diff --git a/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h b/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
index f4444c458..3b867985e 100644
--- a/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
+++ b/libc/kernel/uapi/rdma/vmw_pvrdma-abi.h
@@ -98,12 +98,6 @@ enum pvrdma_wc_flags {
PVRDMA_WC_WITH_NETWORK_HDR_TYPE = 1 << 6,
PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
};
-enum pvrdma_network_type {
- PVRDMA_NETWORK_IB,
- PVRDMA_NETWORK_ROCE_V1 = PVRDMA_NETWORK_IB,
- PVRDMA_NETWORK_IPV4,
- PVRDMA_NETWORK_IPV6
-};
struct pvrdma_alloc_ucontext_resp {
__u32 qp_tab_size;
__u32 reserved;
diff --git a/libc/kernel/uapi/scsi/fc/fc_els.h b/libc/kernel/uapi/scsi/fc/fc_els.h
index f31e764cf..1cabaddfa 100644
--- a/libc/kernel/uapi/scsi/fc/fc_els.h
+++ b/libc/kernel/uapi/scsi/fc/fc_els.h
@@ -19,7 +19,6 @@
#ifndef _FC_ELS_H_
#define _FC_ELS_H_
#include <linux/types.h>
-#include <asm/byteorder.h>
enum fc_els_cmd {
ELS_LS_RJT = 0x01,
ELS_LS_ACC = 0x02,
@@ -42,8 +41,6 @@ enum fc_els_cmd {
ELS_REC = 0x13,
ELS_SRR = 0x14,
ELS_FPIN = 0x16,
- ELS_RDP = 0x18,
- ELS_RDF = 0x19,
ELS_PRLI = 0x20,
ELS_PRLO = 0x21,
ELS_SCN = 0x22,
@@ -85,7 +82,7 @@ enum fc_els_cmd {
ELS_LKA = 0x80,
ELS_AUTH_ELS = 0x90,
};
-#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_FPIN] = "FPIN",[ELS_RDP] = "RDP",[ELS_RDF] = "RDF",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
+#define FC_ELS_CMDS_INIT {[ELS_LS_RJT] = "LS_RJT",[ELS_LS_ACC] = "LS_ACC",[ELS_PLOGI] = "PLOGI",[ELS_FLOGI] = "FLOGI",[ELS_LOGO] = "LOGO",[ELS_ABTX] = "ABTX",[ELS_RCS] = "RCS",[ELS_RES] = "RES",[ELS_RSS] = "RSS",[ELS_RSI] = "RSI",[ELS_ESTS] = "ESTS",[ELS_ESTC] = "ESTC",[ELS_ADVC] = "ADVC",[ELS_RTV] = "RTV",[ELS_RLS] = "RLS",[ELS_ECHO] = "ECHO",[ELS_TEST] = "TEST",[ELS_RRQ] = "RRQ",[ELS_REC] = "REC",[ELS_SRR] = "SRR",[ELS_FPIN] = "FPIN",[ELS_PRLI] = "PRLI",[ELS_PRLO] = "PRLO",[ELS_SCN] = "SCN",[ELS_TPLS] = "TPLS",[ELS_TPRLO] = "TPRLO",[ELS_LCLM] = "LCLM",[ELS_GAID] = "GAID",[ELS_FACT] = "FACT",[ELS_FDACDT] = "FDACDT",[ELS_NACT] = "NACT",[ELS_NDACT] = "NDACT",[ELS_QOSR] = "QOSR",[ELS_RVCS] = "RVCS",[ELS_PDISC] = "PDISC",[ELS_FDISC] = "FDISC",[ELS_ADISC] = "ADISC",[ELS_RNC] = "RNC",[ELS_FARP_REQ] = "FARP_REQ",[ELS_FARP_REPL] = "FARP_REPL",[ELS_RPS] = "RPS",[ELS_RPL] = "RPL",[ELS_RPBC] = "RPBC",[ELS_FAN] = "FAN",[ELS_RSCN] = "RSCN",[ELS_SCR] = "SCR",[ELS_RNFT] = "RNFT",[ELS_CSR] = "CSR",[ELS_CSU] = "CSU",[ELS_LINIT] = "LINIT",[ELS_LSTS] = "LSTS",[ELS_RNID] = "RNID",[ELS_RLIR] = "RLIR",[ELS_LIRR] = "LIRR",[ELS_SRL] = "SRL",[ELS_SBRP] = "SBRP",[ELS_RPSC] = "RPSC",[ELS_QSA] = "QSA",[ELS_EVFP] = "EVFP",[ELS_LKA] = "LKA",[ELS_AUTH_ELS] = "AUTH_ELS", \
}
struct fc_els_ls_acc {
__u8 la_cmd;
@@ -126,32 +123,6 @@ enum fc_els_rjt_explan {
ELS_EXPL_INV_LEN = 0x2d,
ELS_EXPL_NOT_NEIGHBOR = 0x62,
};
-enum fc_ls_tlv_dtag {
- ELS_DTAG_LS_REQ_INFO = 0x00000001,
- ELS_DTAG_LNK_INTEGRITY = 0x00020001,
- ELS_DTAG_DELIVERY = 0x00020002,
- ELS_DTAG_PEER_CONGEST = 0x00020003,
- ELS_DTAG_CONGESTION = 0x00020004,
- ELS_DTAG_FPIN_REGISTER = 0x00030001,
-};
-#define FC_LS_TLV_DTAG_INIT { { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, { ELS_DTAG_CONGESTION, "Congestion Notification" }, { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \
-}
-struct fc_tlv_desc {
- __be32 desc_tag;
- __be32 desc_len;
- __u8 desc_value[0];
-};
-#define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
-#define FC_TLV_DESC_LENGTH_FROM_SZ(desc) (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
-#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
-struct fc_els_lsri_desc {
- __be32 desc_tag;
- __be32 desc_len;
- struct {
- __u8 cmd;
- __u8 bytes[3];
- } rqst_w0;
-};
struct fc_els_csp {
__u8 sp_hi_ver;
__u8 sp_lo_ver;
@@ -572,100 +543,20 @@ enum fc_els_clid_ic {
ELS_CLID_IC_LOOP_TO = 7,
ELS_CLID_IC_LIP = 8,
};
-enum fc_fpin_li_event_types {
- FPIN_LI_UNKNOWN = 0x0,
- FPIN_LI_LINK_FAILURE = 0x1,
- FPIN_LI_LOSS_OF_SYNC = 0x2,
- FPIN_LI_LOSS_OF_SIG = 0x3,
- FPIN_LI_PRIM_SEQ_ERR = 0x4,
- FPIN_LI_INVALID_TX_WD = 0x5,
- FPIN_LI_INVALID_CRC = 0x6,
- FPIN_LI_DEVICE_SPEC = 0xF,
-};
-#define FC_FPIN_LI_EVT_TYPES_INIT { { FPIN_LI_UNKNOWN, "Unknown" }, { FPIN_LI_LINK_FAILURE, "Link Failure" }, { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, { FPIN_LI_INVALID_CRC, "Invalid CRC" }, { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \
-}
-enum fc_fpin_deli_event_types {
- FPIN_DELI_UNKNOWN = 0x0,
- FPIN_DELI_TIMEOUT = 0x1,
- FPIN_DELI_UNABLE_TO_ROUTE = 0x2,
- FPIN_DELI_DEVICE_SPEC = 0xF,
+enum fc_fn_dtag {
+ ELS_FN_DTAG_LNK_INTEGRITY = 0x00020001,
+ ELS_FN_DTAG_PEER_CONGEST = 0x00020003,
+ ELS_FN_DTAG_CONGESTION = 0x00020004,
};
-#define FC_FPIN_DELI_EVT_TYPES_INIT { { FPIN_DELI_UNKNOWN, "Unknown" }, { FPIN_DELI_TIMEOUT, "Timeout" }, { FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, { FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \
-}
-enum fc_fpin_congn_event_types {
- FPIN_CONGN_CLEAR = 0x0,
- FPIN_CONGN_LOST_CREDIT = 0x1,
- FPIN_CONGN_CREDIT_STALL = 0x2,
- FPIN_CONGN_OVERSUBSCRIPTION = 0x3,
- FPIN_CONGN_DEVICE_SPEC = 0xF,
-};
-#define FC_FPIN_CONGN_EVT_TYPES_INIT { { FPIN_CONGN_CLEAR, "Clear" }, { FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, { FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, { FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, { FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \
-}
-enum fc_fpin_congn_severity_types {
- FPIN_CONGN_SEVERITY_WARNING = 0xF1,
- FPIN_CONGN_SEVERITY_ERROR = 0xF7,
-};
-struct fc_fn_li_desc {
- __be32 desc_tag;
- __be32 desc_len;
- __be64 detecting_wwpn;
- __be64 attached_wwpn;
- __be16 event_type;
- __be16 event_modifier;
- __be32 event_threshold;
- __be32 event_count;
- __be32 pname_count;
- __be64 pname_list[0];
-};
-struct fc_fn_deli_desc {
- __be32 desc_tag;
- __be32 desc_len;
- __be64 detecting_wwpn;
- __be64 attached_wwpn;
- __be32 deli_reason_code;
-};
-struct fc_fn_peer_congn_desc {
- __be32 desc_tag;
- __be32 desc_len;
- __be64 detecting_wwpn;
- __be64 attached_wwpn;
- __be16 event_type;
- __be16 event_modifier;
- __be32 event_period;
- __be32 pname_count;
- __be64 pname_list[0];
-};
-struct fc_fn_congn_desc {
- __be32 desc_tag;
- __be32 desc_len;
- __be16 event_type;
- __be16 event_modifier;
- __be32 event_period;
- __u8 severity;
- __u8 resv[3];
+struct fc_fn_desc {
+ __be32 fn_desc_tag;
+ __be32 fn_desc_value_len;
+ __u8 fn_desc_value[0];
};
struct fc_els_fpin {
__u8 fpin_cmd;
__u8 fpin_zero[3];
- __be32 desc_len;
- struct fc_tlv_desc fpin_desc[0];
-};
-struct fc_df_desc_fpin_reg {
- __be32 desc_tag;
- __be32 desc_len;
- __be32 count;
- __be32 desc_tags[0];
-};
-struct fc_els_rdf {
- __u8 fpin_cmd;
- __u8 fpin_zero[3];
- __be32 desc_len;
- struct fc_tlv_desc desc[0];
-};
-struct fc_els_rdf_resp {
- struct fc_els_ls_acc acc_hdr;
- __be32 desc_list_len;
- struct fc_els_lsri_desc lsri;
- struct fc_tlv_desc desc[0];
+ __be32 fpin_desc_cnt;
+ struct fc_fn_desc fpin_desc[0];
};
#endif
diff --git a/libc/kernel/uapi/scsi/scsi_bsg_ufs.h b/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
index ae5c757b1..177cae984 100644
--- a/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
+++ b/libc/kernel/uapi/scsi/scsi_bsg_ufs.h
@@ -46,6 +46,7 @@ struct utp_upiu_req {
union {
struct utp_upiu_cmd sc;
struct utp_upiu_query qr;
+ struct utp_upiu_query tr;
struct utp_upiu_query uc;
};
};
diff --git a/libc/kernel/uapi/sound/asoc.h b/libc/kernel/uapi/sound/asoc.h
index c96260359..e46c4b5ec 100644
--- a/libc/kernel/uapi/sound/asoc.h
+++ b/libc/kernel/uapi/sound/asoc.h
@@ -113,14 +113,10 @@
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
-#define SND_SOC_TPLG_BCLK_CP 0
-#define SND_SOC_TPLG_BCLK_CC 1
-#define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP
-#define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC
-#define SND_SOC_TPLG_FSYNC_CP 0
-#define SND_SOC_TPLG_FSYNC_CC 1
-#define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP
-#define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC
+#define SND_SOC_TPLG_BCLK_CM 0
+#define SND_SOC_TPLG_BCLK_CS 1
+#define SND_SOC_TPLG_FSYNC_CM 0
+#define SND_SOC_TPLG_FSYNC_CS 1
struct snd_soc_tplg_hdr {
__le32 magic;
__le32 abi;
@@ -226,8 +222,8 @@ struct snd_soc_tplg_hw_config {
__u8 clock_gated;
__u8 invert_bclk;
__u8 invert_fsync;
- __u8 bclk_provider;
- __u8 fsync_provider;
+ __u8 bclk_master;
+ __u8 fsync_master;
__u8 mclk_direction;
__le16 reserved;
__le32 mclk_rate;
diff --git a/libc/kernel/uapi/sound/asound.h b/libc/kernel/uapi/sound/asound.h
index 397cccce8..abc81dde2 100644
--- a/libc/kernel/uapi/sound/asound.h
+++ b/libc/kernel/uapi/sound/asound.h
@@ -20,9 +20,7 @@
#define _UAPI__SOUND_ASOUND_H
#ifdef __linux__
#include <linux/types.h>
-#include <asm/byteorder.h>
#else
-#include <endian.h>
#include <sys/ioctl.h>
#endif
#include <stdlib.h>
@@ -103,7 +101,7 @@ struct snd_hwdep_dsp_image {
#define SNDRV_HWDEP_IOCTL_INFO _IOR('H', 0x01, struct snd_hwdep_info)
#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
typedef unsigned long snd_pcm_uframes_t;
typedef signed long snd_pcm_sframes_t;
enum {
@@ -236,9 +234,6 @@ typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME 0x08000000
#define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000
#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000
-#if __BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)
-#define __SND_STRUCT_TIME64
-#endif
typedef int __bitwise snd_pcm_state_t;
#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0)
#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1)
@@ -252,17 +247,8 @@ typedef int __bitwise snd_pcm_state_t;
#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
enum {
SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
- SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
- SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
- SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
- SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
-#ifdef __SND_STRUCT_TIME64
- SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
- SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
-#else
- SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
- SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
-#endif
+ SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
+ SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
};
union snd_pcm_sync_id {
unsigned char id[16];
@@ -365,12 +351,8 @@ enum {
SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5,
SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
};
-typedef struct {
- unsigned char pad[sizeof(time_t) - sizeof(int)];
-} __time_pad;
struct snd_pcm_status {
snd_pcm_state_t state;
- __time_pad pad1;
struct timespec trigger_tstamp;
struct timespec tstamp;
snd_pcm_uframes_t appl_ptr;
@@ -386,87 +368,29 @@ struct snd_pcm_status {
__u32 audio_tstamp_accuracy;
unsigned char reserved[52 - 2 * sizeof(struct timespec)];
};
-#ifdef __SND_STRUCT_TIME64
-#define __snd_pcm_mmap_status64 snd_pcm_mmap_status
-#define __snd_pcm_mmap_control64 snd_pcm_mmap_control
-#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
-#define __snd_timespec64 timespec
-struct __snd_timespec {
- __s32 tv_sec;
- __s32 tv_nsec;
-};
-#else
-#define __snd_pcm_mmap_status snd_pcm_mmap_status
-#define __snd_pcm_mmap_control snd_pcm_mmap_control
-#define __snd_pcm_sync_ptr snd_pcm_sync_ptr
-#define __snd_timespec timespec
-struct __snd_timespec64 {
- __s64 tv_sec;
- __s64 tv_nsec;
-};
-#endif
-struct __snd_pcm_mmap_status {
+struct snd_pcm_mmap_status {
snd_pcm_state_t state;
int pad1;
snd_pcm_uframes_t hw_ptr;
- struct __snd_timespec tstamp;
+ struct timespec tstamp;
snd_pcm_state_t suspended_state;
- struct __snd_timespec audio_tstamp;
+ struct timespec audio_tstamp;
};
-struct __snd_pcm_mmap_control {
+struct snd_pcm_mmap_control {
snd_pcm_uframes_t appl_ptr;
snd_pcm_uframes_t avail_min;
};
#define SNDRV_PCM_SYNC_PTR_HWSYNC (1 << 0)
#define SNDRV_PCM_SYNC_PTR_APPL (1 << 1)
#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1 << 2)
-struct __snd_pcm_sync_ptr {
+struct snd_pcm_sync_ptr {
unsigned int flags;
union {
- struct __snd_pcm_mmap_status status;
- unsigned char reserved[64];
- } s;
- union {
- struct __snd_pcm_mmap_control control;
- unsigned char reserved[64];
- } c;
-};
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
-typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
-typedef char __pad_after_uframe[0];
-#endif
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
-typedef char __pad_before_uframe[0];
-typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
-#endif
-struct __snd_pcm_mmap_status64 {
- snd_pcm_state_t state;
- __u32 pad1;
- __pad_before_uframe __pad1;
- snd_pcm_uframes_t hw_ptr;
- __pad_after_uframe __pad2;
- struct __snd_timespec64 tstamp;
- snd_pcm_state_t suspended_state;
- __u32 pad3;
- struct __snd_timespec64 audio_tstamp;
-};
-struct __snd_pcm_mmap_control64 {
- __pad_before_uframe __pad1;
- snd_pcm_uframes_t appl_ptr;
- __pad_before_uframe __pad2;
- __pad_before_uframe __pad3;
- snd_pcm_uframes_t avail_min;
- __pad_after_uframe __pad4;
-};
-struct __snd_pcm_sync_ptr64 {
- __u32 flags;
- __u32 pad1;
- union {
- struct __snd_pcm_mmap_status64 status;
+ struct snd_pcm_mmap_status status;
unsigned char reserved[64];
} s;
union {
- struct __snd_pcm_mmap_control64 control;
+ struct snd_pcm_mmap_control control;
unsigned char reserved[64];
} c;
};
@@ -541,8 +465,6 @@ enum {
#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
-#define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
-#define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
#define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
@@ -562,7 +484,7 @@ enum {
#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
+#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
enum {
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
SNDRV_RAWMIDI_STREAM_INPUT,
@@ -593,7 +515,6 @@ struct snd_rawmidi_params {
};
struct snd_rawmidi_status {
int stream;
- __time_pad pad1;
struct timespec tstamp;
size_t avail;
size_t xruns;
@@ -605,7 +526,7 @@ struct snd_rawmidi_status {
#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
+#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
enum {
SNDRV_TIMER_CLASS_NONE = - 1,
SNDRV_TIMER_CLASS_SLAVE = 0,
@@ -693,7 +614,7 @@ struct snd_timer_status {
};
#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
-#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
+#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
@@ -705,12 +626,6 @@ struct snd_timer_status {
#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
-#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
-#if __BITS_PER_LONG == 64
-#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
-#else
-#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? SNDRV_TIMER_IOCTL_TREAD_OLD : SNDRV_TIMER_IOCTL_TREAD64)
-#endif
struct snd_timer_read {
unsigned int resolution;
unsigned int ticks;
@@ -734,12 +649,10 @@ enum {
};
struct snd_timer_tread {
int event;
- __time_pad pad1;
struct timespec tstamp;
unsigned int val;
- __time_pad pad2;
};
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
struct snd_ctl_card_info {
int card;
int pad;
@@ -773,6 +686,7 @@ typedef int __bitwise snd_ctl_elem_iface_t;
#define SNDRV_CTL_ELEM_ACCESS_WRITE (1 << 1)
#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE)
#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1 << 2)
+#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1 << 3)
#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1 << 4)
#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1 << 5)
#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
@@ -831,7 +745,11 @@ struct snd_ctl_elem_info {
} enumerated;
unsigned char reserved[128];
} value;
- unsigned char reserved[64];
+ union {
+ unsigned short d[4];
+ unsigned short * d_ptr;
+ } dimen;
+ unsigned char reserved[64 - 4 * sizeof(unsigned short)];
};
struct snd_ctl_elem_value {
struct snd_ctl_elem_id id;
@@ -855,7 +773,8 @@ struct snd_ctl_elem_value {
} bytes;
struct snd_aes_iec958 iec958;
} value;
- unsigned char reserved[128];
+ struct timespec tstamp;
+ unsigned char reserved[128 - sizeof(struct timespec)];
};
struct snd_ctl_tlv {
unsigned int numid;
diff --git a/libc/kernel/uapi/sound/compress_offload.h b/libc/kernel/uapi/sound/compress_offload.h
index 60688bc80..3b532ff93 100644
--- a/libc/kernel/uapi/sound/compress_offload.h
+++ b/libc/kernel/uapi/sound/compress_offload.h
@@ -21,7 +21,7 @@
#include <linux/types.h>
#include <sound/asound.h>
#include <sound/compress_params.h>
-#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 2, 0)
+#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
struct snd_compressed_buffer {
__u32 fragment_size;
__u32 fragments;
diff --git a/libc/kernel/uapi/sound/compress_params.h b/libc/kernel/uapi/sound/compress_params.h
index ee6c00082..f49b45fd3 100644
--- a/libc/kernel/uapi/sound/compress_params.h
+++ b/libc/kernel/uapi/sound/compress_params.h
@@ -37,9 +37,7 @@
#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
#define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E)
-#define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F)
-#define SND_AUDIOCODEC_APE ((__u32) 0x00000010)
-#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE
+#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_BESPOKE
#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
@@ -83,9 +81,6 @@
#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
-#define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010)
-#define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020)
-#define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040)
#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
@@ -176,30 +171,6 @@ struct snd_dec_flac {
__u16 max_frame_size;
__u16 reserved;
} __attribute__((packed, aligned(4)));
-struct snd_dec_wma {
- __u32 encoder_option;
- __u32 adv_encoder_option;
- __u32 adv_encoder_option2;
- __u32 reserved;
-} __attribute__((packed, aligned(4)));
-struct snd_dec_alac {
- __u32 frame_length;
- __u8 compatible_version;
- __u8 pb;
- __u8 mb;
- __u8 kb;
- __u32 max_run;
- __u32 max_frame_bytes;
-} __attribute__((packed, aligned(4)));
-struct snd_dec_ape {
- __u16 compatible_version;
- __u16 compression_level;
- __u32 format_flags;
- __u32 blocks_per_frame;
- __u32 final_frame_blocks;
- __u32 total_frames;
- __u32 seek_table_present;
-} __attribute__((packed, aligned(4)));
union snd_codec_options {
struct snd_enc_wma wma;
struct snd_enc_vorbis vorbis;
@@ -207,9 +178,6 @@ union snd_codec_options {
struct snd_enc_flac flac;
struct snd_enc_generic generic;
struct snd_dec_flac flac_d;
- struct snd_dec_wma wma_d;
- struct snd_dec_alac alac_d;
- struct snd_dec_ape ape_d;
} __attribute__((packed, aligned(4)));
struct snd_codec_desc {
__u32 max_ch;
diff --git a/libc/kernel/uapi/sound/emu10k1.h b/libc/kernel/uapi/sound/emu10k1.h
index 483309e7d..4ad00024a 100644
--- a/libc/kernel/uapi/sound/emu10k1.h
+++ b/libc/kernel/uapi/sound/emu10k1.h
@@ -18,9 +18,8 @@
****************************************************************************/
#ifndef _UAPI__SOUND_EMU10K1_H
#define _UAPI__SOUND_EMU10K1_H
-#ifdef __linux__
#include <linux/types.h>
-#endif
+#include <sound/asound.h>
#define EMU10K1_CARD_CREATIVE 0x00000000
#define EMU10K1_CARD_EMUAPS 0x00000001
#define EMU10K1_FX8010_PCM_COUNT 8
@@ -234,20 +233,8 @@ struct snd_emu10k1_fx8010_info {
#define EMU10K1_GPR_TRANSLATION_BASS 2
#define EMU10K1_GPR_TRANSLATION_TREBLE 3
#define EMU10K1_GPR_TRANSLATION_ONOFF 4
-enum emu10k1_ctl_elem_iface {
- EMU10K1_CTL_ELEM_IFACE_MIXER = 2,
- EMU10K1_CTL_ELEM_IFACE_PCM = 3,
-};
-struct emu10k1_ctl_elem_id {
- unsigned int pad;
- int iface;
- unsigned int device;
- unsigned int subdevice;
- unsigned char name[44];
- unsigned int index;
-};
struct snd_emu10k1_fx8010_control_gpr {
- struct emu10k1_ctl_elem_id id;
+ struct snd_ctl_elem_id id;
unsigned int vcount;
unsigned int count;
unsigned short gpr[32];
@@ -258,7 +245,7 @@ struct snd_emu10k1_fx8010_control_gpr {
const unsigned int * tlv;
};
struct snd_emu10k1_fx8010_control_old_gpr {
- struct emu10k1_ctl_elem_id id;
+ struct snd_ctl_elem_id id;
unsigned int vcount;
unsigned int count;
unsigned short gpr[32];
@@ -270,19 +257,19 @@ struct snd_emu10k1_fx8010_control_old_gpr {
struct snd_emu10k1_fx8010_code {
char name[128];
__EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200);
- __u32 * gpr_map;
+ __u32 __user * gpr_map;
unsigned int gpr_add_control_count;
- struct snd_emu10k1_fx8010_control_gpr * gpr_add_controls;
+ struct snd_emu10k1_fx8010_control_gpr __user * gpr_add_controls;
unsigned int gpr_del_control_count;
- struct emu10k1_ctl_elem_id * gpr_del_controls;
+ struct snd_ctl_elem_id __user * gpr_del_controls;
unsigned int gpr_list_control_count;
unsigned int gpr_list_control_total;
- struct snd_emu10k1_fx8010_control_gpr * gpr_list_controls;
+ struct snd_emu10k1_fx8010_control_gpr __user * gpr_list_controls;
__EMU10K1_DECLARE_BITMAP(tram_valid, 0x100);
- __u32 * tram_data_map;
- __u32 * tram_addr_map;
+ __u32 __user * tram_data_map;
+ __u32 __user * tram_addr_map;
__EMU10K1_DECLARE_BITMAP(code_valid, 1024);
- __u32 * code;
+ __u32 __user * code;
};
struct snd_emu10k1_fx8010_tram {
unsigned int address;
@@ -320,4 +307,9 @@ struct snd_emu10k1_fx8010_pcm_rec {
#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO('H', 0x82)
#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW('H', 0x83, int)
#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR('H', 0x84, int)
+typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
+typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
+typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
+typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
+typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
#endif
diff --git a/libc/kernel/uapi/sound/hdsp.h b/libc/kernel/uapi/sound/hdsp.h
index 2fec3714a..02e7f2da3 100644
--- a/libc/kernel/uapi/sound/hdsp.h
+++ b/libc/kernel/uapi/sound/hdsp.h
@@ -18,9 +18,7 @@
****************************************************************************/
#ifndef __SOUND_HDSP_H
#define __SOUND_HDSP_H
-#ifdef __linux__
#include <linux/types.h>
-#endif
#define HDSP_MATRIX_MIXER_SIZE 2048
enum HDSP_IO_Type {
Digiface,
@@ -66,7 +64,7 @@ struct hdsp_config_info {
};
#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
struct hdsp_firmware {
- void * firmware_data;
+ void __user * firmware_data;
};
#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
struct hdsp_version {
@@ -83,4 +81,11 @@ struct hdsp_9632_aeb {
int aebo;
};
#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
+typedef enum HDSP_IO_Type HDSP_IO_Type;
+typedef struct hdsp_peak_rms hdsp_peak_rms_t;
+typedef struct hdsp_config_info hdsp_config_info_t;
+typedef struct hdsp_firmware hdsp_firmware_t;
+typedef struct hdsp_version hdsp_version_t;
+typedef struct hdsp_mixer hdsp_mixer_t;
+typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
#endif
diff --git a/libc/kernel/uapi/sound/hdspm.h b/libc/kernel/uapi/sound/hdspm.h
index bd28e8caf..dc3192d4e 100644
--- a/libc/kernel/uapi/sound/hdspm.h
+++ b/libc/kernel/uapi/sound/hdspm.h
@@ -18,9 +18,7 @@
****************************************************************************/
#ifndef __SOUND_HDSPM_H
#define __SOUND_HDSPM_H
-#ifdef __linux__
#include <linux/types.h>
-#endif
#define HDSPM_MAX_CHANNELS 64
enum hdspm_io_type {
MADI,
@@ -146,4 +144,9 @@ struct hdspm_mixer_ioctl {
struct hdspm_mixer * mixer;
};
#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
+typedef struct hdspm_peak_rms hdspm_peak_rms_t;
+typedef struct hdspm_config_info hdspm_config_info_t;
+typedef struct hdspm_version hdspm_version_t;
+typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
+typedef struct hdspm_mixer hdspm_mixer_t;
#endif
diff --git a/libc/kernel/uapi/sound/skl-tplg-interface.h b/libc/kernel/uapi/sound/skl-tplg-interface.h
index b516a08bc..58e0afa59 100644
--- a/libc/kernel/uapi/sound/skl-tplg-interface.h
+++ b/libc/kernel/uapi/sound/skl-tplg-interface.h
@@ -21,8 +21,6 @@
#include <linux/types.h>
#define SKL_CONTROL_TYPE_BYTE_TLV 0x100
#define SKL_CONTROL_TYPE_MIC_SELECT 0x102
-#define SKL_CONTROL_TYPE_MULTI_IO_SELECT 0x103
-#define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC 0x104
#define HDA_SST_CFG_MAX 900
#define MAX_IN_QUEUE 8
#define MAX_OUT_QUEUE 8
diff --git a/libc/kernel/uapi/sound/sof/abi.h b/libc/kernel/uapi/sound/sof/abi.h
index 3af3c9d60..f19e4e969 100644
--- a/libc/kernel/uapi/sound/sof/abi.h
+++ b/libc/kernel/uapi/sound/sof/abi.h
@@ -19,7 +19,7 @@
#ifndef __INCLUDE_UAPI_SOUND_SOF_ABI_H__
#define __INCLUDE_UAPI_SOUND_SOF_ABI_H__
#define SOF_ABI_MAJOR 3
-#define SOF_ABI_MINOR 18
+#define SOF_ABI_MINOR 11
#define SOF_ABI_PATCH 0
#define SOF_ABI_MAJOR_SHIFT 24
#define SOF_ABI_MAJOR_MASK 0xff
diff --git a/libc/kernel/uapi/sound/sof/tokens.h b/libc/kernel/uapi/sound/sof/tokens.h
index ef62372a5..6d8561f6a 100644
--- a/libc/kernel/uapi/sound/sof/tokens.h
+++ b/libc/kernel/uapi/sound/sof/tokens.h
@@ -22,9 +22,6 @@
#define SOF_TPLG_KCTL_ENUM_ID 257
#define SOF_TPLG_KCTL_BYTES_ID 258
#define SOF_TPLG_KCTL_SWITCH_ID 259
-#define SOF_TPLG_KCTL_BYTES_VOLATILE_RO 260
-#define SOF_TPLG_KCTL_BYTES_VOLATILE_RW 261
-#define SOF_TPLG_KCTL_BYTES_WO_ID 262
#define SOF_TKN_BUF_SIZE 100
#define SOF_TKN_BUF_CAPS 101
#define SOF_TKN_DAI_TYPE 154
@@ -40,16 +37,10 @@
#define SOF_TKN_VOLUME_RAMP_STEP_MS 251
#define SOF_TKN_SRC_RATE_IN 300
#define SOF_TKN_SRC_RATE_OUT 301
-#define SOF_TKN_ASRC_RATE_IN 320
-#define SOF_TKN_ASRC_RATE_OUT 321
-#define SOF_TKN_ASRC_ASYNCHRONOUS_MODE 322
-#define SOF_TKN_ASRC_OPERATION_MODE 323
#define SOF_TKN_PCM_DMAC_CONFIG 353
#define SOF_TKN_COMP_PERIOD_SINK_COUNT 400
#define SOF_TKN_COMP_PERIOD_SOURCE_COUNT 401
#define SOF_TKN_COMP_FORMAT 402
-#define SOF_TKN_COMP_CORE_ID 404
-#define SOF_TKN_COMP_UUID 405
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
#define SOF_TKN_INTEL_SSP_MCLK_ID 501
#define SOF_TKN_INTEL_SSP_SAMPLE_BITS 502
@@ -76,14 +67,10 @@
#define SOF_TKN_TONE_SAMPLE_RATE 800
#define SOF_TKN_PROCESS_TYPE 900
#define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE
-#define SOF_TKN_IMX_SAI_MCLK_ID 1000
+#define SOF_TKN_IMX_SAI_FIRST_TOKEN 1000
#define SOF_TKN_IMX_ESAI_MCLK_ID 1100
#define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 1200
#define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201
#define SOF_TKN_MUTE_LED_USE 1300
#define SOF_TKN_MUTE_LED_DIRECTION 1301
-#define SOF_TKN_INTEL_ALH_RATE 1400
-#define SOF_TKN_INTEL_ALH_CH 1401
-#define SOF_TKN_INTEL_HDA_RATE 1500
-#define SOF_TKN_INTEL_HDA_CH 1501
#endif
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index c31e30681..4bfb8a232 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1476,8 +1476,8 @@ LIBC_Q { # introduced=Q
# Used by libandroid_net
android_getaddrinfofornet; # apex
- # Used by libandroid_runtime, libcutils, libmedia, and libmediautils
- android_mallopt; # apex llndk
+ # Used by libandroid_runtime, libmedia and libmediautils
+ android_mallopt; # apex
} LIBC_P;
LIBC_R { # introduced=R
@@ -1550,20 +1550,6 @@ LIBC_R { # introduced=R
_Unwind_VRS_Set; # apex llndk arm
} LIBC_Q;
-LIBC_S { # introduced=S
- global:
- __libc_get_static_tls_bounds;
- __libc_register_thread_exit_callback;
- __libc_iterate_dynamic_tls;
- __libc_register_dynamic_tls_listeners;
- ffsl;
- ffsll;
- pidfd_getfd;
- pidfd_open;
- pidfd_send_signal;
- process_madvise;
-} LIBC_R;
-
LIBC_PRIVATE {
global:
__accept4; # arm x86
@@ -1722,7 +1708,6 @@ LIBC_PRIVATE {
android_gethostbyaddrfornetcontext;
android_gethostbynamefornet;
android_gethostbynamefornetcontext;
- android_run_on_all_threads;
android_unsafe_frame_pointer_chase;
arc4random_addrandom; # arm x86
arc4random_stir; # arm x86
@@ -1772,9 +1757,7 @@ LIBC_PLATFORM {
android_fdtrack_compare_exchange_hook; # llndk
android_fdtrack_get_enabled; # llndk
android_fdtrack_set_enabled; # llndk
- android_fdtrack_set_globally_enabled; # llndk
android_net_res_stats_get_info_for_net;
android_net_res_stats_aggregate;
android_net_res_stats_get_usable_servers;
- android_reset_stack_guards;
} LIBC_Q;
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 3b3a22ee7..760039b9c 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -2,16 +2,6 @@
// libc_malloc_debug_backtrace.a
// ==============================================================
// Used by libmemunreachable
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "bionic_libc_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- // SPDX-license-identifier-BSD
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
cc_library_static {
name: "libc_malloc_debug_backtrace",
vendor_available: true,
diff --git a/libc/malloc_debug/MapData.cpp b/libc/malloc_debug/MapData.cpp
index ded81a2d5..e8fbc5401 100644
--- a/libc/malloc_debug/MapData.cpp
+++ b/libc/malloc_debug/MapData.cpp
@@ -116,17 +116,14 @@ static void read_loadbias(MapEntry* entry) {
if (!get_val<ElfW(Word)>(entry, addr + offsetof(ElfW(Phdr), p_type), &phdr.p_type)) {
return;
}
- if (!get_val<ElfW(Word)>(entry, addr + offsetof(ElfW(Phdr), p_flags), &phdr.p_flags)) {
- return;
- }
if (!get_val<ElfW(Off)>(entry, addr + offsetof(ElfW(Phdr), p_offset), &phdr.p_offset)) {
return;
}
- if ((phdr.p_type == PT_LOAD) && (phdr.p_flags & PF_X) ) {
+ if (phdr.p_type == PT_LOAD && phdr.p_offset == entry->offset) {
if (!get_val<ElfW(Addr)>(entry, addr + offsetof(ElfW(Phdr), p_vaddr), &phdr.p_vaddr)) {
return;
}
- entry->load_bias = phdr.p_vaddr - phdr.p_offset;
+ entry->load_bias = phdr.p_vaddr;
return;
}
addr += sizeof(phdr);
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp
index 90c913638..4f81ff7ff 100644
--- a/libc/malloc_debug/PointerData.cpp
+++ b/libc/malloc_debug/PointerData.cpp
@@ -588,8 +588,8 @@ void PointerData::DumpLiveToFile(int fd) {
dprintf(fd, " bt_info");
for (const auto& frame : *info.backtrace_info) {
dprintf(fd, " {");
- if (frame.map_info != nullptr && !frame.map_info->name().empty()) {
- dprintf(fd, "\"%s\"", frame.map_info->name().c_str());
+ if (frame.map_info != nullptr && !frame.map_info->name.empty()) {
+ dprintf(fd, "\"%s\"", frame.map_info->name.c_str());
} else {
dprintf(fd, "\"\"");
}
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index 128991bd9..92fb3fa96 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -90,14 +90,14 @@ void UnwindLog(const std::vector<unwindstack::LocalFrameData>& frame_info) {
unwindstack::MapInfo* map_info = info->map_info;
std::string line = android::base::StringPrintf(" #%0zd pc %" PAD_PTR " ", i, info->rel_pc);
- if (map_info->offset() != 0) {
- line += android::base::StringPrintf("(offset 0x%" PRIx64 ") ", map_info->offset());
+ if (map_info->offset != 0) {
+ line += android::base::StringPrintf("(offset 0x%" PRIx64 ") ", map_info->offset);
}
- if (map_info->name().empty()) {
- line += android::base::StringPrintf("<anonymous:%" PRIx64 ">", map_info->start());
+ if (map_info->name.empty()) {
+ line += android::base::StringPrintf("<anonymous:%" PRIx64 ">", map_info->start);
} else {
- line += map_info->name();
+ line += map_info->name;
}
if (!info->function_name.empty()) {
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index d23ab15c3..609f030bf 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -362,9 +362,10 @@ void debug_finalize() {
backtrace_shutdown();
- // In order to prevent any issues of threads freeing previous pointers
- // after the main thread calls this code, simply leak the g_debug pointer
- // and do not destroy the debug disable pthread key.
+ delete g_debug;
+ g_debug = nullptr;
+
+ DebugDisableFinalize();
}
void debug_get_malloc_leak_info(uint8_t** info, size_t* overall_size, size_t* info_size,
diff --git a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
index 68b3a1ec0..f260db71a 100644
--- a/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_system_tests.cpp
@@ -30,7 +30,6 @@
#include <fcntl.h>
#include <poll.h>
#include <signal.h>
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -41,7 +40,7 @@
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <gtest/gtest.h>
-#include <log/log_read.h>
+#include <log/log.h>
#include <atomic>
#include <string>
@@ -159,7 +158,7 @@ static void GetLogStr(pid_t pid, std::string* log_str, log_id log = LOG_ID_MAIN)
log_str->clear();
logger_list* list;
- list = android_logger_list_open(log, ANDROID_LOG_NONBLOCK, 1000, pid);
+ list = android_logger_list_open(log, ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, 1000, pid);
ASSERT_TRUE(list != nullptr);
while (true) {
@@ -450,12 +449,12 @@ TEST(MallocDebugSystemTest, verify_leak_allocation_limit) {
}
static constexpr int kExpectedExitCode = 30;
-static constexpr size_t kMaxThreads = sizeof(uint32_t) * 8;
TEST(MallocTests, DISABLED_exit_while_threads_allocating) {
- std::atomic_uint32_t thread_mask = {};
+ std::atomic_uint32_t thread_mask;
+ thread_mask = 0;
- for (size_t i = 0; i < kMaxThreads; i++) {
+ for (size_t i = 0; i < 32; i++) {
std::thread malloc_thread([&thread_mask, i] {
while (true) {
void* ptr = malloc(100);
@@ -470,7 +469,7 @@ TEST(MallocTests, DISABLED_exit_while_threads_allocating) {
}
// Wait until each thread has done at least one allocation.
- while (thread_mask.load() != UINT32_MAX)
+ while (thread_mask.load() != 0xffffffff)
;
exit(kExpectedExitCode);
}
@@ -493,59 +492,6 @@ TEST(MallocDebugSystemTest, exit_while_threads_allocating) {
}
}
-TEST(MallocTests, DISABLED_exit_while_threads_freeing_allocs_with_header) {
- static constexpr size_t kMaxAllocsPerThread = 1000;
- std::atomic_uint32_t thread_mask = {};
- std::atomic_bool run;
-
- std::vector<std::vector<void*>> allocs(kMaxThreads);
- // Pre-allocate a bunch of memory so that we can try to trigger
- // the frees after the main thread finishes.
- for (size_t i = 0; i < kMaxThreads; i++) {
- for (size_t j = 0; j < kMaxAllocsPerThread; j++) {
- void* ptr = malloc(8);
- ASSERT_TRUE(ptr != nullptr);
- allocs[i].push_back(ptr);
- }
- }
-
- for (size_t i = 0; i < kMaxThreads; i++) {
- std::thread malloc_thread([&thread_mask, &run, &allocs, i] {
- thread_mask.fetch_or(1 << i);
- while (!run)
- ;
- for (auto ptr : allocs[i]) {
- free(ptr);
- }
- });
- malloc_thread.detach();
- }
-
- // Wait until all threads are running.
- while (thread_mask.load() != UINT32_MAX)
- ;
- run = true;
- exit(kExpectedExitCode);
-}
-
-TEST(MallocDebugSystemTest, exit_while_threads_freeing_allocs_with_header) {
- for (size_t i = 0; i < 50; i++) {
- SCOPED_TRACE(::testing::Message() << "Run " << i);
- pid_t pid;
- // Enable guard to force the use of a header.
- ASSERT_NO_FATAL_FAILURE(
- Exec("MallocTests.DISABLED_exit_while_threads_freeing_allocs_with_header", "verbose guard",
- &pid, kExpectedExitCode));
-
- ASSERT_NO_FATAL_FAILURE(FindStrings(pid, std::vector<const char*>{"malloc debug enabled"}));
-
- std::string log_str;
- GetLogStr(pid, &log_str, LOG_ID_CRASH);
- ASSERT_TRUE(log_str.find("Fatal signal") == std::string::npos)
- << "Found crash in log.\nLog message: " << log_str;
- }
-}
-
TEST(MallocTests, DISABLED_write_leak_info) {
TemporaryFile tf;
ASSERT_TRUE(tf.fd != -1);
@@ -609,11 +555,8 @@ TEST(MallocTests, DISABLED_malloc_and_backtrace_deadlock) {
static constexpr size_t kNumUnwinds = 1000;
for (size_t i = 0; i < kNumUnwinds; i++) {
std::unique_ptr<Backtrace> backtrace(Backtrace::Create(getpid(), tid));
- // Only verify that there is at least one frame in the unwind.
- // This is not a test of the unwinder and clang for arm seems to
- // produces an increasing number of code that does not have unwind
- // information.
ASSERT_TRUE(backtrace->Unwind(0)) << "Failed on unwind " << i;
+ ASSERT_LT(1, backtrace->NumFrames()) << "Failed on unwind " << i;
}
running = false;
thread.join();
diff --git a/libc/malloc_hooks/Android.bp b/libc/malloc_hooks/Android.bp
index 01394da6e..77b523ec4 100644
--- a/libc/malloc_hooks/Android.bp
+++ b/libc/malloc_hooks/Android.bp
@@ -1,15 +1,6 @@
// ==============================================================
// libc_malloc_hooks.so
// ==============================================================
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "bionic_libc_license"
- // to get the below license kinds:
- // SPDX-license-identifier-BSD
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
cc_library {
name: "libc_malloc_hooks",
@@ -79,7 +70,6 @@ cc_test {
cflags: [
"-Wall",
"-Werror",
- "-O1", // FIXME: http://b/169206016 - issues with aligned_alloc and -O2
],
test_suites: ["general-tests"],
}
diff --git a/libc/malloc_hooks/README.md b/libc/malloc_hooks/README.md
index 1747e8d41..b418e1ef4 100644
--- a/libc/malloc_hooks/README.md
+++ b/libc/malloc_hooks/README.md
@@ -74,11 +74,11 @@ Example Implementation
======================
Below is a simple implementation intercepting only malloc/calloc calls.
- void* new_malloc_hook(size_t bytes, const void* arg) {
+ void* new_malloc_hook(size_t bytes, const char* arg) {
return orig_malloc_hook(bytes, arg);
}
- auto orig_malloc_hook = __malloc_hook;
+ void orig_malloc_hook = __malloc_hook;
__malloc_hook = new_malloc_hook;
Enabling Examples
diff --git a/libc/platform/bionic/fdtrack.h b/libc/platform/bionic/fdtrack.h
index fe6ca84b8..6eb379ba0 100644
--- a/libc/platform/bionic/fdtrack.h
+++ b/libc/platform/bionic/fdtrack.h
@@ -70,8 +70,4 @@ bool android_fdtrack_compare_exchange_hook(android_fdtrack_hook_t* expected, and
bool android_fdtrack_get_enabled() __INTRODUCED_IN(30);
bool android_fdtrack_set_enabled(bool new_value) __INTRODUCED_IN(30);
-// Globally enable/disable fdtrack.
-// This is primaryily useful to reenable fdtrack after it's been automatically disabled post-fork.
-void android_fdtrack_set_globally_enabled(bool new_value) __INTRODUCED_IN(31);
-
__END_DECLS
diff --git a/libc/platform/bionic/macros.h b/libc/platform/bionic/macros.h
index 076cff116..28a69e6d7 100644
--- a/libc/platform/bionic/macros.h
+++ b/libc/platform/bionic/macros.h
@@ -83,15 +83,11 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; // NOLINT(readability/casting)
#define __BIONIC_FALLTHROUGH
#endif
-static inline uintptr_t untag_address(uintptr_t p) {
+template <typename T>
+static inline T* untag_address(T* p) {
#if defined(__aarch64__)
- return p & ((1ULL << 56) - 1);
+ return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ((1ULL << 56) - 1));
#else
return p;
#endif
}
-
-template <typename T>
-static inline T* untag_address(T* p) {
- return reinterpret_cast<T*>(untag_address(reinterpret_cast<uintptr_t>(p)));
-}
diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h
index b56ca746a..0ea7e3c12 100644
--- a/libc/platform/bionic/malloc.h
+++ b/libc/platform/bionic/malloc.h
@@ -28,7 +28,6 @@
#pragma once
-#include <malloc.h>
#include <stdbool.h>
#include <stdint.h>
@@ -86,6 +85,12 @@ enum {
// arg_size = sizeof(android_mallopt_leak_info_t)
M_FREE_MALLOC_LEAK_INFO = 7,
#define M_FREE_MALLOC_LEAK_INFO M_FREE_MALLOC_LEAK_INFO
+ // Change the heap tagging state. The program must be single threaded at the point when the
+ // android_mallopt function is called.
+ // arg = HeapTaggingLevel*
+ // arg_size = sizeof(HeapTaggingLevel)
+ M_SET_HEAP_TAGGING_LEVEL = 8,
+#define M_SET_HEAP_TAGGING_LEVEL M_SET_HEAP_TAGGING_LEVEL
// Query whether the current process is considered to be profileable by the
// Android platform. Result is assigned to the arg pointer's destination.
// arg = bool*
@@ -102,6 +107,17 @@ enum {
#define M_INITIALIZE_GWP_ASAN M_INITIALIZE_GWP_ASAN
};
+enum HeapTaggingLevel {
+ // Disable heap tagging. The program must use prctl(PR_SET_TAGGED_ADDR_CTRL) to disable memory tag
+ // checks before disabling heap tagging. Heap tagging may not be re-enabled after being disabled.
+ M_HEAP_TAGGING_LEVEL_NONE = 0,
+ // Address-only tagging. Heap pointers have a non-zero tag in the most significant byte which is
+ // checked in free(). Memory accesses ignore the tag.
+ M_HEAP_TAGGING_LEVEL_TBI = 1,
+ // Enable heap tagging if supported, at a level appropriate for asynchronous memory tag checks.
+ M_HEAP_TAGGING_LEVEL_ASYNC = 2,
+};
+
// Manipulates bionic-specific handling of memory allocation APIs such as
// malloc. Only for use by the Android platform itself.
//
diff --git a/libc/platform/bionic/mte.h b/libc/platform/bionic/mte.h
index 73cd821b6..fbf3895cb 100644
--- a/libc/platform/bionic/mte.h
+++ b/libc/platform/bionic/mte.h
@@ -29,22 +29,18 @@
#pragma once
#include <sys/auxv.h>
-#include <sys/prctl.h>
-
-// Note: Most PR_MTE_* constants come from the upstream kernel. This tag mask
-// allows for the hardware to provision any nonzero tag. Zero tags are reserved
-// for scudo to use for the chunk headers in order to prevent linear heap
-// overflow/underflow.
-#define PR_MTE_TAG_SET_NONZERO (0xfffeUL << PR_MTE_TAG_SHIFT)
+#include <bionic/mte_kernel.h>
+#ifdef __aarch64__
inline bool mte_supported() {
-#if defined(__aarch64__)
+#ifdef ANDROID_EXPERIMENTAL_MTE
static bool supported = getauxval(AT_HWCAP2) & HWCAP2_MTE;
#else
static bool supported = false;
#endif
return supported;
}
+#endif
#ifdef __aarch64__
class ScopedDisableMTE {
diff --git a/libc/include/bits/swab.h b/libc/platform/bionic/mte_kernel.h
index 63281b6e0..2c777c949 100644
--- a/libc/include/bits/swab.h
+++ b/libc/platform/bionic/mte_kernel.h
@@ -28,26 +28,27 @@
#pragma once
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
+// Defines constants used as part of the interface in an experimental MTE branch
+// of the Linux kernel, which may be found at:
+//
+// https://github.com/pcc/linux/tree/android-experimental-mte
+//
+// This interface should not be considered to be stable.
-#if !defined(__BIONIC_SWAB_INLINE)
-#define __BIONIC_SWAB_INLINE static __inline
-#endif
+#ifdef ANDROID_EXPERIMENTAL_MTE
+
+#define HWCAP2_MTE (1 << 10)
+#define PROT_MTE 0x20
-__BEGIN_DECLS
+#define PR_MTE_TCF_SHIFT 1
+#define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
+#define PR_MTE_EXCL_SHIFT 3
+#define PR_MTE_EXCL_MASK (0xffffUL << PR_MTE_EXCL_SHIFT)
-__BIONIC_SWAB_INLINE void swab(const void* __void_src, void* __void_dst, ssize_t __byte_count) {
- const uint8_t* __src = __BIONIC_CAST(static_cast, const uint8_t*, __void_src);
- uint8_t* __dst = __BIONIC_CAST(static_cast, uint8_t*, __void_dst);
- while (__byte_count > 1) {
- uint8_t x = *__src++;
- uint8_t y = *__src++;
- *__dst++ = y;
- *__dst++ = x;
- __byte_count -= 2;
- }
-}
+#define SEGV_MTEAERR 6
+#define SEGV_MTESERR 7
-__END_DECLS
+#endif
diff --git a/libc/platform/bionic/pac.h b/libc/platform/bionic/pac.h
deleted file mode 100644
index 34efc48ae..000000000
--- a/libc/platform/bionic/pac.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <stddef.h>
-
-inline uintptr_t __bionic_clear_pac_bits(uintptr_t ptr) {
-#if defined(__aarch64__)
- register uintptr_t x30 __asm("x30") = ptr;
- // This is a NOP on pre-Armv8.3-A architectures.
- asm("xpaclri" : "+r"(x30));
- return x30;
-#else
- return ptr;
-#endif
-}
diff --git a/libc/platform/bionic/reserved_signals.h b/libc/platform/bionic/reserved_signals.h
index dab58af93..e8e517e20 100644
--- a/libc/platform/bionic/reserved_signals.h
+++ b/libc/platform/bionic/reserved_signals.h
@@ -43,7 +43,9 @@
// 37 (__SIGRTMIN + 5) coverage (libprofile-extras)
// 38 (__SIGRTMIN + 6) heapprofd ART managed heap dumps
// 39 (__SIGRTMIN + 7) fdtrack
-// 40 (__SIGRTMIN + 8) android_run_on_all_threads (bionic/pthread_internal.cpp)
+//
+// If you change this, also change __ndk_legacy___libc_current_sigrtmin
+// in <android/legacy_signal_inlines.h> to match.
#define BIONIC_SIGNAL_POSIX_TIMERS (__SIGRTMIN + 0)
#define BIONIC_SIGNAL_BACKTRACE (__SIGRTMIN + 1)
@@ -51,9 +53,8 @@
#define BIONIC_SIGNAL_PROFILER (__SIGRTMIN + 4)
#define BIONIC_SIGNAL_ART_PROFILER (__SIGRTMIN + 6)
#define BIONIC_SIGNAL_FDTRACK (__SIGRTMIN + 7)
-#define BIONIC_SIGNAL_RUN_ON_ALL_THREADS (__SIGRTMIN + 8)
-#define __SIGRT_RESERVED 9
+#define __SIGRT_RESERVED 8
static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigset, int how) {
int (*block)(sigset64_t*, int);
int (*unblock)(sigset64_t*, int);
@@ -82,6 +83,5 @@ static inline __always_inline sigset64_t filter_reserved_signals(sigset64_t sigs
unblock(&sigset, __SIGRTMIN + 5);
unblock(&sigset, __SIGRTMIN + 6);
unblock(&sigset, __SIGRTMIN + 7);
- unblock(&sigset, __SIGRTMIN + 8);
return sigset;
}
diff --git a/libc/private/WriteProtected.h b/libc/private/WriteProtected.h
index 746f72a4d..8f5b32d7a 100644
--- a/libc/private/WriteProtected.h
+++ b/libc/private/WriteProtected.h
@@ -40,11 +40,23 @@ union WriteProtectedContents {
// explicitly.
template <typename T>
class WriteProtected {
- public:
static_assert(sizeof(T) < PAGE_SIZE,
"WriteProtected only supports contents up to PAGE_SIZE");
static_assert(__is_pod(T), "WriteProtected only supports POD contents");
+ WriteProtectedContents<T> contents;
+
+ int set_protection(int prot) {
+ auto addr = &contents;
+#if __has_feature(hwaddress_sanitizer)
+ // The mprotect system call does not currently untag pointers, so do it
+ // ourselves.
+ addr = untag_address(addr);
+#endif
+ return mprotect(reinterpret_cast<void*>(addr), PAGE_SIZE, prot);
+ }
+
+ public:
WriteProtected() = default;
BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtected);
@@ -52,7 +64,10 @@ class WriteProtected {
// Not strictly necessary, but this will hopefully segfault if we initialize
// multiple times by accident.
memset(&contents, 0, sizeof(contents));
- set_protection(PROT_READ);
+
+ if (set_protection(PROT_READ)) {
+ async_safe_fatal("failed to make WriteProtected nonwritable in initialize");
+ }
}
const T* operator->() {
@@ -65,23 +80,14 @@ class WriteProtected {
template <typename Mutator>
void mutate(Mutator mutator) {
- set_protection(PROT_READ | PROT_WRITE);
+ if (set_protection(PROT_READ | PROT_WRITE) != 0) {
+ async_safe_fatal("failed to make WriteProtected writable in mutate: %s",
+ strerror(errno));
+ }
mutator(&contents.value);
- set_protection(PROT_READ);
- }
-
- private:
- WriteProtectedContents<T> contents;
-
- void set_protection(int prot) {
- auto addr = &contents;
-#if __has_feature(hwaddress_sanitizer)
- // The mprotect system call does not currently untag pointers, so do it
- // ourselves.
- addr = untag_address(addr);
-#endif
- if (mprotect(reinterpret_cast<void*>(addr), PAGE_SIZE, prot) == -1) {
- async_safe_fatal("WriteProtected mprotect %x failed: %s", prot, strerror(errno));
+ if (set_protection(PROT_READ) != 0) {
+ async_safe_fatal("failed to make WriteProtected nonwritable in mutate: %s",
+ strerror(errno));
}
}
};
diff --git a/libc/private/bionic_allocator.h b/libc/private/bionic_allocator.h
index 342fd5149..c705ce403 100644
--- a/libc/private/bionic_allocator.h
+++ b/libc/private/bionic_allocator.h
@@ -110,11 +110,6 @@ class BionicAllocator {
// Note that this implementation of realloc never shrinks allocation
void* realloc(void* ptr, size_t size);
void free(void* ptr);
-
- // Returns the size of the given allocated heap chunk, if it is valid.
- // Otherwise, this may return 0 or cause a segfault if the pointer is invalid.
- size_t get_chunk_size(void* ptr);
-
private:
void* alloc_mmap(size_t align, size_t size);
inline void* alloc_impl(size_t align, size_t size);
diff --git a/libc/private/bionic_asm.h b/libc/private/bionic_asm.h
index d68a2d604..6409563f2 100644
--- a/libc/private/bionic_asm.h
+++ b/libc/private/bionic_asm.h
@@ -26,10 +26,8 @@
* SUCH DAMAGE.
*/
-#pragma once
-
-/* https://github.com/android/ndk/issues/1422 */
-#include <features.h>
+#ifndef _PRIVATE_BIONIC_ASM_H_
+#define _PRIVATE_BIONIC_ASM_H_
#include <asm/unistd.h> /* For system call numbers. */
#define MAX_ERRNO 4095 /* For recognizing system call error returns. */
@@ -37,7 +35,6 @@
#define __bionic_asm_custom_entry(f)
#define __bionic_asm_custom_end(f)
#define __bionic_asm_function_type @function
-#define __bionic_asm_custom_note_gnu_section()
#if defined(__aarch64__)
#include <private/bionic_asm_arm64.h>
@@ -86,5 +83,4 @@
.globl alias; \
.equ alias, original
-#define NOTE_GNU_PROPERTY() \
- __bionic_asm_custom_note_gnu_section()
+#endif
diff --git a/libc/private/bionic_asm_arm64.h b/libc/private/bionic_asm_arm64.h
index ee51a8e78..463ca312a 100644
--- a/libc/private/bionic_asm_arm64.h
+++ b/libc/private/bionic_asm_arm64.h
@@ -41,38 +41,3 @@
#undef __bionic_asm_function_type
#define __bionic_asm_function_type %function
-
-#if defined(__ARM_FEATURE_BTI_DEFAULT)
-#define __bionic_asm_aarch64_feature_bti (1 << 0)
-#undef __bionic_asm_custom_entry
-#define __bionic_asm_custom_entry(f) bti c
-#else
-#define __bionic_asm_aarch64_feature_bti 0
-#endif
-
-#if defined(__ARM_FEATURE_PAC_DEFAULT)
-#define __bionic_asm_aarch64_feature_pac (1 << 1)
-#else
-#define __bionic_asm_aarch64_feature_pac 0
-#endif
-
-#undef __bionic_asm_custom_note_gnu_section
-#define __bionic_asm_custom_note_gnu_section() \
- .pushsection .note.gnu.property, "a"; \
- .balign 8; \
- .long 4; \
- .long 0x10; \
- .long 0x5; /* NT_GNU_PROPERTY_TYPE_0 */ \
- .asciz "GNU"; \
- .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ \
- .long 4; \
- .long (__bionic_asm_aarch64_feature_pac | \
- __bionic_asm_aarch64_feature_bti); \
- .long 0; \
- .popsection;
-
-#define NT_MEMTAG_LEVEL_MASK 3
-#define NT_MEMTAG_LEVEL_DEFAULT 0
-#define NT_MEMTAG_LEVEL_ASYNC 1
-#define NT_MEMTAG_LEVEL_SYNC 2
-#define NT_MEMTAG_HEAP 4
diff --git a/libc/private/bionic_asm_dwarf_exprs.h b/libc/private/bionic_asm_dwarf_exprs.h
deleted file mode 100644
index f988c6e48..000000000
--- a/libc/private/bionic_asm_dwarf_exprs.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-// Define assembler macros for generating DWARF CFI instructions that use DWARF expressions.
-// Assemblers don't natively support DWARF expressions, so use the C preprocessor and assembler
-// macros to lower them to .cfi_escape directives.
-//
-// Signal trampolines need to use DWARF expressions to record the locations of saved registers,
-// because the offsets from the restored SP to the saved registers is variable. e.g. A signal frame
-// can have optional FP/SIMD extensions, and there may be extra padding if the interrupted SP wasn't
-// aligned.
-
-// DWARF constants.
-#define DW_CFA_def_cfa_expression 0x0f
-#define DW_CFA_expression 0x10
-#define DW_OP_breg0 0x70
-#define DW_OP_deref 0x06
-
-// Return the size of a small uleb128 value: either 1 or 2 bytes
-#define ULEB128_14BIT_SIZE(val) \
- (1 + (((val) > 0x7f) & 1))
-
-// Return the size of a small sleb128 value: either 1 or 2 bytes
-#define SLEB128_14BIT_SIZE(val) \
- (1 + (((val) < -0x40) & 1) + \
- (((val) > 0x3f) & 1) )
-
-// Output a 1 or 2-byte CFI uleb128 absolute value.
-.macro m_cfi_uleb128 val
- .if (\val) < 0 || (\val) > 0x3fff
- .error "m_cfi_uleb128 value is out of range (\val)"
- .elseif (\val) > 0x7f
- .cfi_escape ((\val) & 0x7f) | 0x80
- .cfi_escape (\val) >> 7
- .else
- .cfi_escape (\val)
- .endif
-.endm
-
-// Output a 1 or 2-byte CFI sleb128 absolute value.
-.macro m_cfi_sleb128 val
- .if (\val) < -0x2000 || (\val) > 0x1fff
- .error "m_cfi_sleb128 value is out of range (\val)"
- .elseif (\val) < -0x40 || (\val) > 0x3f
- .cfi_escape ((\val) & 0x7f) | 0x80
- .cfi_escape ((\val) >> 7) & 0x7f
- .else
- .cfi_escape (\val) & 0x7f
- .endif
-.endm
-
-.macro check_base_reg reg_no
- .if (\reg_no) < 0 || (\reg_no) > 31
- .error "base register is out of range for DW_OP_breg0..DW_OP_breg31 (\reg_no)"
- .endif
-.endm
-
-// Set CFA to the expression, *(base_reg + offset)
-.macro m_cfi_def_cfa_deref base_reg, offset
- check_base_reg (\base_reg)
- .cfi_escape DW_CFA_def_cfa_expression
- m_cfi_uleb128 (1 + SLEB128_14BIT_SIZE(\offset) + 1) // size of DWARF expression in bytes
- .cfi_escape DW_OP_breg0 + (\base_reg) // expr: 1 byte
- m_cfi_sleb128 (\offset) // expr: 1 or 2 bytes
- .cfi_escape DW_OP_deref // expr: 1 byte
-.endm
-
-// Set the address of the register's previous value to the expression, (base_reg + offset)
-.macro m_cfi_breg_offset dest_reg, base_reg, offset
- check_base_reg (\base_reg)
- .cfi_escape DW_CFA_expression
- m_cfi_uleb128 (\dest_reg)
- m_cfi_uleb128 (1 + SLEB128_14BIT_SIZE(\offset)) // size of DWARF expression in bytes
- .cfi_escape DW_OP_breg0 + (\base_reg) // expr: 1 byte
- m_cfi_sleb128 (\offset) // expr: 1 or 2 bytes
-.endm
diff --git a/libc/private/bionic_auxv.h b/libc/private/bionic_auxv.h
index 9d2cfdd4f..8e33c1cf1 100644
--- a/libc/private/bionic_auxv.h
+++ b/libc/private/bionic_auxv.h
@@ -30,4 +30,4 @@
#include <sys/cdefs.h>
-__LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool* exists);
+__LIBC_HIDDEN__ unsigned long __bionic_getauxval(unsigned long type, bool& exists);
diff --git a/libc/private/bionic_defs.h b/libc/private/bionic_defs.h
index 5a48f259c..1d4f86b9b 100644
--- a/libc/private/bionic_defs.h
+++ b/libc/private/bionic_defs.h
@@ -33,15 +33,7 @@
* This label is used to mark libc/libdl symbols that may need to be replaced
* by native bridge implementation.
*/
-#ifdef __ANDROID_NATIVE_BRIDGE__
#define __BIONIC_WEAK_FOR_NATIVE_BRIDGE __attribute__((__weak__, __noinline__))
#define __BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE __attribute__((__weak__))
-#define __BIONIC_WEAK_FOR_NATIVE_BRIDGE_INLINE \
- __BIONIC_WEAK_FOR_NATIVE_BRIDGE extern "C" __LIBC_HIDDEN__
-#else
-#define __BIONIC_WEAK_FOR_NATIVE_BRIDGE
-#define __BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE
-#define __BIONIC_WEAK_FOR_NATIVE_BRIDGE_INLINE static inline
-#endif
#endif /* __BIONIC_PRIVATE_BIONIC_DEFS_H_ */
diff --git a/libc/private/bionic_elf_tls.h b/libc/private/bionic_elf_tls.h
index e0ec7b51d..fa1af768e 100644
--- a/libc/private/bionic_elf_tls.h
+++ b/libc/private/bionic_elf_tls.h
@@ -111,18 +111,6 @@ struct TlsModule {
void* soinfo_ptr = nullptr;
};
-// Signature of the callbacks that will be called after DTLS creation and
-// before DTLS destruction.
-typedef void (*dtls_listener_t)(void* dynamic_tls_begin, void* dynamic_tls_end);
-
-// Signature of the thread-exit callbacks.
-typedef void (*thread_exit_cb_t)(void);
-
-struct CallbackHolder {
- thread_exit_cb_t cb;
- CallbackHolder* prev;
-};
-
// Table of the ELF TLS modules. Either the dynamic linker or the static
// initialization code prepares this table, and it's then used during thread
// creation and for dynamic TLS lookups.
@@ -140,20 +128,7 @@ struct TlsModules {
// Pointer to a block of TlsModule objects. The first module has ID 1 and
// is stored at index 0 in this table.
size_t module_count = 0;
- size_t static_module_count = 0;
TlsModule* module_table = nullptr;
-
- // Callback to be invoked after a dynamic TLS allocation.
- dtls_listener_t on_creation_cb = nullptr;
-
- // Callback to be invoked before a dynamic TLS deallocation.
- dtls_listener_t on_destruction_cb = nullptr;
-
- // The first thread-exit callback; inlined to avoid allocation.
- thread_exit_cb_t first_thread_exit_callback = nullptr;
-
- // The additional callbacks, if any.
- CallbackHolder* thread_exit_callback_tail_node = nullptr;
};
void __init_static_tls(void* static_tls);
@@ -200,4 +175,3 @@ extern "C" void* TLS_GET_ADDR(const TlsIndex* ti) TLS_GET_ADDR_CCONV;
struct bionic_tcb;
void __free_dynamic_tls(bionic_tcb* tcb);
-void __notify_thread_exit_callbacks();
diff --git a/libc/private/bionic_fdtrack.h b/libc/private/bionic_fdtrack.h
index c05b32ba6..752dd8dc5 100644
--- a/libc/private/bionic_fdtrack.h
+++ b/libc/private/bionic_fdtrack.h
@@ -28,43 +28,41 @@
#pragma once
-#include <stdatomic.h>
#include <sys/cdefs.h>
+#include <stdatomic.h>
#include "platform/bionic/fdtrack.h"
#include "bionic/pthread_internal.h"
-#include "private/ErrnoRestorer.h"
#include "private/bionic_tls.h"
+#include "private/ErrnoRestorer.h"
extern "C" _Atomic(android_fdtrack_hook_t) __android_fdtrack_hook;
-extern "C" bool __android_fdtrack_globally_disabled;
// Macro to record file descriptor creation.
// e.g.:
// int socket(int domain, int type, int protocol) {
// return FDTRACK_CREATE_NAME("socket", __socket(domain, type, protocol));
// }
-#define FDTRACK_CREATE_NAME(name, fd_value) \
- ({ \
- int __fd = (fd_value); \
- if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \
- !__predict_false(__get_thread()->is_vforked())) { \
- bionic_tls& tls = __get_bionic_tls(); \
- /* fdtrack_disabled is only true during reentrant calls. */ \
- if (!__predict_false(tls.fdtrack_disabled) && \
- !__predict_false(__android_fdtrack_globally_disabled)) { \
- ErrnoRestorer r; \
- tls.fdtrack_disabled = true; \
- android_fdtrack_event event; \
- event.fd = __fd; \
- event.type = ANDROID_FDTRACK_EVENT_TYPE_CREATE; \
- event.data.create.function_name = name; \
- atomic_load (&__android_fdtrack_hook)(&event); \
- tls.fdtrack_disabled = false; \
- } \
- } \
- __fd; \
+#define FDTRACK_CREATE_NAME(name, fd_value) \
+ ({ \
+ int __fd = (fd_value); \
+ if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \
+ !__predict_false(__get_thread()->is_vforked())) { \
+ bionic_tls& tls = __get_bionic_tls(); \
+ /* fdtrack_disabled is only true during reentrant calls. */ \
+ if (!__predict_false(tls.fdtrack_disabled)) { \
+ ErrnoRestorer r; \
+ tls.fdtrack_disabled = true; \
+ android_fdtrack_event event; \
+ event.fd = __fd; \
+ event.type = ANDROID_FDTRACK_EVENT_TYPE_CREATE; \
+ event.data.create.function_name = name; \
+ __android_fdtrack_hook(&event); \
+ tls.fdtrack_disabled = false; \
+ } \
+ } \
+ __fd; \
})
// Macro to record file descriptor creation, with the current function's name.
@@ -76,23 +74,22 @@ extern "C" bool __android_fdtrack_globally_disabled;
// Macro to record file descriptor closure.
// Note that this does not actually close the file descriptor.
-#define FDTRACK_CLOSE(fd_value) \
- ({ \
- int __fd = (fd_value); \
- if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \
- !__predict_false(__get_thread()->is_vforked())) { \
- bionic_tls& tls = __get_bionic_tls(); \
- if (!__predict_false(tls.fdtrack_disabled) && \
- !__predict_false(__android_fdtrack_globally_disabled)) { \
- int saved_errno = errno; \
- tls.fdtrack_disabled = true; \
- android_fdtrack_event event; \
- event.fd = __fd; \
- event.type = ANDROID_FDTRACK_EVENT_TYPE_CLOSE; \
- atomic_load (&__android_fdtrack_hook)(&event); \
- tls.fdtrack_disabled = false; \
- errno = saved_errno; \
- } \
- } \
- __fd; \
+#define FDTRACK_CLOSE(fd_value) \
+ ({ \
+ int __fd = (fd_value); \
+ if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \
+ !__predict_false(__get_thread()->is_vforked())) { \
+ bionic_tls& tls = __get_bionic_tls(); \
+ if (!__predict_false(tls.fdtrack_disabled)) { \
+ int saved_errno = errno; \
+ tls.fdtrack_disabled = true; \
+ android_fdtrack_event event; \
+ event.fd = __fd; \
+ event.type = ANDROID_FDTRACK_EVENT_TYPE_CLOSE; \
+ __android_fdtrack_hook(&event); \
+ tls.fdtrack_disabled = false; \
+ errno = saved_errno; \
+ } \
+ } \
+ __fd; \
})
diff --git a/libc/private/bionic_fortify.h b/libc/private/bionic_fortify.h
index df83360be..3c3292e58 100644
--- a/libc/private/bionic_fortify.h
+++ b/libc/private/bionic_fortify.h
@@ -35,11 +35,7 @@
#include <async_safe/log.h>
-//
-// LLVM can't inline variadic functions, and we don't want one definition of
-// this per #include in libc.so, so no `static`.
-//
-inline __noreturn __printflike(1, 2) void __fortify_fatal(const char* fmt, ...) {
+static inline __noreturn void __fortify_fatal(const char* fmt, ...) {
va_list args;
va_start(args, fmt);
async_safe_fatal_va_list("FORTIFY", fmt, args);
@@ -56,7 +52,7 @@ static inline void __check_fd_set(const char* fn, int fd, size_t set_size) {
__fortify_fatal("%s: file descriptor %d < 0", fn, fd);
}
if (__predict_false(fd >= FD_SETSIZE)) {
- __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %d", fn, fd, FD_SETSIZE);
+ __fortify_fatal("%s: file descriptor %d >= FD_SETSIZE %zu", fn, fd, FD_SETSIZE);
}
if (__predict_false(set_size < sizeof(fd_set))) {
__fortify_fatal("%s: set size %zu is too small to be an fd_set", fn, set_size);
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
index e105c18d9..6e7eb76e4 100644
--- a/libc/private/bionic_globals.h
+++ b/libc/private/bionic_globals.h
@@ -41,8 +41,6 @@
#include "private/bionic_vdso.h"
#include "private/WriteProtected.h"
-#include <platform/bionic/malloc.h>
-
struct libc_globals {
vdso_entry vdso[VDSO_END];
long setjmp_cookie;
@@ -95,23 +93,16 @@ struct libc_shared_globals {
TlsModules tls_modules;
BionicAllocator tls_allocator;
- // Values passed from libc.so to the loader.
+ // Values passed from the HWASan runtime (via libc.so) to the loader.
void (*load_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
void (*unload_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
- void (*set_target_sdk_version_hook)(int target) = nullptr;
// Values passed from the linker to libc.so.
const char* init_progname = nullptr;
char** init_environ = nullptr;
- const gwp_asan::AllocatorState* gwp_asan_state = nullptr;
- const gwp_asan::AllocationMetadata* gwp_asan_metadata = nullptr;
-
- const char* scudo_stack_depot = nullptr;
- const char* scudo_region_info = nullptr;
- const char* scudo_ring_buffer = nullptr;
-
- HeapTaggingLevel initial_heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
+ const gwp_asan::AllocatorState *gwp_asan_state = nullptr;
+ const gwp_asan::AllocationMetadata *gwp_asan_metadata = nullptr;
};
__LIBC_HIDDEN__ libc_shared_globals* __libc_shared_globals();
@@ -125,7 +116,7 @@ __LIBC_HIDDEN__ void __libc_init_vdso(libc_globals* globals);
#if defined(__i386__)
__LIBC_HIDDEN__ extern void* __libc_sysinfo;
-extern "C" __LIBC_HIDDEN__ void __libc_int0x80();
+__LIBC_HIDDEN__ void __libc_int0x80();
__LIBC_HIDDEN__ void __libc_init_sysinfo();
#endif
diff --git a/libc/private/bionic_ifuncs.h b/libc/private/bionic_ifuncs.h
index e6b349aff..f175becb8 100644
--- a/libc/private/bionic_ifuncs.h
+++ b/libc/private/bionic_ifuncs.h
@@ -40,12 +40,9 @@
#define IFUNC_ARGS ()
#endif
-// We can't have HWASAN enabled in resolvers because they may be called before HWASAN is
-// initialized.
#define DEFINE_IFUNC_FOR(name) \
name##_func name __attribute__((ifunc(#name "_resolver"))); \
__attribute__((visibility("hidden"))) \
- __attribute__((no_sanitize("hwaddress"))) \
name##_func* name##_resolver IFUNC_ARGS
#define DECLARE_FUNC(type, name) \
diff --git a/libc/private/bionic_inline_raise.h b/libc/private/bionic_inline_raise.h
index 8565c8061..7223b4e46 100644
--- a/libc/private/bionic_inline_raise.h
+++ b/libc/private/bionic_inline_raise.h
@@ -60,18 +60,8 @@ static inline __always_inline void inline_raise(int sig, void* value = nullptr)
register long x3 __asm__("x3") = reinterpret_cast<long>(&info);
register long x8 __asm__("x8") = __NR_rt_tgsigqueueinfo;
__asm__("svc #0" : "=r"(x0) : "r"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x8) : "memory");
-#elif defined(__x86_64__)
- register long rax __asm__("rax") = __NR_rt_tgsigqueueinfo;
- register long rdi __asm__("rdi") = pid;
- register long rsi __asm__("rsi") = tid;
- register long rdx __asm__("rdx") = sig;
- register long r10 __asm__("r10") = reinterpret_cast<long>(&info);
- __asm__("syscall"
- : "+r"(rax)
- : "r"(rdi), "r"(rsi), "r"(rdx), "r"(r10)
- : "memory", "cc", "r11", "rcx");
#else
- // 32-bit x86 is a huge mess, so don't even bother...
syscall(__NR_rt_tgsigqueueinfo, pid, tid, sig, &info);
#endif
}
+
diff --git a/libc/private/bsd_sys_param.h b/libc/private/bionic_string_utils.h
index 8c936c459..ab0eccf02 100644
--- a/libc/private/bsd_sys_param.h
+++ b/libc/private/bionic_string_utils.h
@@ -14,8 +14,18 @@
* limitations under the License.
*/
-#pragma once
+#ifndef _BIONIC_STRING_UTILS_H_
+#define _BIONIC_STRING_UTILS_H_
-/* OpenBSD has these in <sys/param.h>, but "ALIGN" isn't something we want to reserve. */
-#define ALIGNBYTES (sizeof(uintptr_t) - 1)
-#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+#include <string.h>
+
+static inline bool ends_with(const char* s1, const char* s2) {
+ size_t s1_length = strlen(s1);
+ size_t s2_length = strlen(s2);
+ if (s2_length > s1_length) {
+ return false;
+ }
+ return memcmp(s1 + (s1_length - s2_length), s2, s2_length) == 0;
+}
+
+#endif // _BIONIC_STRING_UTILS_H_
diff --git a/libc/seccomp/seccomp_policy.cpp b/libc/seccomp/seccomp_policy.cpp
index a42816eb6..65357fc3a 100644
--- a/libc/seccomp/seccomp_policy.cpp
+++ b/libc/seccomp/seccomp_policy.cpp
@@ -140,12 +140,12 @@ static void ValidateSyscallArgInRange(filter& f, __u32 arg_num, __u32 range_min,
Disallow(f);
}
-// This filter is meant to be installed in addition to a regular allowlist filter.
+// This filter is meant to be installed in addition to a regular whitelist filter.
// Therefore, it's default action has to be Allow, except when the evaluated
// system call matches setresuid/setresgid and the arguments don't fall within the
// passed in range.
//
-// The regular allowlist only allows setresuid/setresgid for UID/GID changes, so
+// The regular whitelist only allows setresuid/setresgid for UID/GID changes, so
// that's the only system call we need to check here. A CTS test ensures the other
// calls will remain blocked.
static void ValidateSetUidGid(filter& f, uint32_t uid_gid_min, uint32_t uid_gid_max, bool primary) {
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 6ffda49c9..1ecf1220f 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -259,8 +259,8 @@ extern void __sinit(void); // Not actually implemented.
size_t parsefloat(FILE*, char*, char*);
size_t wparsefloat(FILE*, wchar_t*, wchar_t*);
-// Check a FILE* isn't nullptr, so we can emit a clear diagnostic message
-// instead of just crashing with SIGSEGV.
+// Sanity check a FILE* for nullptr, so we can emit a message while crashing
+// instead of doing a blind null-dereference.
#define CHECK_FP(fp) \
if (fp == nullptr) __fortify_fatal("%s: null FILE*", __FUNCTION__)
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index c429ff2c3..a0b421923 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -50,15 +50,15 @@
#include <async_safe/log.h>
-#include "glue.h"
#include "local.h"
-#include "private/ErrnoRestorer.h"
-#include "private/FdPath.h"
+#include "glue.h"
#include "private/__bionic_get_shell_path.h"
#include "private/bionic_fortify.h"
+#include "private/ErrnoRestorer.h"
#include "private/thread_private.h"
-#include "private/bsd_sys_param.h" // For ALIGN/ALIGNBYTES.
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
#define NDYNAMIC 10 /* add ten more whenever necessary */
@@ -226,21 +226,25 @@ extern "C" __LIBC_HIDDEN__ void __libc_stdio_cleanup(void) {
_fwalk(__sflush);
}
-static FILE* __FILE_init(FILE* fp, int fd, int flags) {
- if (fp == nullptr) return nullptr;
-
+static FILE* __fopen(int fd, int flags) {
#if !defined(__LP64__)
- if (fd > SHRT_MAX) __fortify_fatal("stdio: fd %d > SHRT_MAX", fd);
+ if (fd > SHRT_MAX) {
+ errno = EMFILE;
+ return nullptr;
+ }
#endif
- fp->_file = fd;
- android_fdsan_exchange_owner_tag(fd, 0, __get_file_tag(fp));
- fp->_flags = flags;
- fp->_cookie = fp;
- fp->_read = __sread;
- fp->_write = __swrite;
- fp->_close = __sclose;
- _EXT(fp)->_seek64 = __sseek64;
+ FILE* fp = __sfp();
+ if (fp != nullptr) {
+ fp->_file = fd;
+ android_fdsan_exchange_owner_tag(fd, 0, __get_file_tag(fp));
+ fp->_flags = flags;
+ fp->_cookie = fp;
+ fp->_read = __sread;
+ fp->_write = __swrite;
+ fp->_close = __sclose;
+ _EXT(fp)->_seek64 = __sseek64;
+ }
return fp;
}
@@ -254,15 +258,14 @@ FILE* fopen(const char* file, const char* mode) {
return nullptr;
}
- FILE* fp = __FILE_init(__sfp(), fd, flags);
+ FILE* fp = __fopen(fd, flags);
if (fp == nullptr) {
ErrnoRestorer errno_restorer;
close(fd);
return nullptr;
}
- // For append mode, O_APPEND sets the write position for free, but we need to
- // set the read position manually.
+ // For append mode, even though we use O_APPEND, we need to seek to the end now.
if ((mode_flags & O_APPEND) != 0) __sseek64(fp, 0, SEEK_END);
return fp;
}
@@ -293,26 +296,15 @@ FILE* fdopen(int fd, const char* mode) {
fcntl(fd, F_SETFD, tmp | FD_CLOEXEC);
}
- return __FILE_init(__sfp(), fd, flags);
+ return __fopen(fd, flags);
}
+// Re-direct an existing, open (probably) file to some other file.
+// ANSI is written such that the original file gets closed if at
+// all possible, no matter what.
+// TODO: rewrite this mess completely.
FILE* freopen(const char* file, const char* mode, FILE* fp) {
CHECK_FP(fp);
-
- // POSIX says: "If pathname is a null pointer, the freopen() function shall
- // attempt to change the mode of the stream to that specified by mode, as if
- // the name of the file currently associated with the stream had been used. In
- // this case, the file descriptor associated with the stream need not be
- // closed if the call to freopen() succeeds. It is implementation-defined
- // which changes of mode are permitted (if any), and under what
- // circumstances."
- //
- // Linux is quite restrictive about what changes you can make with F_SETFL,
- // and in particular won't let you touch the access bits. It's easiest and
- // most effective to just rely on /proc/self/fd/...
- FdPath fd_path(fp->_file);
- if (file == nullptr) file = fd_path.c_str();
-
int mode_flags;
int flags = __sflags(mode, &mode_flags);
if (flags == 0) {
@@ -322,8 +314,6 @@ FILE* freopen(const char* file, const char* mode, FILE* fp) {
ScopedFileLock sfl(fp);
- // TODO: rewrite this mess completely.
-
// There are actually programs that depend on being able to "freopen"
// descriptors that weren't originally open. Keep this from breaking.
// Remember whether the stream was open to begin with, and which file
@@ -393,12 +383,24 @@ FILE* freopen(const char* file, const char* mode, FILE* fp) {
}
}
- __FILE_init(fp, fd, flags);
+ // _file is only a short.
+ if (fd > SHRT_MAX) {
+ fp->_flags = 0; // Release.
+ errno = EMFILE;
+ return nullptr;
+ }
- // For append mode, O_APPEND sets the write position for free, but we need to
- // set the read position manually.
- if ((mode_flags & O_APPEND) != 0) __sseek64(fp, 0, SEEK_END);
+ fp->_flags = flags;
+ fp->_file = fd;
+ android_fdsan_exchange_owner_tag(fd, 0, __get_file_tag(fp));
+ fp->_cookie = fp;
+ fp->_read = __sread;
+ fp->_write = __swrite;
+ fp->_close = __sclose;
+ _EXT(fp)->_seek64 = __sseek64;
+ // For append mode, even though we use O_APPEND, we need to seek to the end now.
+ if ((mode_flags & O_APPEND) != 0) __sseek64(fp, 0, SEEK_END);
return fp;
}
__strong_alias(freopen64, freopen);
@@ -771,7 +773,10 @@ char* fgets(char* buf, int n, FILE* fp) {
// Returns first argument, or nullptr if no characters were read.
// Does not return nullptr if n == 1.
char* fgets_unlocked(char* buf, int n, FILE* fp) {
- if (n <= 0) __fortify_fatal("fgets: buffer size %d <= 0", n);
+ if (n <= 0) {
+ errno = EINVAL;
+ return nullptr;
+ }
_SET_ORIENTATION(fp, -1);
@@ -1021,9 +1026,9 @@ int vsnprintf(char* s, size_t n, const char* fmt, va_list ap) {
__check_count("vsnprintf", "size", n);
// Stdio internals do not deal correctly with zero length buffer.
- char one_byte_buffer[1];
+ char dummy;
if (n == 0) {
- s = one_byte_buffer;
+ s = &dummy;
n = 1;
}
diff --git a/libc/stdlib/exit.c b/libc/stdlib/exit.c
new file mode 100644
index 000000000..e301a2a0c
--- /dev/null
+++ b/libc/stdlib/exit.c
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <unistd.h>
+
+#include "private/bionic_defs.h"
+
+extern void __cxa_finalize(void* dso_handle);
+extern void __cxa_thread_finalize();
+
+__BIONIC_WEAK_FOR_NATIVE_BRIDGE
+void exit(int status) {
+ __cxa_thread_finalize();
+ __cxa_finalize(NULL);
+ _exit(status);
+}
diff --git a/libc/system_properties/Android.bp b/libc/system_properties/Android.bp
index af8bda9f7..8780ddae3 100644
--- a/libc/system_properties/Android.bp
+++ b/libc/system_properties/Android.bp
@@ -1,13 +1,3 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "bionic_libc_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- // SPDX-license-identifier-BSD
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
cc_library_static {
name: "libsystemproperties",
defaults: ["libc_defaults"],
@@ -33,20 +23,3 @@ cc_library_static {
],
export_include_dirs: ["include"],
}
-
-cc_benchmark {
- name: "property_context_lookup_benchmark",
- srcs: [
- "context_lookup_benchmark.cpp",
- ],
- include_dirs: [
- "bionic/libc",
- ],
-
- shared_libs: ["libbase"],
- static_libs: [
- "libpropertyinfoserializer",
- "libsystemproperties",
- "libasync_safe",
- ],
-}
diff --git a/libc/system_properties/context_lookup_benchmark.cpp b/libc/system_properties/context_lookup_benchmark.cpp
deleted file mode 100644
index 1564250e3..000000000
--- a/libc/system_properties/context_lookup_benchmark.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <string>
-#include <vector>
-
-#include <android-base/file.h>
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <benchmark/benchmark.h>
-#include <property_info_parser/property_info_parser.h>
-#include <property_info_serializer/property_info_serializer.h>
-#include <system_properties/contexts_split.h>
-
-#include "context_lookup_benchmark_data.h"
-
-using android::base::Split;
-using android::base::WriteStringToFd;
-using android::properties::BuildTrie;
-using android::properties::ParsePropertyInfoFile;
-using android::properties::PropertyInfoArea;
-using android::properties::PropertyInfoEntry;
-
-BENCHMARK_MAIN();
-
-class LegacyPropertyMapping : public ContextsSplit {
- public:
- LegacyPropertyMapping(const char* property_contexts) {
- TemporaryFile file;
- if (!WriteStringToFd(property_contexts, file.fd)) {
- PLOG(FATAL) << "Could not write to temporary file";
- }
-
- if (!InitializePropertiesFromFile(file.path)) {
- LOG(FATAL) << "Could not initialize properties";
- }
- }
-};
-
-static std::vector<std::string> PropertiesToLookup() {
- std::vector<std::string> properties;
- auto property_lines = Split(aosp_s_property_contexts, "\n");
- for (const auto& line : property_lines) {
- if (line.empty() || line[0] == '#') {
- continue;
- }
-
- auto property = Split(line, " ")[0];
- properties.push_back(property);
- properties.push_back(property + "0");
- properties.push_back(property + "A");
- }
- return properties;
-}
-
-static void LegacyLookupOreo(benchmark::State& state) {
- LegacyPropertyMapping mapping(oreo_property_contexts);
- auto properties = PropertiesToLookup();
- for (auto _ : state) {
- for (const auto& property : properties) {
- benchmark::DoNotOptimize(mapping.GetPrefixNodeForName(property.c_str()));
- }
- }
-}
-BENCHMARK(LegacyLookupOreo);
-
-static void LegacyLookupS(benchmark::State& state) {
- LegacyPropertyMapping mapping(aosp_s_property_contexts);
- auto properties = PropertiesToLookup();
- for (auto _ : state) {
- for (const auto& property : properties) {
- benchmark::DoNotOptimize(mapping.GetPrefixNodeForName(property.c_str()));
- }
- }
-}
-BENCHMARK(LegacyLookupS);
-
-static std::string CreateSerializedTrie(const char* input_file) {
- std::vector<std::string> errors;
- std::vector<PropertyInfoEntry> property_infos;
- ParsePropertyInfoFile(input_file, false, &property_infos, &errors);
-
- std::string serialized_trie;
- std::string error;
- if (!BuildTrie(property_infos, "u:object_r:default_prop:s0", "string", &serialized_trie,
- &error)) {
- LOG(FATAL) << "Could not build trie: " << error;
- }
- return serialized_trie;
-}
-
-static void TrieLookupOreo(benchmark::State& state) {
- std::string serialized_trie = CreateSerializedTrie(oreo_property_contexts);
- PropertyInfoArea* trie = reinterpret_cast<PropertyInfoArea*>(serialized_trie.data());
- auto properties = PropertiesToLookup();
- for (auto _ : state) {
- for (const auto& property : properties) {
- trie->GetPropertyInfo(property.c_str(), nullptr, nullptr);
- }
- }
-}
-BENCHMARK(TrieLookupOreo);
-
-static void TrieLookupS(benchmark::State& state) {
- std::string serialized_trie = CreateSerializedTrie(aosp_s_property_contexts);
- PropertyInfoArea* trie = reinterpret_cast<PropertyInfoArea*>(serialized_trie.data());
- auto properties = PropertiesToLookup();
- for (auto _ : state) {
- for (const auto& property : properties) {
- trie->GetPropertyInfo(property.c_str(), nullptr, nullptr);
- }
- }
-}
-BENCHMARK(TrieLookupS);
diff --git a/libc/system_properties/context_lookup_benchmark_data.h b/libc/system_properties/context_lookup_benchmark_data.h
deleted file mode 100644
index b928875dd..000000000
--- a/libc/system_properties/context_lookup_benchmark_data.h
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-static char oreo_property_contexts[] = R"(
-net.rmnet u:object_r:net_radio_prop:s0
-net.gprs u:object_r:net_radio_prop:s0
-net.ppp u:object_r:net_radio_prop:s0
-net.qmi u:object_r:net_radio_prop:s0
-net.lte u:object_r:net_radio_prop:s0
-net.cdma u:object_r:net_radio_prop:s0
-net.dns u:object_r:net_dns_prop:s0
-sys.usb.config u:object_r:system_radio_prop:s0
-ril. u:object_r:radio_prop:s0
-ro.ril. u:object_r:radio_prop:s0
-gsm. u:object_r:radio_prop:s0
-persist.radio u:object_r:radio_prop:s0
-net. u:object_r:system_prop:s0
-dev. u:object_r:system_prop:s0
-ro.runtime. u:object_r:system_prop:s0
-ro.runtime.firstboot u:object_r:firstboot_prop:s0
-hw. u:object_r:system_prop:s0
-ro.hw. u:object_r:system_prop:s0
-sys. u:object_r:system_prop:s0
-sys.cppreopt u:object_r:cppreopt_prop:s0
-sys.powerctl u:object_r:powerctl_prop:s0
-sys.usb.ffs. u:object_r:ffs_prop:s0
-service. u:object_r:system_prop:s0
-dhcp. u:object_r:dhcp_prop:s0
-dhcp.bt-pan.result u:object_r:pan_result_prop:s0
-bluetooth. u:object_r:bluetooth_prop:s0
-debug. u:object_r:debug_prop:s0
-debug.db. u:object_r:debuggerd_prop:s0
-dumpstate. u:object_r:dumpstate_prop:s0
-dumpstate.options u:object_r:dumpstate_options_prop:s0
-log. u:object_r:log_prop:s0
-log.tag u:object_r:log_tag_prop:s0
-log.tag.WifiHAL u:object_r:wifi_log_prop:s0
-security.perf_harden u:object_r:shell_prop:s0
-service.adb.root u:object_r:shell_prop:s0
-service.adb.tcp.port u:object_r:shell_prop:s0
-persist.audio. u:object_r:audio_prop:s0
-persist.bluetooth. u:object_r:bluetooth_prop:s0
-persist.debug. u:object_r:persist_debug_prop:s0
-persist.logd. u:object_r:logd_prop:s0
-persist.logd.security u:object_r:device_logging_prop:s0
-persist.logd.logpersistd u:object_r:logpersistd_logging_prop:s0
-logd.logpersistd u:object_r:logpersistd_logging_prop:s0
-persist.log.tag u:object_r:log_tag_prop:s0
-persist.mmc. u:object_r:mmc_prop:s0
-persist.sys. u:object_r:system_prop:s0
-persist.sys.safemode u:object_r:safemode_prop:s0
-ro.sys.safemode u:object_r:safemode_prop:s0
-persist.sys.audit_safemode u:object_r:safemode_prop:s0
-persist.service. u:object_r:system_prop:s0
-persist.service.bdroid. u:object_r:bluetooth_prop:s0
-persist.security. u:object_r:system_prop:s0
-persist.vendor.overlay. u:object_r:overlay_prop:s0
-ro.boot.vendor.overlay. u:object_r:overlay_prop:s0
-ro.boottime. u:object_r:boottime_prop:s0
-ro.serialno u:object_r:serialno_prop:s0
-ro.boot.btmacaddr u:object_r:bluetooth_prop:s0
-ro.boot.serialno u:object_r:serialno_prop:s0
-ro.bt. u:object_r:bluetooth_prop:s0
-# Boolean property set by system server upon boot indicating
-# if device owner is provisioned.
-ro.device_owner u:object_r:device_logging_prop:s0
-# selinux non-persistent properties
-selinux.restorecon_recursive u:object_r:restorecon_prop:s0
-# default property context
-* u:object_r:default_prop:s0
-# data partition encryption properties
-vold. u:object_r:vold_prop:s0
-ro.crypto. u:object_r:vold_prop:s0
-# ro.build.fingerprint is either set in /system/build.prop, or is
-# set at runtime by system_server.
-ro.build.fingerprint u:object_r:fingerprint_prop:s0
-ro.persistent_properties.ready u:object_r:persistent_properties_ready_prop:s0
-# ctl properties
-ctl.bootanim u:object_r:ctl_bootanim_prop:s0
-ctl.dumpstate u:object_r:ctl_dumpstate_prop:s0
-ctl.fuse_ u:object_r:ctl_fuse_prop:s0
-ctl.mdnsd u:object_r:ctl_mdnsd_prop:s0
-ctl.ril-daemon u:object_r:ctl_rildaemon_prop:s0
-ctl.bugreport u:object_r:ctl_bugreport_prop:s0
-ctl.console u:object_r:ctl_console_prop:s0
-ctl. u:object_r:ctl_default_prop:s0
-# NFC properties
-nfc. u:object_r:nfc_prop:s0
-# These properties are not normally set by processes other than init.
-# They are only distinguished here for setting by qemu-props on the
-# emulator/goldfish.
-config. u:object_r:config_prop:s0
-ro.config. u:object_r:config_prop:s0
-dalvik. u:object_r:dalvik_prop:s0
-ro.dalvik. u:object_r:dalvik_prop:s0
-# Shared between system server and wificond
-wlan. u:object_r:wifi_prop:s0
-# hwservicemanager properties
-hwservicemanager. u:object_r:hwservicemanager_prop:s0
-# ASAN install trigger
-asan.restore_reboot u:object_r:asan_reboot_prop:s0)";
-
-static char aosp_s_property_contexts[] = R"(
-net.rmnet u:object_r:net_radio_prop:s0
-net.gprs u:object_r:net_radio_prop:s0
-net.ppp u:object_r:net_radio_prop:s0
-net.qmi u:object_r:net_radio_prop:s0
-net.lte u:object_r:net_radio_prop:s0
-net.cdma u:object_r:net_radio_prop:s0
-net.dns u:object_r:net_dns_prop:s0
-ril. u:object_r:radio_prop:s0
-ro.ril. u:object_r:radio_prop:s0
-gsm. u:object_r:radio_prop:s0
-persist.radio u:object_r:radio_prop:s0
-
-net. u:object_r:system_prop:s0
-dev. u:object_r:system_prop:s0
-ro.runtime. u:object_r:system_prop:s0
-ro.runtime.firstboot u:object_r:firstboot_prop:s0
-hw. u:object_r:system_prop:s0
-ro.hw. u:object_r:system_prop:s0
-sys. u:object_r:system_prop:s0
-sys.audio. u:object_r:audio_prop:s0
-sys.init.perf_lsm_hooks u:object_r:init_perf_lsm_hooks_prop:s0
-sys.cppreopt u:object_r:cppreopt_prop:s0
-sys.lpdumpd u:object_r:lpdumpd_prop:s0
-sys.powerctl u:object_r:powerctl_prop:s0
-service. u:object_r:system_prop:s0
-dhcp. u:object_r:dhcp_prop:s0
-dhcp.bt-pan.result u:object_r:pan_result_prop:s0
-bluetooth. u:object_r:bluetooth_prop:s0
-
-debug. u:object_r:debug_prop:s0
-debug.db. u:object_r:debuggerd_prop:s0
-dumpstate. u:object_r:dumpstate_prop:s0
-dumpstate.options u:object_r:dumpstate_options_prop:s0
-init.svc_debug_pid. u:object_r:init_svc_debug_prop:s0
-llk. u:object_r:llkd_prop:s0
-khungtask. u:object_r:llkd_prop:s0
-ro.llk. u:object_r:llkd_prop:s0
-ro.khungtask. u:object_r:llkd_prop:s0
-log. u:object_r:log_prop:s0
-log.tag u:object_r:log_tag_prop:s0
-log.tag.WifiHAL u:object_r:wifi_log_prop:s0
-security.perf_harden u:object_r:shell_prop:s0
-service.adb.root u:object_r:shell_prop:s0
-service.adb.tls.port u:object_r:adbd_prop:s0
-persist.adb.wifi. u:object_r:adbd_prop:s0
-persist.adb.tls_server.enable u:object_r:system_adbd_prop:s0
-
-persist.audio. u:object_r:audio_prop:s0
-persist.bluetooth. u:object_r:bluetooth_prop:s0
-persist.nfc_cfg. u:object_r:nfc_prop:s0
-persist.debug. u:object_r:persist_debug_prop:s0
-logd. u:object_r:logd_prop:s0
-persist.logd. u:object_r:logd_prop:s0
-ro.logd. u:object_r:logd_prop:s0
-persist.logd.security u:object_r:device_logging_prop:s0
-persist.logd.logpersistd u:object_r:logpersistd_logging_prop:s0
-logd.logpersistd u:object_r:logpersistd_logging_prop:s0
-persist.log.tag u:object_r:log_tag_prop:s0
-persist.mmc. u:object_r:mmc_prop:s0
-persist.netd.stable_secret u:object_r:netd_stable_secret_prop:s0
-persist.pm.mock-upgrade u:object_r:mock_ota_prop:s0
-persist.sys. u:object_r:system_prop:s0
-persist.sys.safemode u:object_r:safemode_prop:s0
-persist.sys.theme u:object_r:theme_prop:s0
-persist.sys.fflag.override.settings_dynamic_system u:object_r:dynamic_system_prop:s0
-ro.sys.safemode u:object_r:safemode_prop:s0
-persist.sys.audit_safemode u:object_r:safemode_prop:s0
-persist.sys.dalvik.jvmtiagent u:object_r:system_jvmti_agent_prop:s0
-persist.service. u:object_r:system_prop:s0
-persist.service.bdroid. u:object_r:bluetooth_prop:s0
-persist.security. u:object_r:system_prop:s0
-persist.traced.enable u:object_r:traced_enabled_prop:s0
-traced.lazy. u:object_r:traced_lazy_prop:s0
-persist.heapprofd.enable u:object_r:heapprofd_enabled_prop:s0
-persist.traced_perf.enable u:object_r:traced_perf_enabled_prop:s0
-persist.vendor.overlay. u:object_r:overlay_prop:s0
-ro.boot.vendor.overlay. u:object_r:overlay_prop:s0
-ro.boottime. u:object_r:boottime_prop:s0
-ro.serialno u:object_r:serialno_prop:s0
-ro.boot.btmacaddr u:object_r:bluetooth_prop:s0
-ro.boot.serialno u:object_r:serialno_prop:s0
-ro.bt. u:object_r:bluetooth_prop:s0
-ro.boot.bootreason u:object_r:bootloader_boot_reason_prop:s0
-persist.sys.boot.reason u:object_r:last_boot_reason_prop:s0
-sys.boot.reason u:object_r:system_boot_reason_prop:s0
-sys.boot.reason.last u:object_r:last_boot_reason_prop:s0
-pm. u:object_r:pm_prop:s0
-test.sys.boot.reason u:object_r:test_boot_reason_prop:s0
-test.userspace_reboot.requested u:object_r:userspace_reboot_test_prop:s0
-sys.lmk. u:object_r:system_lmk_prop:s0
-sys.trace. u:object_r:system_trace_prop:s0
-
-# Fastbootd protocol control property
-fastbootd.protocol u:object_r:fastbootd_protocol_prop:s0 exact enum usb tcp
-
-# adbd protoctl configuration property
-service.adb.tcp.port u:object_r:adbd_config_prop:s0 exact int
-
-# Boolean property set by system server upon boot indicating
-# if device is fully owned by organization instead of being
-# a personal device.
-ro.organization_owned u:object_r:device_logging_prop:s0
-
-# selinux non-persistent properties
-selinux.restorecon_recursive u:object_r:restorecon_prop:s0
-
-# default property context
-* u:object_r:default_prop:s0
-
-# data partition encryption properties
-vold. u:object_r:vold_prop:s0
-ro.crypto. u:object_r:vold_prop:s0
-
-# ro.build.fingerprint is either set in /system/build.prop, or is
-# set at runtime by system_server.
-ro.build.fingerprint u:object_r:fingerprint_prop:s0 exact string
-
-ro.persistent_properties.ready u:object_r:persistent_properties_ready_prop:s0
-
-# ctl properties
-ctl.bootanim u:object_r:ctl_bootanim_prop:s0
-ctl.dumpstate u:object_r:ctl_dumpstate_prop:s0
-ctl.fuse_ u:object_r:ctl_fuse_prop:s0
-ctl.mdnsd u:object_r:ctl_mdnsd_prop:s0
-ctl.ril-daemon u:object_r:ctl_rildaemon_prop:s0
-ctl.bugreport u:object_r:ctl_bugreport_prop:s0
-ctl.console u:object_r:ctl_console_prop:s0
-ctl. u:object_r:ctl_default_prop:s0
-
-# Don't allow uncontrolled access to all services
-ctl.sigstop_on$ u:object_r:ctl_sigstop_prop:s0
-ctl.sigstop_off$ u:object_r:ctl_sigstop_prop:s0
-ctl.start$ u:object_r:ctl_start_prop:s0
-ctl.stop$ u:object_r:ctl_stop_prop:s0
-ctl.restart$ u:object_r:ctl_restart_prop:s0
-ctl.interface_start$ u:object_r:ctl_interface_start_prop:s0
-ctl.interface_stop$ u:object_r:ctl_interface_stop_prop:s0
-ctl.interface_restart$ u:object_r:ctl_interface_restart_prop:s0
-
- # Restrict access to starting/stopping adbd
-ctl.start$adbd u:object_r:ctl_adbd_prop:s0
-ctl.stop$adbd u:object_r:ctl_adbd_prop:s0
-ctl.restart$adbd u:object_r:ctl_adbd_prop:s0
-
-# Restrict access to starting/stopping gsid.
-ctl.start$gsid u:object_r:ctl_gsid_prop:s0
-ctl.stop$gsid u:object_r:ctl_gsid_prop:s0
-ctl.restart$gsid u:object_r:ctl_gsid_prop:s0
-
-# Restrict access to stopping apexd.
-ctl.stop$apexd u:object_r:ctl_apexd_prop:s0
-
-# Restrict access to restart dumpstate
-ctl.interface_restart$android.hardware.dumpstate u:object_r:ctl_dumpstate_prop:s0
-
-# NFC properties
-nfc. u:object_r:nfc_prop:s0
-
-# These properties are not normally set by processes other than init.
-# They are only distinguished here for setting by qemu-props on the
-# emulator/goldfish.
-config. u:object_r:config_prop:s0
-ro.config. u:object_r:config_prop:s0
-dalvik. u:object_r:dalvik_prop:s0
-ro.dalvik. u:object_r:dalvik_prop:s0
-
-# Shared between system server and wificond
-wifi. u:object_r:wifi_prop:s0
-wlan. u:object_r:wifi_prop:s0
-
-# Lowpan properties
-lowpan. u:object_r:lowpan_prop:s0
-ro.lowpan. u:object_r:lowpan_prop:s0
-
-# heapprofd properties
-heapprofd. u:object_r:heapprofd_prop:s0
-
-# hwservicemanager properties
-hwservicemanager. u:object_r:hwservicemanager_prop:s0
-
-# Common default properties for vendor, odm, vendor_dlkm, and odm_dlkm.
-init.svc.odm. u:object_r:vendor_default_prop:s0
-init.svc.vendor. u:object_r:vendor_default_prop:s0
-ro.hardware. u:object_r:vendor_default_prop:s0
-ro.odm. u:object_r:vendor_default_prop:s0
-ro.vendor. u:object_r:vendor_default_prop:s0
-ro.vendor_dlkm. u:object_r:vendor_default_prop:s0
-ro.odm_dlkm. u:object_r:vendor_default_prop:s0
-odm. u:object_r:vendor_default_prop:s0
-persist.odm. u:object_r:vendor_default_prop:s0
-persist.vendor. u:object_r:vendor_default_prop:s0
-vendor. u:object_r:vendor_default_prop:s0
-
-# Properties that relate to time / time zone detection behavior.
-persist.time. u:object_r:time_prop:s0
-
-# Properties that relate to server configurable flags
-device_config.reset_performed u:object_r:device_config_reset_performed_prop:s0
-persist.device_config.activity_manager_native_boot. u:object_r:device_config_activity_manager_native_boot_prop:s0
-persist.device_config.attempted_boot_count u:object_r:device_config_boot_count_prop:s0
-persist.device_config.input_native_boot. u:object_r:device_config_input_native_boot_prop:s0
-persist.device_config.netd_native. u:object_r:device_config_netd_native_prop:s0
-persist.device_config.runtime_native. u:object_r:device_config_runtime_native_prop:s0
-persist.device_config.runtime_native_boot. u:object_r:device_config_runtime_native_boot_prop:s0
-persist.device_config.media_native. u:object_r:device_config_media_native_prop:s0
-persist.device_config.storage_native_boot. u:object_r:device_config_storage_native_boot_prop:s0
-persist.device_config.window_manager_native_boot. u:object_r:device_config_window_manager_native_boot_prop:s0
-persist.device_config.configuration. u:object_r:device_config_configuration_prop:s0
-
-# Properties that relate to legacy server configurable flags
-persist.device_config.global_settings.sys_traced u:object_r:device_config_sys_traced_prop:s0
-
-apexd. u:object_r:apexd_prop:s0
-persist.apexd. u:object_r:apexd_prop:s0
-
-bpf.progs_loaded u:object_r:bpf_progs_loaded_prop:s0
-
-gsid. u:object_r:gsid_prop:s0
-ro.gsid. u:object_r:gsid_prop:s0
-
-# Property for disabling NNAPI vendor extensions on product image (used on GSI /product image,
-# which can't use NNAPI vendor extensions).
-ro.nnapi.extensions.deny_on_product u:object_r:nnapi_ext_deny_product_prop:s0
-
-# Property that is set once ueventd finishes cold boot.
-ro.cold_boot_done u:object_r:cold_boot_done_prop:s0
-
-# Charger properties
-ro.charger. u:object_r:charger_prop:s0
-sys.boot_from_charger_mode u:object_r:charger_status_prop:s0 exact int
-ro.enable_boot_charger_mode u:object_r:charger_config_prop:s0 exact bool
-
-# Virtual A/B properties
-ro.virtual_ab.enabled u:object_r:virtual_ab_prop:s0
-ro.virtual_ab.retrofit u:object_r:virtual_ab_prop:s0
-
-ro.product.ab_ota_partitions u:object_r:ota_prop:s0 exact string
-# Property to set/clear the warm reset flag after an OTA update.
-ota.warm_reset u:object_r:ota_prop:s0
-
-# Module properties
-com.android.sdkext. u:object_r:module_sdkextensions_prop:s0
-persist.com.android.sdkext. u:object_r:module_sdkextensions_prop:s0
-
-# Userspace reboot properties
-sys.userspace_reboot.log. u:object_r:userspace_reboot_log_prop:s0
-persist.sys.userspace_reboot.log. u:object_r:userspace_reboot_log_prop:s0
-
-# Integer property which is used in libgui to configure the number of frames
-# tracked by buffer queue's frame event timing history. The property is set
-# by devices with video decoding pipelines long enough to overflow the default
-# history size.
-ro.lib_gui.frame_event_history_size u:object_r:bq_config_prop:s0
-
-af.fast_track_multiplier u:object_r:audio_config_prop:s0 exact int
-ro.af.client_heap_size_kbyte u:object_r:audio_config_prop:s0 exact int
-
-audio.camerasound.force u:object_r:audio_config_prop:s0 exact bool
-audio.deep_buffer.media u:object_r:audio_config_prop:s0 exact bool
-audio.offload.video u:object_r:audio_config_prop:s0 exact bool
-audio.offload.min.duration.secs u:object_r:audio_config_prop:s0 exact int
-
-ro.audio.ignore_effects u:object_r:audio_config_prop:s0 exact bool
-ro.audio.monitorRotation u:object_r:audio_config_prop:s0 exact bool
-
-persist.config.calibration_fac u:object_r:camera_calibration_prop:s0 exact string
-
-config.disable_cameraservice u:object_r:camera_config_prop:s0 exact bool
-
-camera.disable_zsl_mode u:object_r:camera_config_prop:s0 exact bool
-camera.fifo.disable u:object_r:camera_config_prop:s0 exact bool
-ro.camera.notify_nfc u:object_r:camera_config_prop:s0 exact bool
-ro.camera.enableLazyHal u:object_r:camera_config_prop:s0 exact bool
-
-# Should always_debuggable be bool? It's checked against the string "1".
-dalvik.vm.always_debuggable u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.appimageformat u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.backgroundgctype u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.boot-dex2oat-cpu-set u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.boot-dex2oat-threads u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.boot-image u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.checkjni u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.dex2oat-Xms u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-Xmx u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-cpu-set u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-filter u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-flags u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-max-image-block-size u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.dex2oat-minidebuginfo u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.dex2oat-resolve-startup-strings u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.dex2oat-threads u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.dex2oat-updatable-bcp-packages-file u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.dex2oat-very-large u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.dex2oat-swap u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.dex2oat64.enabled u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.dexopt.secondary u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.execution-mode u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.extra-opts u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.foreground-heap-growth-multiplier u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.gctype u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heapgrowthlimit u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heapmaxfree u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heapminfree u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heapsize u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heapstartsize u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.heaptargetutilization u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.hot-startup-method-samples u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.image-dex2oat-Xms u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.image-dex2oat-Xmx u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.image-dex2oat-cpu-set u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.image-dex2oat-filter u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.image-dex2oat-flags u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.image-dex2oat-threads u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.isa.arm.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.arm.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.arm64.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.arm64.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.mips.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.mips.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.mips64.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.mips64.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.unknown.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.unknown.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.x86.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.x86.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.x86_64.features u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.isa.x86_64.variant u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.jitinitialsize u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.jitmaxsize u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.jitprithreadweight u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.jitthreshold u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.jittransitionweight u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.jniopts u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.lockprof.threshold u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.method-trace u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.method-trace-file u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.method-trace-file-siz u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.method-trace-stream u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.profilesystemserver u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.profilebootclasspath u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.restore-dex2oat-cpu-set u:object_r:dalvik_config_prop:s0 exact string
-dalvik.vm.restore-dex2oat-threads u:object_r:dalvik_config_prop:s0 exact int
-dalvik.vm.usejit u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.usejitprofiles u:object_r:dalvik_config_prop:s0 exact bool
-dalvik.vm.zygote.max-boot-retry u:object_r:dalvik_config_prop:s0 exact int
-ro.zygote u:object_r:dalvik_config_prop:s0 exact string
-
-persist.sys.dalvik.vm.lib.2 u:object_r:dalvik_runtime_prop:s0 exact string
-
-keyguard.no_require_sim u:object_r:keyguard_config_prop:s0 exact bool
-
-media.recorder.show_manufacturer_and_model u:object_r:media_config_prop:s0 exact bool
-media.stagefright.cache-params u:object_r:media_config_prop:s0 exact string
-media.stagefright.thumbnail.prefer_hw_codecs u:object_r:media_config_prop:s0 exact bool
-persist.sys.media.avsync u:object_r:media_config_prop:s0 exact bool
-
-persist.bluetooth.a2dp_offload.cap u:object_r:bluetooth_a2dp_offload_prop:s0 exact string
-persist.bluetooth.a2dp_offload.disabled u:object_r:bluetooth_a2dp_offload_prop:s0 exact bool
-persist.bluetooth.bluetooth_audio_hal.disabled u:object_r:bluetooth_audio_hal_prop:s0 exact bool
-persist.bluetooth.btsnoopenable u:object_r:exported_bluetooth_prop:s0 exact bool
-
-persist.radio.multisim.config u:object_r:radio_control_prop:s0 exact string
-
-persist.sys.hdmi.keep_awake u:object_r:hdmi_config_prop:s0 exact bool
-ro.hdmi.cec_device_types u:object_r:hdmi_config_prop:s0 exact string
-ro.hdmi.device_type u:object_r:hdmi_config_prop:s0 exact string
-ro.hdmi.wake_on_hotplug u:object_r:hdmi_config_prop:s0 exact bool
-ro.hdmi.cec.source.send_standby_on_sleep u:object_r:hdmi_config_prop:s0 exact enum to_tv broadcast none
-
-pm.dexopt.ab-ota u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.bg-dexopt u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.boot u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.disable_bg_dexopt u:object_r:exported_pm_prop:s0 exact bool
-pm.dexopt.downgrade_after_inactive_days u:object_r:exported_pm_prop:s0 exact int
-pm.dexopt.first-boot u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.inactive u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.install u:object_r:exported_pm_prop:s0 exact string
-pm.dexopt.shared u:object_r:exported_pm_prop:s0 exact string
-
-ro.apk_verity.mode u:object_r:apk_verity_prop:s0 exact int
-
-ro.bluetooth.a2dp_offload.supported u:object_r:bluetooth_a2dp_offload_prop:s0 exact bool
-
-ro.boot.vendor.overlay.theme u:object_r:exported_overlay_prop:s0 exact string
-
-ro.bt.bdaddr_path u:object_r:exported_bluetooth_prop:s0 exact string
-
-ro.config.alarm_alert u:object_r:systemsound_config_prop:s0 exact string
-ro.config.alarm_vol_default u:object_r:systemsound_config_prop:s0 exact int
-ro.config.alarm_vol_steps u:object_r:systemsound_config_prop:s0 exact int
-ro.config.media_vol_default u:object_r:systemsound_config_prop:s0 exact int
-ro.config.media_vol_steps u:object_r:systemsound_config_prop:s0 exact int
-ro.config.notification_sound u:object_r:systemsound_config_prop:s0 exact string
-ro.config.ringtone u:object_r:systemsound_config_prop:s0 exact string
-ro.config.system_vol_default u:object_r:systemsound_config_prop:s0 exact int
-ro.config.system_vol_steps u:object_r:systemsound_config_prop:s0 exact int
-ro.config.vc_call_vol_default u:object_r:systemsound_config_prop:s0 exact int
-
-ro.control_privapp_permissions u:object_r:packagemanager_config_prop:s0 exact enum disable enforce log
-ro.cp_system_other_odex u:object_r:packagemanager_config_prop:s0 exact bool
-
-ro.crypto.allow_encrypt_override u:object_r:vold_config_prop:s0 exact bool
-ro.crypto.dm_default_key.options_format.version u:object_r:vold_config_prop:s0 exact int
-ro.crypto.fde_algorithm u:object_r:vold_config_prop:s0 exact string
-ro.crypto.fde_sector_size u:object_r:vold_config_prop:s0 exact int
-ro.crypto.scrypt_params u:object_r:vold_config_prop:s0 exact string
-ro.crypto.set_dun u:object_r:vold_config_prop:s0 exact bool
-ro.crypto.volume.contents_mode u:object_r:vold_config_prop:s0 exact string
-ro.crypto.volume.filenames_mode u:object_r:vold_config_prop:s0 exact string
-ro.crypto.volume.metadata.encryption u:object_r:vold_config_prop:s0 exact string
-ro.crypto.volume.metadata.method u:object_r:vold_config_prop:s0 exact string
-ro.crypto.volume.options u:object_r:vold_config_prop:s0 exact string
-
-ro.dalvik.vm.native.bridge u:object_r:dalvik_config_prop:s0 exact string
-
-external_storage.projid.enabled u:object_r:storage_config_prop:s0 exact bool
-external_storage.casefold.enabled u:object_r:storage_config_prop:s0 exact bool
-external_storage.sdcardfs.enabled u:object_r:storage_config_prop:s0 exact bool
-
-ro.config.per_app_memcg u:object_r:lmkd_config_prop:s0 exact bool
-ro.lmk.critical u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.critical_upgrade u:object_r:lmkd_config_prop:s0 exact bool
-ro.lmk.debug u:object_r:lmkd_config_prop:s0 exact bool
-ro.lmk.downgrade_pressure u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.kill_heaviest_task u:object_r:lmkd_config_prop:s0 exact bool
-ro.lmk.kill_timeout_ms u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.low u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.medium u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.psi_partial_stall_ms u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.psi_complete_stall_ms u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.swap_free_low_percentage u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.swap_util_max u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.thrashing_limit u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.thrashing_limit_decay u:object_r:lmkd_config_prop:s0 exact int
-ro.lmk.use_minfree_levels u:object_r:lmkd_config_prop:s0 exact bool
-ro.lmk.upgrade_pressure u:object_r:lmkd_config_prop:s0 exact int
-lmkd.reinit u:object_r:lmkd_prop:s0 exact int
-
-ro.media.xml_variant.codecs u:object_r:media_variant_prop:s0 exact string
-ro.media.xml_variant.codecs_performance u:object_r:media_variant_prop:s0 exact string
-ro.media.xml_variant.profiles u:object_r:media_variant_prop:s0 exact string
-
-ro.minui.default_rotation u:object_r:recovery_config_prop:s0 exact string
-ro.minui.overscan_percent u:object_r:recovery_config_prop:s0 exact int
-ro.minui.pixel_format u:object_r:recovery_config_prop:s0 exact string
-
-ro.oem_unlock_supported u:object_r:oem_unlock_prop:s0 exact int
-
-ro.rebootescrow.device u:object_r:rebootescrow_hal_prop:s0 exact string
-
-ro.storage_manager.enabled u:object_r:storagemanager_config_prop:s0 exact bool
-
-ro.vehicle.hal u:object_r:vehicle_hal_prop:s0 exact string
-
-ro.vendor.build.security_patch u:object_r:vendor_security_patch_level_prop:s0 exact string
-
-ro.zram.mark_idle_delay_mins u:object_r:zram_config_prop:s0 exact int
-ro.zram.first_wb_delay_mins u:object_r:zram_config_prop:s0 exact int
-ro.zram.periodic_wb_delay_hours u:object_r:zram_config_prop:s0 exact int
-zram.force_writeback u:object_r:zram_config_prop:s0 exact bool
-persist.sys.zram_enabled u:object_r:zram_control_prop:s0 exact bool
-
-sendbug.preferred.domain u:object_r:sendbug_config_prop:s0 exact string
-
-persist.sys.usb.usbradio.config u:object_r:usb_control_prop:s0 exact string
-
-sys.usb.config u:object_r:usb_control_prop:s0 exact string
-sys.usb.configfs u:object_r:usb_control_prop:s0 exact int
-sys.usb.controller u:object_r:usb_control_prop:s0 exact string
-sys.usb.state u:object_r:usb_control_prop:s0 exact string
-
-sys.usb.mtp.device_type u:object_r:usb_config_prop:s0 exact int
-
-sys.usb.config. u:object_r:usb_prop:s0
-
-sys.usb.ffs.aio_compat u:object_r:ffs_config_prop:s0 exact bool
-sys.usb.ffs.max_read u:object_r:ffs_config_prop:s0 exact int
-sys.usb.ffs.max_write u:object_r:ffs_config_prop:s0 exact int
-
-sys.usb.ffs.ready u:object_r:ffs_control_prop:s0 exact bool
-sys.usb.ffs.mtp.ready u:object_r:ffs_control_prop:s0 exact bool
-
-tombstoned.max_tombstone_count u:object_r:tombstone_config_prop:s0 exact int
-
-vold.post_fs_data_done u:object_r:vold_config_prop:s0 exact int
-
-apexd.status u:object_r:apexd_prop:s0 exact enum starting activated ready
-
-dev.bootcomplete u:object_r:boot_status_prop:s0 exact bool
-sys.boot_completed u:object_r:boot_status_prop:s0 exact bool
-
-persist.sys.device_provisioned u:object_r:provisioned_prop:s0 exact string
-
-persist.sys.theme u:object_r:theme_prop:s0 exact string
-
-sys.retaildemo.enabled u:object_r:retaildemo_prop:s0 exact int
-
-sys.user.0.ce_available u:object_r:exported3_system_prop:s0 exact bool
-
-aac_drc_boost u:object_r:aac_drc_prop:s0 exact int
-aac_drc_cut u:object_r:aac_drc_prop:s0 exact int
-aac_drc_enc_target_level u:object_r:aac_drc_prop:s0 exact int
-aac_drc_heavy u:object_r:aac_drc_prop:s0 exact int
-aac_drc_reference_level u:object_r:aac_drc_prop:s0 exact int
-ro.aac_drc_effect_type u:object_r:aac_drc_prop:s0 exact int
-
-build.version.extensions. u:object_r:module_sdkextensions_prop:s0 prefix int
-
-drm.64bit.enabled u:object_r:mediadrm_config_prop:s0 exact bool
-media.mediadrmservice.enable u:object_r:mediadrm_config_prop:s0 exact bool
-
-drm.service.enabled u:object_r:drm_service_config_prop:s0 exact bool
-
-dumpstate.dry_run u:object_r:exported_dumpstate_prop:s0 exact bool
-dumpstate.unroot u:object_r:exported_dumpstate_prop:s0 exact bool
-persist.dumpstate.verbose_logging.enabled u:object_r:hal_dumpstate_config_prop:s0 exact bool
-
-hal.instrumentation.enable u:object_r:hal_instrumentation_prop:s0 exact bool
-
-# default contexts only accessible by coredomain
-init.svc. u:object_r:init_service_status_private_prop:s0 prefix string
-
-# vendor-init-readable init service props
-init.svc.bugreport u:object_r:init_service_status_prop:s0 exact string
-init.svc.bugreportd u:object_r:init_service_status_prop:s0 exact string
-init.svc.console u:object_r:init_service_status_prop:s0 exact string
-init.svc.dumpstatez u:object_r:init_service_status_prop:s0 exact string
-init.svc.mediadrm u:object_r:init_service_status_prop:s0 exact string
-init.svc.statsd u:object_r:init_service_status_prop:s0 exact string
-init.svc.surfaceflinger u:object_r:init_service_status_prop:s0 exact string
-init.svc.tombstoned u:object_r:init_service_status_prop:s0 exact string
-init.svc.zygote u:object_r:init_service_status_prop:s0 exact string
-
-libc.debug.malloc.options u:object_r:libc_debug_prop:s0 exact string
-libc.debug.malloc.program u:object_r:libc_debug_prop:s0 exact string
-libc.debug.hooks.enable u:object_r:libc_debug_prop:s0 exact string
-
-net.redirect_socket_calls.hooked u:object_r:socket_hook_prop:s0 exact bool
-
-persist.sys.locale u:object_r:exported_system_prop:s0 exact string
-persist.sys.timezone u:object_r:exported_system_prop:s0 exact string
-persist.sys.test_harness u:object_r:test_harness_prop:s0 exact bool
-
-ro.arch u:object_r:build_prop:s0 exact string
-
-# ro.boot. properties are set based on kernel commandline arguments, which are vendor owned.
-ro.boot. u:object_r:bootloader_prop:s0
-ro.boot.avb_version u:object_r:bootloader_prop:s0 exact string
-ro.boot.baseband u:object_r:bootloader_prop:s0 exact string
-ro.boot.bootdevice u:object_r:bootloader_prop:s0 exact string
-ro.boot.bootloader u:object_r:bootloader_prop:s0 exact string
-ro.boot.boottime u:object_r:bootloader_prop:s0 exact string
-ro.boot.console u:object_r:bootloader_prop:s0 exact string
-ro.boot.hardware u:object_r:bootloader_prop:s0 exact string
-ro.boot.hardware.color u:object_r:bootloader_prop:s0 exact string
-ro.boot.hardware.sku u:object_r:bootloader_prop:s0 exact string
-ro.boot.keymaster u:object_r:bootloader_prop:s0 exact string
-ro.boot.mode u:object_r:bootloader_prop:s0 exact string
-ro.boot.revision u:object_r:bootloader_prop:s0 exact string
-ro.boot.vbmeta.avb_version u:object_r:bootloader_prop:s0 exact string
-ro.boot.verifiedbootstate u:object_r:bootloader_prop:s0 exact string
-ro.boot.veritymode u:object_r:bootloader_prop:s0 exact string
-
-# These ro.X properties are set to values of ro.boot.X by property_service.
-ro.baseband u:object_r:bootloader_prop:s0 exact string
-ro.bootloader u:object_r:bootloader_prop:s0 exact string
-ro.bootmode u:object_r:bootloader_prop:s0 exact string
-ro.hardware u:object_r:bootloader_prop:s0 exact string
-ro.revision u:object_r:bootloader_prop:s0 exact string
-
-ro.boot.dynamic_partitions u:object_r:exported_default_prop:s0 exact string
-ro.boot.dynamic_partitions_retrofit u:object_r:exported_default_prop:s0 exact string
-
-ro.build.date u:object_r:build_prop:s0 exact string
-ro.build.date.utc u:object_r:build_prop:s0 exact int
-ro.build.description u:object_r:build_prop:s0 exact string
-ro.build.display.id u:object_r:build_prop:s0 exact string
-ro.build.host u:object_r:build_prop:s0 exact string
-ro.build.id u:object_r:build_prop:s0 exact string
-ro.build.product u:object_r:build_prop:s0 exact string
-ro.build.system_root_image u:object_r:build_prop:s0 exact bool
-ro.build.tags u:object_r:build_prop:s0 exact string
-ro.build.type u:object_r:build_prop:s0 exact string
-ro.build.user u:object_r:build_prop:s0 exact string
-ro.build.version.base_os u:object_r:build_prop:s0 exact string
-ro.build.version.codename u:object_r:build_prop:s0 exact string
-ro.build.version.incremental u:object_r:build_prop:s0 exact string
-ro.build.version.preview_sdk u:object_r:build_prop:s0 exact int
-ro.build.version.release u:object_r:build_prop:s0 exact string
-ro.build.version.release_or_codename u:object_r:build_prop:s0 exact string
-ro.build.version.sdk u:object_r:build_prop:s0 exact int
-ro.build.version.security_patch u:object_r:build_prop:s0 exact string
-
-ro.debuggable u:object_r:build_prop:s0 exact bool
-
-ro.product.cpu.abi u:object_r:build_prop:s0 exact string
-ro.product.cpu.abilist u:object_r:build_prop:s0 exact string
-ro.product.cpu.abilist32 u:object_r:build_prop:s0 exact string
-ro.product.cpu.abilist64 u:object_r:build_prop:s0 exact string
-
-ro.adb.secure u:object_r:build_prop:s0 exact bool
-ro.secure u:object_r:build_prop:s0 exact int
-
-# These 5 properties are set by property_service
-ro.product.brand u:object_r:build_prop:s0 exact string
-ro.product.device u:object_r:build_prop:s0 exact string
-ro.product.manufacturer u:object_r:build_prop:s0 exact string
-ro.product.model u:object_r:build_prop:s0 exact string
-ro.product.name u:object_r:build_prop:s0 exact string
-
-# Sanitizer properties
-ro.sanitize.address u:object_r:build_prop:s0 exact bool
-ro.sanitize.cfi u:object_r:build_prop:s0 exact bool
-ro.sanitize.default-ub u:object_r:build_prop:s0 exact bool
-ro.sanitize.fuzzer u:object_r:build_prop:s0 exact bool
-ro.sanitize.hwaddress u:object_r:build_prop:s0 exact bool
-ro.sanitize.integer_overflow u:object_r:build_prop:s0 exact bool
-ro.sanitize.safe-stack u:object_r:build_prop:s0 exact bool
-ro.sanitize.scudo u:object_r:build_prop:s0 exact bool
-ro.sanitize.thread u:object_r:build_prop:s0 exact bool
-ro.sanitize.undefined u:object_r:build_prop:s0 exact bool
-
-# All odm build props are set by /odm/build.prop
-ro.odm.build.date u:object_r:build_odm_prop:s0 exact string
-ro.odm.build.date.utc u:object_r:build_odm_prop:s0 exact int
-ro.odm.build.fingerprint u:object_r:build_odm_prop:s0 exact string
-ro.odm.build.version.incremental u:object_r:build_odm_prop:s0 exact string
-
-ro.product.odm.brand u:object_r:build_odm_prop:s0 exact string
-ro.product.odm.device u:object_r:build_odm_prop:s0 exact string
-ro.product.odm.manufacturer u:object_r:build_odm_prop:s0 exact string
-ro.product.odm.model u:object_r:build_odm_prop:s0 exact string
-ro.product.odm.name u:object_r:build_odm_prop:s0 exact string
-
-# All vendor_dlkm build props are set by /vendor_dlkm/etc/build.prop
-ro.vendor_dlkm.build.date u:object_r:build_vendor_prop:s0 exact string
-ro.vendor_dlkm.build.date.utc u:object_r:build_vendor_prop:s0 exact int
-ro.vendor_dlkm.build.fingerprint u:object_r:build_vendor_prop:s0 exact string
-ro.vendor_dlkm.build.version.incremental u:object_r:build_vendor_prop:s0 exact string
-
-# All odm_dlkm build props are set by /odm_dlkm/etc/build.prop
-ro.odm_dlkm.build.date u:object_r:build_vendor_prop:s0 exact string
-ro.odm_dlkm.build.date.utc u:object_r:build_vendor_prop:s0 exact int
-ro.odm_dlkm.build.fingerprint u:object_r:build_vendor_prop:s0 exact string
-ro.odm_dlkm.build.version.incremental u:object_r:build_vendor_prop:s0 exact string
-
-# All vendor build props are set by /vendor/build.prop
-ro.vendor.build.date u:object_r:build_vendor_prop:s0 exact string
-ro.vendor.build.date.utc u:object_r:build_vendor_prop:s0 exact int
-ro.vendor.build.fingerprint u:object_r:build_vendor_prop:s0 exact string
-ro.vendor.build.version.incremental u:object_r:build_vendor_prop:s0 exact string
-ro.vendor.build.version.sdk u:object_r:build_vendor_prop:s0 exact int
-
-ro.product.board u:object_r:build_vendor_prop:s0 exact string
-ro.product.first_api_level u:object_r:build_vendor_prop:s0 exact int
-ro.product.vendor.brand u:object_r:build_vendor_prop:s0 exact string
-ro.product.vendor.device u:object_r:build_vendor_prop:s0 exact string
-ro.product.vendor.manufacturer u:object_r:build_vendor_prop:s0 exact string
-ro.product.vendor.model u:object_r:build_vendor_prop:s0 exact string
-ro.product.vendor.name u:object_r:build_vendor_prop:s0 exact string
-
-ro.crypto.state u:object_r:vold_status_prop:s0 exact enum encrypted unencrypted unsupported
-ro.crypto.type u:object_r:vold_status_prop:s0 exact enum block file none
-
-ro.property_service.version u:object_r:property_service_version_prop:s0 exact int
-
-ro.vendor.redirect_socket_calls u:object_r:vendor_socket_hook_prop:s0 exact bool
-
-service.bootanim.exit u:object_r:exported_system_prop:s0 exact int
-
-sys.init.userspace_reboot.in_progress u:object_r:userspace_reboot_exported_prop:s0 exact bool
-sys.use_memfd u:object_r:use_memfd_prop:s0 exact bool
-
-vold.decrypt u:object_r:vold_status_prop:s0 exact string
-
-aaudio.hw_burst_min_usec u:object_r:aaudio_config_prop:s0 exact int
-aaudio.minimum_sleep_usec u:object_r:aaudio_config_prop:s0 exact int
-aaudio.mixer_bursts u:object_r:aaudio_config_prop:s0 exact int
-aaudio.mmap_exclusive_policy u:object_r:aaudio_config_prop:s0 exact int
-aaudio.mmap_policy u:object_r:aaudio_config_prop:s0 exact int
-aaudio.wakeup_delay_usec u:object_r:aaudio_config_prop:s0 exact int
-
-persist.rcs.supported u:object_r:exported_default_prop:s0 exact int
-
-ro.bionic.2nd_arch u:object_r:cpu_variant_prop:s0 exact string
-ro.bionic.2nd_cpu_variant u:object_r:cpu_variant_prop:s0 exact string
-ro.bionic.arch u:object_r:cpu_variant_prop:s0 exact string
-ro.bionic.cpu_variant u:object_r:cpu_variant_prop:s0 exact string
-
-ro.board.platform u:object_r:exported_default_prop:s0 exact string
-
-ro.boot.fake_battery u:object_r:exported_default_prop:s0 exact int
-ro.boot.fstab_suffix u:object_r:exported_default_prop:s0 exact string
-ro.boot.hardware.revision u:object_r:exported_default_prop:s0 exact string
-ro.boot.product.hardware.sku u:object_r:exported_default_prop:s0 exact string
-ro.boot.product.vendor.sku u:object_r:exported_default_prop:s0 exact string
-ro.boot.slot_suffix u:object_r:exported_default_prop:s0 exact string
-
-ro.boringcrypto.hwrand u:object_r:exported_default_prop:s0 exact bool
-
-ro.build.ab_update u:object_r:exported_default_prop:s0 exact string
-ro.build.expect.baseband u:object_r:exported_default_prop:s0 exact string
-ro.build.expect.bootloader u:object_r:exported_default_prop:s0 exact string
-
-ro.carrier u:object_r:exported_default_prop:s0 exact string
-
-ro.config.low_ram u:object_r:exported_config_prop:s0 exact bool
-ro.config.vc_call_vol_steps u:object_r:exported_config_prop:s0 exact int
-
-ro.frp.pst u:object_r:exported_default_prop:s0 exact string
-
-ro.hardware.activity_recognition u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio.a2dp u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio.hearing_aid u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio.primary u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio.usb u:object_r:exported_default_prop:s0 exact string
-ro.hardware.audio_policy u:object_r:exported_default_prop:s0 exact string
-ro.hardware.bootctrl u:object_r:exported_default_prop:s0 exact string
-ro.hardware.camera u:object_r:exported_default_prop:s0 exact string
-ro.hardware.consumerir u:object_r:exported_default_prop:s0 exact string
-ro.hardware.context_hub u:object_r:exported_default_prop:s0 exact string
-ro.hardware.egl u:object_r:exported_default_prop:s0 exact string
-ro.hardware.fingerprint u:object_r:exported_default_prop:s0 exact string
-ro.hardware.flp u:object_r:exported_default_prop:s0 exact string
-ro.hardware.gatekeeper u:object_r:exported_default_prop:s0 exact string
-ro.hardware.gps u:object_r:exported_default_prop:s0 exact string
-ro.hardware.gralloc u:object_r:exported_default_prop:s0 exact string
-ro.hardware.hdmi_cec u:object_r:exported_default_prop:s0 exact string
-ro.hardware.hwcomposer u:object_r:exported_default_prop:s0 exact string
-ro.hardware.input u:object_r:exported_default_prop:s0 exact string
-ro.hardware.keystore u:object_r:exported_default_prop:s0 exact string
-ro.hardware.keystore_desede u:object_r:exported_default_prop:s0 exact string
-ro.hardware.lights u:object_r:exported_default_prop:s0 exact string
-ro.hardware.local_time u:object_r:exported_default_prop:s0 exact string
-ro.hardware.memtrack u:object_r:exported_default_prop:s0 exact string
-ro.hardware.nfc u:object_r:exported_default_prop:s0 exact string
-ro.hardware.nfc_nci u:object_r:exported_default_prop:s0 exact string
-ro.hardware.nfc_tag u:object_r:exported_default_prop:s0 exact string
-ro.hardware.nvram u:object_r:exported_default_prop:s0 exact string
-ro.hardware.power u:object_r:exported_default_prop:s0 exact string
-ro.hardware.radio u:object_r:exported_default_prop:s0 exact string
-ro.hardware.sensors u:object_r:exported_default_prop:s0 exact string
-ro.hardware.sound_trigger u:object_r:exported_default_prop:s0 exact string
-ro.hardware.thermal u:object_r:exported_default_prop:s0 exact string
-ro.hardware.tv_input u:object_r:exported_default_prop:s0 exact string
-ro.hardware.type u:object_r:exported_default_prop:s0 exact string
-ro.hardware.vehicle u:object_r:exported_default_prop:s0 exact string
-ro.hardware.vibrator u:object_r:exported_default_prop:s0 exact string
-ro.hardware.virtual_device u:object_r:exported_default_prop:s0 exact string
-ro.hardware.vulkan u:object_r:exported_default_prop:s0 exact string
-
-ro.hwui.use_vulkan u:object_r:exported_default_prop:s0 exact bool
-
-ro.kernel.qemu u:object_r:exported_default_prop:s0 exact bool
-ro.kernel.qemu. u:object_r:exported_default_prop:s0
-ro.kernel.android.bootanim u:object_r:exported_default_prop:s0 exact int
-
-ro.oem.key1 u:object_r:exported_default_prop:s0 exact string
-
-ro.product.vndk.version u:object_r:vndk_prop:s0 exact string
-
-ro.vndk.lite u:object_r:vndk_prop:s0 exact bool
-ro.vndk.version u:object_r:vndk_prop:s0 exact string
-
-ro.vts.coverage u:object_r:vts_config_prop:s0 exact int
-
-vts.native_server.on u:object_r:vts_status_prop:s0 exact bool
-
-wifi.active.interface u:object_r:wifi_hal_prop:s0 exact string
-wifi.aware.interface u:object_r:wifi_hal_prop:s0 exact string
-wifi.concurrent.interface u:object_r:wifi_hal_prop:s0 exact string
-wifi.direct.interface u:object_r:wifi_hal_prop:s0 exact string
-wifi.interface u:object_r:wifi_hal_prop:s0 exact string
-wlan.driver.status u:object_r:wifi_hal_prop:s0 exact enum ok unloaded
-
-ro.boot.wificountrycode u:object_r:wifi_config_prop:s0 exact string
-
-ro.apex.updatable u:object_r:exported_default_prop:s0 exact bool
-
-# Property to enable incremental feature
-ro.incremental.enable u:object_r:incremental_prop:s0
-
-# Properties to configure userspace reboot.
-init.userspace_reboot.is_supported u:object_r:userspace_reboot_config_prop:s0 exact bool
-init.userspace_reboot.sigkill.timeoutmillis u:object_r:userspace_reboot_config_prop:s0 exact int
-init.userspace_reboot.sigterm.timeoutmillis u:object_r:userspace_reboot_config_prop:s0 exact int
-init.userspace_reboot.started.timeoutmillis u:object_r:userspace_reboot_config_prop:s0 exact int
-init.userspace_reboot.userdata_remount.timeoutmillis u:object_r:userspace_reboot_config_prop:s0 exact int
-init.userspace_reboot.watchdog.timeoutmillis u:object_r:userspace_reboot_config_prop:s0 exact int
-
-sys.shutdown.requested u:object_r:exported_system_prop:s0 exact string
-
-# surfaceflinger properties
-ro.surface_flinger.default_composition_dataspace u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.default_composition_pixel_format u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.force_hwc_copy_for_virtual_displays u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.has_HDR_display u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.has_wide_color_display u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.max_frame_buffer_acquired_buffers u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.max_graphics_height u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.max_graphics_width u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.max_virtual_display_dimension u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.primary_display_orientation u:object_r:surfaceflinger_prop:s0 exact enum ORIENTATION_0 ORIENTATION_180 ORIENTATION_270 ORIENTATION_90
-ro.surface_flinger.present_time_offset_from_vsync_ns u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.running_without_sync_framework u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.start_graphics_allocator_service u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.use_color_management u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.use_context_priority u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.use_vr_flinger u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.vsync_event_phase_offset_ns u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.vsync_sf_event_phase_offset_ns u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.wcg_composition_dataspace u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.wcg_composition_pixel_format u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.display_primary_red u:object_r:surfaceflinger_prop:s0 exact string
-ro.surface_flinger.display_primary_green u:object_r:surfaceflinger_prop:s0 exact string
-ro.surface_flinger.display_primary_blue u:object_r:surfaceflinger_prop:s0 exact string
-ro.surface_flinger.display_primary_white u:object_r:surfaceflinger_prop:s0 exact string
-ro.surface_flinger.protected_contents u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.set_idle_timer_ms u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.set_touch_timer_ms u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.set_display_power_timer_ms u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.support_kernel_idle_timer u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.use_smart_90_for_video u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.use_content_detection_for_refresh_rate u:object_r:surfaceflinger_prop:s0 exact bool
-ro.surface_flinger.color_space_agnostic_dataspace u:object_r:surfaceflinger_prop:s0 exact int
-ro.surface_flinger.refresh_rate_switching u:object_r:surfaceflinger_prop:s0 exact bool
-
-ro.sf.disable_triple_buffer u:object_r:surfaceflinger_prop:s0 exact bool
-ro.sf.lcd_density u:object_r:surfaceflinger_prop:s0 exact int
-
-persist.sys.sf.color_mode u:object_r:surfaceflinger_color_prop:s0 exact int
-persist.sys.sf.color_saturation u:object_r:surfaceflinger_color_prop:s0 exact string
-persist.sys.sf.native_mode u:object_r:surfaceflinger_color_prop:s0 exact int
-
-# Binder cache properties. These are world-readable
-cache_key.app_inactive u:object_r:binder_cache_system_server_prop:s0
-cache_key.is_compat_change_enabled u:object_r:binder_cache_system_server_prop:s0
-cache_key.get_packages_for_uid u:object_r:binder_cache_system_server_prop:s0
-cache_key.has_system_feature u:object_r:binder_cache_system_server_prop:s0
-cache_key.is_interactive u:object_r:binder_cache_system_server_prop:s0
-cache_key.is_power_save_mode u:object_r:binder_cache_system_server_prop:s0
-cache_key.is_user_unlocked u:object_r:binder_cache_system_server_prop:s0
-cache_key.volume_list u:object_r:binder_cache_system_server_prop:s0
-cache_key.display_info u:object_r:binder_cache_system_server_prop:s0
-cache_key.location_enabled u:object_r:binder_cache_system_server_prop:s0
-cache_key.package_info u:object_r:binder_cache_system_server_prop:s0
-
-cache_key.bluetooth. u:object_r:binder_cache_bluetooth_server_prop:s0 prefix string
-cache_key.system_server. u:object_r:binder_cache_system_server_prop:s0 prefix string
-cache_key.telephony. u:object_r:binder_cache_telephony_server_prop:s0 prefix string
-
-gsm.sim.operator.numeric u:object_r:telephony_status_prop:s0 exact string
-persist.radio.airplane_mode_on u:object_r:telephony_status_prop:s0 exact bool
-
-ro.com.android.dataroaming u:object_r:telephony_config_prop:s0 exact bool
-ro.com.android.prov_mobiledata u:object_r:telephony_config_prop:s0 exact bool
-ro.radio.noril u:object_r:telephony_config_prop:s0 exact string
-ro.telephony.call_ring.multiple u:object_r:telephony_config_prop:s0 exact bool
-ro.telephony.default_cdma_sub u:object_r:telephony_config_prop:s0 exact int
-ro.telephony.default_network u:object_r:telephony_config_prop:s0 exact string
-ro.telephony.iwlan_operation_mode u:object_r:telephony_config_prop:s0 exact enum default legacy AP-assisted
-telephony.active_modems.max_count u:object_r:telephony_config_prop:s0 exact int
-telephony.lteOnCdmaDevice u:object_r:telephony_config_prop:s0 exact int
-persist.dbg.volte_avail_ovr u:object_r:telephony_config_prop:s0 exact int
-persist.dbg.vt_avail_ovr u:object_r:telephony_config_prop:s0 exact int
-persist.dbg.wfc_avail_ovr u:object_r:telephony_config_prop:s0 exact int
-
-# System locale list filter configuration
-ro.localization.locale_filter u:object_r:localization_prop:s0 exact string
-
-# Graphics related properties
-ro.opengles.version u:object_r:graphics_config_prop:s0 exact int
-
-ro.gfx.driver.0 u:object_r:graphics_config_prop:s0 exact string
-ro.gfx.driver.1 u:object_r:graphics_config_prop:s0 exact string
-ro.gfx.angle.supported u:object_r:graphics_config_prop:s0 exact bool
-
-graphics.gpu.profiler.support u:object_r:graphics_config_prop:s0 exact bool
-graphics.gpu.profiler.vulkan_layer_apk u:object_r:graphics_config_prop:s0 exact string
- )";
diff --git a/libc/system_properties/contexts_split.cpp b/libc/system_properties/contexts_split.cpp
index f71d70aa7..11db7ec68 100644
--- a/libc/system_properties/contexts_split.cpp
+++ b/libc/system_properties/contexts_split.cpp
@@ -114,6 +114,8 @@ static void ListFree(List** list) {
}
// The below two functions are duplicated from label_support.c in libselinux.
+// TODO: Find a location suitable for these functions such that both libc and
+// libselinux can share a common source file.
// The read_spec_entries and read_spec_entry functions may be used to
// replace sscanf to read entries from spec files. The file and
@@ -269,7 +271,7 @@ bool ContextsSplit::InitializeProperties() {
if (!InitializePropertiesFromFile("/system/etc/selinux/plat_property_contexts")) {
return false;
}
- // Don't check for failure here, since we don't always have all of these partitions.
+ // Don't check for failure here, so we always have a sane list of properties.
// E.g. In case of recovery, the vendor partition will not have mounted and we
// still need the system / platform properties to function.
if (access("/vendor/etc/selinux/vendor_property_contexts", R_OK) != -1) {
@@ -324,16 +326,10 @@ bool ContextsSplit::Initialize(bool writable, const char* filename, bool* fsetxa
return true;
}
-PrefixNode* ContextsSplit::GetPrefixNodeForName(const char* name) {
+prop_area* ContextsSplit::GetPropAreaForName(const char* name) {
auto entry = ListFind(prefixes_, [name](PrefixNode* l) {
return l->prefix[0] == '*' || !strncmp(l->prefix, name, l->prefix_len);
});
-
- return entry;
-}
-
-prop_area* ContextsSplit::GetPropAreaForName(const char* name) {
- auto entry = GetPrefixNodeForName(name);
if (!entry) {
return nullptr;
}
diff --git a/libc/system_properties/include/system_properties/contexts_split.h b/libc/system_properties/include/system_properties/contexts_split.h
index 1d954ccac..acb18e3de 100644
--- a/libc/system_properties/include/system_properties/contexts_split.h
+++ b/libc/system_properties/include/system_properties/contexts_split.h
@@ -47,9 +47,7 @@ class ContextsSplit : public Contexts {
virtual void ResetAccess() override;
virtual void FreeAndUnmap() override;
- PrefixNode* GetPrefixNodeForName(const char* name);
-
- protected:
+ private:
bool MapSerialPropertyArea(bool access_rw, bool* fsetxattr_failed);
bool InitializePropertiesFromFile(const char* filename);
bool InitializeProperties();
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
index 1cb15c3df..840477858 100644
--- a/libc/system_properties/system_properties.cpp
+++ b/libc/system_properties/system_properties.cpp
@@ -129,7 +129,7 @@ const prop_info* SystemProperties::Find(const char* name) {
prop_area* pa = contexts_->GetPropAreaForName(name);
if (!pa) {
- async_safe_format_log(ANDROID_LOG_WARN, "libc", "Access denied finding property \"%s\"", name);
+ async_safe_format_log(ANDROID_LOG_ERROR, "libc", "Access denied finding property \"%s\"", name);
return nullptr;
}
diff --git a/libc/tools/Android.bp b/libc/tools/Android.bp
index 116b853d5..13179a0b8 100644
--- a/libc/tools/Android.bp
+++ b/libc/tools/Android.bp
@@ -1,44 +1,4 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "bionic_libc_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- // legacy_unencumbered
- default_applicable_licenses: ["bionic_libc_license"],
-}
-
filegroup {
name: "bionic-gensyscalls",
- srcs: ["gensyscalls.py"],
-}
-
-// Generate the C++ policy sources for app and system seccomp-bpf filters.
-python_binary_host {
- name: "genseccomp",
- main: "genseccomp.py",
-
- srcs: [
- "genseccomp.py",
- "gensyscalls.py",
- ],
-
- data: [
- ":all_kernel_uapi_headers",
- ],
-}
-
-python_binary_host {
- name: "genfunctosyscallnrs",
- main: "genfunctosyscallnrs.py",
-
- srcs: [
- "genseccomp.py",
- "genfunctosyscallnrs.py",
- "gensyscalls.py",
- ],
-
- data: [
- ":all_kernel_uapi_headers",
- ],
+ srcs: ["gensyscalls.py"]
}
diff --git a/libc/tools/check-symbols-glibc.py b/libc/tools/check-symbols-glibc.py
index 613aa88ee..4de018101 100755
--- a/libc/tools/check-symbols-glibc.py
+++ b/libc/tools/check-symbols-glibc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python2
#
# Copyright (C) 2015 The Android Open Source Project
#
@@ -182,9 +182,9 @@ known = set([
'_ctype_',
'__libc_init',
])
-# POSIX has some stuff that's unusable in the modern world (a64l) or not
-# actually implemented in glibc unless you count always failing with ENOSYS
-# as being implemented (fattach). Other stuff (fmtmsg) isn't used in any
+# POSIX has some stuff that's too stupid for words (a64l) or not actually
+# implemented in glibc unless you count always failing with ENOSYS as
+# being implemented (fattach). Other stuff (fmtmsg) isn't used in any
# codebase I have access to, internal or external.
in_posix_and_glibc_but_dead_or_useless = set([
'a64l', # obsolete
@@ -231,33 +231,33 @@ posix = posix - in_posix_and_glibc_but_dead_or_useless
glibc = glibc - in_posix_and_glibc_but_dead_or_useless
if not only_unwanted:
- #print('glibc:')
+ #print 'glibc:'
#for symbol in sorted(glibc):
- # print(symbol)
- #print()
+ # print symbol
+ #print
- #print('bionic:')
+ #print 'bionic:'
#for symbol in sorted(bionic):
- # print(symbol)
- #print()
+ # print symbol
+ #print
- print('in glibc (but not posix) but not bionic:')
+ print 'in glibc (but not posix) but not bionic:'
for symbol in sorted((glibc - posix).difference(bionic)):
- print(symbol)
- print()
+ print symbol
+ print
- print('in posix (and implemented in glibc) but not bionic:')
+ print 'in posix (and implemented in glibc) but not bionic:'
for symbol in sorted((posix.intersection(glibc)).difference(bionic)):
- print(symbol)
- print()
+ print symbol
+ print
- print('in bionic but not glibc:')
+ print 'in bionic but not glibc:'
allowed_stuff = (bsd_stuff | FORTIFY_stuff | linux_stuff | macro_stuff |
std_stuff | weird_stuff | libresolv_stuff | known)
for symbol in sorted((bionic - allowed_stuff).difference(glibc)):
if symbol in ndk_ignored:
symbol += '*'
- print(symbol)
+ print symbol
sys.exit(0)
diff --git a/libc/tools/check-symbols.py b/libc/tools/check-symbols.py
new file mode 100755
index 000000000..656891790
--- /dev/null
+++ b/libc/tools/check-symbols.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+
+import glob
+import os
+import re
+import string
+import subprocess
+import sys
+
+toolchain = os.environ['ANDROID_TOOLCHAIN']
+arch = re.sub(r'.*/linux-x86/([^/]+)/.*', r'\1', toolchain)
+
+sys.stderr.write('Checking symbols for arch "%s"...\n' % arch)
+
+def GetSymbols(library, functions_or_variables):
+ global api
+ global arch
+
+ api = '9'
+ if library == 'libm' and arch == 'arm':
+ api = '3'
+
+ # There were no 64-bit ABIs before API level 21.
+ if '64' in arch:
+ api = '21'
+
+ # What GCC calls aarch64, Android calls arm64.
+ if arch == 'aarch64':
+ arch = 'arm64'
+
+ path = '%s/development/ndk/platforms/android-%s/arch-%s/symbols/%s.so.%s.txt' % (os.environ['ANDROID_BUILD_TOP'], api, arch, library, functions_or_variables)
+ symbols = set()
+ for line in open(path, 'r'):
+ symbols.add(line.rstrip())
+ #sys.stdout.write('%d %s in %s for %s\n' % (len(symbols), functions_or_variables, library, arch))
+ return symbols
+
+def CheckSymbols(library, functions_or_variables):
+ expected_symbols = GetSymbols(library, functions_or_variables)
+
+ lib_dir = 'lib'
+ if '64' in arch:
+ lib_dir = 'lib64'
+
+ so_file = '%s/system/%s/%s.so' % (os.environ['ANDROID_PRODUCT_OUT'], lib_dir, library)
+
+ # Example readelf output:
+ # 264: 0001623c 4 FUNC GLOBAL DEFAULT 8 cabsf
+ # 266: 00016244 4 FUNC GLOBAL DEFAULT 8 dremf
+ # 267: 00019018 4 OBJECT GLOBAL DEFAULT 11 __fe_dfl_env
+ # 268: 00000000 0 FUNC GLOBAL DEFAULT UND __aeabi_dcmplt
+
+
+ r = re.compile(r' +\d+: [0-9a-f]+ +\d+ (FUNC|OBJECT) +\S+ +\S+ +\d+ (\S+)')
+
+ actual_symbols = set()
+ for line in subprocess.check_output(['readelf', '-W', '--dyn-syms', so_file]).split('\n'):
+ m = r.match(line)
+ if m:
+ symbol = string.split(m.group(2), '@')[0]
+ if m.group(1) == 'FUNC' and functions_or_variables == 'functions':
+ actual_symbols.add(symbol)
+ elif m.group(1) == 'OBJECT' and functions_or_variables == 'variables':
+ actual_symbols.add(symbol)
+ #else:
+ #print 'ignoring: ' % line
+
+ missing = expected_symbols - actual_symbols
+ if len(missing) > 0:
+ sys.stderr.write('%d missing %s in %s for %s:\n' % (len(missing), functions_or_variables, library, arch))
+ for miss in sorted(missing):
+ sys.stderr.write(' %s\n' % miss)
+
+ extra = actual_symbols - expected_symbols
+ if len(extra) > 0:
+ sys.stderr.write('%d extra %s in %s for %s:\n' % (len(extra), functions_or_variables, library, arch))
+ for s in sorted(extra):
+ sys.stderr.write(' %s\n' % s)
+
+ return len(missing) == 0
+
+CheckSymbols("libc", "functions")
+CheckSymbols("libc", "variables")
+CheckSymbols("libm", "functions")
+CheckSymbols("libm", "variables")
+
+sys.exit(0)
diff --git a/libc/tools/generate_notice.py b/libc/tools/generate-NOTICE.py
index e004d74e9..72184454c 100755
--- a/libc/tools/generate_notice.py
+++ b/libc/tools/generate-NOTICE.py
@@ -1,49 +1,43 @@
-#!/usr/bin/env python3
-# Run with directory arguments from any directory, with no special setup
-# required.
+#!/usr/bin/env python
+# Run with directory arguments from any directory, with no special setup required.
+import ftplib
+import hashlib
import os
-from pathlib import Path
import re
+import shutil
+import string
+import subprocess
import sys
-from typing import Sequence
+import tarfile
+import tempfile
VERBOSE = False
-copyrights = set()
-
-
def warn(s):
sys.stderr.write("warning: %s\n" % s)
-
def warn_verbose(s):
if VERBOSE:
warn(s)
-
-def is_interesting(path_str: str) -> bool:
- path = Path(path_str.lower())
+def is_interesting(path):
+ path = path.lower()
uninteresting_extensions = [
".bp",
".map",
- ".md",
".mk",
".py",
".pyc",
".swp",
".txt",
]
- if path.suffix in uninteresting_extensions:
- return False
- if path.name in {"notice", "readme", "pylintrc"}:
+ if os.path.splitext(path)[1] in uninteresting_extensions:
return False
- # Backup files for some editors.
- if path.match("*~"):
+ if path.endswith("/notice") or path.endswith("/readme"):
return False
return True
-
def is_auto_generated(content):
if "Generated by gensyscalls.py" in content or "generated by genserv.py" in content:
return True
@@ -51,40 +45,14 @@ def is_auto_generated(content):
return True
return False
+copyrights = set()
-def is_copyright_end(line: str, first_line_was_hash: bool) -> bool:
- endings = [
- " $FreeBSD: ",
- "$Citrus$",
- "$FreeBSD$",
- "*/",
- "From: @(#)",
- # OpenBSD likes to say where stuff originally came from:
- "Original version ID:",
- "\t$Citrus: ",
- "\t$NetBSD: ",
- "\t$OpenBSD: ",
- "\t@(#)",
- "\tcitrus Id: ",
- "\tfrom: @(#)",
- "from OpenBSD:",
- ]
- if first_line_was_hash and not line:
- return True
-
- for ending in endings:
- if ending in line:
- return True
-
- return False
-
-
-def extract_copyright_at(lines: Sequence[str], i: int) -> int:
- first_line_was_hash = lines[i].startswith("#")
+def extract_copyright_at(lines, i):
+ hash = lines[i].startswith("#")
# Do we need to back up to find the start of the copyright header?
start = i
- if not first_line_was_hash:
+ if not hash:
while start > 0:
if "/*" in lines[start - 1]:
break
@@ -93,7 +61,20 @@ def extract_copyright_at(lines: Sequence[str], i: int) -> int:
# Read comment lines until we hit something that terminates a
# copyright header.
while i < len(lines):
- if is_copyright_end(lines[i], first_line_was_hash):
+ if "*/" in lines[i]:
+ break
+ if hash and len(lines[i]) == 0:
+ break
+ if "\t@(#)" in lines[i] or "\tfrom: @(#)" in lines[i] or "From: @(#)" in lines[i] or "from OpenBSD:" in lines[i]:
+ break
+ if "\tcitrus Id: " in lines[i]:
+ break
+ if "\t$Citrus: " in lines[i] or "\t$OpenBSD: " in lines[i] or " $FreeBSD: " in lines[i] or "\t$NetBSD: " in lines[i]:
+ break
+ if "$FreeBSD$" in lines[i] or "$Citrus$" in lines[i]:
+ break
+ # OpenBSD likes to say where stuff originally came from:
+ if "Original version ID:" in lines[i]:
break
i += 1
@@ -101,10 +82,7 @@ def extract_copyright_at(lines: Sequence[str], i: int) -> int:
# Trim trailing cruft.
while end > 0:
- line = lines[end - 1]
- if line not in {
- " *", " * ===================================================="
- }:
+ if lines[end - 1] != " *" and lines[end - 1] != " * ====================================================":
break
end -= 1
@@ -113,7 +91,7 @@ def extract_copyright_at(lines: Sequence[str], i: int) -> int:
for line in lines[start:end]:
line = line.replace("\t", " ")
line = line.replace("/* ", "")
- line = re.sub(r"^ \* ", "", line)
+ line = re.sub("^ \* ", "", line)
line = line.replace("** ", "")
line = line.replace("# ", "")
if "SPDX-License-Identifier:" in line:
@@ -123,7 +101,7 @@ def extract_copyright_at(lines: Sequence[str], i: int) -> int:
line = line.replace("--Copyright--", "")
line = line.rstrip()
# These come last and take care of "blank" comment lines.
- if line in {"#", " *", "**", "-"}:
+ if line == "#" or line == " *" or line == "**" or line == "-":
line = ""
clean_lines.append(line)
@@ -133,18 +111,19 @@ def extract_copyright_at(lines: Sequence[str], i: int) -> int:
while clean_lines[len(clean_lines) - 1] == "":
clean_lines = clean_lines[0:(len(clean_lines) - 1)]
- copyrights.add("\n".join(clean_lines))
+ copyright = "\n".join(clean_lines)
+ copyrights.add(copyright)
return i
-def do_file(path: str) -> None:
- raw = Path(path).read_bytes()
- try:
- content = raw.decode("utf-8")
- except UnicodeDecodeError:
- warn("bad UTF-8 in %s" % path)
- content = raw.decode("iso-8859-1")
+def do_file(path):
+ with open(path, "r") as the_file:
+ try:
+ content = open(path, "r").read().decode("utf-8")
+ except UnicodeDecodeError:
+ warn("bad UTF-8 in %s" % path)
+ content = open(path, "r").read().decode("iso-8859-1")
lines = content.split("\n")
@@ -158,14 +137,12 @@ def do_file(path: str) -> None:
if not "Copyright" in content:
if "public domain" in content.lower():
- warn_verbose("ignoring public domain file %s" % path)
+ warn("ignoring public domain file %s" % path)
return
- warn('no copyright notice found in "%s" (%d lines)' %
- (path, len(lines)))
+ warn('no copyright notice found in "%s" (%d lines)' % (path, len(lines)))
return
- # Manually iterate because extract_copyright_at tells us how many lines to
- # skip.
+ # Manually iterate because extract_copyright_at tells us how many lines to skip.
i = 0
while i < len(lines):
if "Copyright" in lines[i] and not "@(#) Copyright" in lines[i]:
@@ -174,7 +151,7 @@ def do_file(path: str) -> None:
i += 1
-def do_dir(arg):
+def do_dir(path):
for directory, sub_directories, filenames in os.walk(arg):
if ".git" in sub_directories:
sub_directories.remove(".git")
@@ -186,23 +163,20 @@ def do_dir(arg):
do_file(path)
-def main() -> None:
- args = sys.argv[1:]
- if len(args) == 0:
- args = ["."]
-
- for arg in args:
- if os.path.isdir(arg):
- do_dir(arg)
- else:
- do_file(arg)
+args = sys.argv[1:]
+if len(args) == 0:
+ args = [ "." ]
- for notice in sorted(copyrights):
- print(notice)
- print()
- print("-" * 67)
- print()
+for arg in args:
+ if os.path.isdir(arg):
+ do_dir(arg)
+ else:
+ do_file(arg)
+for copyright in sorted(copyrights):
+ print copyright.encode("utf-8")
+ print
+ print "-------------------------------------------------------------------"
+ print
-if __name__ == "__main__":
- main()
+sys.exit(0)
diff --git a/libc/tools/genfunctosyscallnrs.py b/libc/tools/genfunctosyscallnrs.py
index fa488447a..ecfc8abc1 100755
--- a/libc/tools/genfunctosyscallnrs.py
+++ b/libc/tools/genfunctosyscallnrs.py
@@ -1,71 +1,60 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
import argparse
+import collections
import logging
import os
import re
+import subprocess
+import textwrap
from gensyscalls import SupportedArchitectures, SysCallsTxtParser
from genseccomp import parse_syscall_NRs
-
def load_syscall_names_from_file(file_path, architecture):
- parser = SysCallsTxtParser()
- parser.parse_open_file(open(file_path))
- arch_map = {}
- for syscall in parser.syscalls:
- if syscall.get(architecture):
- arch_map[syscall["func"]] = syscall["name"]
-
- return arch_map
+ parser = SysCallsTxtParser()
+ parser.parse_open_file(open(file_path))
+ arch_map = {}
+ for syscall in parser.syscalls:
+ if syscall.get(architecture):
+ arch_map[syscall["func"]] = syscall["name"];
+ return arch_map
def gen_syscall_nrs(out_file, base_syscall_file, syscall_NRs):
- for arch in SupportedArchitectures:
- base_names = load_syscall_names_from_file(base_syscall_file, arch)
-
- for func, syscall in base_names.items():
- out_file.write("#define __" + arch + "_" + func + " " +
- str(syscall_NRs[arch][syscall]) + ";\n")
+ for arch in SupportedArchitectures:
+ base_names = load_syscall_names_from_file(base_syscall_file, arch)
+ for func,syscall in base_names.iteritems():
+ out_file.write("#define __" + arch + "_" + func + " " + str(syscall_NRs[arch][syscall]) + ";\n")
def main():
- parser = argparse.ArgumentParser(
- description=
- "Generates a mapping of bionic functions to system call numbers per architecture."
- )
- parser.add_argument("--verbose", "-v", help="Enables verbose logging.")
- parser.add_argument("--out-dir",
- help="The output directory for the output files")
- parser.add_argument(
- "base_file",
- metavar="base-file",
- type=str,
- help="The path of the base syscall list (SYSCALLS.TXT).")
- parser.add_argument(
- "files",
- metavar="FILE",
- type=str,
- nargs="+",
- help=("A syscall name-number mapping file for an architecture.\n"))
- args = parser.parse_args()
-
- if args.verbose:
- logging.basicConfig(level=logging.DEBUG)
- else:
- logging.basicConfig(level=logging.INFO)
-
- syscall_NRs = {}
- for filename in args.files:
- m = re.search(r"libseccomp_gen_syscall_nrs_([^/]+)", filename)
- syscall_NRs[m.group(1)] = parse_syscall_NRs(filename)
-
- output_path = os.path.join(args.out_dir, "func_to_syscall_nrs.h")
- with open(output_path, "w") as output_file:
- gen_syscall_nrs(out_file=output_file,
- syscall_NRs=syscall_NRs,
- base_syscall_file=args.base_file)
-
+ parser = argparse.ArgumentParser(
+ description="Generates a mapping of bionic functions to system call numbers per architecture.")
+ parser.add_argument("--verbose", "-v", help="Enables verbose logging.")
+ parser.add_argument("--out-dir",
+ help="The output directory for the output files")
+ parser.add_argument("base_file", metavar="base-file", type=str,
+ help="The path of the base syscall list (SYSCALLS.TXT).")
+ parser.add_argument("files", metavar="FILE", type=str, nargs="+",
+ help=("A syscall name-number mapping file for an architecture.\n"))
+ args = parser.parse_args()
+
+ if args.verbose:
+ logging.basicConfig(level=logging.DEBUG)
+ else:
+ logging.basicConfig(level=logging.INFO)
+
+ syscall_files = []
+ syscall_NRs = {}
+ for filename in args.files:
+ m = re.search(r"libseccomp_gen_syscall_nrs_([^/]+)", filename)
+ syscall_NRs[m.group(1)] = parse_syscall_NRs(filename)
+
+ output_path = os.path.join(args.out_dir, "func_to_syscall_nrs.h")
+ with open(output_path, "w") as output_file:
+ gen_syscall_nrs(out_file=output_file,
+ syscall_NRs=syscall_NRs, base_syscall_file=args.base_file)
if __name__ == "__main__":
- main()
+ main()
diff --git a/libc/tools/genseccomp.py b/libc/tools/genseccomp.py
index 33bf47074..ba7e2cae7 100755
--- a/libc/tools/genseccomp.py
+++ b/libc/tools/genseccomp.py
@@ -1,10 +1,11 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
import argparse
+import collections
import logging
-import operator
import os
import re
+import subprocess
import textwrap
from gensyscalls import SupportedArchitectures, SysCallsTxtParser
@@ -15,7 +16,7 @@ BPF_JEQ = "BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, {0}, {1}, {2})"
BPF_ALLOW = "BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW)"
-class SyscallRange:
+class SyscallRange(object):
def __init__(self, name, value):
self.names = [name]
self.begin = value
@@ -34,33 +35,33 @@ class SyscallRange:
def load_syscall_names_from_file(file_path, architecture):
parser = SysCallsTxtParser()
parser.parse_open_file(open(file_path))
- return {x["name"] for x in parser.syscalls if x.get(architecture)}
+ return set([x["name"] for x in parser.syscalls if x.get(architecture)])
def load_syscall_priorities_from_file(file_path):
format_re = re.compile(r'^\s*([A-Za-z_][A-Za-z0-9_]+)\s*$')
priorities = []
- with open(file_path) as priority_file:
- for line in priority_file:
- match = format_re.match(line)
- if match is None:
+ with open(file_path) as f:
+ for line in f:
+ m = format_re.match(line)
+ if not m:
continue
try:
- name = match.group(1)
+ name = m.group(1)
priorities.append(name)
- except IndexError:
- # TODO: This should be impossible becauase it wouldn't have matched?
- logging.exception('Failed to parse %s from %s', line, file_path)
+ except:
+ logging.debug('Failed to parse %s from %s', (line, file_path))
+ pass
return priorities
-def merge_names(base_names, allowlist_names, blocklist_names):
- if bool(blocklist_names - base_names):
- raise RuntimeError("blocklist item not in bionic - aborting " + str(
- blocklist_names - base_names))
+def merge_names(base_names, whitelist_names, blacklist_names):
+ if bool(blacklist_names - base_names):
+ raise RuntimeError("Blacklist item not in bionic - aborting " + str(
+ blacklist_names - base_names))
- return (base_names - blocklist_names) | allowlist_names
+ return (base_names - blacklist_names) | whitelist_names
def extract_priority_syscalls(syscalls, priorities):
@@ -92,7 +93,7 @@ def parse_syscall_NRs(names_path):
with open(names_path) as f:
for line in f:
m = constant_re.match(line)
- if m is None:
+ if not m:
continue
try:
name = m.group(1)
@@ -101,21 +102,12 @@ def parse_syscall_NRs(names_path):
m.group(2)))
constants[name] = value
- except: # pylint: disable=bare-except
- # TODO: This seems wrong.
- # Key error doesn't seem like the error the original author was trying
- # to catch. It looks like the intent was to catch IndexError from
- # match.group() for non-matching lines, but that's impossible because
- # the match object is checked and continued if not matched. What
- # actually happens is that KeyError is thrown by constants[x.group(0)]
- # on at least the first run because the dict is empty.
- #
- # It's also matching syntax errors because not all C integer literals
- # are valid Python integer literals, e.g. 10L.
+ except:
logging.debug('Failed to parse %s', line)
+ pass
syscalls = {}
- for name, value in constants.items():
+ for name, value in constants.iteritems():
if not name.startswith("__NR_") and not name.startswith("__ARM_NR"):
continue
if name.startswith("__NR_"):
@@ -128,7 +120,7 @@ def parse_syscall_NRs(names_path):
def convert_NRs_to_ranges(syscalls):
# Sort the values so we convert to ranges and binary chop
- syscalls = sorted(syscalls, key=operator.itemgetter(1))
+ syscalls = sorted(syscalls, lambda x, y: cmp(x[1], y[1]))
# Turn into a list of ranges. Keep the names for the comments
ranges = []
@@ -156,12 +148,12 @@ def convert_to_intermediate_bpf(ranges):
# We will replace {fail} and {allow} with appropriate range jumps later
return [BPF_JGE.format(ranges[0].end, "{fail}", "{allow}") +
", //" + "|".join(ranges[0].names)]
-
- half = (len(ranges) + 1) // 2
- first = convert_to_intermediate_bpf(ranges[:half])
- second = convert_to_intermediate_bpf(ranges[half:])
- jump = [BPF_JGE.format(ranges[half].begin, len(first), 0) + ","]
- return jump + first + second
+ else:
+ half = (len(ranges) + 1) / 2
+ first = convert_to_intermediate_bpf(ranges[:half])
+ second = convert_to_intermediate_bpf(ranges[half:])
+ jump = [BPF_JGE.format(ranges[half].begin, len(first), 0) + ","]
+ return jump + first + second
# Converts the prioritized syscalls to a bpf list that is prepended to the
@@ -170,7 +162,7 @@ def convert_to_intermediate_bpf(ranges):
# immediately
def convert_priority_to_intermediate_bpf(priority_syscalls):
result = []
- for syscall in priority_syscalls:
+ for i, syscall in enumerate(priority_syscalls):
result.append(BPF_JEQ.format(syscall[1], "{allow}", 0) +
", //" + syscall[0])
return result
@@ -235,23 +227,22 @@ def construct_bpf(syscalls, architecture, name_modifier, priorities):
return convert_bpf_to_output(bpf, architecture, name_modifier)
-def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files,
- syscall_NRs, priority_file):
+def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files, syscall_NRs, priority_file):
for arch in SupportedArchitectures:
base_names = load_syscall_names_from_file(base_syscall_file, arch)
- allowlist_names = set()
- blocklist_names = set()
+ whitelist_names = set()
+ blacklist_names = set()
for f in syscall_files:
- if "blocklist" in f.lower():
- blocklist_names |= load_syscall_names_from_file(f, arch)
+ if "blacklist" in f.lower():
+ blacklist_names |= load_syscall_names_from_file(f, arch)
else:
- allowlist_names |= load_syscall_names_from_file(f, arch)
+ whitelist_names |= load_syscall_names_from_file(f, arch)
priorities = []
if priority_file:
priorities = load_syscall_priorities_from_file(priority_file)
allowed_syscalls = []
- for name in merge_names(base_names, allowlist_names, blocklist_names):
+ for name in merge_names(base_names, whitelist_names, blacklist_names):
try:
allowed_syscalls.append((name, syscall_NRs[arch][name]))
except:
@@ -260,6 +251,7 @@ def gen_policy(name_modifier, out_dir, base_syscall_file, syscall_files,
output = construct_bpf(allowed_syscalls, arch, name_modifier, priorities)
# And output policy
+ existing = ""
filename_modifier = "_" + name_modifier if name_modifier else ""
output_path = os.path.join(out_dir,
"{}{}_policy.cpp".format(arch, filename_modifier))
@@ -282,8 +274,8 @@ def main():
help=("The path of the input files. In order to "
"simplify the build rules, it can take any of the "
"following files: \n"
- "* /blocklist.*\\.txt$/ syscall blocklist.\n"
- "* /allowlist.*\\.txt$/ syscall allowlist.\n"
+ "* /blacklist.*\.txt$/ syscall blacklist.\n"
+ "* /whitelist.*\.txt$/ syscall whitelist.\n"
"* /priority.txt$/ priorities for bpf rules.\n"
"* otherwise, syscall name-number mapping.\n"))
args = parser.parse_args()
diff --git a/libc/tools/genserv.py b/libc/tools/genserv.py
index acbfea2f0..84a139d25 100755
--- a/libc/tools/genserv.py
+++ b/libc/tools/genserv.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
#
import sys, os, string, re
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index baaa52d25..0271a04c5 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -1,10 +1,11 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# This tool is used to generate the assembler system call stubs,
# the header files listing all available system calls, and the
# makefiles used to build all the stubs.
import atexit
+import commands
import filecmp
import glob
import re
@@ -314,7 +315,7 @@ class SysCallsTxtParser:
self.lineno = 0
def E(self, msg):
- print("%d: %s" % (self.lineno, msg))
+ print "%d: %s" % (self.lineno, msg)
def parse_line(self, line):
""" parse a syscall spec line.
@@ -339,7 +340,7 @@ class SysCallsTxtParser:
return
syscall_func = return_type[-1]
- return_type = ' '.join(return_type[:-1])
+ return_type = string.join(return_type[:-1],' ')
socketcall_id = -1
pos_colon = syscall_func.find(':')
@@ -371,13 +372,13 @@ class SysCallsTxtParser:
alias_delim = syscall_name.find('|')
if alias_delim > 0:
syscall_name = syscall_name[:alias_delim]
- syscall_aliases = alias_list.split(',')
+ syscall_aliases = string.split(alias_list, ',')
else:
syscall_aliases = []
if pos_rparen > pos_lparen+1:
syscall_params = line[pos_lparen+1:pos_rparen].split(',')
- params = ','.join(syscall_params)
+ params = string.join(syscall_params,',')
else:
syscall_params = []
params = "void"
@@ -397,7 +398,7 @@ class SysCallsTxtParser:
for arch in SupportedArchitectures:
t[arch] = True
else:
- for arch in arch_list.split(','):
+ for arch in string.split(arch_list, ','):
if arch == "lp32":
for arch in SupportedArchitectures:
if "64" not in arch:
@@ -434,13 +435,13 @@ def main(arch, syscall_file):
for syscall in parser.syscalls:
syscall["__NR_name"] = make__NR_name(syscall["name"])
- if "arm" in syscall:
+ if syscall.has_key("arm"):
syscall["asm-arm"] = add_footer(32, arm_eabi_genstub(syscall), syscall)
- if "arm64" in syscall:
+ if syscall.has_key("arm64"):
syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
- if "x86" in syscall:
+ if syscall.has_key("x86"):
if syscall["socketcall_id"] >= 0:
syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
else:
@@ -449,21 +450,19 @@ def main(arch, syscall_file):
E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
return
- if "x86_64" in syscall:
+ if syscall.has_key("x86_64"):
syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
print("/* Generated by gensyscalls.py. Do not edit. */\n")
print("#include <private/bionic_asm.h>\n")
for syscall in parser.syscalls:
- if ("asm-%s" % arch) in syscall:
+ if syscall.has_key("asm-%s" % arch):
print(syscall["asm-%s" % arch])
- if arch == 'arm64':
- print('\nNOTE_GNU_PROPERTY()\n')
if __name__ == "__main__":
if len(sys.argv) < 2:
- print("Usage: gensyscalls.py ARCH SOURCE_FILE")
+ print "Usage: gensyscalls.py ARCH SOURCE_FILE"
sys.exit(1)
arch = sys.argv[1]
diff --git a/libc/tools/mypy.ini b/libc/tools/mypy.ini
deleted file mode 100644
index 026935454..000000000
--- a/libc/tools/mypy.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[mypy]
-# TODO: Enable.
-# disallow_untyped_defs = True
diff --git a/libc/tools/ndk_missing_symbols.py b/libc/tools/ndk_missing_symbols.py
index eff697219..a9f92b183 100755
--- a/libc/tools/ndk_missing_symbols.py
+++ b/libc/tools/ndk_missing_symbols.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python2
#
# Copyright (C) 2015 The Android Open Source Project
#
diff --git a/libc/tools/pylintrc b/libc/tools/pylintrc
index df319e378..2481b12b9 100644
--- a/libc/tools/pylintrc
+++ b/libc/tools/pylintrc
@@ -1,8 +1,280 @@
+[MASTER]
+
+# Specify a configuration file.
+#rcfile=
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Profiled execution.
+profile=no
+
+# Add files or directories to the blacklist. They should be base names, not
+# paths.
+ignore=CVS
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+
[MESSAGES CONTROL]
-disable=
- eval-used,
- design,
- fixme,
- invalid-name,
- logging-fstring-interpolation,
- missing-docstring
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time. See also the "--disable" option for examples.
+#enable=
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once).You can also use "--disable=all" to
+# disable everything first and then reenable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use"--disable=all --enable=classes
+# --disable=W"
+disable=missing-docstring,invalid-name,no-self-use,fixme,design
+
+
+[REPORTS]
+
+# Set the output format. Available formats are text, parseable, colorized, msvs
+# (visual studio) and html. You can also give a reporter class, eg
+# mypackage.mymodule.MyReporterClass.
+output-format=text
+
+# Put messages in a separate file for each module / package specified on the
+# command line instead of printing them on stdout. Reports (if any) will be
+# written in a file name "pylint_global.[txt|html]".
+files-output=no
+
+# Tells whether to display a full report or only the messages
+reports=yes
+
+# Python expression which should return a note less than 10 (10 is the highest
+# note). You have access to the variables errors warning, statement which
+# respectively contain the number of errors / warnings messages and the total
+# number of statements analyzed. This is used by the global evaluation report
+# (RP0004).
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
+
+# Add a comment according to your evaluation note. This is used by the global
+# evaluation report (RP0004).
+comment=no
+
+# Template used to display messages. This is a python new-style format string
+# used to format the message information. See doc for all details
+#msg-template=
+
+
+[BASIC]
+
+# Required attributes for module, separated by a comma
+required-attributes=
+
+# List of builtins function names that should not be used, separated by a comma
+bad-functions=map,filter,apply,input
+
+# Regular expression which should only match correct module names
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
+
+# Regular expression which should only match correct module level names
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
+
+# Regular expression which should only match correct class names
+class-rgx=[A-Z_][a-zA-Z0-9]+$
+
+# Regular expression which should only match correct function names
+function-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct method names
+method-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct instance attribute names
+attr-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct argument names
+argument-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct variable names
+variable-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct attribute names in class
+# bodies
+class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
+
+# Regular expression which should only match correct list comprehension /
+# generator expression variable names
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
+
+# Good variable names which should always be accepted, separated by a comma
+good-names=i,j,k,ex,Run,_
+
+# Bad variable names which should always be refused, separated by a comma
+bad-names=foo,bar,baz,toto,tutu,tata
+
+# Regular expression which should only match function or class names that do
+# not require a docstring.
+no-docstring-rgx=__.*__
+
+# Minimum line length for functions/classes that require docstrings, shorter
+# ones are exempt.
+docstring-min-length=-1
+
+
+[TYPECHECK]
+
+# Tells whether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+# List of classes names for which member attributes should not be checked
+# (useful for classes with attributes dynamically set).
+ignored-classes=SQLObject
+
+# When zope mode is activated, add a predefined set of Zope acquired attributes
+# to generated-members.
+zope=no
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed. Python regular
+# expressions are accepted.
+generated-members=REQUEST,acl_users,aq_parent
+
+
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,XXX,TODO
+
+
+[SIMILARITIES]
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+# Ignore comments when computing similarities.
+ignore-comments=yes
+
+# Ignore docstrings when computing similarities.
+ignore-docstrings=yes
+
+# Ignore imports when computing similarities.
+ignore-imports=no
+
+
+[VARIABLES]
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching the beginning of the name of dummy variables
+# (i.e. not used).
+dummy-variables-rgx=_$|dummy
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid to define new builtins when possible.
+additional-builtins=
+
+
+[FORMAT]
+
+# Maximum number of characters on a single line.
+max-line-length=100
+
+# Regexp for a line that is allowed to be longer than the limit.
+ignore-long-lines=^\s*(# )?<?https?://\S+>?$
+
+# Allow the body of an if to be on the same line as the test if there is no
+# else.
+single-line-if-stmt=no
+
+# List of optional constructs for which whitespace checking is disabled
+no-space-check=trailing-comma,dict-separator
+
+# Maximum number of lines in a module
+max-module-lines=1000
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string=' '
+
+
+[IMPORTS]
+
+# Deprecated modules which should not be used, separated by a comma
+deprecated-modules=regsub,TERMIOS,Bastion,rexec
+
+# Create a graph of every (i.e. internal and external) dependencies in the
+# given file (report RP0402 must not be disabled)
+import-graph=
+
+# Create a graph of external dependencies in the given file (report RP0402 must
+# not be disabled)
+ext-import-graph=
+
+# Create a graph of internal dependencies in the given file (report RP0402 must
+# not be disabled)
+int-import-graph=
+
+
+[DESIGN]
+
+# Maximum number of arguments for function / method
+max-args=5
+
+# Argument names that match this expression will be ignored. Default to name
+# with leading underscore
+ignored-argument-names=_.*
+
+# Maximum number of locals for function / method body
+max-locals=15
+
+# Maximum number of return / yield for function / method body
+max-returns=6
+
+# Maximum number of branch for function / method body
+max-branches=12
+
+# Maximum number of statements in function / method body
+max-statements=50
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+
+[CLASSES]
+
+# List of interface methods to ignore, separated by a comma. This is used for
+# instance to not check methods defines in Zope's Interface base class.
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,__new__,setUp
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+# List of valid names for the first argument in a metaclass class method.
+valid-metaclass-classmethod-first-arg=mcs
+
+
+[EXCEPTIONS]
+
+# Exceptions that will emit a warning when being caught. Defaults to
+# "Exception"
+overgeneral-exceptions=Exception
diff --git a/libc/tools/symbols.py b/libc/tools/symbols.py
index 145753421..3f40aad99 100644
--- a/libc/tools/symbols.py
+++ b/libc/tools/symbols.py
@@ -41,8 +41,7 @@ def GetFromElf(elf_file, sym_type='--dyn-syms'):
symbols = set()
- output = subprocess.check_output(['readelf', sym_type, '-W', elf_file],
- text=True)
+ output = subprocess.check_output(['readelf', sym_type, '-W', elf_file])
for line in output.split('\n'):
if ' HIDDEN ' in line or ' UND ' in line:
continue
@@ -77,10 +76,6 @@ def GetFromAndroidSo(files):
if not os.path.isdir(lib_dir):
lib_dir = os.path.join(out_dir, 'system/lib')
- lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib64/bionic/')
- if not os.path.isdir(lib_dir):
- lib_dir = os.path.join(out_dir, 'apex/com.android.runtime/lib/bionic/')
-
results = set()
for f in files:
results |= GetFromElf(os.path.join(lib_dir, f))
diff --git a/libc/tools/test_genseccomp.py b/libc/tools/test_genseccomp.py
index b833c2709..0c2699a0b 100755
--- a/libc/tools/test_genseccomp.py
+++ b/libc/tools/test_genseccomp.py
@@ -1,65 +1,176 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Unit tests for genseccomp.py
+import cStringIO
import textwrap
import unittest
import genseccomp
class TestGenseccomp(unittest.TestCase):
+ def setUp(self):
+ genseccomp.set_dir()
+
+ def get_config(self, arch):
+ for i in genseccomp.POLICY_CONFIGS:
+ if i[0] == arch:
+ return i
+ self.fail("No such architecture")
+
+ def get_headers(self, arch):
+ return self.get_config(arch)[1]
+
+ def get_switches(self, arch):
+ return self.get_config(arch)[2]
+
+ def test_get_names(self):
+ bionic = cStringIO.StringIO(textwrap.dedent("""\
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
+ """))
+
+ whitelist = cStringIO.StringIO(textwrap.dedent("""\
+ssize_t read(int, void*, size_t) all
+ """))
+
+ empty = cStringIO.StringIO(textwrap.dedent("""\
+ """))
+
+ names = genseccomp.get_names([bionic, whitelist, empty], "arm")
+ bionic.seek(0)
+ whitelist.seek(0)
+ empty.seek(0)
+ names64 = genseccomp.get_names([bionic, whitelist, empty], "arm64")
+ bionic.seek(0)
+ whitelist.seek(0)
+ empty.seek(0)
+
+ self.assertIn("fchown", names64)
+ self.assertNotIn("fchown", names)
+ self.assertIn("_llseek", names)
+ self.assertNotIn("_llseek", names64)
+ self.assertIn("read", names)
+ self.assertIn("read", names64)
+
+ # Blacklist item must be in bionic
+ blacklist = cStringIO.StringIO(textwrap.dedent("""\
+int fchown2:fchown2(int, uid_t, gid_t) arm64,x86_64
+ """))
+ with self.assertRaises(RuntimeError):
+ genseccomp.get_names([bionic, whitelist, blacklist], "arm")
+ bionic.seek(0)
+ whitelist.seek(0)
+ blacklist.seek(0)
+
+ # Test blacklist item is removed
+ blacklist = cStringIO.StringIO(textwrap.dedent("""\
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
+ """))
+ names = genseccomp.get_names([bionic, whitelist, blacklist], "arm64")
+ bionic.seek(0)
+ whitelist.seek(0)
+ blacklist.seek(0)
+ self.assertIn("read", names)
+ self.assertNotIn("fchown", names)
+
+ # Blacklist item must not be in whitelist
+ whitelist = cStringIO.StringIO(textwrap.dedent("""\
+int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
+ """))
+ with self.assertRaises(RuntimeError):
+ genseccomp.get_names([empty, whitelist, blacklist], "arm")
+ empty.seek(0)
+ whitelist.seek(0)
+ blacklist.seek(0)
+
+ # No dups in bionic and whitelist
+ whitelist = cStringIO.StringIO(textwrap.dedent("""\
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
+ """))
+ with self.assertRaises(RuntimeError):
+ genseccomp.get_names([bionic, whitelist, empty], "arm")
+ bionic.seek(0)
+ whitelist.seek(0)
+ empty.seek(0)
+
+ def test_convert_names_to_NRs(self):
+ self.assertEquals(genseccomp.convert_names_to_NRs(["open"],
+ self.get_headers("arm"),
+ self.get_switches("arm")),
+ [("open", 5)])
+
+ self.assertEquals(genseccomp.convert_names_to_NRs(["__ARM_NR_set_tls"],
+ self.get_headers("arm"),
+ self.get_switches("arm")),
+ [('__ARM_NR_set_tls', 983045)])
+
+ self.assertEquals(genseccomp.convert_names_to_NRs(["openat"],
+ self.get_headers("arm64"),
+ self.get_switches("arm64")),
+ [("openat", 56)])
+
+ self.assertEquals(genseccomp.convert_names_to_NRs(["openat"],
+ self.get_headers("x86"),
+ self.get_switches("x86")),
+ [("openat", 295)])
+
+ self.assertEquals(genseccomp.convert_names_to_NRs(["openat"],
+ self.get_headers("x86_64"),
+ self.get_switches("x86_64")),
+ [("openat", 257)])
+
+
def test_convert_NRs_to_ranges(self):
ranges = genseccomp.convert_NRs_to_ranges([("b", 2), ("a", 1)])
- self.assertEqual(len(ranges), 1)
- self.assertEqual(ranges[0].begin, 1)
- self.assertEqual(ranges[0].end, 3)
- self.assertEqual(set(ranges[0].names), {"a", "b"})
+ self.assertEquals(len(ranges), 1)
+ self.assertEquals(ranges[0].begin, 1)
+ self.assertEquals(ranges[0].end, 3)
+ self.assertItemsEqual(ranges[0].names, ["a", "b"])
ranges = genseccomp.convert_NRs_to_ranges([("b", 3), ("a", 1)])
- self.assertEqual(len(ranges), 2)
- self.assertEqual(ranges[0].begin, 1)
- self.assertEqual(ranges[0].end, 2)
- self.assertEqual(set(ranges[0].names), {"a"})
- self.assertEqual(ranges[1].begin, 3)
- self.assertEqual(ranges[1].end, 4)
- self.assertEqual(set(ranges[1].names), {"b"})
+ self.assertEquals(len(ranges), 2)
+ self.assertEquals(ranges[0].begin, 1)
+ self.assertEquals(ranges[0].end, 2)
+ self.assertItemsEqual(ranges[0].names, ["a"])
+ self.assertEquals(ranges[1].begin, 3)
+ self.assertEquals(ranges[1].end, 4)
+ self.assertItemsEqual(ranges[1].names, ["b"])
def test_convert_to_intermediate_bpf(self):
ranges = genseccomp.convert_NRs_to_ranges([("b", 2), ("a", 1)])
bpf = genseccomp.convert_to_intermediate_bpf(ranges)
- self.assertEqual(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, {fail}, {allow}), //a|b'])
+ self.assertEquals(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, {fail}, {allow}), //a|b'])
ranges = genseccomp.convert_NRs_to_ranges([("b", 3), ("a", 1)])
bpf = genseccomp.convert_to_intermediate_bpf(ranges)
- self.assertEqual(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 1, 0),',
+ self.assertEquals(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 1, 0),',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 2, {fail}, {allow}), //a',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 4, {fail}, {allow}), //b'])
def test_convert_ranges_to_bpf(self):
ranges = genseccomp.convert_NRs_to_ranges([("b", 2), ("a", 1)])
- bpf = genseccomp.convert_ranges_to_bpf(ranges, priority_syscalls=[])
- self.assertEqual(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 1, 0, 2),',
+ bpf = genseccomp.convert_ranges_to_bpf(ranges)
+ self.assertEquals(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 1, 0, 2),',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 1, 0), //a|b',
'BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),'])
ranges = genseccomp.convert_NRs_to_ranges([("b", 3), ("a", 1)])
- bpf = genseccomp.convert_ranges_to_bpf(ranges, priority_syscalls=[])
- self.assertEqual(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 1, 0, 4),',
+ bpf = genseccomp.convert_ranges_to_bpf(ranges)
+ self.assertEquals(bpf, ['BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 1, 0, 4),',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 1, 0),',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 2, 2, 1), //a',
'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 4, 1, 0), //b',
'BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),'])
def test_convert_bpf_to_output(self):
- output = genseccomp.convert_bpf_to_output(["line1", "line2"],
- "arm",
- name_modifier="")
+ output = genseccomp.convert_bpf_to_output(["line1", "line2"], "arm")
expected_output = textwrap.dedent("""\
- // File autogenerated by genseccomp.py - edit at your peril!!
+ // Autogenerated file - edit at your peril!!
#include <linux/filter.h>
#include <errno.h>
- #include "seccomp/seccomp_bpfs.h"
+ #include "seccomp_bpfs.h"
const sock_filter arm_filter[] = {
line1
line2
@@ -67,7 +178,43 @@ class TestGenseccomp(unittest.TestCase):
const size_t arm_filter_size = sizeof(arm_filter) / sizeof(struct sock_filter);
""")
- self.assertEqual(output, expected_output)
+ self.assertEquals(output, expected_output)
+
+ def test_construct_bpf(self):
+ syscalls = cStringIO.StringIO(textwrap.dedent("""\
+ int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,x86
+ int fchown:fchown(int, uid_t, gid_t) arm64,x86_64
+ """))
+
+ whitelist = cStringIO.StringIO(textwrap.dedent("""\
+ ssize_t read(int, void*, size_t) all
+ """))
+
+ blacklist = cStringIO.StringIO(textwrap.dedent("""\
+ """))
+
+ syscall_files = [syscalls, whitelist, blacklist]
+ output = genseccomp.construct_bpf(syscall_files, "arm", self.get_headers("arm"),
+ self.get_switches("arm"))
+
+ expected_output = textwrap.dedent("""\
+ // Autogenerated file - edit at your peril!!
+
+ #include <linux/filter.h>
+ #include <errno.h>
+
+ #include "seccomp_bpfs.h"
+ const sock_filter arm_filter[] = {
+ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 3, 0, 4),
+ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 140, 1, 0),
+ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 4, 2, 1), //read
+ BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 141, 1, 0), //_llseek
+ BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW),
+ };
+
+ const size_t arm_filter_size = sizeof(arm_filter) / sizeof(struct sock_filter);
+ """)
+ self.assertEquals(output, expected_output)
if __name__ == '__main__':
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index e134aaae7..6d84303a4 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -90,12 +90,12 @@ static char* make_path(const char* path_prefix_variable,
// byte[12] tzdata_version -- "tzdata2012f\0"
// int index_offset
// int data_offset
-// int final_offset
+// int zonetab_offset
struct bionic_tzdata_header_t {
char tzdata_version[12];
int32_t index_offset;
int32_t data_offset;
- int32_t final_offset;
+ int32_t zonetab_offset;
};
static constexpr size_t NAME_LENGTH = 40;
struct index_entry_t {
@@ -105,18 +105,12 @@ struct index_entry_t {
int32_t unused; // Was raw GMT offset; always 0 since tzdata2014f (L).
};
-// Returns -2 for a soft failure (where the caller should try another file),
-// -1 for a hard failure (where the caller should give up), and >= 0 is a
-// file descriptor whose offset points to the data for the given olson id in
-// the given file (and *entry_length is the size of the data).
static int __bionic_open_tzdata_path(const char* path,
const char* olson_id,
int32_t* entry_length) {
int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC));
if (fd == -1) {
- // We don't log here, because this is quite common --- current devices
- // aren't expected to have the old APK tzdata, for example.
- return -2;
+ return -2; // Distinguish failure to find any data from failure to find a specific id.
}
bionic_tzdata_header_t header = {};
@@ -125,49 +119,49 @@ static int __bionic_open_tzdata_path(const char* path,
fprintf(stderr, "%s: could not read header of \"%s\": %s\n",
__FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read");
close(fd);
- return -2;
+ return -1;
}
if (strncmp(header.tzdata_version, "tzdata", 6) != 0 || header.tzdata_version[11] != 0) {
fprintf(stderr, "%s: bad magic in \"%s\": \"%.6s\"\n", __FUNCTION__, path, header.tzdata_version);
close(fd);
- return -2;
+ return -1;
}
if (TEMP_FAILURE_RETRY(lseek(fd, ntohl(header.index_offset), SEEK_SET)) == -1) {
fprintf(stderr, "%s: couldn't seek to index in \"%s\": %s\n", __FUNCTION__, path, strerror(errno));
close(fd);
- return -2;
+ return -1;
}
if (ntohl(header.index_offset) > ntohl(header.data_offset)) {
fprintf(stderr, "%s: invalid data and index offsets in \"%s\": %u %u\n",
__FUNCTION__, path, ntohl(header.data_offset), ntohl(header.index_offset));
close(fd);
- return -2;
+ return -1;
}
const size_t index_size = ntohl(header.data_offset) - ntohl(header.index_offset);
if ((index_size % sizeof(index_entry_t)) != 0) {
fprintf(stderr, "%s: invalid index size in \"%s\": %zd\n", __FUNCTION__, path, index_size);
close(fd);
- return -2;
+ return -1;
}
+ off_t specific_zone_offset = -1;
char* index = reinterpret_cast<char*>(malloc(index_size));
if (index == nullptr) {
fprintf(stderr, "%s: couldn't allocate %zd-byte index for \"%s\"\n", __FUNCTION__, index_size, path);
close(fd);
- return -2;
+ return -1;
}
if (TEMP_FAILURE_RETRY(read(fd, index, index_size)) != static_cast<ssize_t>(index_size)) {
fprintf(stderr, "%s: could not read index of \"%s\": %s\n",
__FUNCTION__, path, (bytes_read == -1) ? strerror(errno) : "short read");
free(index);
close(fd);
- return -2;
+ return -1;
}
- off_t specific_zone_offset = -1;
size_t id_count = index_size / sizeof(index_entry_t);
index_entry_t* entry = reinterpret_cast<index_entry_t*>(index);
for (size_t i = 0; i < id_count; ++i) {
@@ -186,9 +180,6 @@ static int __bionic_open_tzdata_path(const char* path,
free(index);
if (specific_zone_offset == -1) {
- // We found a valid tzdata file, but didn't find the requested id in it.
- // Give up now, and don't try fallback tzdata files. We don't log here
- // because for all we know the given olson id was nonsense.
close(fd);
return -1;
}
@@ -197,9 +188,11 @@ static int __bionic_open_tzdata_path(const char* path,
fprintf(stderr, "%s: could not seek to %ld in \"%s\": %s\n",
__FUNCTION__, specific_zone_offset, path, strerror(errno));
close(fd);
- return -2;
+ return -1;
}
+ // TODO: check that there's TZ_MAGIC at this offset, so we can fall back to the other file if not.
+
return fd;
}
@@ -211,9 +204,8 @@ int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
// tried first because it allows us to test that the time zone updates
// via APK mechanism still works even on devices with the time zone
// module.
- // TODO: remove this when those devices are no longer supported.
// 2: The time zone data module which contains the main copy. This is the
- // common case for current devices.
+ // common case.
// 3: The ultimate fallback: the non-updatable copy in /system.
#if defined(__ANDROID__)
@@ -222,15 +214,15 @@ int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
olson_id, entry_length);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
olson_id, entry_length);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
olson_id, entry_length);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
#else
// On the host, we don't expect the hard-coded locations above to exist, and
// we're not worried about security so we trust $ANDROID_DATA,
@@ -240,17 +232,17 @@ int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
free(path);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
path = make_path("ANDROID_TZDATA_ROOT", "/etc/tz/tzdata");
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
free(path);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
path = make_path("ANDROID_ROOT", "/usr/share/zoneinfo/tzdata");
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
free(path);
- if (fd >= -1) return fd;
+ if (fd >= 0) return fd;
#endif
// Not finding any tzdata is more serious that not finding a specific zone,
@@ -261,6 +253,5 @@ int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
fprintf(stderr, "%s: couldn't find any tzdata when looking for %s!\n", __FUNCTION__, olson_id);
}
- // Otherwise we were successful.
return fd;
}
diff --git a/libc/tzcode/strptime.c b/libc/tzcode/strptime.c
index 7e8e23499..41eaa9b42 100644
--- a/libc/tzcode/strptime.c
+++ b/libc/tzcode/strptime.c
@@ -95,22 +95,9 @@ struct century_relyear {
int century;
int relyear;
};
-
-static char gmt[] = { "GMT" };
-static char utc[] = { "UTC" };
-/* RFC-822/RFC-2822 */
-static const char * const nast[5] = {
- "EST", "CST", "MST", "PST", "\0\0\0"
-};
-static const char * const nadt[5] = {
- "EDT", "CDT", "MDT", "PDT", "\0\0\0"
-};
-
static int _conv_num(const unsigned char **, int *, int, int);
static unsigned char *_strptime(const unsigned char *, const char *, struct tm *,
struct century_relyear *);
-static const u_char *_find_string(const u_char *, int *, const char * const *,
- const char * const *, int);
char *
@@ -126,10 +113,9 @@ static unsigned char *
_strptime(const unsigned char *buf, const char *fmt, struct tm *tm, struct century_relyear *cr)
{
unsigned char c;
- const unsigned char *bp, *ep;
+ const unsigned char *bp;
size_t len = 0;
- int alt_format, i, offs;
- int neg = 0;
+ int alt_format, i;
bp = (unsigned char *)buf;
while ((c = *fmt) != '\0') {
@@ -446,108 +432,6 @@ literal:
return (NULL);
break;
- case 'Z':
- tzset();
- if (strncmp((const char *)bp, gmt, 3) == 0) {
- tm->tm_isdst = 0;
- tm->tm_gmtoff = 0;
- tm->tm_zone = gmt;
- bp += 3;
- } else if (strncmp((const char *)bp, utc, 3) == 0) {
- tm->tm_isdst = 0;
- tm->tm_gmtoff = 0;
- tm->tm_zone = utc;
- bp += 3;
- } else {
- ep = _find_string(bp, &i,
- (const char * const *)tzname,
- NULL, 2);
- if (ep == NULL)
- return (NULL);
-
- tm->tm_isdst = i;
- tm->tm_gmtoff = -(timezone);
- tm->tm_zone = tzname[i];
- bp = ep;
- }
- continue;
-
- case 'z':
- /*
- * We recognize all ISO 8601 formats:
- * Z = Zulu time/UTC
- * [+-]hhmm
- * [+-]hh:mm
- * [+-]hh
- * We recognize all RFC-822/RFC-2822 formats:
- * UT|GMT
- * North American : UTC offsets
- * E[DS]T = Eastern : -4 | -5
- * C[DS]T = Central : -5 | -6
- * M[DS]T = Mountain: -6 | -7
- * P[DS]T = Pacific : -7 | -8
- */
- while (isspace(*bp))
- bp++;
-
- switch (*bp++) {
- case 'G':
- if (*bp++ != 'M')
- return NULL;
- /*FALLTHROUGH*/
- case 'U':
- if (*bp++ != 'T')
- return NULL;
- /*FALLTHROUGH*/
- case 'Z':
- tm->tm_isdst = 0;
- tm->tm_gmtoff = 0;
- tm->tm_zone = utc;
- continue;
- case '+':
- neg = 0;
- break;
- case '-':
- neg = 1;
- break;
- default:
- --bp;
- ep = _find_string(bp, &i, nast, NULL, 4);
- if (ep != NULL) {
- tm->tm_gmtoff = (-5 - i) * SECSPERHOUR;
- tm->tm_zone = (char *)nast[i];
- bp = ep;
- continue;
- }
- ep = _find_string(bp, &i, nadt, NULL, 4);
- if (ep != NULL) {
- tm->tm_isdst = 1;
- tm->tm_gmtoff = (-4 - i) * SECSPERHOUR;
- tm->tm_zone = (char *)nadt[i];
- bp = ep;
- continue;
- }
- return NULL;
- }
- if (!isdigit(bp[0]) || !isdigit(bp[1]))
- return NULL;
- offs = ((bp[0]-'0') * 10 + (bp[1]-'0')) * SECSPERHOUR;
- bp += 2;
- if (*bp == ':')
- bp++;
- if (isdigit(*bp)) {
- offs += (*bp++ - '0') * 10 * SECSPERMIN;
- if (!isdigit(*bp))
- return NULL;
- offs += (*bp++ - '0') * SECSPERMIN;
- }
- if (neg)
- offs = -offs;
- tm->tm_isdst = 0; /* XXX */
- tm->tm_gmtoff = offs;
- tm->tm_zone = NULL; /* XXX */
- continue;
-
/*
* Miscellaneous conversions.
*/
@@ -584,49 +468,28 @@ literal:
return (unsigned char*)bp;
}
+
static int
_conv_num(const unsigned char **buf, int *dest, int llim, int ulim)
{
- int result = 0;
- int rulim = ulim;
-
- if (**buf < '0' || **buf > '9')
- return (0);
+ int result = 0;
+ int rulim = ulim;
- /* we use rulim to break out of the loop when we run out of digits */
- do {
- result *= 10;
- result += *(*buf)++ - '0';
- rulim /= 10;
- } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9');
+ if (**buf < '0' || **buf > '9')
+ return (0);
- if (result < llim || result > ulim)
- return (0);
+ /* we use rulim to break out of the loop when we run out of digits */
+ do {
+ result *= 10;
+ result += *(*buf)++ - '0';
+ rulim /= 10;
+ } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9');
- *dest = result;
- return (1);
-}
+ if (result < llim || result > ulim)
+ return (0);
-static const u_char *
-_find_string(const u_char *bp, int *tgt, const char * const *n1,
- const char * const *n2, int c)
-{
- int i;
- unsigned int len;
-
- /* check full name - then abbreviated ones */
- for (; n1 != NULL; n1 = n2, n2 = NULL) {
- for (i = 0; i < c; i++, n1++) {
- len = strlen(*n1);
- if (strncasecmp(*n1, (const char *)bp, len) == 0) {
- *tgt = i;
- return bp + len;
- }
- }
- }
-
- /* Nothing matched */
- return NULL;
+ *dest = result;
+ return (1);
}
char* strptime_l(const char* buf, const char* fmt, struct tm* tm, locale_t l) {
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index 5dd086e41..ea630b273 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -17,7 +17,7 @@
#pragma once
#define _BSD_SOURCE
-#define _GNU_SOURCE 1
+#define _GNU_SOURCE
// NetBSD uses _DIAGASSERT to null-check arguments and the like,
// but it's clear from the number of mistakes in their assertions
diff --git a/libc/upstream-netbsd/lib/libc/gen/utmp.c b/libc/upstream-netbsd/lib/libc/gen/utmp.c
new file mode 100644
index 000000000..9fb0799db
--- /dev/null
+++ b/libc/upstream-netbsd/lib/libc/gen/utmp.c
@@ -0,0 +1,106 @@
+/* $NetBSD: utmp.c,v 1.10 2011/10/15 23:00:02 christos Exp $ */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: utmp.c,v 1.10 2011/10/15 23:00:02 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <utmp.h>
+#include <sys/stat.h>
+
+static struct utmp utmp;
+static FILE *ut;
+static char utfile[MAXPATHLEN] = _PATH_UTMP;
+
+void
+setutent(void)
+{
+ if (ut == NULL)
+ return;
+ (void)fseeko(ut, (off_t)0, SEEK_SET);
+}
+
+struct utmp *
+getutent(void)
+{
+ if (ut == NULL) {
+ struct stat st;
+ off_t numentries;
+ if ((ut = fopen(utfile, "re")) == NULL)
+ return NULL;
+ if (fstat(fileno(ut), &st) == -1)
+ goto out;
+ /*
+ * If we have a an old version utmp file bail.
+ */
+ numentries = st.st_size / sizeof(utmp);
+ if ((off_t)(numentries * sizeof(utmp)) != st.st_size)
+ goto out;
+ }
+ if (fread(&utmp, sizeof(utmp), 1, ut) == 1)
+ return &utmp;
+out:
+ (void)fclose(ut);
+ return NULL;
+}
+
+void
+endutent(void)
+{
+ if (ut != NULL) {
+ (void)fclose(ut);
+ ut = NULL;
+ }
+}
+
+int
+utmpname(const char *fname)
+{
+ size_t len = strlen(fname);
+
+ if (len >= sizeof(utfile))
+ return 0;
+
+ /* must not end in x! */
+ if (fname[len - 1] == 'x')
+ return 0;
+
+ (void)strlcpy(utfile, fname, sizeof(utfile));
+ endutent();
+ return 1;
+}
diff --git a/libc/upstream-netbsd/lib/libc/stdlib/_rand48.c b/libc/upstream-netbsd/lib/libc/stdlib/_rand48.c
index 6e3e22348..0468026dc 100644
--- a/libc/upstream-netbsd/lib/libc/stdlib/_rand48.c
+++ b/libc/upstream-netbsd/lib/libc/stdlib/_rand48.c
@@ -1,4 +1,4 @@
-/* $NetBSD: _rand48.c,v 1.10 2020/02/23 09:53:42 kamil Exp $ */
+/* $NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $ */
/*
* Copyright (c) 1993 Martin Birgmeier
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _rand48.c,v 1.10 2020/02/23 09:53:42 kamil Exp $");
+__RCSID("$NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
@@ -42,17 +42,15 @@ __dorand48(unsigned short xseed[3])
_DIAGASSERT(xseed != NULL);
- accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0];
- accu += (unsigned long) __rand48_add;
+ accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] +
+ (unsigned long) __rand48_add;
temp[0] = (unsigned short) accu; /* lower 16 bits */
accu >>= sizeof(unsigned short) * 8;
- accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1];
- accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
+ accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1] +
+ (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
temp[1] = (unsigned short) accu; /* middle 16 bits */
accu >>= sizeof(unsigned short) * 8;
- accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[2];
- accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[1];
- accu += (unsigned long) __rand48_mult[2] * (unsigned long) xseed[0];
+ accu += __rand48_mult[0] * xseed[2] + __rand48_mult[1] * xseed[1] + __rand48_mult[2] * xseed[0];
xseed[0] = temp[0];
xseed[1] = temp[1];
xseed[2] = (unsigned short) accu;
diff --git a/libc/upstream-openbsd/android/include/arc4random.h b/libc/upstream-openbsd/android/include/arc4random.h
index 96f94be03..5f0b15e0f 100644
--- a/libc/upstream-openbsd/android/include/arc4random.h
+++ b/libc/upstream-openbsd/android/include/arc4random.h
@@ -36,6 +36,14 @@
//#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
//#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
+#ifdef __GLIBC__
+extern void *__dso_handle;
+extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
+#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
+#else
+#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
+#endif
+
static inline void _getentropy_fail(void) {
async_safe_fatal("getentropy failed: %s", strerror(errno));
}
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index 6c21c5b49..878f71cec 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -25,8 +25,6 @@
#include <sys/random.h> // For getentropy.
-#include "private/bsd_sys_param.h"
-
#define __BEGIN_HIDDEN_DECLS _Pragma("GCC visibility push(hidden)")
#define __END_HIDDEN_DECLS _Pragma("GCC visibility pop")
@@ -40,8 +38,6 @@ extern const char* __progname;
/* Ignore all __warn_references in OpenBSD. */
#define __warn_references(sym,msg)
-#define PROTO_NORMAL(x)
-
/* OpenBSD's <ctype.h> uses these names, which conflicted with stlport.
* Additionally, we changed the numeric/digit type from N to D for libcxx.
*/
@@ -59,6 +55,10 @@ extern const char* __progname;
#define explicit_bzero(p, s) memset(p, 0, s)
+/* OpenBSD has these in <sys/param.h>, but "ALIGN" isn't something we want to reserve. */
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
/* OpenBSD has this in paths.h. But this directory doesn't normally exist.
* Even when it does exist, only the 'shell' user has permissions.
*/
@@ -70,7 +70,3 @@ __LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
__LIBC_HIDDEN__ extern char* __findenv(const char*, int, int*);
__LIBC_HIDDEN__ extern char* _mktemp(char*);
-
-// Only OpenBSD has this at the moment, and we're more likely to just say
-// "malloc is always calloc", so we don't expose this as libc API.
-__LIBC_HIDDEN__ void* recallocarray(void*, size_t, size_t, size_t);
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
index 8d621b06b..9e1cea07c 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoa.h
@@ -112,18 +112,7 @@ extern void __freedtoa ANSI((char*));
extern float strtof ANSI((CONST char *, char **));
extern double strtod ANSI((CONST char *, char **));
extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
-char *__hdtoa(double, const char *, int, int *, int *, char **);
-char *__hldtoa(long double, const char *, int, int *, int *, char **);
-char *__ldtoa(long double *, int, int, int *, int *, char **);
-
-PROTO_NORMAL(__dtoa);
-PROTO_NORMAL(__gdtoa);
-PROTO_NORMAL(__freedtoa);
-PROTO_NORMAL(__hdtoa);
-PROTO_NORMAL(__hldtoa);
-PROTO_NORMAL(__ldtoa);
-
-__BEGIN_HIDDEN_DECLS
+
extern char* __g_ddfmt ANSI((char*, double*, int, size_t));
extern char* __g_dfmt ANSI((char*, double*, int, size_t));
extern char* __g_ffmt ANSI((char*, float*, int, size_t));
@@ -159,7 +148,6 @@ extern int __strtopxL ANSI((CONST char*, char**, void*));
#define __strtopx(s,se,x) strtorx(s,se,1,x)
#define __strtopxL(s,se,x) strtorxL(s,se,1,x)
#endif
-__END_HIDDEN_DECLS
#ifdef __cplusplus
}
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
index 823f2a9b1..0f3de1285 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gdtoaimp.h
@@ -463,6 +463,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#define FREE_DTOA_LOCK(n) /*nothing*/
#else
#include "thread_private.h"
+extern void *__dtoa_locks[];
#define ACQUIRE_DTOA_LOCK(n) _MUTEX_LOCK(&__dtoa_locks[n])
#define FREE_DTOA_LOCK(n) _MUTEX_UNLOCK(&__dtoa_locks[n])
#endif
@@ -566,7 +567,6 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
#define trailz __trailz_D2A
#define ulp __ulp_D2A
-__BEGIN_HIDDEN_DECLS
extern char *dtoa_result;
extern CONST double bigtens[], tens[], tinytens[];
extern unsigned char hexdig[];
@@ -586,6 +586,8 @@ __BEGIN_HIDDEN_DECLS
extern Bigint *d2b ANSI((double, int*, int*));
extern void decrement ANSI((Bigint*));
extern Bigint *diff ANSI((Bigint*, Bigint*));
+ extern char *dtoa ANSI((double d, int mode, int ndigits,
+ int *decpt, int *sign, char **rve));
extern char *g__fmt ANSI((char*, char*, char*, int, ULong, size_t));
extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
extern void __hexdig_init_D2A(Void);
@@ -608,10 +610,10 @@ __BEGIN_HIDDEN_DECLS
extern Bigint *set_ones ANSI((Bigint*, int));
extern char *strcp ANSI((char*, const char*));
extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
+ extern double strtod ANSI((const char *s00, char **se));
extern Bigint *sum ANSI((Bigint*, Bigint*));
extern int trailz ANSI((Bigint*));
extern double ulp ANSI((U*));
-__END_HIDDEN_DECLS
#ifdef __cplusplus
}
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c b/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
index d48c9ed03..f521f15c6 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/gethex.c
@@ -57,8 +57,11 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
static unsigned char *decimalpoint_cache;
if (!(s0 = decimalpoint_cache)) {
s0 = (unsigned char*)localeconv()->decimal_point;
- decimalpoint_cache = strdup(s0);
- }
+ if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
+ strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
+ s0 = decimalpoint_cache;
+ }
+ }
decimalpoint = s0;
#endif
#endif
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c b/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
index 4a7f798e2..45caef40a 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/hdtoa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdtoa.c,v 1.5 2020/05/31 12:27:19 mortimer Exp $ */
+/* $OpenBSD: hdtoa.c,v 1.3 2015/09/14 12:49:33 guenther Exp $ */
/*-
* Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -112,7 +112,7 @@ dorounding(char *s0, int ndigits, int sign, int *decpt)
*
* Note that the C99 standard does not specify what the leading digit
* should be for non-zero numbers. For instance, 0x1.3p3 is the same
- * as 0x2.6p2 is the same as 0x4.cp1. This implementation chooses the
+ * as 0x2.6p2 is the same as 0x4.cp3. This implementation chooses the
* first digit so that subsequent digits are aligned on nibble
* boundaries (before rounding).
*
@@ -225,7 +225,6 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
struct ieee_ext *p = (struct ieee_ext *)&e;
char *s, *s0;
int bufsize;
- int fbits = 0;
*sign = p->ext_sign;
@@ -274,24 +273,23 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
*/
for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--)
*s = 0;
-
- for (fbits = EXT_FRACLBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
+ for (; s > s0 + sigfigs - (EXT_FRACLBITS / 4) - 1 && s > s0; s--) {
*s = p->ext_fracl & 0xf;
p->ext_fracl >>= 4;
}
-#ifdef EXT_FRACLMBITS
- for (fbits = EXT_FRACLMBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
- *s = p->ext_fraclm & 0xf;
- p->ext_fraclm >>= 4;
- }
-#endif
#ifdef EXT_FRACHMBITS
- for (fbits = EXT_FRACHMBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
+ for (; s > s0; s--) {
*s = p->ext_frachm & 0xf;
p->ext_frachm >>= 4;
}
#endif
- for (fbits = EXT_FRACHBITS / 4; fbits > 0 && s > s0; s--, fbits--) {
+#ifdef EXT_FRACLMBITS
+ for (; s > s0; s--) {
+ *s = p->ext_fraclm & 0xf;
+ p->ext_fraclm >>= 4;
+ }
+#endif
+ for (; s > s0; s--) {
*s = p->ext_frach & 0xf;
p->ext_frach >>= 4;
}
@@ -302,7 +300,7 @@ __hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign,
* (partial) nibble, which is dealt with by the next
* statement. We also tack on the implicit normalization bit.
*/
- *s = (p->ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4))) & 0xf;
+ *s = p->ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4));
/* If ndigits < 0, we are expected to auto-size the precision. */
if (ndigits < 0) {
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
index 79a310495..b149f07f0 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/misc.c
@@ -40,10 +40,6 @@ THIS SOFTWARE.
static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
#endif
-#ifdef MULTIPLE_THREADS
-extern void *__dtoa_locks[];
-#endif
-
Bigint *
Balloc
#ifdef KR_headers
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c b/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
index 0fb37fded..ac2283c62 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/strtod.c
@@ -114,7 +114,10 @@ strtod
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
- decimalpoint_cache = strdup(s0);
+ if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
+ strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
+ s0 = decimalpoint_cache;
+ }
dplen = strlen(s0);
}
decimalpoint = (char*)s0;
diff --git a/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c b/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
index defb4740e..753f6bf0e 100644
--- a/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
+++ b/libc/upstream-openbsd/lib/libc/gdtoa/strtodg.c
@@ -363,7 +363,10 @@ strtodg
static int dplen;
if (!(s0 = decimalpoint_cache)) {
s0 = localeconv()->decimal_point;
- decimalpoint_cache = strdup(s0);
+ if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) {
+ strlcpy(decimalpoint_cache, s0, strlen(s0) + 1);
+ s0 = decimalpoint_cache;
+ }
dplen = strlen(s0);
}
decimalpoint = (char*)s0;
diff --git a/libc/upstream-openbsd/lib/libc/gen/fnmatch.c b/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
index d7afd5f8e..0d0f18ff4 100644
--- a/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
+++ b/libc/upstream-openbsd/lib/libc/gen/fnmatch.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: fnmatch.c,v 1.22 2020/03/13 03:25:45 djm Exp $ */
+/* $OpenBSD: fnmatch.c,v 1.19 2015/08/01 18:11:08 millert Exp $ */
/* Copyright (c) 2011, VMware, Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@@ -13,7 +13,7 @@
* * Neither the name of the VMware, Inc. nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -27,7 +27,7 @@
*/
/*
- * Copyright (c) 2008, 2016 Todd C. Miller <millert@openbsd.org>
+ * Copyright (c) 2008 Todd C. Miller <millert@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -51,9 +51,9 @@
* Filename pattern matches defined in section 2.13, "Pattern Matching Notation"
* from chapter 2. "Shell Command Language"
* http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
- * where; 1. A bracket expression starting with an unquoted <circumflex> '^'
- * character CONTINUES to specify a non-matching list; 2. an explicit <period> '.'
- * in a bracket expression matching list, e.g. "[.abc]" does NOT match a leading
+ * where; 1. A bracket expression starting with an unquoted <circumflex> '^'
+ * character CONTINUES to specify a non-matching list; 2. an explicit <period> '.'
+ * in a bracket expression matching list, e.g. "[.abc]" does NOT match a leading
* <period> in a filename; 3. a <left-square-bracket> '[' which does not introduce
* a valid bracket expression is treated as an ordinary character; 4. a differing
* number of consecutive slashes within pattern and string will NOT match;
@@ -62,10 +62,10 @@
* Bracket expansion defined in section 9.3.5, "RE Bracket Expression",
* from chapter 9, "Regular Expressions"
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05
- * with no support for collating symbols, equivalence class expressions or
- * character class expressions. A partial range expression with a leading
+ * with no support for collating symbols, equivalence class expressions or
+ * character class expressions. A partial range expression with a leading
* hyphen following a valid range expression will match only the ordinary
- * <hyphen> and the ending character (e.g. "[a-m-z]" will match characters
+ * <hyphen> and the ending character (e.g. "[a-m-z]" will match characters
* 'a' through 'm', a <hyphen> '-', or a 'z').
*
* Supports BSD extensions FNM_LEADING_DIR to match pattern to the end of one
@@ -98,21 +98,22 @@
static int
classmatch(const char *pattern, char test, int foldcase, const char **ep)
{
- const char * const mismatch = pattern;
- const char *colon;
struct cclass *cc;
- int rval = RANGE_NOMATCH;
+ const char *colon;
size_t len;
+ int rval = RANGE_NOMATCH;
+ const char * const mismatch = pattern;
- if (pattern[0] != '[' || pattern[1] != ':') {
+ if (*pattern != '[' || pattern[1] != ':') {
*ep = mismatch;
- return RANGE_ERROR;
+ return(RANGE_ERROR);
}
+
pattern += 2;
if ((colon = strchr(pattern, ':')) == NULL || colon[1] != ']') {
*ep = mismatch;
- return RANGE_ERROR;
+ return(RANGE_ERROR);
}
*ep = colon + 2;
len = (size_t)(colon - pattern);
@@ -131,11 +132,11 @@ classmatch(const char *pattern, char test, int foldcase, const char **ep)
*ep = mismatch;
rval = RANGE_ERROR;
}
- return rval;
+ return(rval);
}
/* Most MBCS/collation/case issues handled here. Wildcard '*' is not handled.
- * EOS '\0' and the FNM_PATHNAME '/' delimiters are not advanced over,
+ * EOS '\0' and the FNM_PATHNAME '/' delimiters are not advanced over,
* however the "\/" sequence is advanced to '/'.
*
* Both pattern and string are **char to support pointer increment of arbitrary
@@ -143,347 +144,341 @@ classmatch(const char *pattern, char test, int foldcase, const char **ep)
*/
static int fnmatch_ch(const char **pattern, const char **string, int flags)
{
- const char * const mismatch = *pattern;
- const int nocase = !!(flags & FNM_CASEFOLD);
- const int escape = !(flags & FNM_NOESCAPE);
- const int slash = !!(flags & FNM_PATHNAME);
- int result = FNM_NOMATCH;
- const char *startch;
- int negate;
-
- if (**pattern == '[') {
- ++*pattern;
-
- /* Handle negation, either leading ! or ^ operators */
- negate = (**pattern == '!') || (**pattern == '^');
- if (negate)
- ++*pattern;
-
- /* ']' is an ordinary char at the start of the range pattern */
- if (**pattern == ']')
- goto leadingclosebrace;
-
- while (**pattern) {
- if (**pattern == ']') {
- ++*pattern;
- /* XXX: Fix for MBCS character width */
- ++*string;
- return (result ^ negate);
- }
-
- if (escape && (**pattern == '\\')) {
- ++*pattern;
-
- /* Patterns must terminate with ']', not EOS */
- if (!**pattern)
- break;
- }
-
- /* Patterns must terminate with ']' not '/' */
- if (slash && (**pattern == '/'))
- break;
-
- /* Match character classes. */
- switch (classmatch(*pattern, **string, nocase, pattern)) {
- case RANGE_MATCH:
- result = 0;
- continue;
- case RANGE_NOMATCH:
- /* Valid character class but no match. */
- continue;
- default:
- /* Not a valid character class. */
- break;
- }
- if (!**pattern)
- break;
+ const char * const mismatch = *pattern;
+ const int nocase = !!(flags & FNM_CASEFOLD);
+ const int escape = !(flags & FNM_NOESCAPE);
+ const int slash = !!(flags & FNM_PATHNAME);
+ int result = FNM_NOMATCH;
+ const char *startch;
+ int negate;
+
+ if (**pattern == '[')
+ {
+ ++*pattern;
+
+ /* Handle negation, either leading ! or ^ operators (never both) */
+ negate = ((**pattern == '!') || (**pattern == '^'));
+ if (negate)
+ ++*pattern;
+
+ /* ']' is an ordinary character at the start of the range pattern */
+ if (**pattern == ']')
+ goto leadingclosebrace;
+
+ while (**pattern)
+ {
+ if (**pattern == ']') {
+ ++*pattern;
+ /* XXX: Fix for MBCS character width */
+ ++*string;
+ return (result ^ negate);
+ }
+
+ if (escape && (**pattern == '\\')) {
+ ++*pattern;
+
+ /* Patterns must be terminated with ']', not EOS */
+ if (!**pattern)
+ break;
+ }
+
+ /* Patterns must be terminated with ']' not '/' */
+ if (slash && (**pattern == '/'))
+ break;
+
+ /* Match character classes. */
+ if (classmatch(*pattern, **string, nocase, pattern)
+ == RANGE_MATCH) {
+ result = 0;
+ continue;
+ }
+ if (!**pattern)
+ break;
leadingclosebrace:
- /* Look at only well-formed range patterns;
- * "x-]" is not allowed unless escaped ("x-\]")
- * XXX: Fix for locale/MBCS character width
- */
- if (((*pattern)[1] == '-') && ((*pattern)[2] != ']')) {
- startch = *pattern;
- *pattern += (escape && ((*pattern)[2] == '\\')) ? 3 : 2;
-
- /*
- * NOT a properly balanced [expr] pattern, EOS
- * terminated or ranges containing a slash in
- * FNM_PATHNAME mode pattern fall out to to the
- * rewind and test '[' literal code path.
- */
- if (!**pattern || (slash && (**pattern == '/')))
- break;
-
- /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
- if ((**string >= *startch) && (**string <= **pattern))
- result = 0;
- else if (nocase &&
- (isupper((unsigned char)**string) ||
- isupper((unsigned char)*startch) ||
- isupper((unsigned char)**pattern)) &&
- (tolower((unsigned char)**string) >=
- tolower((unsigned char)*startch)) &&
- (tolower((unsigned char)**string) <=
- tolower((unsigned char)**pattern)))
- result = 0;
-
- ++*pattern;
- continue;
- }
-
- /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
- if ((**string == **pattern))
- result = 0;
- else if (nocase && (isupper((unsigned char)**string) ||
- isupper((unsigned char)**pattern)) &&
- (tolower((unsigned char)**string) ==
- tolower((unsigned char)**pattern)))
- result = 0;
-
- ++*pattern;
- }
- /*
- * NOT a properly balanced [expr] pattern;
- * Rewind and reset result to test '[' literal
- */
- *pattern = mismatch;
- result = FNM_NOMATCH;
- } else if (**pattern == '?') {
- /* Optimize '?' match before unescaping **pattern */
- if (!**string || (slash && (**string == '/')))
- return FNM_NOMATCH;
- result = 0;
- goto fnmatch_ch_success;
- } else if (escape && (**pattern == '\\') && (*pattern)[1]) {
- ++*pattern;
- }
-
- /* XXX: handle locale/MBCS comparison, advance by the MBCS char width */
- if (**string == **pattern)
- result = 0;
- else if (nocase && (isupper((unsigned char)**string) ||
- isupper((unsigned char)**pattern)) &&
- (tolower((unsigned char)**string) ==
- tolower((unsigned char)**pattern)))
- result = 0;
-
- /* Refuse to advance over trailing slash or NULs */
- if (**string == '\0' || **pattern == '\0' ||
- (slash && ((**string == '/') || (**pattern == '/'))))
- return result;
+ /* Look at only well-formed range patterns;
+ * "x-]" is not allowed unless escaped ("x-\]")
+ * XXX: Fix for locale/MBCS character width
+ */
+ if (((*pattern)[1] == '-') && ((*pattern)[2] != ']'))
+ {
+ startch = *pattern;
+ *pattern += (escape && ((*pattern)[2] == '\\')) ? 3 : 2;
+
+ /* NOT a properly balanced [expr] pattern, EOS terminated
+ * or ranges containing a slash in FNM_PATHNAME mode pattern
+ * fall out to to the rewind and test '[' literal code path
+ */
+ if (!**pattern || (slash && (**pattern == '/')))
+ break;
+
+ /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
+ if ((**string >= *startch) && (**string <= **pattern))
+ result = 0;
+ else if (nocase && (isupper((unsigned char)**string) ||
+ isupper((unsigned char)*startch) ||
+ isupper((unsigned char)**pattern))
+ && (tolower((unsigned char)**string) >=
+ tolower((unsigned char)*startch))
+ && (tolower((unsigned char)**string) <=
+ tolower((unsigned char)**pattern)))
+ result = 0;
+
+ ++*pattern;
+ continue;
+ }
+
+ /* XXX: handle locale/MBCS comparison, advance by MBCS char width */
+ if ((**string == **pattern))
+ result = 0;
+ else if (nocase && (isupper((unsigned char)**string) ||
+ isupper((unsigned char)**pattern))
+ && (tolower((unsigned char)**string) ==
+ tolower((unsigned char)**pattern)))
+ result = 0;
+
+ ++*pattern;
+ }
+
+ /* NOT a properly balanced [expr] pattern; Rewind
+ * and reset result to test '[' literal
+ */
+ *pattern = mismatch;
+ result = FNM_NOMATCH;
+ }
+ else if (**pattern == '?') {
+ /* Optimize '?' match before unescaping **pattern */
+ if (!**string || (slash && (**string == '/')))
+ return FNM_NOMATCH;
+ result = 0;
+ goto fnmatch_ch_success;
+ }
+ else if (escape && (**pattern == '\\') && (*pattern)[1]) {
+ ++*pattern;
+ }
+
+ /* XXX: handle locale/MBCS comparison, advance by the MBCS char width */
+ if (**string == **pattern)
+ result = 0;
+ else if (nocase && (isupper((unsigned char)**string) ||
+ isupper((unsigned char)**pattern))
+ && (tolower((unsigned char)**string) ==
+ tolower((unsigned char)**pattern)))
+ result = 0;
+
+ /* Refuse to advance over trailing slash or nulls
+ */
+ if (!**string || !**pattern || (slash && ((**string == '/') || (**pattern == '/'))))
+ return result;
fnmatch_ch_success:
- ++*pattern;
- ++*string;
- return result;
+ ++*pattern;
+ ++*string;
+ return result;
}
int fnmatch(const char *pattern, const char *string, int flags)
{
- static const char dummystring[2] = {' ', 0};
- const int escape = !(flags & FNM_NOESCAPE);
- const int slash = !!(flags & FNM_PATHNAME);
- const int leading_dir = !!(flags & FNM_LEADING_DIR);
- const char *dummyptr, *matchptr, *strendseg;
- int wild;
- /* For '*' wild processing only; suppress 'used before initialization'
- * warnings with dummy initialization values;
- */
- const char *strstartseg = NULL;
- const char *mismatch = NULL;
- int matchlen = 0;
-
- if (*pattern == '*')
- goto firstsegment;
-
- while (*pattern && *string) {
- /*
- * Pre-decode "\/" which has no special significance, and
- * match balanced slashes, starting a new segment pattern.
- */
- if (slash && escape && (*pattern == '\\') && (pattern[1] == '/'))
- ++pattern;
- if (slash && (*pattern == '/') && (*string == '/')) {
- ++pattern;
- ++string;
- }
+ static const char dummystring[2] = {' ', 0};
+ const int escape = !(flags & FNM_NOESCAPE);
+ const int slash = !!(flags & FNM_PATHNAME);
+ const int leading_dir = !!(flags & FNM_LEADING_DIR);
+ const char *strendseg;
+ const char *dummyptr;
+ const char *matchptr;
+ int wild;
+ /* For '*' wild processing only; surpress 'used before initialization'
+ * warnings with dummy initialization values;
+ */
+ const char *strstartseg = NULL;
+ const char *mismatch = NULL;
+ int matchlen = 0;
+
+ if (*pattern == '*')
+ goto firstsegment;
+
+ while (*pattern && *string)
+ {
+ /* Pre-decode "\/" which has no special significance, and
+ * match balanced slashes, starting a new segment pattern
+ */
+ if (slash && escape && (*pattern == '\\') && (pattern[1] == '/'))
+ ++pattern;
+ if (slash && (*pattern == '/') && (*string == '/')) {
+ ++pattern;
+ ++string;
+ }
firstsegment:
- /*
- * At the beginning of each segment, validate leading period
- * behavior.
- */
- if ((flags & FNM_PERIOD) && (*string == '.')) {
- if (*pattern == '.')
- ++pattern;
- else if (escape && (*pattern == '\\') && (pattern[1] == '.'))
- pattern += 2;
- else
- return FNM_NOMATCH;
- ++string;
- }
-
- /*
- * Determine the end of string segment. Presumes '/'
- * character is unique, not composite in any MBCS encoding
- */
- if (slash) {
- strendseg = strchr(string, '/');
- if (!strendseg)
- strendseg = strchr(string, '\0');
- } else {
- strendseg = strchr(string, '\0');
- }
-
- /*
- * Allow pattern '*' to be consumed even with no remaining
- * string to match.
- */
- while (*pattern) {
- if ((string > strendseg) ||
- ((string == strendseg) && (*pattern != '*')))
- break;
-
- if (slash && ((*pattern == '/') ||
- (escape && (*pattern == '\\') && (pattern[1] == '/'))))
- break;
-
- /*
- * Reduce groups of '*' and '?' to n '?' matches
- * followed by one '*' test for simplicity.
- */
- for (wild = 0; (*pattern == '*') || (*pattern == '?'); ++pattern) {
- if (*pattern == '*') {
- wild = 1;
- } else if (string < strendseg) { /* && (*pattern == '?') */
- /* XXX: Advance 1 char for MBCS locale */
- ++string;
- }
- else { /* (string >= strendseg) && (*pattern == '?') */
- return FNM_NOMATCH;
- }
- }
-
- if (wild) {
- strstartseg = string;
- mismatch = pattern;
-
- /*
- * Count fixed (non '*') char matches remaining
- * in pattern * excluding '/' (or "\/") and '*'.
- */
- for (matchptr = pattern, matchlen = 0; 1; ++matchlen) {
- if ((*matchptr == '\0') ||
- (slash && ((*matchptr == '/') ||
- (escape && (*matchptr == '\\') &&
- (matchptr[1] == '/'))))) {
- /* Compare precisely this many
- * trailing string chars, the
- * resulting match needs no
- * wildcard loop.
- */
- /* XXX: Adjust for MBCS */
- if (string + matchlen > strendseg)
- return FNM_NOMATCH;
-
- string = strendseg - matchlen;
- wild = 0;
- break;
- }
-
- if (*matchptr == '*') {
- /*
- * Ensure at least this many
- * trailing string chars remain
- * for the first comparison.
- */
- /* XXX: Adjust for MBCS */
- if (string + matchlen > strendseg)
- return FNM_NOMATCH;
-
- /*
- * Begin first wild comparison
- * at the current position.
- */
- break;
- }
-
- /*
- * Skip forward in pattern by a single
- * character match Use a dummy
- * fnmatch_ch() test to count one
- * "[range]" escape.
- */
- /* XXX: Adjust for MBCS */
- if (escape && (*matchptr == '\\') &&
- matchptr[1]) {
- matchptr += 2;
- } else if (*matchptr == '[') {
- dummyptr = dummystring;
- fnmatch_ch(&matchptr, &dummyptr,
- flags);
- } else {
- ++matchptr;
- }
- }
- }
-
- /* Incrementally match string against the pattern. */
- while (*pattern && (string < strendseg)) {
- /* Success; begin a new wild pattern search. */
- if (*pattern == '*')
- break;
-
- if (slash && ((*string == '/') ||
- (*pattern == '/') || (escape &&
- (*pattern == '\\') && (pattern[1] == '/'))))
- break;
-
- /*
- * Compare ch's (the pattern is advanced over
- * "\/" to the '/', but slashes will mismatch,
- * and are not consumed).
- */
- if (!fnmatch_ch(&pattern, &string, flags))
- continue;
-
- /*
- * Failed to match, loop against next char
- * offset of string segment until not enough
- * string chars remain to match the fixed
- * pattern.
- */
- if (wild) {
- /* XXX: Advance 1 char for MBCS locale */
- string = ++strstartseg;
- if (string + matchlen > strendseg)
- return FNM_NOMATCH;
-
- pattern = mismatch;
- continue;
- } else
- return FNM_NOMATCH;
- }
- }
-
- if (*string && !((slash || leading_dir) && (*string == '/')))
- return FNM_NOMATCH;
-
- if (*pattern && !(slash && ((*pattern == '/') ||
- (escape && (*pattern == '\\') && (pattern[1] == '/')))))
- return FNM_NOMATCH;
-
- if (leading_dir && !*pattern && *string == '/')
- return 0;
- }
-
- /* Where both pattern and string are at EOS, declare success. */
- if (!*string && !*pattern)
- return 0;
-
- /* Pattern didn't match to the end of string. */
- return FNM_NOMATCH;
+ /* At the beginning of each segment, validate leading period behavior.
+ */
+ if ((flags & FNM_PERIOD) && (*string == '.'))
+ {
+ if (*pattern == '.')
+ ++pattern;
+ else if (escape && (*pattern == '\\') && (pattern[1] == '.'))
+ pattern += 2;
+ else
+ return FNM_NOMATCH;
+ ++string;
+ }
+
+ /* Determine the end of string segment
+ *
+ * Presumes '/' character is unique, not composite in any MBCS encoding
+ */
+ if (slash) {
+ strendseg = strchr(string, '/');
+ if (!strendseg)
+ strendseg = strchr(string, '\0');
+ }
+ else {
+ strendseg = strchr(string, '\0');
+ }
+
+ /* Allow pattern '*' to be consumed even with no remaining string to match
+ */
+ while (*pattern)
+ {
+ if ((string > strendseg)
+ || ((string == strendseg) && (*pattern != '*')))
+ break;
+
+ if (slash && ((*pattern == '/')
+ || (escape && (*pattern == '\\')
+ && (pattern[1] == '/'))))
+ break;
+
+ /* Reduce groups of '*' and '?' to n '?' matches
+ * followed by one '*' test for simplicity
+ */
+ for (wild = 0; ((*pattern == '*') || (*pattern == '?')); ++pattern)
+ {
+ if (*pattern == '*') {
+ wild = 1;
+ }
+ else if (string < strendseg) { /* && (*pattern == '?') */
+ /* XXX: Advance 1 char for MBCS locale */
+ ++string;
+ }
+ else { /* (string >= strendseg) && (*pattern == '?') */
+ return FNM_NOMATCH;
+ }
+ }
+
+ if (wild)
+ {
+ strstartseg = string;
+ mismatch = pattern;
+
+ /* Count fixed (non '*') char matches remaining in pattern
+ * excluding '/' (or "\/") and '*'
+ */
+ for (matchptr = pattern, matchlen = 0; 1; ++matchlen)
+ {
+ if ((*matchptr == '\0')
+ || (slash && ((*matchptr == '/')
+ || (escape && (*matchptr == '\\')
+ && (matchptr[1] == '/')))))
+ {
+ /* Compare precisely this many trailing string chars,
+ * the resulting match needs no wildcard loop
+ */
+ /* XXX: Adjust for MBCS */
+ if (string + matchlen > strendseg)
+ return FNM_NOMATCH;
+
+ string = strendseg - matchlen;
+ wild = 0;
+ break;
+ }
+
+ if (*matchptr == '*')
+ {
+ /* Ensure at least this many trailing string chars remain
+ * for the first comparison
+ */
+ /* XXX: Adjust for MBCS */
+ if (string + matchlen > strendseg)
+ return FNM_NOMATCH;
+
+ /* Begin first wild comparison at the current position */
+ break;
+ }
+
+ /* Skip forward in pattern by a single character match
+ * Use a dummy fnmatch_ch() test to count one "[range]" escape
+ */
+ /* XXX: Adjust for MBCS */
+ if (escape && (*matchptr == '\\') && matchptr[1]) {
+ matchptr += 2;
+ }
+ else if (*matchptr == '[') {
+ dummyptr = dummystring;
+ fnmatch_ch(&matchptr, &dummyptr, flags);
+ }
+ else {
+ ++matchptr;
+ }
+ }
+ }
+
+ /* Incrementally match string against the pattern
+ */
+ while (*pattern && (string < strendseg))
+ {
+ /* Success; begin a new wild pattern search
+ */
+ if (*pattern == '*')
+ break;
+
+ if (slash && ((*string == '/')
+ || (*pattern == '/')
+ || (escape && (*pattern == '\\')
+ && (pattern[1] == '/'))))
+ break;
+
+ /* Compare ch's (the pattern is advanced over "\/" to the '/',
+ * but slashes will mismatch, and are not consumed)
+ */
+ if (!fnmatch_ch(&pattern, &string, flags))
+ continue;
+
+ /* Failed to match, loop against next char offset of string segment
+ * until not enough string chars remain to match the fixed pattern
+ */
+ if (wild) {
+ /* XXX: Advance 1 char for MBCS locale */
+ string = ++strstartseg;
+ if (string + matchlen > strendseg)
+ return FNM_NOMATCH;
+
+ pattern = mismatch;
+ continue;
+ }
+ else
+ return FNM_NOMATCH;
+ }
+ }
+
+ if (*string && !((slash || leading_dir) && (*string == '/')))
+ return FNM_NOMATCH;
+
+ if (*pattern && !(slash && ((*pattern == '/')
+ || (escape && (*pattern == '\\')
+ && (pattern[1] == '/')))))
+ return FNM_NOMATCH;
+
+ if (leading_dir && !*pattern && *string == '/')
+ return 0;
+ }
+
+ /* Where both pattern and string are at EOS, declare success
+ */
+ if (!*string && !*pattern)
+ return 0;
+
+ /* pattern didn't match to the end of string */
+ return FNM_NOMATCH;
}
diff --git a/libc/upstream-openbsd/lib/libc/locale/mbtowc.c b/libc/upstream-openbsd/lib/libc/locale/mbtowc.c
index 4399ed840..920f4bf26 100644
--- a/libc/upstream-openbsd/lib/libc/locale/mbtowc.c
+++ b/libc/upstream-openbsd/lib/libc/locale/mbtowc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbtowc.c,v 1.3 2016/02/27 14:02:13 schwarze Exp $ */
+/* $OpenBSD: mbtowc.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */
/*-
* Copyright (c) 2002-2004 Tim J. Robbins.
@@ -44,14 +44,7 @@ mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
return (0);
}
rval = mbrtowc(pwc, s, n, &mbs);
-
- switch (rval) {
- case (size_t)-2:
- errno = EILSEQ;
- /* FALLTHROUGH */
- case (size_t)-1:
- return -1;
- default:
- return (int)rval;
- }
+ if (rval == (size_t)-1 || rval == (size_t)-2)
+ return (-1);
+ return ((int)rval);
}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fgetln.c b/libc/upstream-openbsd/lib/libc/stdio/fgetln.c
index 903dbd606..1109cf25c 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fgetln.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fgetln.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fgetln.c,v 1.17 2017/03/17 14:53:08 deraadt Exp $ */
+/* $OpenBSD: fgetln.c,v 1.13 2015/01/05 21:58:52 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -46,7 +46,7 @@ __slbexpand(FILE *fp, size_t newsize)
if (fp->_lb._size >= newsize)
return (0);
- if ((p = recallocarray(fp->_lb._base, fp->_lb._size, newsize, 1)) == NULL)
+ if ((p = realloc(fp->_lb._base, newsize)) == NULL)
return (-1);
fp->_lb._base = p;
fp->_lb._size = newsize;
@@ -76,7 +76,7 @@ fgetln(FILE *fp, size_t *lenp)
goto error;
/* look for a newline in the input */
- if ((p = memchr(fp->_p, '\n', fp->_r)) != NULL) {
+ if ((p = memchr((void *)fp->_p, '\n', fp->_r)) != NULL) {
/*
* Found one. Flag buffer as modified to keep fseek from
* `optimising' a backward seek, in case the user stomps on
@@ -112,14 +112,12 @@ fgetln(FILE *fp, size_t *lenp)
*/
if (__slbexpand(fp, len + OPTIMISTIC))
goto error;
- (void)memcpy(fp->_lb._base + off, fp->_p, len - off);
+ (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
+ len - off);
off = len;
- if (__srefill(fp)) {
- if (fp->_flags & __SEOF)
- break;
- goto error;
- }
- if ((p = memchr(fp->_p, '\n', fp->_r)) == NULL)
+ if (__srefill(fp))
+ break; /* EOF or error: return partial line */
+ if ((p = memchr((void *)fp->_p, '\n', fp->_r)) == NULL)
continue;
/* got it: finish up the line (like code above) */
@@ -128,7 +126,8 @@ fgetln(FILE *fp, size_t *lenp)
len += diff;
if (__slbexpand(fp, len))
goto error;
- (void)memcpy(fp->_lb._base + off, fp->_p, diff);
+ (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
+ diff);
fp->_r -= diff;
fp->_p = p;
break;
@@ -143,4 +142,3 @@ error:
*lenp = 0;
return (NULL);
}
-DEF_WEAK(fgetln);
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fputwc.c b/libc/upstream-openbsd/lib/libc/stdio/fputwc.c
index e156922ad..829c22c48 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fputwc.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fputwc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fputwc.c,v 1.7 2016/01/26 13:57:02 schwarze Exp $ */
+/* $OpenBSD: fputwc.c,v 1.6 2015/10/01 02:32:07 guenther Exp $ */
/* $NetBSD: fputwc.c,v 1.3 2003/03/07 07:11:37 tshiozak Exp $ */
/*-
@@ -62,7 +62,7 @@ __fputwc_unlock(wchar_t wc, FILE *fp)
size = wcrtomb(buf, wc, st);
if (size == (size_t)-1) {
- fp->_flags |= __SERR;
+ errno = EILSEQ;
return WEOF;
}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c b/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
index ba58f9de0..1088991fd 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fvwrite.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fvwrite.c,v 1.20 2017/03/17 16:06:33 millert Exp $ */
+/* $OpenBSD: fvwrite.c,v 1.17 2009/11/09 00:18:27 kurt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,7 +35,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <unistd.h>
#include "local.h"
#include "fvwrite.h"
@@ -64,7 +63,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define COPY(n) (void)memcpy(fp->_p, p, n)
+#define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n))
iov = uio->uio_iov;
p = iov->iov_base;
@@ -106,14 +105,15 @@ __sfvwrite(FILE *fp, struct __suio *uio)
if ((fp->_flags & (__SALC | __SSTR)) ==
(__SALC | __SSTR) && fp->_w < len) {
size_t blen = fp->_p - fp->_bf._base;
- int pgmsk = getpagesize() - 1;
unsigned char *_base;
int _size;
- /* Round up to nearest page. */
- _size = ((blen + len + 1 + pgmsk) & ~pgmsk) - 1;
- _base = recallocarray(fp->_bf._base,
- fp->_bf._size + 1, _size + 1, 1);
+ /* Allocate space exponentially. */
+ _size = fp->_bf._size;
+ do {
+ _size = (_size << 1) + 1;
+ } while (_size < blen + len);
+ _base = realloc(fp->_bf._base, _size + 1);
if (_base == NULL)
goto err;
fp->_w += _size - fp->_bf._size;
@@ -164,7 +164,7 @@ __sfvwrite(FILE *fp, struct __suio *uio)
do {
GETIOV(nlknown = 0);
if (!nlknown) {
- nl = memchr(p, '\n', len);
+ nl = memchr((void *)p, '\n', len);
nldist = nl ? nl + 1 - p : len + 1;
nlknown = 1;
}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fwide.c b/libc/upstream-openbsd/lib/libc/stdio/fwide.c
index 4b93d598e..27ca0f8ac 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/fwide.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/fwide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fwide.c,v 1.6 2019/12/03 05:03:37 asou Exp $ */
+/* $OpenBSD: fwide.c,v 1.5 2015/08/31 02:53:57 guenther Exp $ */
/* $NetBSD: fwide.c,v 1.2 2003/01/18 11:29:54 thorpej Exp $ */
/*-
@@ -51,10 +51,8 @@ fwide(FILE *fp, int mode)
FLOCKFILE(fp);
wcio = WCIO_GET(fp);
- if (!wcio) {
- FUNLOCKFILE(fp);
+ if (!wcio)
return 0; /* XXX */
- }
if (wcio->wcio_mode == 0 && mode != 0)
wcio->wcio_mode = mode;
diff --git a/libc/upstream-openbsd/lib/libc/stdio/getdelim.c b/libc/upstream-openbsd/lib/libc/stdio/getdelim.c
index d709a3d18..58ff0a1be 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/getdelim.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/getdelim.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getdelim.c,v 1.6 2017/04/13 18:36:51 brynet Exp $ */
+/* $OpenBSD: getdelim.c,v 1.4 2015/08/31 02:53:57 guenther Exp $ */
/* $NetBSD: getdelim.c,v 1.13 2011/07/22 23:12:30 joerg Exp $ */
/*
@@ -73,7 +73,7 @@ getdelim(char **__restrict buf, size_t *__restrict buflen,
}
/* Scan through looking for the separator */
- p = memchr(fp->_p, sep, fp->_r);
+ p = memchr(fp->_p, sep, (size_t)fp->_r);
if (p == NULL)
len = fp->_r;
else
@@ -103,7 +103,7 @@ getdelim(char **__restrict buf, size_t *__restrict buflen,
newlen++;
}
- newb = recallocarray(*buf, *buflen, newlen, 1);
+ newb = realloc(*buf, newlen);
if (newb == NULL)
goto error;
*buf = newb;
diff --git a/libc/upstream-openbsd/lib/libc/stdio/open_memstream.c b/libc/upstream-openbsd/lib/libc/stdio/open_memstream.c
index 6ee5a5c27..f708acc50 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/open_memstream.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/open_memstream.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: open_memstream.c,v 1.8 2019/05/02 08:30:10 yasuoka Exp $ */
+/* $OpenBSD: open_memstream.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
/*
* Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
@@ -50,7 +50,7 @@ memstream_write(void *v, const char *b, int l)
if (sz < end + 1)
sz = end + 1;
- p = recallocarray(st->string, st->size, sz, 1);
+ p = realloc(st->string, sz);
if (!p)
return (-1);
bzero(p + st->size, sz - st->size);
@@ -76,7 +76,7 @@ static fpos_t
memstream_seek(void *v, fpos_t off, int whence)
{
struct state *st = v;
- size_t base = 0;
+ ssize_t base = 0;
switch (whence) {
case SEEK_SET:
@@ -89,7 +89,7 @@ memstream_seek(void *v, fpos_t off, int whence)
break;
}
- if ((off > 0 && off > SIZE_MAX - base) || (off < 0 && base < -off)) {
+ if (off > SIZE_MAX - base || off < -base) {
errno = EOVERFLOW;
return (-1);
}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/tempnam.c b/libc/upstream-openbsd/lib/libc/stdio/tempnam.c
new file mode 100644
index 000000000..d2c848c8f
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/stdio/tempnam.c
@@ -0,0 +1,100 @@
+/* $OpenBSD: tempnam.c,v 1.20 2017/11/28 06:55:49 tb Exp $ */
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <paths.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+__warn_references(tempnam,
+ "tempnam() possibly used unsafely; consider using mkstemp()");
+
+char *
+tempnam(const char *dir, const char *pfx)
+{
+ int sverrno, len;
+ char *f, *name;
+
+ if (!(name = malloc(PATH_MAX)))
+ return(NULL);
+
+ if (!pfx)
+ pfx = "tmp.";
+
+ if (issetugid() == 0 && (f = getenv("TMPDIR")) && *f != '\0') {
+ len = snprintf(name, PATH_MAX, "%s%s%sXXXXXXXXXX", f,
+ f[strlen(f) - 1] == '/' ? "" : "/", pfx);
+ if (len < 0 || len >= PATH_MAX) {
+ errno = ENAMETOOLONG;
+ goto fail;
+ }
+ if ((f = _mktemp(name)))
+ return(f);
+ }
+
+ if (dir != NULL) {
+ f = *dir ? (char *)dir : ".";
+ len = snprintf(name, PATH_MAX, "%s%s%sXXXXXXXXXX", f,
+ f[strlen(f) - 1] == '/' ? "" : "/", pfx);
+ if (len < 0 || len >= PATH_MAX) {
+ errno = ENAMETOOLONG;
+ goto fail;
+ }
+ if ((f = _mktemp(name)))
+ return(f);
+ }
+
+ f = P_tmpdir;
+ len = snprintf(name, PATH_MAX, "%s%sXXXXXXXXX", f, pfx);
+ if (len < 0 || len >= PATH_MAX) {
+ errno = ENAMETOOLONG;
+ goto fail;
+ }
+ if ((f = _mktemp(name)))
+ return(f);
+
+ f = _PATH_TMP;
+ len = snprintf(name, PATH_MAX, "%s%sXXXXXXXXX", f, pfx);
+ if (len < 0 || len >= PATH_MAX) {
+ errno = ENAMETOOLONG;
+ goto fail;
+ }
+ if ((f = _mktemp(name)))
+ return(f);
+
+fail:
+ sverrno = errno;
+ free(name);
+ errno = sverrno;
+ return(NULL);
+}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/tmpnam.c b/libc/upstream-openbsd/lib/libc/stdio/tmpnam.c
new file mode 100644
index 000000000..52cd43d94
--- /dev/null
+++ b/libc/upstream-openbsd/lib/libc/stdio/tmpnam.c
@@ -0,0 +1,53 @@
+/* $OpenBSD: tmpnam.c,v 1.12 2017/11/28 06:55:49 tb Exp $ */
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+
+#include <stdio.h>
+#include <unistd.h>
+
+__warn_references(tmpnam,
+ "tmpnam() possibly used unsafely; consider using mkstemp()");
+
+char *
+tmpnam(char *s)
+{
+ static u_long tmpcount;
+ static char buf[L_tmpnam];
+
+ if (s == NULL)
+ s = buf;
+ (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXX", P_tmpdir, tmpcount);
+ ++tmpcount;
+ return (_mktemp(s));
+}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/vasprintf.c b/libc/upstream-openbsd/lib/libc/stdio/vasprintf.c
index c2e17e7c1..98cdb4554 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/vasprintf.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/vasprintf.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: vasprintf.c,v 1.23 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: vasprintf.c,v 1.19 2015/12/28 22:08:18 mmcc Exp $ */
/*
- * Copyright (c) 1997 Todd C. Miller <millert@openbsd.org>
+ * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -20,40 +20,31 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <unistd.h>
#include "local.h"
-#define INITIAL_SIZE 128
-
int
vasprintf(char **str, const char *fmt, __va_list ap)
{
int ret;
FILE f;
struct __sfileext fext;
- const int pgsz = getpagesize();
+ unsigned char *_base;
_FILEEXT_SETUP(&f, &fext);
f._file = -1;
f._flags = __SWR | __SSTR | __SALC;
- f._bf._base = f._p = malloc(INITIAL_SIZE);
+ f._bf._base = f._p = malloc(128);
if (f._bf._base == NULL)
goto err;
- f._bf._size = f._w = INITIAL_SIZE - 1; /* leave room for the NUL */
+ f._bf._size = f._w = 127; /* Leave room for the NUL */
ret = __vfprintf(&f, fmt, ap);
if (ret == -1)
goto err;
*f._p = '\0';
- if (ret + 1 > INITIAL_SIZE && ret + 1 < pgsz / 2) {
- /* midsize allocations can try to conserve memory */
- unsigned char *_base = recallocarray(f._bf._base,
- f._bf._size + 1, ret + 1, 1);
-
- if (_base == NULL)
- goto err;
- *str = (char *)_base;
- } else
- *str = (char *)f._bf._base;
+ _base = realloc(f._bf._base, ret + 1);
+ if (_base == NULL)
+ goto err;
+ *str = (char *)_base;
return (ret);
err:
diff --git a/libc/upstream-openbsd/lib/libc/stdio/vdprintf.c b/libc/upstream-openbsd/lib/libc/stdio/vdprintf.c
index ad4ab0a76..e76fcd498 100644
--- a/libc/upstream-openbsd/lib/libc/stdio/vdprintf.c
+++ b/libc/upstream-openbsd/lib/libc/stdio/vdprintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vdprintf.c,v 1.3 2019/03/03 16:41:41 semarie Exp $ */
+/* $OpenBSD: vdprintf.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
/* $FreeBSD: src/lib/libc/stdio/vdprintf.c,v 1.4 2012/11/17 01:49:40 svnexp Exp $ */
/*-
@@ -69,6 +69,6 @@ vdprintf(int fd, const char * __restrict fmt, va_list ap)
if ((ret = __vfprintf(&f, fmt, ap)) < 0)
return ret;
- return __sflush(&f) ? EOF : ret;
+ return fflush(&f) ? EOF : ret;
}
DEF_WEAK(vdprintf);
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c b/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c
deleted file mode 100644
index a2f37fe81..000000000
--- a/libc/upstream-openbsd/lib/libc/stdlib/recallocarray.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */
-/*
- * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
- * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
- */
-#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
-
-void *
-recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
-{
- size_t oldsize, newsize;
- void *newptr;
-
- if (ptr == NULL)
- return calloc(newnmemb, size);
-
- if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
- newnmemb > 0 && SIZE_MAX / newnmemb < size) {
- errno = ENOMEM;
- return NULL;
- }
- newsize = newnmemb * size;
-
- if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
- oldnmemb > 0 && SIZE_MAX / oldnmemb < size) {
- errno = EINVAL;
- return NULL;
- }
- oldsize = oldnmemb * size;
-
- /*
- * Don't bother too much if we're shrinking just a bit,
- * we do not shrink for series of small steps, oh well.
- */
- if (newsize <= oldsize) {
- size_t d = oldsize - newsize;
-
- if (d < oldsize / 2 && d < getpagesize()) {
- memset((char *)ptr + newsize, 0, d);
- return ptr;
- }
- }
-
- newptr = malloc(newsize);
- if (newptr == NULL)
- return NULL;
-
- if (newsize > oldsize) {
- memcpy(newptr, ptr, oldsize);
- memset((char *)newptr + oldsize, 0, newsize - oldsize);
- } else
- memcpy(newptr, ptr, newsize);
-
- explicit_bzero(ptr, oldsize);
- free(ptr);
-
- return newptr;
-}
-DEF_WEAK(recallocarray);
diff --git a/libc/upstream-openbsd/lib/libc/stdlib/setenv.c b/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
index 15c550ba3..e55a1feb6 100644
--- a/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
+++ b/libc/upstream-openbsd/lib/libc/stdlib/setenv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setenv.c,v 1.19 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: setenv.c,v 1.16 2015/09/13 08:31:47 guenther Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
+extern char **environ;
static char **lastenv; /* last value of environ */
/*
@@ -43,7 +44,7 @@ int
putenv(char *str)
{
char **P, *cp;
- size_t cnt = 0;
+ size_t cnt;
int offset = 0;
for (cp = str; *cp && *cp != '='; ++cp)
@@ -65,15 +66,13 @@ putenv(char *str)
}
/* create new slot for string */
- if (environ != NULL) {
- for (P = environ; *P != NULL; P++)
- ;
- cnt = P - environ;
- }
+ for (P = environ; *P != NULL; P++)
+ ;
+ cnt = P - environ;
P = reallocarray(lastenv, cnt + 2, sizeof(char *));
if (!P)
return (-1);
- if (lastenv != environ && environ != NULL)
+ if (lastenv != environ)
memcpy(P, environ, cnt * sizeof(char *));
lastenv = environ = P;
environ[cnt] = str;
@@ -124,24 +123,22 @@ setenv(const char *name, const char *value, int rewrite)
break;
}
} else { /* create new slot */
- size_t cnt = 0;
+ size_t cnt;
- if (environ != NULL) {
- for (P = environ; *P != NULL; P++)
- ;
- cnt = P - environ;
- }
+ for (P = environ; *P != NULL; P++)
+ ;
+ cnt = P - environ;
P = reallocarray(lastenv, cnt + 2, sizeof(char *));
if (!P)
return (-1);
- if (lastenv != environ && environ != NULL)
+ if (lastenv != environ)
memcpy(P, environ, cnt * sizeof(char *));
lastenv = environ = P;
offset = cnt;
environ[cnt + 1] = NULL;
}
if (!(environ[offset] = /* name + `=' + value */
- malloc((int)(np - name) + l_value + 2)))
+ malloc((size_t)((int)(np - name) + l_value + 2))))
return (-1);
for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
;
diff --git a/libc/upstream-openbsd/lib/libc/string/memmem.c b/libc/upstream-openbsd/lib/libc/string/memmem.c
deleted file mode 100644
index 3b180b4a6..000000000
--- a/libc/upstream-openbsd/lib/libc/string/memmem.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $OpenBSD: memmem.c,v 1.5 2020/04/16 12:39:28 claudio Exp $ */
-
-/*
- * Copyright (c) 2005-2020 Rich Felker, et al.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <string.h>
-#include <stdint.h>
-
-static char *
-twobyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
-{
- uint16_t nw = n[0]<<8 | n[1], hw = h[0]<<8 | h[1];
- for (h+=2, k-=2; k; k--, hw = hw<<8 | *h++)
- if (hw == nw) return (char *)h-2;
- return hw == nw ? (char *)h-2 : 0;
-}
-
-static char *
-threebyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
-{
- uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8;
- uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8;
- for (h+=3, k-=3; k; k--, hw = (hw|*h++)<<8)
- if (hw == nw) return (char *)h-3;
- return hw == nw ? (char *)h-3 : 0;
-}
-
-static char *
-fourbyte_memmem(const unsigned char *h, size_t k, const unsigned char *n)
-{
- uint32_t nw = n[0]<<24 | n[1]<<16 | n[2]<<8 | n[3];
- uint32_t hw = h[0]<<24 | h[1]<<16 | h[2]<<8 | h[3];
- for (h+=4, k-=4; k; k--, hw = hw<<8 | *h++)
- if (hw == nw) return (char *)h-4;
- return hw == nw ? (char *)h-4 : 0;
-}
-
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#define MIN(a,b) ((a)<(b)?(a):(b))
-
-#define BITOP(a,b,op) \
- ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a))))
-
-/*
- * Maxime Crochemore and Dominique Perrin, Two-way string-matching,
- * Journal of the ACM, 38(3):651-675, July 1991.
- */
-static char *
-twoway_memmem(const unsigned char *h, const unsigned char *z,
- const unsigned char *n, size_t l)
-{
- size_t i, ip, jp, k, p, ms, p0, mem, mem0;
- size_t byteset[32 / sizeof(size_t)] = { 0 };
- size_t shift[256];
-
- /* Computing length of needle and fill shift table */
- for (i=0; i<l; i++)
- BITOP(byteset, n[i], |=), shift[n[i]] = i+1;
-
- /* Compute maximal suffix */
- ip = -1; jp = 0; k = p = 1;
- while (jp+k<l) {
- if (n[ip+k] == n[jp+k]) {
- if (k == p) {
- jp += p;
- k = 1;
- } else k++;
- } else if (n[ip+k] > n[jp+k]) {
- jp += k;
- k = 1;
- p = jp - ip;
- } else {
- ip = jp++;
- k = p = 1;
- }
- }
- ms = ip;
- p0 = p;
-
- /* And with the opposite comparison */
- ip = -1; jp = 0; k = p = 1;
- while (jp+k<l) {
- if (n[ip+k] == n[jp+k]) {
- if (k == p) {
- jp += p;
- k = 1;
- } else k++;
- } else if (n[ip+k] < n[jp+k]) {
- jp += k;
- k = 1;
- p = jp - ip;
- } else {
- ip = jp++;
- k = p = 1;
- }
- }
- if (ip+1 > ms+1) ms = ip;
- else p = p0;
-
- /* Periodic needle? */
- if (memcmp(n, n+p, ms+1)) {
- mem0 = 0;
- p = MAX(ms, l-ms-1) + 1;
- } else mem0 = l-p;
- mem = 0;
-
- /* Search loop */
- for (;;) {
- /* If remainder of haystack is shorter than needle, done */
- if (z-h < l) return 0;
-
- /* Check last byte first; advance by shift on mismatch */
- if (BITOP(byteset, h[l-1], &)) {
- k = l-shift[h[l-1]];
- if (k) {
- if (k < mem) k = mem;
- h += k;
- mem = 0;
- continue;
- }
- } else {
- h += l;
- mem = 0;
- continue;
- }
-
- /* Compare right half */
- for (k=MAX(ms+1,mem); k<l && n[k] == h[k]; k++);
- if (k < l) {
- h += k-ms;
- mem = 0;
- continue;
- }
- /* Compare left half */
- for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k <= mem) return (char *)h;
- h += p;
- mem = mem0;
- }
-}
-
-void *
-memmem(const void *h0, size_t k, const void *n0, size_t l)
-{
- const unsigned char *h = h0, *n = n0;
-
- /* Return immediately on empty needle */
- if (!l) return (void *)h;
-
- /* Return immediately when needle is longer than haystack */
- if (k<l) return 0;
-
- /* Use faster algorithms for short needles */
- h = memchr(h0, *n, k);
- if (!h || l==1) return (void *)h;
- k -= h - (const unsigned char *)h0;
- if (k<l) return 0;
- if (l==2) return twobyte_memmem(h, k, n);
- if (l==3) return threebyte_memmem(h, k, n);
- if (l==4) return fourbyte_memmem(h, k, n);
-
- return twoway_memmem(h, h+k, n, l);
-}
-DEF_WEAK(memmem);
diff --git a/libc/upstream-openbsd/lib/libc/string/strstr.c b/libc/upstream-openbsd/lib/libc/string/strstr.c
index 241a080e7..079d69d25 100644
--- a/libc/upstream-openbsd/lib/libc/string/strstr.c
+++ b/libc/upstream-openbsd/lib/libc/string/strstr.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: strstr.c,v 1.9 2020/04/16 12:37:52 claudio Exp $ */
+/* $OpenBSD: strstr.c,v 1.8 2018/04/30 07:44:56 denis Exp $ */
/*
- * Copyright (c) 2005-2018 Rich Felker
+ * Copyright (c) 2005-2014 Rich Felker
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,8 +24,13 @@
*/
#include <string.h>
+#include <stdlib.h>
#include <stdint.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
static char *
twobyte_strstr(const unsigned char *h, const unsigned char *n)
{
@@ -141,8 +146,11 @@ twoway_strstr(const unsigned char *h, const unsigned char *n)
/* Check last byte first; advance by shift on mismatch */
if (BITOP(byteset, h[l-1], &)) {
k = l-shift[h[l-1]];
+#ifdef DEBUG
+ printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l);
+#endif
if (k) {
- if (k < mem) k = mem;
+ if (mem0 && mem && k < p) k = l-p;
h += k;
mem = 0;
continue;
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 750a6e26f..8e3a3fc25 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -1,26 +1,10 @@
//
// libdl
//
-package {
- default_applicable_licenses: ["bionic_libdl_license"],
-}
-
-license {
- name: "bionic_libdl_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_library_static {
name: "libdl_static",
defaults: ["linux_bionic_supported"],
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
@@ -41,8 +25,6 @@ cc_library_static {
stl: "none",
system_shared_libs: [],
- header_libs: ["libc_headers"],
- export_header_lib_headers: ["libc_headers"],
sanitize: {
never: true,
@@ -52,7 +34,6 @@ cc_library_static {
cc_library {
name: "libdl",
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
static_ndk_lib: true,
@@ -73,7 +54,7 @@ cc_library {
"-Wl,--exclude-libs=libgcc_stripped.a",
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
- "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -116,7 +97,6 @@ cc_library {
nocrt: true,
system_shared_libs: [],
- header_libs: ["libc_headers"],
// Opt out of native_coverage when opting out of system_shared_libs
native_coverage: false,
@@ -133,21 +113,14 @@ cc_library {
symbol_file: "libdl.map.txt",
versions: [
"29",
- "current",
+ "10000",
],
},
- llndk: {
- symbol_file: "libdl.map.txt",
- },
apex_available: [
"//apex_available:platform",
"com.android.runtime",
],
-
- lto: {
- never: true,
- },
}
cc_library {
@@ -155,7 +128,6 @@ cc_library {
defaults: ["linux_bionic_supported"],
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
@@ -173,7 +145,7 @@ cc_library {
"-Wl,--exclude-libs=libgcc_stripped.a",
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
- "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -203,7 +175,6 @@ cc_library {
nocrt: true,
system_shared_libs: [],
- header_libs: ["libc_headers"],
// Opt out of native_coverage when opting out of system_shared_libs
native_coverage: false,
@@ -218,25 +189,28 @@ cc_library {
stubs: {
symbol_file: "libdl_android.map.txt",
- versions: ["current"],
+ versions: ["10000"],
},
apex_available: [
"//apex_available:platform",
"com.android.runtime",
],
-
- lto: {
- never: true,
- },
}
ndk_library {
name: "libdl",
+ native_bridge_supported: true,
symbol_file: "libdl.map.txt",
first_version: "9",
}
+llndk_library {
+ name: "libdl",
+ native_bridge_supported: true,
+ symbol_file: "libdl.map.txt",
+}
+
genrule {
name: "libdl.arm.map",
out: ["libdl.arm.map"],
diff --git a/libdl/NOTICE b/libdl/NOTICE
index fce010459..d64569567 100644
--- a/libdl/NOTICE
+++ b/libdl/NOTICE
@@ -1,32 +1,202 @@
-Copyright (C) 2007 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
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
- http://www.apache.org/licenses/LICENSE-2.0
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-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.
+ 1. Definitions.
--------------------------------------------------------------------
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
-Copyright (C) 2016 The Android Open Source Project
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
-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
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
- http://www.apache.org/licenses/LICENSE-2.0
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
-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.
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
--------------------------------------------------------------------
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/libfdtrack/.clang-format b/libfdtrack/.clang-format
index 7cab60ce3..fd0645fdf 120000
--- a/libfdtrack/.clang-format
+++ b/libfdtrack/.clang-format
@@ -1 +1 @@
-../.clang-format \ No newline at end of file
+../.clang-format-2 \ No newline at end of file
diff --git a/libfdtrack/Android.bp b/libfdtrack/Android.bp
index fb28623ef..a907d9ae0 100644
--- a/libfdtrack/Android.bp
+++ b/libfdtrack/Android.bp
@@ -1,18 +1,3 @@
-package {
- default_applicable_licenses: ["bionic_libfdtrack_license"],
-}
-
-license {
- name: "bionic_libfdtrack_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-BSD",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_library_shared {
name: "libfdtrack",
srcs: ["fdtrack.cpp"],
diff --git a/libfdtrack/NOTICE b/libfdtrack/NOTICE
deleted file mode 100644
index 744e56c69..000000000
--- a/libfdtrack/NOTICE
+++ /dev/null
@@ -1,56 +0,0 @@
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
diff --git a/libfdtrack/fdtrack.cpp b/libfdtrack/fdtrack.cpp
index 2e9cfbcd0..d37157799 100644
--- a/libfdtrack/fdtrack.cpp
+++ b/libfdtrack/fdtrack.cpp
@@ -31,12 +31,9 @@
#include <array>
#include <mutex>
-#include <thread>
-#include <utility>
#include <vector>
#include <android/fdsan.h>
-#include <android/set_abort_message.h>
#include <bionic/fdtrack.h>
#include <android-base/no_destructor.h>
@@ -51,7 +48,6 @@ struct FdEntry {
};
extern "C" void fdtrack_dump();
-extern "C" void fdtrack_dump_fatal();
using fdtrack_callback_t = bool (*)(int fd, const char* const* function_names,
const uint64_t* function_offsets, size_t count, void* arg);
@@ -61,10 +57,7 @@ static void fd_hook(android_fdtrack_event* event);
// Backtraces for the first 4k file descriptors ought to be enough to diagnose an fd leak.
static constexpr size_t kFdTableSize = 4096;
-
-// 32 frames, plus two to skip from fdtrack itself.
-static constexpr size_t kStackDepth = 34;
-static constexpr size_t kStackFrameSkip = 2;
+static constexpr size_t kStackDepth = 10;
static bool installed = false;
static std::array<FdEntry, kFdTableSize> stack_traces [[clang::no_destroy]];
@@ -78,23 +71,11 @@ __attribute__((constructor)) static void ctor() {
entry.backtrace.reserve(kStackDepth);
}
- struct sigaction sa = {};
- sa.sa_sigaction = [](int, siginfo_t* siginfo, void*) {
- if (siginfo->si_code == SI_QUEUE && siginfo->si_int == 1) {
- fdtrack_dump_fatal();
- } else {
- fdtrack_dump();
- }
- };
- sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
- sigaction(BIONIC_SIGNAL_FDTRACK, &sa, nullptr);
-
+ signal(BIONIC_SIGNAL_FDTRACK, [](int) { fdtrack_dump(); });
if (Unwinder().Init()) {
android_fdtrack_hook_t expected = nullptr;
installed = android_fdtrack_compare_exchange_hook(&expected, &fd_hook);
}
-
- android_fdtrack_set_globally_enabled(true);
}
__attribute__((destructor)) static void dtor() {
@@ -153,14 +134,15 @@ void fdtrack_iterate(fdtrack_callback_t callback, void* arg) {
continue;
}
- for (size_t i = kStackFrameSkip; i < entry->backtrace.size(); ++i) {
- size_t j = i - kStackFrameSkip;
+ constexpr size_t frame_skip = 2;
+ for (size_t i = frame_skip; i < entry->backtrace.size(); ++i) {
+ size_t j = i - frame_skip;
function_names[j] = entry->backtrace[i].function_name.c_str();
function_offsets[j] = entry->backtrace[i].function_offset;
}
- bool should_continue = callback(fd, function_names, function_offsets,
- entry->backtrace.size() - kStackFrameSkip, arg);
+ bool should_continue =
+ callback(fd, function_names, function_offsets, entry->backtrace.size() - frame_skip, arg);
entry->mutex.unlock();
@@ -172,47 +154,16 @@ void fdtrack_iterate(fdtrack_callback_t callback, void* arg) {
android_fdtrack_set_enabled(prev);
}
-static size_t hash_stack(const char* const* function_names, const uint64_t* function_offsets,
- size_t stack_depth) {
- size_t hash = 0;
- for (size_t i = 0; i < stack_depth; ++i) {
- // To future maintainers: if a libc++ update ever makes this invalid, replace this with +.
- hash = std::__hash_combine(hash, std::hash<std::string_view>()(function_names[i]));
- hash = std::__hash_combine(hash, std::hash<uint64_t>()(function_offsets[i]));
- }
- return hash;
-}
-
-static void fdtrack_dump_impl(bool fatal) {
+void fdtrack_dump() {
if (!installed) {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fdtrack not installed");
} else {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fdtrack dumping...");
}
- // If we're aborting, identify the most common stack in the hopes that it's the culprit,
- // and emit that in the abort message so crash reporting can separate different fd leaks out.
- // This is horrible and quadratic, but we need to avoid allocation since this can happen in
- // response to a signal generated asynchronously. We're only going to dump 1k fds by default,
- // and we're about to blow up the entire system, so this isn't too expensive.
- struct StackInfo {
- size_t hash = 0;
- size_t count = 0;
-
- size_t stack_depth = 0;
- const char* function_names[kStackDepth - kStackFrameSkip];
- uint64_t function_offsets[kStackDepth - kStackFrameSkip];
- };
- struct StackList {
- size_t count = 0;
- std::array<StackInfo, 128> data;
- };
- static StackList stacks;
-
fdtrack_iterate(
- [](int fd, const char* const* function_names, const uint64_t* function_offsets,
- size_t stack_depth, void* stacks_ptr) {
- auto stacks = static_cast<StackList*>(stacks_ptr);
+ [](int fd, const char* const* function_names, const uint64_t* function_offsets, size_t count,
+ void*) {
uint64_t fdsan_owner = android_fdsan_get_owner_tag(fd);
if (fdsan_owner != 0) {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (owner = 0x%" PRIx64 ")", fd,
@@ -221,81 +172,12 @@ static void fdtrack_dump_impl(bool fatal) {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", "fd %d: (unowned)", fd);
}
- for (size_t i = 0; i < stack_depth; ++i) {
+ for (size_t i = 0; i < count; ++i) {
async_safe_format_log(ANDROID_LOG_INFO, "fdtrack", " %zu: %s+%" PRIu64, i,
function_names[i], function_offsets[i]);
}
- if (stacks) {
- size_t hash = hash_stack(function_names, function_offsets, stack_depth);
- bool found_stack = false;
- for (size_t i = 0; i < stacks->count; ++i) {
- if (stacks->data[i].hash == hash) {
- ++stacks->data[i].count;
- found_stack = true;
- break;
- }
- }
-
- if (!found_stack) {
- if (stacks->count < stacks->data.size()) {
- auto& stack = stacks->data[stacks->count++];
- stack.hash = hash;
- stack.count = 1;
- stack.stack_depth = stack_depth;
- for (size_t i = 0; i < stack_depth; ++i) {
- stack.function_names[i] = function_names[i];
- stack.function_offsets[i] = function_offsets[i];
- }
- }
- }
- }
-
return true;
},
- fatal ? &stacks : nullptr);
-
- if (fatal) {
- // Find the most common stack.
- size_t max = 0;
- StackInfo* stack = nullptr;
- for (size_t i = 0; i < stacks.count; ++i) {
- if (stacks.data[i].count > max) {
- stack = &stacks.data[i];
- max = stack->count;
- }
- }
-
- static char buf[1024];
-
- if (!stack) {
- async_safe_format_buffer(buf, sizeof(buf),
- "aborting due to fd leak: failed to find most common stack");
- } else {
- char* p = buf;
- p += async_safe_format_buffer(buf, sizeof(buf),
- "aborting due to fd leak: most common stack =\n");
-
- for (size_t i = 0; i < stack->stack_depth; ++i) {
- ssize_t bytes_left = buf + sizeof(buf) - p;
- if (bytes_left > 0) {
- p += async_safe_format_buffer(p, buf + sizeof(buf) - p, " %zu: %s+%" PRIu64 "\n", i,
- stack->function_names[i], stack->function_offsets[i]);
- }
- }
- }
-
- android_set_abort_message(buf);
-
- // Abort on a different thread to avoid ART dumping runtime stacks.
- std::thread([]() { abort(); }).join();
- }
-}
-
-void fdtrack_dump() {
- fdtrack_dump_impl(false);
-}
-
-void fdtrack_dump_fatal() {
- fdtrack_dump_impl(true);
+ nullptr);
}
diff --git a/libfdtrack/libfdtrack.map.txt b/libfdtrack/libfdtrack.map.txt
index 6c4015c00..7a23954d8 100644
--- a/libfdtrack/libfdtrack.map.txt
+++ b/libfdtrack/libfdtrack.map.txt
@@ -1,7 +1,6 @@
LIBFDTRACK {
global:
fdtrack_dump;
- fdtrack_dump_fatal;
fdtrack_iterate;
local:
*;
diff --git a/libm/Android.bp b/libm/Android.bp
index 6c3abd129..1c4fe551a 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -1,29 +1,12 @@
+bionic_coverage = false
+
//
// libm.so and libm.a for target.
//
-package {
- default_applicable_licenses: ["bionic_libm_license"],
-}
-
-license {
- name: "bionic_libm_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-BSD",
- "SPDX-license-identifier-MIT",
- "legacy_unencumbered",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_library {
name: "libm",
defaults: ["linux_bionic_supported"],
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
static_ndk_lib: true,
@@ -304,11 +287,6 @@ cc_library {
pack_relocations: false,
ldflags: ["-Wl,--hash-style=both"],
version_script: ":libm.arm.map",
- no_libcrt: true,
- shared: {
- // For backwards-compatibility, some arm32 builtins are exported from libm.so.
- static_libs: ["libclang_rt.builtins-arm-android-exported"],
- },
},
arm64: {
@@ -492,7 +470,6 @@ cc_library {
"-fno-math-errno",
"-Wall",
"-Werror",
- "-Wno-ignored-pragmas",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-sign-compare",
@@ -511,6 +488,7 @@ cc_library {
include_dirs: ["bionic/libc"],
system_shared_libs: ["libc"],
+ native_coverage: bionic_coverage,
sanitize: {
address: false,
fuzzer: false,
@@ -523,30 +501,29 @@ cc_library {
symbol_file: "libm.map.txt",
versions: [
"29",
- "current",
+ "10000",
],
},
- llndk: {
- symbol_file: "libm.map.txt",
- },
-
apex_available: [
"//apex_available:platform",
"com.android.runtime",
],
-
- lto: {
- never: true,
- },
}
ndk_library {
name: "libm",
+ native_bridge_supported: true,
symbol_file: "libm.map.txt",
first_version: "9",
}
+llndk_library {
+ name: "libm",
+ native_bridge_supported: true,
+ symbol_file: "libm.map.txt",
+}
+
genrule {
name: "libm.arm.map",
out: ["libm.arm.map"],
diff --git a/libm/NOTICE b/libm/NOTICE
deleted file mode 100644
index 62d253b3a..000000000
--- a/libm/NOTICE
+++ /dev/null
@@ -1,1158 +0,0 @@
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-Optimized by Bruce D. Evans.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-k_sinf.c and k_cosf.c merged by Steven G. Kargl.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-s_sin.c and s_cos.c merged by Steven G. Kargl. Descriptions of the
-algorithms are contained in the original files.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-Optimized by Bruce D. Evans.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-k_sin.c and k_cos.c merged by Steven G. Kargl.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-Optimized by Bruce D. Evans.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-k_sinl.c and k_cosl.c merged by Steven G. Kargl
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-Copyright (c) 2009-2011, Bruce D. Evans, Steven G. Kargl, David Schultz.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-====================================================
-
-The argument reduction and testing for exceptional cases was
-written by Steven G. Kargl with input from Bruce D. Evans
-and David A. Schultz.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
-
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-====================================================
-Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
-Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
-
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-Copyright (C) 2013 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2015 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2017 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 1985, 1993
- The Regents of the University of California. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 1988, 1993
- The Regents of the University of California. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by the University of
- California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 1992, 1993
- The Regents of the University of California. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003 Dag-Erling Smørgrav
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer
- in this position and unchanged.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
-Copyright (c) 2002 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, Steven G. Kargl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004 Stefan Farfeleder
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005-2008 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005-2011 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007 David Schultz
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-Derived from s_modf.c, which has the following Copyright:
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007 Steven G. Kargl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007 The NetBSD Foundation, Inc.
-All rights reserved.
-
-This code is derived from software written by Stephen L. Moshier.
-It is redistributed by the NetBSD Foundation by permission of the author.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2010-2013 Steven G. Kargl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-s_sinl.c and s_cosl.c merged by Steven G. Kargl.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007-2008 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007-2013 Bruce D. Evans
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2009-2013 Steven G. Kargl
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Optimized by Bruce D. Evans.
-
--------------------------------------------------------------------
-
-Copyright (c) 2011 David Schultz
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2011 David Schultz <das@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
-Copyright (c) 2017 Mahdi Mokhtari <mmokhi@FreeBSD.org>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2013 Bruce D. Evans
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice unmodified, this list of conditions, and the following
- disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2013-2014, NVIDIA Corporation. All rights reserved.
-Johnny Qiu <joqiu@nvidia.com>
-Shu Zhang <chazhang@nvidia.com>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of The Linux Foundation nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 2014, Intel Corporation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
-
- * Neither the name of Intel Corporation nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-From: @(#)s_ilogb.c 5.1 93/09/24
-====================================================
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunPro, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
--------------------------------------------------------------------
-
diff --git a/libm/arm64/lrint.S b/libm/arm64/lrint.S
index e835d0835..5f95ae817 100644
--- a/libm/arm64/lrint.S
+++ b/libm/arm64/lrint.S
@@ -32,5 +32,3 @@ END(lrintf)
ALIAS_SYMBOL(llrint, lrint);
ALIAS_SYMBOL(llrintf, lrintf);
-
-NOTE_GNU_PROPERTY()
diff --git a/libm/arm64/sqrt.S b/libm/arm64/sqrt.S
index 0659b13a8..3a58ef364 100644
--- a/libm/arm64/sqrt.S
+++ b/libm/arm64/sqrt.S
@@ -25,5 +25,3 @@ ENTRY(sqrtf)
fsqrt s0, s0
ret
END(sqrtf)
-
-NOTE_GNU_PROPERTY()
diff --git a/libm/upstream-freebsd/lib/msun/bsdsrc/b_exp.c b/libm/upstream-freebsd/lib/msun/bsdsrc/b_exp.c
index 89a290529..febc1adb5 100644
--- a/libm/upstream-freebsd/lib/msun/bsdsrc/b_exp.c
+++ b/libm/upstream-freebsd/lib/msun/bsdsrc/b_exp.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@@ -12,7 +12,11 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,7 +35,7 @@
/* @(#)exp.c 8.1 (Berkeley) 6/4/93 */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/bsdsrc/b_exp.c 325966 2017-11-18 14:26:50Z pfg $");
/* EXP(X)
diff --git a/libm/upstream-freebsd/lib/msun/bsdsrc/b_log.c b/libm/upstream-freebsd/lib/msun/bsdsrc/b_log.c
index c164dfa50..810222602 100644
--- a/libm/upstream-freebsd/lib/msun/bsdsrc/b_log.c
+++ b/libm/upstream-freebsd/lib/msun/bsdsrc/b_log.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -12,7 +12,11 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,7 +35,7 @@
/* @(#)log.c 8.2 (Berkeley) 11/30/93 */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/bsdsrc/b_log.c 326670 2017-12-07 20:41:23Z dim $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c b/libm/upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c
index 5cb1f93f2..e53064993 100644
--- a/libm/upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c
+++ b/libm/upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -12,7 +12,11 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,7 +35,7 @@
/* @(#)gamma.c 8.1 (Berkeley) 6/4/93 */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/bsdsrc/b_tgamma.c 325966 2017-11-18 14:26:50Z pfg $");
/*
* This code by P. McIlroy, Oct 1992;
diff --git a/libm/upstream-freebsd/lib/msun/bsdsrc/mathimpl.h b/libm/upstream-freebsd/lib/msun/bsdsrc/mathimpl.h
index abf299658..e38ea4fe1 100644
--- a/libm/upstream-freebsd/lib/msun/bsdsrc/mathimpl.h
+++ b/libm/upstream-freebsd/lib/msun/bsdsrc/mathimpl.h
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)mathimpl.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/bsdsrc/mathimpl.h 325966 2017-11-18 14:26:50Z pfg $
*/
#ifndef _MATHIMPL_H_
diff --git a/libm/upstream-freebsd/lib/msun/ld128/e_powl.c b/libm/upstream-freebsd/lib/msun/ld128/e_powl.c
index 12b92a1a9..2f3ee554c 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/e_powl.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/e_powl.c
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/e_powl.c 342651 2018-12-31 15:43:06Z pfg $");
#include <float.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/ld128/e_rem_pio2l.h b/libm/upstream-freebsd/lib/msun/ld128/e_rem_pio2l.h
index fcef399a8..1ed79ae4e 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/e_rem_pio2l.h
+++ b/libm/upstream-freebsd/lib/msun/ld128/e_rem_pio2l.h
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/e_rem_pio2l.h 336545 2018-07-20 12:42:24Z bde $");
/* ld128 version of __ieee754_rem_pio2l(x,y)
*
diff --git a/libm/upstream-freebsd/lib/msun/ld128/invtrig.c b/libm/upstream-freebsd/lib/msun/ld128/invtrig.c
index ab93732c8..e89a2262d 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/invtrig.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/invtrig.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/invtrig.c 326219 2017-11-26 02:00:33Z pfg $");
#include "invtrig.h"
diff --git a/libm/upstream-freebsd/lib/msun/ld128/invtrig.h b/libm/upstream-freebsd/lib/msun/ld128/invtrig.h
index 423b56847..fd1302a93 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/invtrig.h
+++ b/libm/upstream-freebsd/lib/msun/ld128/invtrig.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/ld128/invtrig.h 326219 2017-11-26 02:00:33Z pfg $
*/
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/ld128/k_expl.h b/libm/upstream-freebsd/lib/msun/ld128/k_expl.h
index 159338fe3..b80d00ebf 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/k_expl.h
+++ b/libm/upstream-freebsd/lib/msun/ld128/k_expl.h
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/k_expl.h 336545 2018-07-20 12:42:24Z bde $");
/*
* ld128 version of k_expl.h. See ../ld80/s_expl.c for most comments.
@@ -265,8 +265,7 @@ __k_expl(long double x, long double *hip, long double *lop, int *kp)
/*
* XXX: the rest of the functions are identical for ld80 and ld128.
* However, we should use scalbnl() for ld128, since long double
- * multiplication was very slow on sparc64 and no new evaluation has
- * been made for aarch64 and/or riscv.
+ * multiplication is very slow on the only supported ld128 arch (sparc64).
*/
static inline void
@@ -300,7 +299,7 @@ hexpl(long double x)
static inline long double complex
__ldexp_cexpl(long double complex z, int expt)
{
- long double c, exp_x, hi, lo, s;
+ long double exp_x, hi, lo;
long double x, y, scale1, scale2;
int half_expt, k;
@@ -308,17 +307,16 @@ __ldexp_cexpl(long double complex z, int expt)
y = cimagl(z);
__k_expl(x, &hi, &lo, &k);
- exp_x = (lo + hi) * 0x1p16382L;
+ exp_x = (lo + hi) * 0x1p16382;
expt += k - 16382;
scale1 = 1;
half_expt = expt / 2;
SET_LDBL_EXPSIGN(scale1, BIAS + half_expt);
scale2 = 1;
- SET_LDBL_EXPSIGN(scale2, BIAS + expt - half_expt);
+ SET_LDBL_EXPSIGN(scale1, BIAS + expt - half_expt);
- sincosl(y, &s, &c);
- return (CMPLXL(c * exp_x * scale1 * scale2,
- s * exp_x * scale1 * scale2));
+ return (CMPLXL(cos(y) * exp_x * scale1 * scale2,
+ sinl(y) * exp_x * scale1 * scale2));
}
#endif /* _COMPLEX_H */
diff --git a/libm/upstream-freebsd/lib/msun/ld128/s_exp2l.c b/libm/upstream-freebsd/lib/msun/ld128/s_exp2l.c
index ee3d2c782..effeb78ca 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/s_exp2l.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/s_exp2l.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/s_exp2l.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#include <stdint.h>
diff --git a/libm/upstream-freebsd/lib/msun/ld128/s_expl.c b/libm/upstream-freebsd/lib/msun/ld128/s_expl.c
index 5b786af49..f4c18be60 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/s_expl.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/s_expl.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/s_expl.c 336545 2018-07-20 12:42:24Z bde $");
/*
* ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments.
@@ -92,10 +92,7 @@ expl(long double x)
t = SUM2P(hi, lo);
/* Scale by 2**k. */
- /*
- * XXX sparc64 multiplication was so slow that scalbnl() is faster,
- * but performance on aarch64 and riscv hasn't yet been quantified.
- */
+ /* XXX sparc64 multiplication is so slow that scalbnl() is faster. */
if (k >= LDBL_MIN_EXP) {
if (k == LDBL_MAX_EXP)
RETURNI(t * 2 * 0x1p16383L);
diff --git a/libm/upstream-freebsd/lib/msun/ld128/s_logl.c b/libm/upstream-freebsd/lib/msun/ld128/s_logl.c
index 93a2a7c35..6c9981b4b 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/s_logl.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/s_logl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/ld128/s_logl.c 326219 2017-11-26 02:00:33Z pfg $");
/**
* Implementation of the natural logarithm of x for 128-bit format.
@@ -535,17 +535,16 @@ logl(long double x)
* efficiency than is gained.
*/
/*
- * Use double precision operations wherever possible, since
- * long double operations are emulated and were very slow on
- * the old sparc64 and unknown on the newer aarch64 and riscv
- * machines. Also, don't try to improve parallelism by
- * increasing the number of operations, since any parallelism
- * on such machines is needed for the emulation. Horner's
- * method is good for this, and is also good for accuracy.
- * Horner's method doesn't handle the `lo' term well, either
- * for efficiency or accuracy. However, for accuracy we
- * evaluate d * d * P2 separately to take advantage of by P2
- * being exact, and this gives a good place to sum the 'lo'
+ * Use double precision operations wherever possible, since long
+ * double operations are emulated and are very slow on the only
+ * known machines that support ld128 (sparc64). Also, don't try
+ * to improve parallelism by increasing the number of operations,
+ * since any parallelism on such machines is needed for the
+ * emulation. Horner's method is good for this, and is also good
+ * for accuracy. Horner's method doesn't handle the `lo' term
+ * well, either for efficiency or accuracy. However, for accuracy
+ * we evaluate d * d * P2 separately to take advantage of
+ * by P2 being exact, and this gives a good place to sum the 'lo'
* term too.
*/
dd = (double)d;
diff --git a/libm/upstream-freebsd/lib/msun/ld128/s_nanl.c b/libm/upstream-freebsd/lib/msun/ld128/s_nanl.c
index 45d10e5a8..1b8196f4c 100644
--- a/libm/upstream-freebsd/lib/msun/ld128/s_nanl.c
+++ b/libm/upstream-freebsd/lib/msun/ld128/s_nanl.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/ld128/s_nanl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/catrig.c b/libm/upstream-freebsd/lib/msun/src/catrig.c
index 431d8e674..4a2d0769a 100644
--- a/libm/upstream-freebsd/lib/msun/src/catrig.c
+++ b/libm/upstream-freebsd/lib/msun/src/catrig.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/catrig.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/catrigf.c b/libm/upstream-freebsd/lib/msun/src/catrigf.c
index 62bcd3995..e25187109 100644
--- a/libm/upstream-freebsd/lib/msun/src/catrigf.c
+++ b/libm/upstream-freebsd/lib/msun/src/catrigf.c
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/catrigf.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/catrigl.c b/libm/upstream-freebsd/lib/msun/src/catrigl.c
index e66f87a24..63b068a62 100644
--- a/libm/upstream-freebsd/lib/msun/src/catrigl.c
+++ b/libm/upstream-freebsd/lib/msun/src/catrigl.c
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/catrigl.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/e_asin.c b/libm/upstream-freebsd/lib/msun/src/e_asin.c
index 931b27049..d750658e8 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_asin.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_asin.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_asin.c 317349 2017-04-23 22:31:12Z pfg $");
/* __ieee754_asin(x)
* Method :
diff --git a/libm/upstream-freebsd/lib/msun/src/e_atan2.c b/libm/upstream-freebsd/lib/msun/src/e_atan2.c
index 231a1611e..bef9df86f 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_atan2.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_atan2.c
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2.c 336362 2018-07-17 07:42:14Z bde $");
/* __ieee754_atan2(y,x)
* Method :
diff --git a/libm/upstream-freebsd/lib/msun/src/e_atan2f.c b/libm/upstream-freebsd/lib/msun/src/e_atan2f.c
index 346d76746..0ce9bc068 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_atan2f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_atan2f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2f.c 336362 2018-07-17 07:42:14Z bde $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/e_atan2l.c b/libm/upstream-freebsd/lib/msun/src/e_atan2l.c
index 94ebdec54..8f80acc9f 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_atan2l.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_atan2l.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_atan2l.c 336362 2018-07-17 07:42:14Z bde $");
/*
* See comments in e_atan2.c.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_coshl.c b/libm/upstream-freebsd/lib/msun/src/e_coshl.c
index 4e3b28311..0002bb56e 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_coshl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_coshl.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_coshl.c 306527 2016-09-30 20:20:07Z emaste $");
/*
* See e_cosh.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_exp.c b/libm/upstream-freebsd/lib/msun/src/e_exp.c
index dd04d8e83..dd88d3e91 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_exp.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_exp.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_exp.c 352710 2019-09-25 18:50:57Z dim $");
/* __ieee754_exp(x)
* Returns the exponential of x.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_expf.c b/libm/upstream-freebsd/lib/msun/src/e_expf.c
index 4903d55c5..aaf6d5f6c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_expf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_expf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_expf.c 352710 2019-09-25 18:50:57Z dim $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/e_fmod.c b/libm/upstream-freebsd/lib/msun/src/e_fmod.c
index 3a28dc4ff..fbb2d932c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_fmod.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_fmod.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_fmod.c 336663 2018-07-24 10:10:16Z bde $");
/*
* __ieee754_fmod(x,y)
diff --git a/libm/upstream-freebsd/lib/msun/src/e_fmodf.c b/libm/upstream-freebsd/lib/msun/src/e_fmodf.c
index 1b6bf36f9..3783a880c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_fmodf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_fmodf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_fmodf.c 336663 2018-07-24 10:10:16Z bde $");
/*
* __ieee754_fmodf(x,y)
diff --git a/libm/upstream-freebsd/lib/msun/src/e_fmodl.c b/libm/upstream-freebsd/lib/msun/src/e_fmodl.c
index ad3bcc34c..77d1642c3 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_fmodl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_fmodl.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_fmodl.c 336663 2018-07-24 10:10:16Z bde $");
#include <float.h>
#include <stdint.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/e_hypot.c b/libm/upstream-freebsd/lib/msun/src/e_hypot.c
index 7c455bb66..0c1676776 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_hypot.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_hypot.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_hypot.c 336362 2018-07-17 07:42:14Z bde $");
/* __ieee754_hypot(x,y)
*
@@ -118,8 +118,10 @@ __ieee754_hypot(double x, double y)
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
}
if(k!=0) {
- t1 = 0.0;
- SET_HIGH_WORD(t1,(1023+k)<<20);
+ u_int32_t high;
+ t1 = 1.0;
+ GET_HIGH_WORD(high,t1);
+ SET_HIGH_WORD(t1,high+(k<<20));
return t1*w;
} else return w;
}
diff --git a/libm/upstream-freebsd/lib/msun/src/e_hypotf.c b/libm/upstream-freebsd/lib/msun/src/e_hypotf.c
index 00610268f..79e46979e 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_hypotf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_hypotf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_hypotf.c 336362 2018-07-17 07:42:14Z bde $");
#include "math.h"
#include "math_private.h"
@@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y)
w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b)));
}
if(k!=0) {
- SET_FLOAT_WORD(t1,(127+k)<<23);
+ SET_FLOAT_WORD(t1,0x3f800000+(k<<23));
return t1*w;
} else return w;
}
diff --git a/libm/upstream-freebsd/lib/msun/src/e_hypotl.c b/libm/upstream-freebsd/lib/msun/src/e_hypotl.c
index 9189b1fab..5603b6e23 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_hypotl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_hypotl.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_hypotl.c 336362 2018-07-17 07:42:14Z bde $");
/* long double version of hypot(). See e_hypot.c for most comments. */
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0.c b/libm/upstream-freebsd/lib/msun/src/e_j0.c
index 5d862b6f8..a008b42c0 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0.c 343953 2019-02-10 08:46:07Z peterj $");
/* __ieee754_j0(x), __ieee754_y0(x)
* Bessel function of the first and second kinds of order zero.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j0f.c b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
index 1c5ef4da1..495a5e54b 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j0f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j0f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j0f.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* See e_j0.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1.c b/libm/upstream-freebsd/lib/msun/src/e_j1.c
index fb4462738..6d1c41c5b 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1.c 343953 2019-02-10 08:46:07Z peterj $");
/* __ieee754_j1(x), __ieee754_y1(x)
* Bessel function of the first and second kinds of order zero.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_j1f.c b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
index c6c45c107..31fc28a5d 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_j1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_j1f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_j1f.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* See e_j1.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_jn.c b/libm/upstream-freebsd/lib/msun/src/e_jn.c
index c7ba7da65..c039cf234 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_jn.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_jn.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_jn.c 343953 2019-02-10 08:46:07Z peterj $");
/*
* __ieee754_jn(n, x), __ieee754_yn(n, x)
diff --git a/libm/upstream-freebsd/lib/msun/src/e_jnf.c b/libm/upstream-freebsd/lib/msun/src/e_jnf.c
index 965feeb66..c82d5cf95 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_jnf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_jnf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_jnf.c 279856 2015-03-10 17:10:54Z kargl $");
/*
* See e_jn.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_lgammaf_r.c b/libm/upstream-freebsd/lib/msun/src/e_lgammaf_r.c
index 48346c336..46bdd6f8c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_lgammaf_r.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_lgammaf_r.c
@@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_lgammaf_r.c 306709 2016-10-05 17:04:58Z emaste $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/e_pow.c b/libm/upstream-freebsd/lib/msun/src/e_pow.c
index 52b2f5ceb..b4f6a5a33 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_pow.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_pow.c
@@ -10,7 +10,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_pow.c 342851 2019-01-07 17:35:09Z pfg $");
/* __ieee754_pow(x,y) return x**y
*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_powf.c b/libm/upstream-freebsd/lib/msun/src/e_powf.c
index 53f1d37d6..13dd4eb6d 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_powf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_powf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_powf.c 336362 2018-07-17 07:42:14Z bde $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/e_rem_pio2.c b/libm/upstream-freebsd/lib/msun/src/e_rem_pio2.c
index 47b651351..3e62c2bdb 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_rem_pio2.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_rem_pio2.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_rem_pio2.c 336545 2018-07-20 12:42:24Z bde $");
/* __ieee754_rem_pio2(x,y)
*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c b/libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c
index 597f6139f..2a89d27fd 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c
@@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_rem_pio2f.c 336545 2018-07-20 12:42:24Z bde $");
/* __ieee754_rem_pio2f(x,y)
*
diff --git a/libm/upstream-freebsd/lib/msun/src/e_remainder.c b/libm/upstream-freebsd/lib/msun/src/e_remainder.c
index a4ae0b780..334d2825c 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_remainder.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_remainder.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_remainder.c 336663 2018-07-24 10:10:16Z bde $");
/* __ieee754_remainder(x,p)
* Return :
diff --git a/libm/upstream-freebsd/lib/msun/src/e_remainderf.c b/libm/upstream-freebsd/lib/msun/src/e_remainderf.c
index 8004493de..ba3e07a13 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_remainderf.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_remainderf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_remainderf.c 336663 2018-07-24 10:10:16Z bde $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/e_remainderl.c b/libm/upstream-freebsd/lib/msun/src/e_remainderl.c
index 4a6786309..6e4a4dad0 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_remainderl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_remainderl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_remainderl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/e_sinhl.c b/libm/upstream-freebsd/lib/msun/src/e_sinhl.c
index 38d3df195..21dd8b2df 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_sinhl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_sinhl.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_sinhl.c 306527 2016-09-30 20:20:07Z emaste $");
/*
* See e_sinh.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/e_sqrtl.c b/libm/upstream-freebsd/lib/msun/src/e_sqrtl.c
index 565d96396..fbb3a10c2 100644
--- a/libm/upstream-freebsd/lib/msun/src/e_sqrtl.c
+++ b/libm/upstream-freebsd/lib/msun/src/e_sqrtl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/e_sqrtl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <fenv.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/k_exp.c b/libm/upstream-freebsd/lib/msun/src/k_exp.c
index dd15ff4cb..7cc083ff8 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_exp.c
+++ b/libm/upstream-freebsd/lib/msun/src/k_exp.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_exp.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
@@ -88,7 +88,7 @@ __ldexp_exp(double x, int expt)
double complex
__ldexp_cexp(double complex z, int expt)
{
- double c, exp_x, s, scale1, scale2, x, y;
+ double x, y, exp_x, scale1, scale2;
int ex_expt, half_expt;
x = creal(z);
@@ -105,7 +105,6 @@ __ldexp_cexp(double complex z, int expt)
half_expt = expt - half_expt;
INSERT_WORDS(scale2, (0x3ff + half_expt) << 20, 0);
- sincos(y, &s, &c);
- return (CMPLX(c * exp_x * scale1 * scale2,
- s * exp_x * scale1 * scale2));
+ return (CMPLX(cos(y) * exp_x * scale1 * scale2,
+ sin(y) * exp_x * scale1 * scale2));
}
diff --git a/libm/upstream-freebsd/lib/msun/src/k_expf.c b/libm/upstream-freebsd/lib/msun/src/k_expf.c
index 80e629b0f..5aa5c76b8 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_expf.c
+++ b/libm/upstream-freebsd/lib/msun/src/k_expf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_expf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
@@ -71,7 +71,7 @@ __ldexp_expf(float x, int expt)
float complex
__ldexp_cexpf(float complex z, int expt)
{
- float c, exp_x, s, scale1, scale2, x, y;
+ float x, y, exp_x, scale1, scale2;
int ex_expt, half_expt;
x = crealf(z);
@@ -84,7 +84,6 @@ __ldexp_cexpf(float complex z, int expt)
half_expt = expt - half_expt;
SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
- sincosf(y, &s, &c);
- return (CMPLXF(c * exp_x * scale1 * scale2,
- s * exp_x * scale1 * scale2));
+ return (CMPLXF(cosf(y) * exp_x * scale1 * scale2,
+ sinf(y) * exp_x * scale1 * scale2));
}
diff --git a/libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c b/libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c
index 0a717f768..0869e0386 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c
+++ b/libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_rem_pio2.c 342651 2018-12-31 15:43:06Z pfg $");
/*
* __kernel_rem_pio2(x,y,e0,nx,prec)
diff --git a/libm/upstream-freebsd/lib/msun/src/k_sincos.h b/libm/upstream-freebsd/lib/msun/src/k_sincos.h
index 6f03be297..b83e6909a 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_sincos.h
+++ b/libm/upstream-freebsd/lib/msun/src/k_sincos.h
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_sincos.h 319047 2017-05-28 06:13:38Z mmel $");
static const double
S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */
diff --git a/libm/upstream-freebsd/lib/msun/src/k_sincosf.h b/libm/upstream-freebsd/lib/msun/src/k_sincosf.h
index 073986db8..ad51e8389 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_sincosf.h
+++ b/libm/upstream-freebsd/lib/msun/src/k_sincosf.h
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_sincosf.h 319047 2017-05-28 06:13:38Z mmel $");
/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
static const double
diff --git a/libm/upstream-freebsd/lib/msun/src/k_sincosl.h b/libm/upstream-freebsd/lib/msun/src/k_sincosl.h
index 4d4dc69f7..423948ed2 100644
--- a/libm/upstream-freebsd/lib/msun/src/k_sincosl.h
+++ b/libm/upstream-freebsd/lib/msun/src/k_sincosl.h
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/k_sincosl.h 319047 2017-05-28 06:13:38Z mmel $");
#if LDBL_MANT_DIG == 64 /* ld80 version of k_sincosl.c. */
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000.0p-109 */
#define C1 ((long double)C1hi + C1lo)
#else
static const long double
-C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */
-S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */
+C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */
+S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */
#endif
static const double
diff --git a/libm/upstream-freebsd/lib/msun/src/math_private.h b/libm/upstream-freebsd/lib/msun/src/math_private.h
index b91b54cea..bc3d516c9 100644
--- a/libm/upstream-freebsd/lib/msun/src/math_private.h
+++ b/libm/upstream-freebsd/lib/msun/src/math_private.h
@@ -11,7 +11,7 @@
/*
* from: @(#)fdlibm.h 5.1 93/09/24
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/math_private.h 336663 2018-07-24 10:10:16Z bde $
*/
#ifndef _MATH_PRIVATE_H_
diff --git a/libm/upstream-freebsd/lib/msun/src/s_carg.c b/libm/upstream-freebsd/lib/msun/src/s_carg.c
index 1611b9de3..d0f9ced0e 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_carg.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_carg.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_carg.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cargf.c b/libm/upstream-freebsd/lib/msun/src/s_cargf.c
index 71c705daa..e4a76f476 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cargf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cargf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cargf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cargl.c b/libm/upstream-freebsd/lib/msun/src/s_cargl.c
index 96c3336bd..9885d60ac 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cargl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cargl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cargl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cbrt.c b/libm/upstream-freebsd/lib/msun/src/s_cbrt.c
index 0e609e110..268425e01 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cbrt.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cbrt.c
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cbrt.c 342563 2018-12-28 01:34:08Z jhibbits $");
#include <float.h>
#include "math.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/s_ccosh.c b/libm/upstream-freebsd/lib/msun/src/s_ccosh.c
index 7652b3c49..da568f4d3 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_ccosh.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_ccosh.c
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_ccosh.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_ccoshf.c b/libm/upstream-freebsd/lib/msun/src/s_ccoshf.c
index 5d7a09ba5..4aeea6367 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_ccoshf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_ccoshf.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_ccoshf.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cexp.c b/libm/upstream-freebsd/lib/msun/src/s_cexp.c
index 2ef8ba197..a2b91545a 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cexp.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cexp.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cexp.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cexpf.c b/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
index b815c99af..ee7512b3d 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cexpf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cexpf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cimag.c b/libm/upstream-freebsd/lib/msun/src/s_cimag.c
index 1f383cb2a..e89ee12a0 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cimag.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cimag.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_cimag.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cimagf.c b/libm/upstream-freebsd/lib/msun/src/s_cimagf.c
index 86a43c116..2bfce1075 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cimagf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cimagf.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_cimagf.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cimagl.c b/libm/upstream-freebsd/lib/msun/src/s_cimagl.c
index 6d8795058..fafeaff10 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cimagl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cimagl.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_cimagl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_clog.c b/libm/upstream-freebsd/lib/msun/src/s_clog.c
index 8150fa7f8..2c310954b 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_clog.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_clog.c
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_clog.c 333577 2018-05-13 09:54:34Z kib $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_clogf.c b/libm/upstream-freebsd/lib/msun/src/s_clogf.c
index 19a94453e..d94977ddf 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_clogf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_clogf.c
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_clogf.c 333577 2018-05-13 09:54:34Z kib $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_clogl.c b/libm/upstream-freebsd/lib/msun/src/s_clogl.c
index e59a1377a..9f56ca357 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_clogl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_clogl.c
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_clogl.c 333577 2018-05-13 09:54:34Z kib $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_conj.c b/libm/upstream-freebsd/lib/msun/src/s_conj.c
index dc56f48b2..8e4d3fc99 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_conj.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_conj.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_conj.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_conjf.c b/libm/upstream-freebsd/lib/msun/src/s_conjf.c
index 3fd8b8f02..f69189408 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_conjf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_conjf.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_conjf.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_conjl.c b/libm/upstream-freebsd/lib/msun/src/s_conjl.c
index d2f8d0fd3..00f315adf 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_conjl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_conjl.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_conjl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_copysignl.c b/libm/upstream-freebsd/lib/msun/src/s_copysignl.c
index bd6744705..cef101ef9 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_copysignl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_copysignl.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_copysignl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cosl.c b/libm/upstream-freebsd/lib/msun/src/s_cosl.c
index 46a2e8620..72c2dd31f 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cosl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cosl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cosl.c 326219 2017-11-26 02:00:33Z pfg $");
/*
* Limited testing on pseudorandom numbers drawn within [-2e8:4e8] shows
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cpow.c b/libm/upstream-freebsd/lib/msun/src/s_cpow.c
index cdc57bd46..1cb99aaa7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cpow.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cpow.c
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cpow.c 336563 2018-07-20 18:27:30Z dim $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cpowf.c b/libm/upstream-freebsd/lib/msun/src/s_cpowf.c
index aeb773b02..a2ef52541 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cpowf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cpowf.c
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cpowf.c 336563 2018-07-20 18:27:30Z dim $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cpowl.c b/libm/upstream-freebsd/lib/msun/src/s_cpowl.c
index 5d43b55a7..f9c637349 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cpowl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cpowl.c
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cpowl.c 336563 2018-07-20 18:27:30Z dim $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cproj.c b/libm/upstream-freebsd/lib/msun/src/s_cproj.c
index 38e774723..7677b5fbd 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cproj.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cproj.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cproj.c 342563 2018-12-28 01:34:08Z jhibbits $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cprojf.c b/libm/upstream-freebsd/lib/msun/src/s_cprojf.c
index af4c3a80c..f29f8d7ad 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cprojf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cprojf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cprojf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_cprojl.c b/libm/upstream-freebsd/lib/msun/src/s_cprojl.c
index 16df514f3..c9242cbbd 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_cprojl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_cprojl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_cprojl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_creal.c b/libm/upstream-freebsd/lib/msun/src/s_creal.c
index 69a10f279..a30c7f694 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_creal.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_creal.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_creal.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_crealf.c b/libm/upstream-freebsd/lib/msun/src/s_crealf.c
index 83e4d4632..95469d858 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_crealf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_crealf.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_crealf.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_creall.c b/libm/upstream-freebsd/lib/msun/src/s_creall.c
index 538b7d53d..e34f761b7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_creall.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_creall.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_creall.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <complex.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_csinh.c b/libm/upstream-freebsd/lib/msun/src/s_csinh.c
index 09b2dcbec..7408b1334 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_csinh.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_csinh.c
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csinh.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_csinhf.c b/libm/upstream-freebsd/lib/msun/src/s_csinhf.c
index ba1a79497..6e29f1951 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_csinhf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_csinhf.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csinhf.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_csqrt.c b/libm/upstream-freebsd/lib/msun/src/s_csqrt.c
index d172efc75..215b7d704 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_csqrt.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_csqrt.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csqrt.c 336488 2018-07-19 15:04:10Z bde $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_csqrtf.c b/libm/upstream-freebsd/lib/msun/src/s_csqrtf.c
index 6836a3903..16d32663d 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_csqrtf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_csqrtf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csqrtf.c 336412 2018-07-17 12:01:59Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_csqrtl.c b/libm/upstream-freebsd/lib/msun/src/s_csqrtl.c
index 40bc59df4..e58e4aea8 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_csqrtl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_csqrtl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_csqrtl.c 336488 2018-07-19 15:04:10Z bde $");
#include <complex.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_ctanh.c b/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
index 88afeb50e..d005baf40 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_ctanh.c
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_ctanh.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_ctanhf.c b/libm/upstream-freebsd/lib/msun/src/s_ctanhf.c
index d2bd0b678..06825a396 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_ctanhf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_ctanhf.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_ctanhf.c 336362 2018-07-17 07:42:14Z bde $");
#include <complex.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_erf.c b/libm/upstream-freebsd/lib/msun/src/s_erf.c
index 5f228474f..3e39d8038 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_erf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_erf.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_erf.c 342563 2018-12-28 01:34:08Z jhibbits $");
/* double erf(double x)
* double erfc(double x)
diff --git a/libm/upstream-freebsd/lib/msun/src/s_exp2.c b/libm/upstream-freebsd/lib/msun/src/s_exp2.c
index bc36e5564..dc3fb0220 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_exp2.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_exp2.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_exp2.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_exp2f.c b/libm/upstream-freebsd/lib/msun/src/s_exp2f.c
index c082924af..e587b0696 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_exp2f.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_exp2f.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_exp2f.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1.c b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
index 844f10360..21256ce5a 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1.c 352710 2019-09-25 18:50:57Z dim $");
/* expm1(x)
* Returns exp(x)-1, the exponential of x minus 1.
diff --git a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
index b47daac2e..4d9ab36b7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_expm1f.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_expm1f.c 352710 2019-09-25 18:50:57Z dim $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fabsl.c b/libm/upstream-freebsd/lib/msun/src/s_fabsl.c
index 5076d8a9b..0eef5b739 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fabsl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fabsl.c
@@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_fabsl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fdim.c b/libm/upstream-freebsd/lib/msun/src/s_fdim.c
index c40c3e9d3..bb22474be 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fdim.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fdim.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fdim.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fma.c b/libm/upstream-freebsd/lib/msun/src/s_fma.c
index 41a6424fd..447253704 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fma.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fma.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fma.c 326219 2017-11-26 02:00:33Z pfg $");
#include <fenv.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmaf.c b/libm/upstream-freebsd/lib/msun/src/s_fmaf.c
index 389cf1b11..88a86f236 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmaf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmaf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmaf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <fenv.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmal.c b/libm/upstream-freebsd/lib/msun/src/s_fmal.c
index a379346c1..3c1910aed 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmal.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmal.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmal.c 326219 2017-11-26 02:00:33Z pfg $");
#include <fenv.h>
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmax.c b/libm/upstream-freebsd/lib/msun/src/s_fmax.c
index 0c234bcc5..ba0bf6b4b 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmax.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmax.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmax.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmaxf.c b/libm/upstream-freebsd/lib/msun/src/s_fmaxf.c
index 8e9d1baf3..6a3f06b6f 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmaxf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmaxf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmaxf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmaxl.c b/libm/upstream-freebsd/lib/msun/src/s_fmaxl.c
index c0d7c8832..4f0ee311c 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmaxl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmaxl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmaxl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fmin.c b/libm/upstream-freebsd/lib/msun/src/s_fmin.c
index d7f24c121..d49bedb31 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fmin.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fmin.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fmin.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fminf.c b/libm/upstream-freebsd/lib/msun/src/s_fminf.c
index 258316725..3c8822824 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fminf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fminf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fminf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_fminl.c b/libm/upstream-freebsd/lib/msun/src/s_fminl.c
index 97604b38b..aa6cc9f58 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_fminl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_fminl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_fminl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_frexpl.c b/libm/upstream-freebsd/lib/msun/src/s_frexpl.c
index 66e284fdd..310f2e317 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_frexpl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_frexpl.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_frexpl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_logbl.c b/libm/upstream-freebsd/lib/msun/src/s_logbl.c
index ee1a91fd8..ae71302c3 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_logbl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_logbl.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_logbl.c 306409 2016-09-28 14:48:34Z emaste $");
#include <float.h>
#include <limits.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_lrint.c b/libm/upstream-freebsd/lib/msun/src/s_lrint.c
index ad9b978fa..0e159996a 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_lrint.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_lrint.c
@@ -31,7 +31,7 @@
#include <math.h>
#ifndef type
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_lrint.c 326219 2017-11-26 02:00:33Z pfg $");
#define type double
#define roundit rint
#define dtype long
diff --git a/libm/upstream-freebsd/lib/msun/src/s_lround.c b/libm/upstream-freebsd/lib/msun/src/s_lround.c
index 66d9183a7..ce2aee779 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_lround.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_lround.c
@@ -32,7 +32,7 @@
#include <math.h>
#ifndef type
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_lround.c 353329 2019-10-08 21:39:51Z brooks $");
#define type double
#define roundit round
#define dtype long
diff --git a/libm/upstream-freebsd/lib/msun/src/s_modfl.c b/libm/upstream-freebsd/lib/msun/src/s_modfl.c
index 2d83bbe33..2f884d207 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_modfl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_modfl.c
@@ -35,7 +35,7 @@
* is preserved.
* ====================================================
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_modfl.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_nan.c b/libm/upstream-freebsd/lib/msun/src/s_nan.c
index 17692445a..4a25df087 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_nan.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_nan.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
+ * $FreeBSD: head/lib/msun/src/s_nan.c 326219 2017-11-26 02:00:33Z pfg $
*/
#include <sys/endian.h>
@@ -66,15 +66,14 @@ _scan_nan(uint32_t *words, int num_words, const char *s)
;
/* Scan backwards, filling in the bits in words[] as we go. */
+#if _BYTE_ORDER == _LITTLE_ENDIAN
for (bitpos = 0; bitpos < 32 * num_words; bitpos += 4) {
+#else
+ for (bitpos = 32 * num_words - 4; bitpos >= 0; bitpos -= 4) {
+#endif
if (--si < 0)
break;
-#if _BYTE_ORDER == _LITTLE_ENDIAN
words[bitpos / 32] |= digittoint(s[si]) << (bitpos % 32);
-#else
- words[num_words - 1 - bitpos / 32] |=
- digittoint(s[si]) << (bitpos % 32);
-#endif
}
}
diff --git a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
index 796dbaf98..0ea6ce711 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_nearbyint.c 326219 2017-11-26 02:00:33Z pfg $");
#include <fenv.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_remquo.c b/libm/upstream-freebsd/lib/msun/src/s_remquo.c
index 6a111dfc6..be6a2e847 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_remquo.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_remquo.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_remquo.c 336663 2018-07-24 10:10:16Z bde $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_remquof.c b/libm/upstream-freebsd/lib/msun/src/s_remquof.c
index f4c101620..775672f5e 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_remquof.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_remquof.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_remquof.c 336663 2018-07-24 10:10:16Z bde $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/s_remquol.c b/libm/upstream-freebsd/lib/msun/src/s_remquol.c
index a9f5813d0..5ac13e462 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_remquol.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_remquol.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_remquol.c 336665 2018-07-24 11:50:05Z bde $");
#include <float.h>
#include <stdint.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_rintl.c b/libm/upstream-freebsd/lib/msun/src/s_rintl.c
index 1e9824d83..a05f4c490 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_rintl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_rintl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_rintl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_round.c b/libm/upstream-freebsd/lib/msun/src/s_round.c
index ca25f8efd..cdf6b9721 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_round.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_round.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_round.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_roundf.c b/libm/upstream-freebsd/lib/msun/src/s_roundf.c
index 5bbf6b33b..37be766ca 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_roundf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_roundf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_roundf.c 326219 2017-11-26 02:00:33Z pfg $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/s_roundl.c b/libm/upstream-freebsd/lib/msun/src/s_roundl.c
index 8d1c02a7f..22f956ccb 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_roundl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_roundl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_roundl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#ifdef __i386__
diff --git a/libm/upstream-freebsd/lib/msun/src/s_scalbln.c b/libm/upstream-freebsd/lib/msun/src/s_scalbln.c
index c27420c92..52e3d7883 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_scalbln.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_scalbln.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_scalbln.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_scalbn.c b/libm/upstream-freebsd/lib/msun/src/s_scalbn.c
index b048b0596..52b0d2783 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_scalbn.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_scalbn.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_scalbn.c 306409 2016-09-28 14:48:34Z emaste $");
/*
* scalbn (double x, int n)
diff --git a/libm/upstream-freebsd/lib/msun/src/s_scalbnf.c b/libm/upstream-freebsd/lib/msun/src/s_scalbnf.c
index 21d001c1f..d78fe245a 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_scalbnf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_scalbnf.c
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_scalbnf.c 306409 2016-09-28 14:48:34Z emaste $");
#include "math.h"
#include "math_private.h"
diff --git a/libm/upstream-freebsd/lib/msun/src/s_scalbnl.c b/libm/upstream-freebsd/lib/msun/src/s_scalbnl.c
index 28b0cf9b7..a7822e228 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_scalbnl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_scalbnl.c
@@ -11,7 +11,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_scalbnl.c 306409 2016-09-28 14:48:34Z emaste $");
/*
* scalbnl (long double x, int n)
diff --git a/libm/upstream-freebsd/lib/msun/src/s_sincos.c b/libm/upstream-freebsd/lib/msun/src/s_sincos.c
index 85e8d7408..72b2d64da 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_sincos.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_sincos.c
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_sincos.c 319047 2017-05-28 06:13:38Z mmel $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_sincosf.c b/libm/upstream-freebsd/lib/msun/src/s_sincosf.c
index 755ff05d4..4aaa780cb 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_sincosf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_sincosf.c
@@ -16,7 +16,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_sincosf.c 319047 2017-05-28 06:13:38Z mmel $");
#include <float.h>
diff --git a/libm/upstream-freebsd/lib/msun/src/s_sincosl.c b/libm/upstream-freebsd/lib/msun/src/s_sincosl.c
index aef36c232..75cf24d81 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_sincosl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_sincosl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_sincosl.c 319047 2017-05-28 06:13:38Z mmel $");
#include <float.h>
#ifdef __i386__
diff --git a/libm/upstream-freebsd/lib/msun/src/s_sinl.c b/libm/upstream-freebsd/lib/msun/src/s_sinl.c
index f1ef84c8c..1bdbbc554 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_sinl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_sinl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_sinl.c 326219 2017-11-26 02:00:33Z pfg $");
#include <float.h>
#ifdef __i386__
diff --git a/libm/upstream-freebsd/lib/msun/src/s_tanhl.c b/libm/upstream-freebsd/lib/msun/src/s_tanhl.c
index b7531866d..696039f62 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_tanhl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_tanhl.c
@@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_tanhl.c 306527 2016-09-30 20:20:07Z emaste $");
/*
* See s_tanh.c for complete comments.
diff --git a/libm/upstream-freebsd/lib/msun/src/s_tanl.c b/libm/upstream-freebsd/lib/msun/src/s_tanl.c
index 0c5228ec8..192817600 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_tanl.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_tanl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_tanl.c 326219 2017-11-26 02:00:33Z pfg $");
/*
* Limited testing on pseudorandom numbers drawn within [0:4e8] shows
diff --git a/libm/upstream-freebsd/lib/msun/src/s_tgammaf.c b/libm/upstream-freebsd/lib/msun/src/s_tgammaf.c
index 1fd46e809..8527e16ba 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_tgammaf.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_tgammaf.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/lib/msun/src/s_tgammaf.c 326219 2017-11-26 02:00:33Z pfg $");
#include <math.h>
diff --git a/libm/x86/e_acos.S b/libm/x86/e_acos.S
index 04b178719..fa6185314 100644
--- a/libm/x86/e_acos.S
+++ b/libm/x86/e_acos.S
@@ -1925,5 +1925,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,6112
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_asin.S b/libm/x86/e_asin.S
index 6a3ff8e7a..5d7f33179 100644
--- a/libm/x86/e_asin.S
+++ b/libm/x86/e_asin.S
@@ -1999,5 +1999,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,6096
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_atan2.S b/libm/x86/e_atan2.S
index e49139665..1efdf6582 100644
--- a/libm/x86/e_atan2.S
+++ b/libm/x86/e_atan2.S
@@ -1217,5 +1217,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,3024
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_cosh.S b/libm/x86/e_cosh.S
index 567a9d0b6..ecea8f478 100644
--- a/libm/x86/e_cosh.S
+++ b/libm/x86/e_cosh.S
@@ -1345,5 +1345,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,4256
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_hypot.S b/libm/x86/e_hypot.S
index 8422024b1..6a143e50b 100644
--- a/libm/x86/e_hypot.S
+++ b/libm/x86/e_hypot.S
@@ -216,5 +216,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,32
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_log10.S b/libm/x86/e_log10.S
index 473cea3f9..09b295211 100644
--- a/libm/x86/e_log10.S
+++ b/libm/x86/e_log10.S
@@ -791,5 +791,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,2160
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/e_sinh.S b/libm/x86/e_sinh.S
index b9a29308d..d6b04b57d 100644
--- a/libm/x86/e_sinh.S
+++ b/libm/x86/e_sinh.S
@@ -1403,5 +1403,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,4280
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/libm_reduce_pi04l.S b/libm/x86/libm_reduce_pi04l.S
index 25976ea67..af6a7d05b 100644
--- a/libm/x86/libm_reduce_pi04l.S
+++ b/libm/x86/libm_reduce_pi04l.S
@@ -3714,5 +3714,5 @@ __4onpi_31l:
.type __4onpi_31l,@object
.size __4onpi_31l,6444
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/libm_sincos_huge.S b/libm/x86/libm_sincos_huge.S
index 4601b87c1..b43d193e5 100644
--- a/libm/x86/libm_sincos_huge.S
+++ b/libm/x86/libm_sincos_huge.S
@@ -664,5 +664,5 @@ _ones:
.size _ones,16
.data
.hidden __libm_reduce_pi04l
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/libm_tancot_huge.S b/libm/x86/libm_tancot_huge.S
index cdaa82045..80f16d5ba 100644
--- a/libm/x86/libm_tancot_huge.S
+++ b/libm/x86/libm_tancot_huge.S
@@ -746,5 +746,5 @@ _GP:
.size _GP,144
.data
.hidden __libm_reduce_pi04l
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_atan.S b/libm/x86/s_atan.S
index 71ca4dbb5..c4413f158 100644
--- a/libm/x86/s_atan.S
+++ b/libm/x86/s_atan.S
@@ -930,5 +930,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,2704
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_cbrt.S b/libm/x86/s_cbrt.S
index 53d3cc220..0c98c9949 100644
--- a/libm/x86/s_cbrt.S
+++ b/libm/x86/s_cbrt.S
@@ -734,5 +734,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,2000
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_cos.S b/libm/x86/s_cos.S
index e47c63ecc..fd5ef5db6 100644
--- a/libm/x86/s_cos.S
+++ b/libm/x86/s_cos.S
@@ -888,5 +888,5 @@ static_const_table:
.size static_const_table,2256
.data
.hidden __libm_sincos_huge
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_expm1.S b/libm/x86/s_expm1.S
index 1816f595e..1f9e87b91 100644
--- a/libm/x86/s_expm1.S
+++ b/libm/x86/s_expm1.S
@@ -698,5 +698,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,1296
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_log1p.S b/libm/x86/s_log1p.S
index de7b87b64..7a6d845bd 100644
--- a/libm/x86/s_log1p.S
+++ b/libm/x86/s_log1p.S
@@ -823,5 +823,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,2192
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_sin.S b/libm/x86/s_sin.S
index 74d1b8667..1e6cbd4aa 100644
--- a/libm/x86/s_sin.S
+++ b/libm/x86/s_sin.S
@@ -903,5 +903,5 @@ static_const_table:
.size static_const_table,2288
.data
.hidden __libm_sincos_huge
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_tan.S b/libm/x86/s_tan.S
index 7935efe37..3ee21075f 100644
--- a/libm/x86/s_tan.S
+++ b/libm/x86/s_tan.S
@@ -1762,5 +1762,5 @@ static_const_table:
.size static_const_table,5872
.data
.hidden __libm_tancot_huge
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86/s_tanh.S b/libm/x86/s_tanh.S
index 777519f45..737bcbbd9 100644
--- a/libm/x86/s_tanh.S
+++ b/libm/x86/s_tanh.S
@@ -1357,5 +1357,5 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,4280
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
# End
diff --git a/libm/x86_64/e_acos.S b/libm/x86_64/e_acos.S
index 57c910e64..d83c66b97 100644
--- a/libm/x86_64/e_acos.S
+++ b/libm/x86_64/e_acos.S
@@ -1934,7 +1934,7 @@ ONE_BY_2:
.type ONE_BY_2,@object
.size ONE_BY_2,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_asin.S b/libm/x86_64/e_asin.S
index 42425431b..9f41c7cfd 100644
--- a/libm/x86_64/e_asin.S
+++ b/libm/x86_64/e_asin.S
@@ -2013,7 +2013,7 @@ cv:
.type cv,@object
.size cv,24
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_atan2.S b/libm/x86_64/e_atan2.S
index f0ba43c7b..f9baea975 100644
--- a/libm/x86_64/e_atan2.S
+++ b/libm/x86_64/e_atan2.S
@@ -1219,7 +1219,7 @@ EXPMASK:
.type EXPMASK,@object
.size EXPMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_cosh.S b/libm/x86_64/e_cosh.S
index 97cb389b5..8cdbca6c0 100644
--- a/libm/x86_64/e_cosh.S
+++ b/libm/x86_64/e_cosh.S
@@ -1349,7 +1349,7 @@ ONEMASK:
.type ONEMASK,@object
.size ONEMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_hypot.S b/libm/x86_64/e_hypot.S
index e46669ffd..089b2b47c 100644
--- a/libm/x86_64/e_hypot.S
+++ b/libm/x86_64/e_hypot.S
@@ -191,7 +191,7 @@ static_const_table:
.type static_const_table,@object
.size static_const_table,32
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_log10.S b/libm/x86_64/e_log10.S
index 86f86ced1..4f43a36e5 100644
--- a/libm/x86_64/e_log10.S
+++ b/libm/x86_64/e_log10.S
@@ -784,7 +784,7 @@ coeff:
.type coeff,@object
.size coeff,48
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/e_sinh.S b/libm/x86_64/e_sinh.S
index d5f7b163a..4d8db630a 100644
--- a/libm/x86_64/e_sinh.S
+++ b/libm/x86_64/e_sinh.S
@@ -1407,7 +1407,7 @@ HALFMASK:
.type HALFMASK,@object
.size HALFMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_atan.S b/libm/x86_64/s_atan.S
index d0e5d7225..2453e1002 100644
--- a/libm/x86_64/s_atan.S
+++ b/libm/x86_64/s_atan.S
@@ -904,7 +904,7 @@ SGNMASK:
.type SGNMASK,@object
.size SGNMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_cbrt.S b/libm/x86_64/s_cbrt.S
index 6b00f56c0..4aa4373e4 100644
--- a/libm/x86_64/s_cbrt.S
+++ b/libm/x86_64/s_cbrt.S
@@ -731,7 +731,7 @@ NEG_INF:
.type NEG_INF,@object
.size NEG_INF,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_cos.S b/libm/x86_64/s_cos.S
index 3d9e4022d..ab5a0e1b7 100644
--- a/libm/x86_64/s_cos.S
+++ b/libm/x86_64/s_cos.S
@@ -1248,7 +1248,7 @@ NEG_ZERO:
.type NEG_ZERO,@object
.size NEG_ZERO,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_expm1.S b/libm/x86_64/s_expm1.S
index 4b22f5a2c..9da1d9dd6 100644
--- a/libm/x86_64/s_expm1.S
+++ b/libm/x86_64/s_expm1.S
@@ -704,7 +704,7 @@ HIGHMASK:
.type HIGHMASK,@object
.size HIGHMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_log1p.S b/libm/x86_64/s_log1p.S
index 27fab7445..1ff2d3965 100644
--- a/libm/x86_64/s_log1p.S
+++ b/libm/x86_64/s_log1p.S
@@ -806,7 +806,7 @@ coeff2:
.type coeff2,@object
.size coeff2,48
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_sin.S b/libm/x86_64/s_sin.S
index fb54a2a0d..2f93a34bb 100644
--- a/libm/x86_64/s_sin.S
+++ b/libm/x86_64/s_sin.S
@@ -1273,7 +1273,7 @@ NEG_ZERO:
.type NEG_ZERO,@object
.size NEG_ZERO,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_tan.S b/libm/x86_64/s_tan.S
index 4fa12e376..74cb04494 100644
--- a/libm/x86_64/s_tan.S
+++ b/libm/x86_64/s_tan.S
@@ -2212,7 +2212,7 @@ NEG_ZERO:
.type NEG_ZERO,@object
.size NEG_ZERO,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libm/x86_64/s_tanh.S b/libm/x86_64/s_tanh.S
index a76a5c2c8..2c8f9bfd5 100644
--- a/libm/x86_64/s_tanh.S
+++ b/libm/x86_64/s_tanh.S
@@ -1369,7 +1369,7 @@ TWOMASK:
.type TWOMASK,@object
.size TWOMASK,8
.data
- .section .note.GNU-stack, "",@progbits
+ .section .note.GNU-stack, ""
// -- Begin DWARF2 SEGMENT .eh_frame
.section .eh_frame,"a",@progbits
.eh_frame_seg:
diff --git a/libstdc++/NOTICE b/libstdc++/NOTICE
deleted file mode 100644
index e68a9e4ac..000000000
--- a/libstdc++/NOTICE
+++ /dev/null
@@ -1,16 +0,0 @@
-Copyright (C) 2008 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.
-
--------------------------------------------------------------------
-
diff --git a/libstdc++/include/new b/libstdc++/include/new
index 9d1c6fc66..cffab6e1c 100644
--- a/libstdc++/include/new
+++ b/libstdc++/include/new
@@ -1,20 +1,6 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#pragma once
+/* -*- c++ -*- */
+#ifndef __NEW__
+#define __NEW__
#include <stddef.h>
@@ -45,3 +31,5 @@ inline void operator delete(void*, void*) throw() { }
inline void operator delete[](void*, void*) throw() { }
} // extern C++
+
+#endif // __NEW__
diff --git a/linker/Android.bp b/linker/Android.bp
index 4a5bf44a6..f75088d60 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -9,21 +9,6 @@
// embedded as the entry point, and the linker is embedded as ELF sections in
// each binary. There's a linker script that sets all of that up (generated by
// extract_linker), and defines the extern symbols used in this file.
-package {
- default_applicable_licenses: ["bionic_linker_license"],
-}
-
-license {
- name: "bionic_linker_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-BSD",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_object {
name: "linker_wrapper",
host_supported: true,
@@ -54,9 +39,6 @@ cc_object {
"linker_wrapper.cpp",
],
arch: {
- arm64: {
- srcs: ["arch/arm64/begin.S"],
- },
x86_64: {
srcs: ["arch/x86_64/begin.S"],
},
@@ -64,13 +46,8 @@ cc_object {
prefix_symbols: "__dlwrap_",
- header_libs: ["libc_headers"],
-
// We need to access Bionic private headers in the linker.
include_dirs: ["bionic/libc"],
-
- // b/182338959
- bazel_module: { bp2build_available: false },
}
// ========================================================
@@ -142,7 +119,6 @@ cc_defaults {
name: "linker_all_targets",
defaults: ["linux_bionic_supported"],
recovery_available: true,
- vendor_ramdisk_available: true,
native_bridge_supported: true,
}
@@ -188,12 +164,10 @@ filegroup {
"linker_namespaces.cpp",
"linker_logger.cpp",
"linker_mapped_file_fragment.cpp",
- "linker_note_gnu_property.cpp",
"linker_phdr.cpp",
"linker_relocate.cpp",
"linker_sdk_versions.cpp",
"linker_soinfo.cpp",
- "linker_transparent_hugepage_support.cpp",
"linker_tls.cpp",
"linker_utils.cpp",
"rt.cpp",
@@ -251,15 +225,19 @@ cc_defaults {
arch: {
arm: {
srcs: [":linker_sources_arm"],
+ static_libs: ["libunwind_llvm"],
},
arm64: {
srcs: [":linker_sources_arm64"],
+ static_libs: ["libgcc_stripped"],
},
x86: {
srcs: [":linker_sources_x86"],
+ static_libs: ["libgcc_stripped"],
},
x86_64: {
srcs: [":linker_sources_x86_64"],
+ static_libs: ["libgcc_stripped"],
},
},
@@ -307,7 +285,6 @@ cc_defaults {
"libc_nomalloc",
"libc_dynamic_dispatch",
"libm",
- "libunwind",
],
// Ensure that if the linker needs __gnu_Unwind_Find_exidx, then the linker will have a
@@ -353,7 +330,6 @@ cc_binary {
compile_multilib: "both",
recovery_available: true,
- vendor_ramdisk_available: true,
apex_available: [
"//apex_available:platform",
"com.android.runtime",
@@ -373,34 +349,7 @@ cc_binary {
static_libs: [
"liblinker_debuggerd_stub",
],
- },
- android_arm64: {
- pgo: {
- profile_file: "bionic/linker_arm_arm64.profdata",
- },
- },
- android_arm: {
- pgo: {
- profile_file: "bionic/linker_arm_arm64.profdata",
- },
- },
- android_x86_64: {
- pgo: {
- profile_file: "bionic/linker_x86_x86_64.profdata",
- },
- },
- android_x86: {
- pgo: {
- profile_file: "bionic/linker_x86_x86_64.profdata",
- },
- },
- },
-
- lto: {
- never: true,
- },
- pgo: {
- sampling: true,
+ }
},
}
@@ -410,21 +359,7 @@ cc_binary {
sh_binary {
name: "ldd",
- src: "ldd.sh",
- bazel_module: { bp2build_available: true },
-}
-
-// Used to generate binaries that can be backed by transparent hugepages.
-cc_defaults {
- name: "linker_hugepage_aligned",
- arch: {
- arm64: {
- ldflags: ["-z max-page-size=0x200000"],
- },
- x86_64: {
- ldflags: ["-z max-page-size=0x200000"],
- },
- },
+ src: "ldd",
}
cc_library {
@@ -442,7 +377,7 @@ cc_library {
"-Wl,--exclude-libs=libgcc_stripped.a",
"-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
- "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
+ "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a",
"-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
],
@@ -468,13 +403,11 @@ cc_library {
name: "ld-android",
defaults: ["linux_bionic_supported", "linker_version_script_overlay"],
ramdisk_available: true,
- vendor_ramdisk_available: true,
recovery_available: true,
native_bridge_supported: true,
nocrt: true,
system_shared_libs: [],
- header_libs: ["libc_headers"],
// Opt out of native_coverage when opting out of system_shared_libs
native_coverage: false,
@@ -487,10 +420,6 @@ cc_library {
"//apex_available:platform",
"com.android.runtime",
],
-
- lto: {
- never: true,
- },
}
cc_test {
@@ -512,7 +441,6 @@ cc_test {
"linker_block_allocator_test.cpp",
"linker_config_test.cpp",
"linked_list_test.cpp",
- "linker_note_gnu_property_test.cpp",
"linker_sleb128_test.cpp",
"linker_utils_test.cpp",
"linker_gnu_hash_test.cpp",
@@ -521,7 +449,6 @@ cc_test {
"linker_block_allocator.cpp",
"linker_config.cpp",
"linker_debug.cpp",
- "linker_note_gnu_property.cpp",
"linker_test_globals.cpp",
"linker_utils.cpp",
],
diff --git a/linker/MODULE_LICENSE_BSD b/linker/MODULE_LICENSE_APACHE2
index e69de29bb..e69de29bb 100644
--- a/linker/MODULE_LICENSE_BSD
+++ b/linker/MODULE_LICENSE_APACHE2
diff --git a/linker/NOTICE b/linker/NOTICE
index 8f70d871d..e9ece13b4 100644
--- a/linker/NOTICE
+++ b/linker/NOTICE
@@ -23,314 +23,3 @@ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2008 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2012 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2013 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2015 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2016 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2017 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2021 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index af050274d..ec6850a40 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -332,8 +332,7 @@ soinfo* get_libdl_info(const soinfo& linker_si) {
__libdl_info->target_sdk_version_ = __ANDROID_API__;
__libdl_info->generate_handle();
#if defined(__work_around_b_24465209__)
- strlcpy(__libdl_info->old_name_, __libdl_info->soname_.c_str(),
- sizeof(__libdl_info->old_name_));
+ strlcpy(__libdl_info->old_name_, __libdl_info->soname_, sizeof(__libdl_info->old_name_));
#endif
}
diff --git a/linker/ld.config.format.md b/linker/ld.config.format.md
index a16efa4cc..f9fbcde3f 100644
--- a/linker/ld.config.format.md
+++ b/linker/ld.config.format.md
@@ -80,9 +80,7 @@ namespace.ns1.asan.permitted.paths = /data/vendor/${LIB}
namespace.ns.links = default
namespace.ns.link.default.shared_libs = libc.so:libdl.so:libm.so:libstdc++.so
-# [Deprecated] This defines what libraries are allowed to be loaded from ns1
-namespace.ns1.whitelisted = libsomething.so
# This defines what libraries are allowed to be loaded from ns1
-namespace.ns1.allowed_libs = libsomething2.so
+namespace.ns1.whitelisted = libsomething.so
```
diff --git a/linker/ldd.sh b/linker/ldd
index 56810bb1d..6bc49b4b1 100755..100644
--- a/linker/ldd.sh
+++ b/linker/ldd
@@ -10,7 +10,7 @@ function error() {
[ $# -eq 1 ] || error "usage: ldd FILE"
-what=$(LD_LIBRARY_PATH= file -L "$1")
+what=$(file -L "$1")
case "$what" in
*32-bit*)
linker --list "$1"
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 3488f5cc7..f24167722 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -186,10 +186,10 @@ static bool maybe_accessible_via_namespace_links(android_namespace_t* ns, const
return false;
}
-// TODO(dimitry): The exempt-list is a workaround for http://b/26394120 ---
+// TODO(dimitry): The grey-list is a workaround for http://b/26394120 ---
// gradually remove libraries from this list until it is gone.
-static bool is_exempt_lib(android_namespace_t* ns, const char* name, const soinfo* needed_by) {
- static const char* const kLibraryExemptList[] = {
+static bool is_greylisted(android_namespace_t* ns, const char* name, const soinfo* needed_by) {
+ static const char* const kLibraryGreyList[] = {
"libandroid_runtime.so",
"libbinder.so",
"libcrypto.so",
@@ -206,13 +206,13 @@ static bool is_exempt_lib(android_namespace_t* ns, const char* name, const soinf
nullptr
};
- // If you're targeting N, you don't get the exempt-list.
- if (get_application_target_sdk_version() >= 24) {
+ // If you're targeting N, you don't get the greylist.
+ if (g_greylist_disabled || get_application_target_sdk_version() >= 24) {
return false;
}
// if the library needed by a system library - implicitly assume it
- // is exempt unless it is in the list of shared libraries for one or
+ // is greylisted unless it is in the list of shared libraries for one or
// more linked namespaces
if (needed_by != nullptr && is_system_library(needed_by->get_realpath())) {
return !maybe_accessible_via_namespace_links(ns, name);
@@ -224,8 +224,8 @@ static bool is_exempt_lib(android_namespace_t* ns, const char* name, const soinf
name = basename(name);
}
- for (size_t i = 0; kLibraryExemptList[i] != nullptr; ++i) {
- if (strcmp(name, kLibraryExemptList[i]) == 0) {
+ for (size_t i = 0; kLibraryGreyList[i] != nullptr; ++i) {
+ if (strcmp(name, kLibraryGreyList[i]) == 0) {
return true;
}
}
@@ -311,10 +311,6 @@ static void soinfo_free(soinfo* si) {
}
}
- if (si->has_min_version(6) && si->get_gap_size()) {
- munmap(reinterpret_cast<void*>(si->get_gap_start()), si->get_gap_size());
- }
-
TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si);
if (!solist_remove_soinfo(si)) {
@@ -502,10 +498,10 @@ class LoadTask {
static deleter_t deleter;
- // needed_by is NULL iff dlopen is called from memory that isn't part of any known soinfo.
- static LoadTask* create(const char* _Nonnull name, soinfo* _Nullable needed_by,
- android_namespace_t* _Nonnull start_from,
- std::unordered_map<const soinfo*, ElfReader>* _Nonnull readers_map) {
+ static LoadTask* create(const char* name,
+ soinfo* needed_by,
+ android_namespace_t* start_from,
+ std::unordered_map<const soinfo*, ElfReader>* readers_map) {
LoadTask* ptr = TypeBasedAllocator<LoadTask>::alloc();
return new (ptr) LoadTask(name, needed_by, start_from, readers_map);
}
@@ -567,11 +563,6 @@ class LoadTask {
return start_from_;
}
- void remove_cached_elf_reader() {
- CHECK(si_ != nullptr);
- (*elf_readers_map_).erase(si_);
- }
-
const ElfReader& get_elf_reader() const {
CHECK(si_ != nullptr);
return (*elf_readers_map_)[si_];
@@ -603,8 +594,6 @@ class LoadTask {
si_->load_bias = elf_reader.load_bias();
si_->phnum = elf_reader.phdr_count();
si_->phdr = elf_reader.loaded_phdr();
- si_->set_gap_start(elf_reader.gap_start());
- si_->set_gap_size(elf_reader.gap_size());
return true;
}
@@ -632,7 +621,7 @@ class LoadTask {
bool close_fd_;
off64_t file_offset_;
std::unordered_map<const soinfo*, ElfReader>* elf_readers_map_;
- // TODO(dimitry): needed by workaround for http://b/26394120 (the exempt-list)
+ // TODO(dimitry): needed by workaround for http://b/26394120 (the grey-list)
bool is_dt_needed_;
// END OF WORKAROUND
const android_namespace_t* const start_from_;
@@ -1012,24 +1001,47 @@ static int open_library(android_namespace_t* ns,
// If the name contains a slash, we should attempt to open it directly and not search the paths.
if (strchr(name, '/') != nullptr) {
- return open_library_at_path(zip_archive_cache, name, file_offset, realpath);
+ int fd = -1;
+
+ if (strstr(name, kZipFileSeparator) != nullptr) {
+ fd = open_library_in_zipfile(zip_archive_cache, name, file_offset, realpath);
+ }
+
+ if (fd == -1) {
+ fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CLOEXEC));
+ if (fd != -1) {
+ *file_offset = 0;
+ if (!realpath_fd(fd, realpath)) {
+ if (!is_first_stage_init()) {
+ PRINT("warning: unable to get realpath for the library \"%s\". Will use given path.",
+ name);
+ }
+ *realpath = name;
+ }
+ }
+ }
+
+ return fd;
}
- // LD_LIBRARY_PATH has the highest priority. We don't have to check accessibility when searching
- // the namespace's path lists, because anything found on a namespace path list should always be
- // accessible.
+ // Otherwise we try LD_LIBRARY_PATH first, and fall back to the default library path
int fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_ld_library_paths(), realpath);
-
- // Try the DT_RUNPATH, and verify that the library is accessible.
if (fd == -1 && needed_by != nullptr) {
fd = open_library_on_paths(zip_archive_cache, name, file_offset, needed_by->get_dt_runpath(), realpath);
+ // Check if the library is accessible
if (fd != -1 && !ns->is_accessible(*realpath)) {
close(fd);
fd = -1;
}
}
- // Finally search the namespace's main search path list.
+#if !defined(__ANDROID_APEX__)
+ if (fd == -1) {
+ std::vector<std::string> bootstrap_paths = { std::string(kSystemLibDir) + "/bootstrap" };
+ fd = open_library_on_paths(zip_archive_cache, name, file_offset, bootstrap_paths, realpath);
+ }
+#endif
+
if (fd == -1) {
fd = open_library_on_paths(zip_archive_cache, name, file_offset, ns->get_default_library_paths(), realpath);
}
@@ -1187,12 +1199,12 @@ static bool load_library(android_namespace_t* ns,
// do not check accessibility using realpath if fd is located on tmpfs
// this enables use of memfd_create() for apps
if ((fs_stat.f_type != TMPFS_MAGIC) && (!ns->is_accessible(realpath))) {
- // TODO(dimitry): workaround for http://b/26394120 - the exempt-list
+ // TODO(dimitry): workaround for http://b/26394120 - the grey-list
// TODO(dimitry) before O release: add a namespace attribute to have this enabled
// only for classloader-namespaces
const soinfo* needed_by = task->is_dt_needed() ? task->get_needed_by() : nullptr;
- if (is_exempt_lib(ns, name, needed_by)) {
+ if (is_greylisted(ns, name, needed_by)) {
// print warning only if needed by non-system library
if (needed_by == nullptr || !is_system_library(needed_by->get_realpath())) {
const soinfo* needed_or_dlopened_by = task->get_needed_by();
@@ -1231,18 +1243,20 @@ static bool load_library(android_namespace_t* ns,
}
soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);
+ if (si == nullptr) {
+ return false;
+ }
task->set_soinfo(si);
// Read the ELF header and some of the segments.
if (!task->read(realpath.c_str(), file_stat.st_size)) {
- task->remove_cached_elf_reader();
- task->set_soinfo(nullptr);
soinfo_free(si);
+ task->set_soinfo(nullptr);
return false;
}
- // Find and set DT_RUNPATH, DT_SONAME, and DT_FLAGS_1.
+ // find and set DT_RUNPATH and dt_soname
// Note that these field values are temporary and are
// going to be overwritten on soinfo::prelink_image
// with values from PT_LOAD segments.
@@ -1254,10 +1268,6 @@ static bool load_library(android_namespace_t* ns,
if (d->d_tag == DT_SONAME) {
si->set_soname(elf_reader.get_string(d->d_un.d_val));
}
- // We need to identify a DF_1_GLOBAL library early so we can link it to namespaces.
- if (d->d_tag == DT_FLAGS_1) {
- si->set_dt_flags_1(d->d_un.d_val);
- }
}
#if !defined(__ANDROID__)
@@ -1288,13 +1298,14 @@ static bool load_library(android_namespace_t* ns,
soinfo* needed_by = task->get_needed_by();
const android_dlextinfo* extinfo = task->get_extinfo();
+ off64_t file_offset;
+ std::string realpath;
if (extinfo != nullptr && (extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD) != 0) {
- off64_t file_offset = 0;
+ file_offset = 0;
if ((extinfo->flags & ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET) != 0) {
file_offset = extinfo->library_fd_offset;
}
- std::string realpath;
if (!realpath_fd(extinfo->library_fd, &realpath)) {
if (!is_first_stage_init()) {
PRINT(
@@ -1312,12 +1323,10 @@ static bool load_library(android_namespace_t* ns,
LD_LOG(kLogDlopen,
"load_library(ns=%s, task=%s, flags=0x%x, search_linked_namespaces=%d): calling "
- "open_library",
- ns->get_name(), name, rtld_flags, search_linked_namespaces);
+ "open_library with realpath=%s",
+ ns->get_name(), name, rtld_flags, search_linked_namespaces, realpath.c_str());
// Open the file.
- off64_t file_offset;
- std::string realpath;
int fd = open_library(ns, zip_archive_cache, name, needed_by, &file_offset, &realpath);
if (fd == -1) {
if (task->is_dt_needed()) {
@@ -1343,7 +1352,8 @@ static bool find_loaded_library_by_soname(android_namespace_t* ns,
const char* name,
soinfo** candidate) {
return !ns->soinfo_list().visit([&](soinfo* si) {
- if (strcmp(name, si->get_soname()) == 0) {
+ const char* soname = si->get_soname();
+ if (soname != nullptr && (strcmp(name, soname) == 0)) {
*candidate = si;
return false;
}
@@ -1427,11 +1437,11 @@ static bool find_library_internal(android_namespace_t* ns,
LoadTask* task,
ZipArchiveCache* zip_archive_cache,
LoadTaskList* load_tasks,
- int rtld_flags) {
+ int rtld_flags,
+ bool search_linked_namespaces) {
soinfo* candidate;
- if (find_loaded_library_by_soname(ns, task->get_name(), true /* search_linked_namespaces */,
- &candidate)) {
+ if (find_loaded_library_by_soname(ns, task->get_name(), search_linked_namespaces, &candidate)) {
LD_LOG(kLogDlopen,
"find_library_internal(ns=%s, task=%s): Already loaded (by soname): %s",
ns->get_name(), task->get_name(), candidate->get_realpath());
@@ -1444,49 +1454,54 @@ static bool find_library_internal(android_namespace_t* ns,
TRACE("[ \"%s\" find_loaded_library_by_soname failed (*candidate=%s@%p). Trying harder... ]",
task->get_name(), candidate == nullptr ? "n/a" : candidate->get_realpath(), candidate);
- if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags,
- true /* search_linked_namespaces */)) {
+ if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags, search_linked_namespaces)) {
return true;
}
- // TODO(dimitry): workaround for http://b/26394120 (the exempt-list)
- if (ns->is_exempt_list_enabled() && is_exempt_lib(ns, task->get_name(), task->get_needed_by())) {
- // For the libs in the exempt-list, switch to the default namespace and then
+ // TODO(dimitry): workaround for http://b/26394120 (the grey-list)
+ if (ns->is_greylist_enabled() && is_greylisted(ns, task->get_name(), task->get_needed_by())) {
+ // For the libs in the greylist, switch to the default namespace and then
// try the load again from there. The library could be loaded from the
// default namespace or from another namespace (e.g. runtime) that is linked
// from the default namespace.
LD_LOG(kLogDlopen,
- "find_library_internal(ns=%s, task=%s): Exempt system library - trying namespace %s",
+ "find_library_internal(ns=%s, task=%s): Greylisted library - trying namespace %s",
ns->get_name(), task->get_name(), g_default_namespace.get_name());
ns = &g_default_namespace;
if (load_library(ns, task, zip_archive_cache, load_tasks, rtld_flags,
- true /* search_linked_namespaces */)) {
+ search_linked_namespaces)) {
return true;
}
}
// END OF WORKAROUND
- // if a library was not found - look into linked namespaces
- // preserve current dlerror in the case it fails.
- DlErrorRestorer dlerror_restorer;
- LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Trying %zu linked namespaces",
- ns->get_name(), task->get_name(), ns->linked_namespaces().size());
- for (auto& linked_namespace : ns->linked_namespaces()) {
- if (find_library_in_linked_namespace(linked_namespace, task)) {
- // Library is already loaded.
- if (task->get_soinfo() != nullptr) {
- // n.b. This code path runs when find_library_in_linked_namespace found an already-loaded
- // library by soname. That should only be possible with a exempt-list lookup, where we
- // switch the namespace, because otherwise, find_library_in_linked_namespace is duplicating
- // the soname scan done in this function's first call to find_loaded_library_by_soname.
- return true;
- }
-
- if (load_library(linked_namespace.linked_namespace(), task, zip_archive_cache, load_tasks,
- rtld_flags, false /* search_linked_namespaces */)) {
- LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Found in linked namespace %s",
- ns->get_name(), task->get_name(), linked_namespace.linked_namespace()->get_name());
- return true;
+ if (search_linked_namespaces) {
+ // if a library was not found - look into linked namespaces
+ // preserve current dlerror in the case it fails.
+ DlErrorRestorer dlerror_restorer;
+ LD_LOG(kLogDlopen, "find_library_internal(ns=%s, task=%s): Trying %zu linked namespaces",
+ ns->get_name(), task->get_name(), ns->linked_namespaces().size());
+ for (auto& linked_namespace : ns->linked_namespaces()) {
+ if (find_library_in_linked_namespace(linked_namespace, task)) {
+ if (task->get_soinfo() == nullptr) {
+ // try to load the library - once namespace boundary is crossed
+ // we need to load a library within separate load_group
+ // to avoid using symbols from foreign namespace while.
+ //
+ // However, actual linking is deferred until when the global group
+ // is fully identified and is applied to all namespaces.
+ // Otherwise, the libs in the linked namespace won't get symbols from
+ // the global group.
+ if (load_library(linked_namespace.linked_namespace(), task, zip_archive_cache, load_tasks, rtld_flags, false)) {
+ LD_LOG(
+ kLogDlopen, "find_library_internal(ns=%s, task=%s): Found in linked namespace %s",
+ ns->get_name(), task->get_name(), linked_namespace.linked_namespace()->get_name());
+ return true;
+ }
+ } else {
+ // lib is already loaded
+ return true;
+ }
}
}
}
@@ -1523,6 +1538,7 @@ bool find_libraries(android_namespace_t* ns,
int rtld_flags,
const android_dlextinfo* extinfo,
bool add_as_children,
+ bool search_linked_namespaces,
std::vector<android_namespace_t*>* namespaces) {
// Step 0: prepare.
std::unordered_map<const soinfo*, ElfReader> readers_map;
@@ -1556,7 +1572,6 @@ bool find_libraries(android_namespace_t* ns,
});
ZipArchiveCache zip_archive_cache;
- soinfo_list_t new_global_group_members;
// Step 1: expand the list of load_tasks to include
// all DT_NEEDED libraries (do not load them just yet)
@@ -1579,7 +1594,8 @@ bool find_libraries(android_namespace_t* ns,
task,
&zip_archive_cache,
&load_tasks,
- rtld_flags)) {
+ rtld_flags,
+ search_linked_namespaces || is_dt_needed)) {
return false;
}
@@ -1591,31 +1607,13 @@ bool find_libraries(android_namespace_t* ns,
// When ld_preloads is not null, the first
// ld_preloads_count libs are in fact ld_preloads.
- bool is_ld_preload = false;
if (ld_preloads != nullptr && soinfos_count < ld_preloads_count) {
ld_preloads->push_back(si);
- is_ld_preload = true;
}
if (soinfos_count < library_names_count) {
soinfos[soinfos_count++] = si;
}
-
- // Add the new global group members to all initial namespaces. Do this secondary namespace setup
- // at the same time that libraries are added to their primary namespace so that the order of
- // global group members is the same in the every namespace. Only add a library to a namespace
- // once, even if it appears multiple times in the dependency graph.
- if (is_ld_preload || (si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
- if (!si->is_linked() && namespaces != nullptr && !new_global_group_members.contains(si)) {
- new_global_group_members.push_back(si);
- for (auto linked_ns : *namespaces) {
- if (si->get_primary_namespace() != linked_ns) {
- linked_ns->add_soinfo(si);
- si->add_secondary_namespace(linked_ns);
- }
- }
- }
- }
}
// Step 2: Load libraries in random order (see b/24047022)
@@ -1672,15 +1670,39 @@ bool find_libraries(android_namespace_t* ns,
register_soinfo_tls(si);
}
- // Step 4: Construct the global group. DF_1_GLOBAL bit is force set for LD_PRELOADed libs because
- // they must be added to the global group. Note: The DF_1_GLOBAL bit for a library is normally set
- // in step 3.
+ // Step 4: Construct the global group. Note: DF_1_GLOBAL bit of a library is
+ // determined at step 3.
+
+ // Step 4-1: DF_1_GLOBAL bit is force set for LD_PRELOADed libs because they
+ // must be added to the global group
if (ld_preloads != nullptr) {
for (auto&& si : *ld_preloads) {
si->set_dt_flags_1(si->get_dt_flags_1() | DF_1_GLOBAL);
}
}
+ // Step 4-2: Gather all DF_1_GLOBAL libs which were newly loaded during this
+ // run. These will be the new member of the global group
+ soinfo_list_t new_global_group_members;
+ for (auto&& task : load_tasks) {
+ soinfo* si = task->get_soinfo();
+ if (!si->is_linked() && (si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
+ new_global_group_members.push_back(si);
+ }
+ }
+
+ // Step 4-3: Add the new global group members to all the linked namespaces
+ if (namespaces != nullptr) {
+ for (auto linked_ns : *namespaces) {
+ for (auto si : new_global_group_members) {
+ if (si->get_primary_namespace() != linked_ns) {
+ linked_ns->add_soinfo(si);
+ si->add_secondary_namespace(linked_ns);
+ }
+ }
+ }
+ }
+
// Step 5: Collect roots of local_groups.
// Whenever needed_by->si link crosses a namespace boundary it forms its own local_group.
// Here we collect new roots to link them separately later on. Note that we need to avoid
@@ -1815,7 +1837,8 @@ static soinfo* find_library(android_namespace_t* ns,
0,
rtld_flags,
extinfo,
- false /* add_as_children */)) {
+ false /* add_as_children */,
+ true /* search_linked_namespaces */)) {
if (si != nullptr) {
soinfo_unload(si);
}
@@ -2381,21 +2404,6 @@ static void add_soinfos_to_namespace(const soinfo_list_t& soinfos, android_names
}
}
-std::vector<std::string> fix_lib_paths(std::vector<std::string> paths) {
- // For the bootstrap linker, insert /system/${LIB}/bootstrap in front of /system/${LIB} in any
- // namespace search path. The bootstrap linker should prefer to use the bootstrap bionic libraries
- // (e.g. libc.so).
-#if !defined(__ANDROID_APEX__)
- for (size_t i = 0; i < paths.size(); ++i) {
- if (paths[i] == kSystemLibDir) {
- paths.insert(paths.begin() + i, std::string(kSystemLibDir) + "/bootstrap");
- ++i;
- }
- }
-#endif
- return paths;
-}
-
android_namespace_t* create_namespace(const void* caller_addr,
const char* name,
const char* ld_library_path,
@@ -2424,7 +2432,7 @@ android_namespace_t* create_namespace(const void* caller_addr,
android_namespace_t* ns = new (g_namespace_allocator.alloc()) android_namespace_t();
ns->set_name(name);
ns->set_isolated((type & ANDROID_NAMESPACE_TYPE_ISOLATED) != 0);
- ns->set_exempt_list_enabled((type & ANDROID_NAMESPACE_TYPE_EXEMPT_LIST_ENABLED) != 0);
+ ns->set_greylist_enabled((type & ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED) != 0);
ns->set_also_used_as_anonymous((type & ANDROID_NAMESPACE_TYPE_ALSO_USED_AS_ANONYMOUS) != 0);
if ((type & ANDROID_NAMESPACE_TYPE_SHARED) != 0) {
@@ -2569,8 +2577,9 @@ bool VersionTracker::init_verneed(const soinfo* si_from) {
const char* target_soname = si_from->get_string(verneed->vn_file);
// find it in dependencies
- soinfo* target_si = si_from->get_children().find_if(
- [&](const soinfo* si) { return strcmp(si->get_soname(), target_soname) == 0; });
+ soinfo* target_si = si_from->get_children().find_if([&](const soinfo* si) {
+ return si->get_soname() != nullptr && strcmp(si->get_soname(), target_soname) == 0;
+ });
if (target_si == nullptr) {
DL_ERR("cannot find \"%s\" from verneed[%zd] in DT_NEEDED list for \"%s\"",
@@ -3138,14 +3147,6 @@ bool soinfo::prelink_image() {
// resolves everything eagerly, so these can be ignored.
break;
-#if defined(__aarch64__)
- case DT_AARCH64_BTI_PLT:
- case DT_AARCH64_PAC_PLT:
- case DT_AARCH64_VARIANT_PCS:
- // Ignored: AArch64 processor-specific dynamic array tags.
- break;
-#endif
-
default:
if (!relocating_linker) {
const char* tag_name;
@@ -3173,7 +3174,7 @@ bool soinfo::prelink_image() {
DEBUG("si->base = %p, si->strtab = %p, si->symtab = %p",
reinterpret_cast<void*>(base), strtab_, symtab_);
- // Validity checks.
+ // Sanity checks.
if (relocating_linker && needed_count != 0) {
DL_ERR("linker cannot have DT_NEEDED dependencies on other libraries");
return false;
@@ -3192,32 +3193,34 @@ bool soinfo::prelink_image() {
return false;
}
- // Second pass - parse entries relying on strtab. Skip this while relocating the linker so as to
- // avoid doing heap allocations until later in the linker's initialization.
- if (!relocating_linker) {
- for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) {
- switch (d->d_tag) {
- case DT_SONAME:
- set_soname(get_string(d->d_un.d_val));
- break;
- case DT_RUNPATH:
- set_dt_runpath(get_string(d->d_un.d_val));
- break;
- }
+ // second pass - parse entries relying on strtab
+ for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) {
+ switch (d->d_tag) {
+ case DT_SONAME:
+ set_soname(get_string(d->d_un.d_val));
+ break;
+ case DT_RUNPATH:
+ set_dt_runpath(get_string(d->d_un.d_val));
+ break;
}
}
- // Before M release, linker was using basename in place of soname. In the case when DT_SONAME is
- // absent some apps stop working because they can't find DT_NEEDED library by soname. This
- // workaround should keep them working. (Applies only for apps targeting sdk version < M.) Make
- // an exception for the main executable, which does not need to have DT_SONAME. The linker has an
- // DT_SONAME but the soname_ field is initialized later on.
- if (soname_.empty() && this != solist_get_somain() && !relocating_linker &&
+ // Before M release linker was using basename in place of soname.
+ // In the case when dt_soname is absent some apps stop working
+ // because they can't find dt_needed library by soname.
+ // This workaround should keep them working. (Applies only
+ // for apps targeting sdk version < M.) Make an exception for
+ // the main executable and linker; they do not need to have dt_soname.
+ // TODO: >= O the linker doesn't need this workaround.
+ if (soname_ == nullptr &&
+ this != solist_get_somain() &&
+ (flags_ & FLAG_LINKER) == 0 &&
get_application_target_sdk_version() < 23) {
soname_ = basename(realpath_.c_str());
- DL_WARN_documented_change(23, "missing-soname-enforced-for-api-level-23",
- "\"%s\" has no DT_SONAME (will use %s instead)", get_realpath(),
- soname_.c_str());
+ DL_WARN_documented_change(23,
+ "missing-soname-enforced-for-api-level-23",
+ "\"%s\" has no DT_SONAME (will use %s instead)",
+ get_realpath(), soname_);
// Don't call add_dlwarning because a missing DT_SONAME isn't important enough to show in the UI
}
@@ -3256,8 +3259,9 @@ bool soinfo::link_image(const SymbolLookupList& lookup_list, soinfo* local_group
// Fail if app is targeting M or above.
int app_target_api_level = get_application_target_sdk_version();
if (app_target_api_level >= 23) {
- DL_ERR_AND_LOG("\"%s\" has text relocations (%s#Text-Relocations-Enforced-for-API-level-23)",
- get_realpath(), kBionicChangesUrl);
+ DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
+ "bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
+ "Enforced-for-API-level-23)", get_realpath());
return false;
}
// Make segments writable to allow text relocations to work properly. We will later call
@@ -3381,22 +3385,6 @@ static std::string get_ld_config_file_vndk_path() {
return ld_config_file_vndk;
}
-bool is_linker_config_expected(const char* executable_path) {
- // Do not raise message from a host environment which is expected to miss generated linker
- // configuration.
-#if !defined(__ANDROID__)
- return false;
-#endif
-
- if (strcmp(executable_path, "/system/bin/init") == 0) {
- // Generated linker configuration can be missed from processes executed
- // with init binary
- return false;
- }
-
- return true;
-}
-
static std::string get_ld_config_file_path(const char* executable_path) {
#ifdef USE_LD_CONFIG_FILE
// This is a debugging/testing only feature. Must not be available on
@@ -3423,11 +3411,10 @@ static std::string get_ld_config_file_path(const char* executable_path) {
if (file_exists(kLdGeneratedConfigFilePath)) {
return kLdGeneratedConfigFilePath;
- }
-
- if (is_linker_config_expected(executable_path)) {
- DL_WARN("Warning: failed to find generated linker configuration from \"%s\"",
- kLdGeneratedConfigFilePath);
+ } else {
+ // TODO(b/146386369) : Adjust log level and add more condition to log only when necessary
+ INFO("Warning: failed to find generated linker configuration from \"%s\"",
+ kLdGeneratedConfigFilePath);
}
path = get_ld_config_file_vndk_path();
@@ -3453,19 +3440,23 @@ std::vector<android_namespace_t*> init_default_namespaces(const char* executable
const Config* config = nullptr;
- {
- std::string ld_config_file_path = get_ld_config_file_path(executable_path);
- INFO("[ Reading linker config \"%s\" ]", ld_config_file_path.c_str());
- ScopedTrace trace(("linker config " + ld_config_file_path).c_str());
- std::string error_msg;
- if (!Config::read_binary_config(ld_config_file_path.c_str(), executable_path, g_is_asan,
- &config, &error_msg)) {
- if (!error_msg.empty()) {
- DL_WARN("Warning: couldn't read '%s' for '%s' (using default configuration instead): %s",
- ld_config_file_path.c_str(), executable_path, error_msg.c_str());
- }
- config = nullptr;
+ std::string error_msg;
+
+ std::string ld_config_file_path = get_ld_config_file_path(executable_path);
+
+ INFO("[ Reading linker config \"%s\" ]", ld_config_file_path.c_str());
+ if (!Config::read_binary_config(ld_config_file_path.c_str(),
+ executable_path,
+ g_is_asan,
+ &config,
+ &error_msg)) {
+ if (!error_msg.empty()) {
+ DL_WARN("Warning: couldn't read \"%s\" for \"%s\" (using default configuration instead): %s",
+ ld_config_file_path.c_str(),
+ executable_path,
+ error_msg.c_str());
}
+ config = nullptr;
}
if (config == nullptr) {
@@ -3499,7 +3490,7 @@ std::vector<android_namespace_t*> init_default_namespaces(const char* executable
ns->set_isolated(ns_config->isolated());
ns->set_default_library_paths(ns_config->search_paths());
ns->set_permitted_paths(ns_config->permitted_paths());
- ns->set_allowed_libs(ns_config->allowed_libs());
+ ns->set_whitelisted_libs(ns_config->whitelisted_libs());
namespaces[ns_config->name()] = ns;
if (ns_config->visible()) {
diff --git a/linker/linker.h b/linker/linker.h
index 74bdcc7fa..2da14041b 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -71,10 +71,6 @@ class VersionTracker {
DISALLOW_COPY_AND_ASSIGN(VersionTracker);
};
-static constexpr const char* kBionicChangesUrl =
- "https://android.googlesource.com/platform/bionic/+/master/"
- "android-changes-for-ndk-developers.md";
-
soinfo* get_libdl_info(const soinfo& linker_si);
soinfo* find_containing_library(const void* p);
@@ -110,8 +106,6 @@ void ___cfi_fail(uint64_t CallSiteTypeId, void* Ptr, void *DiagData, void *Ret);
void set_application_target_sdk_version(int target);
int get_application_target_sdk_version();
-bool get_transparent_hugepages_supported();
-
enum {
/* A regular namespace is the namespace with a custom search path that does
* not impose any restrictions on the location of native libraries.
@@ -135,10 +129,10 @@ enum {
*/
ANDROID_NAMESPACE_TYPE_SHARED = 2,
- /* This flag instructs linker to enable exempt-list workaround for the namespace.
+ /* This flag instructs linker to enable grey-list workaround for the namespace.
* See http://b/26394120 for details.
*/
- ANDROID_NAMESPACE_TYPE_EXEMPT_LIST_ENABLED = 0x08000000,
+ ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED = 0x08000000,
/* This flag instructs linker to use this namespace as the anonymous
* namespace. There can be only one anonymous namespace in a process. If there
@@ -183,9 +177,3 @@ struct address_space_params {
int get_application_target_sdk_version();
ElfW(Versym) find_verdef_version_index(const soinfo* si, const version_info* vi);
bool validate_verdef_section(const soinfo* si);
-
-struct platform_properties {
-#if defined(__aarch64__)
- bool bti_supported = false;
-#endif
-};
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index 5b68b1d6c..1e2f9a2a2 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -27,15 +27,12 @@
*/
#include "linker_block_allocator.h"
-
#include <inttypes.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <unistd.h>
-#include "linker_debug.h"
-
static constexpr size_t kAllocateSize = PAGE_SIZE * 100;
static_assert(kAllocateSize % PAGE_SIZE == 0, "Invalid kAllocateSize.");
@@ -91,10 +88,16 @@ void LinkerBlockAllocator::free(void* block) {
}
LinkerBlockAllocatorPage* page = find_page(block);
- CHECK(page != nullptr);
+
+ if (page == nullptr) {
+ abort();
+ }
ssize_t offset = reinterpret_cast<uint8_t*>(block) - page->bytes;
- CHECK((offset % block_size_) == 0);
+
+ if (offset % block_size_ != 0) {
+ abort();
+ }
memset(block, 0, block_size_);
@@ -111,7 +114,7 @@ void LinkerBlockAllocator::free(void* block) {
void LinkerBlockAllocator::protect_all(int prot) {
for (LinkerBlockAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
if (mprotect(page, kAllocateSize, prot) == -1) {
- async_safe_fatal("mprotect(%p, %zu, %d) failed: %m", page, kAllocateSize, prot);
+ abort();
}
}
}
@@ -122,7 +125,10 @@ void LinkerBlockAllocator::create_new_page() {
LinkerBlockAllocatorPage* page = reinterpret_cast<LinkerBlockAllocatorPage*>(
mmap(nullptr, kAllocateSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0));
- CHECK(page != MAP_FAILED);
+
+ if (page == MAP_FAILED) {
+ abort(); // oom
+ }
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, page, kAllocateSize, "linker_alloc");
@@ -137,7 +143,9 @@ void LinkerBlockAllocator::create_new_page() {
}
LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
- CHECK(block != nullptr);
+ if (block == nullptr) {
+ abort();
+ }
LinkerBlockAllocatorPage* page = page_list_;
while (page != nullptr) {
@@ -149,7 +157,7 @@ LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
page = page->next;
}
- async_safe_fatal("couldn't find page for %p", block);
+ abort();
}
void LinkerBlockAllocator::purge() {
diff --git a/linker/linker_block_allocator_test.cpp b/linker/linker_block_allocator_test.cpp
index 6fb2b2680..359eefbab 100644
--- a/linker/linker_block_allocator_test.cpp
+++ b/linker/linker_block_allocator_test.cpp
@@ -47,14 +47,14 @@ struct test_struct_nominal {
* this one has size below allocator cap which is 2*sizeof(void*)
*/
struct test_struct_small {
- char str[5];
+ char dummy_str[5];
};
/*
* 1009 byte struct (1009 is prime)
*/
struct test_struct_larger {
- char str[1009];
+ char dummy_str[1009];
};
static size_t kPageSize = sysconf(_SC_PAGE_SIZE);
@@ -131,14 +131,14 @@ static void protect_all() {
allocator.protect_all(PROT_READ);
allocator.protect_all(PROT_READ | PROT_WRITE);
// check access
- page2_ptr->str[23] = 27;
- page1_ptr->str[13] = 11;
+ page2_ptr->dummy_str[23] = 27;
+ page1_ptr->dummy_str[13] = 11;
allocator.protect_all(PROT_READ);
fprintf(stderr, "trying to access protected page");
// this should result in segmentation fault
- page1_ptr->str[11] = 7;
+ page1_ptr->dummy_str[11] = 7;
}
TEST(linker_allocator, test_protect) {
diff --git a/linker/linker_cfi.cpp b/linker/linker_cfi.cpp
index 6bc261545..87b5d3485 100644
--- a/linker/linker_cfi.cpp
+++ b/linker/linker_cfi.cpp
@@ -133,7 +133,8 @@ void CFIShadowWriter::Add(uintptr_t begin, uintptr_t end, uintptr_t cfi_check) {
static soinfo* find_libdl(soinfo* solist) {
for (soinfo* si = solist; si != nullptr; si = si->next) {
- if (strcmp(si->get_soname(), "libdl.so") == 0) {
+ const char* soname = si->get_soname();
+ if (soname && strcmp(soname, "libdl.so") == 0) {
return si;
}
}
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 1771e8706..ada25a589 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -325,9 +325,7 @@ static bool parse_config_file(const char* ld_config_file_path,
value = "," + value;
(*properties)[name].append_value(std::move(value));
} else if (android::base::EndsWith(name, ".paths") ||
- android::base::EndsWith(name, ".shared_libs") ||
- android::base::EndsWith(name, ".whitelisted") ||
- android::base::EndsWith(name, ".allowed_libs")) {
+ android::base::EndsWith(name, ".shared_libs")) {
value = ":" + value;
(*properties)[name].append_value(std::move(value));
} else {
@@ -565,15 +563,10 @@ bool Config::read_binary_config(const char* ld_config_file_path,
ns_config->set_isolated(properties.get_bool(property_name_prefix + ".isolated"));
ns_config->set_visible(properties.get_bool(property_name_prefix + ".visible"));
- std::string allowed_libs =
+ std::string whitelisted =
properties.get_string(property_name_prefix + ".whitelisted", &lineno);
- const std::string libs = properties.get_string(property_name_prefix + ".allowed_libs", &lineno);
- if (!allowed_libs.empty() && !libs.empty()) {
- allowed_libs += ":";
- }
- allowed_libs += libs;
- if (!allowed_libs.empty()) {
- ns_config->set_allowed_libs(android::base::Split(allowed_libs, ":"));
+ if (!whitelisted.empty()) {
+ ns_config->set_whitelisted_libs(android::base::Split(whitelisted, ":"));
}
// these are affected by is_asan flag
diff --git a/linker/linker_config.h b/linker/linker_config.h
index fe23ec169..673314870 100644
--- a/linker/linker_config.h
+++ b/linker/linker_config.h
@@ -98,7 +98,9 @@ class NamespaceConfig {
return permitted_paths_;
}
- const std::vector<std::string>& allowed_libs() const { return allowed_libs_; }
+ const std::vector<std::string>& whitelisted_libs() const {
+ return whitelisted_libs_;
+ }
const std::vector<NamespaceLinkConfig>& links() const {
return namespace_links_;
@@ -125,17 +127,16 @@ class NamespaceConfig {
permitted_paths_ = std::move(permitted_paths);
}
- void set_allowed_libs(std::vector<std::string>&& allowed_libs) {
- allowed_libs_ = std::move(allowed_libs);
+ void set_whitelisted_libs(std::vector<std::string>&& whitelisted_libs) {
+ whitelisted_libs_ = std::move(whitelisted_libs);
}
-
private:
const std::string name_;
bool isolated_;
bool visible_;
std::vector<std::string> search_paths_;
std::vector<std::string> permitted_paths_;
- std::vector<std::string> allowed_libs_;
+ std::vector<std::string> whitelisted_libs_;
std::vector<NamespaceLinkConfig> namespace_links_;
DISALLOW_IMPLICIT_CONSTRUCTORS(NamespaceConfig);
diff --git a/linker/linker_config_test.cpp b/linker/linker_config_test.cpp
index acdf64173..49370566c 100644
--- a/linker/linker_config_test.cpp
+++ b/linker/linker_config_test.cpp
@@ -47,7 +47,6 @@
#define ARCH_SUFFIX ""
#endif
-// clang-format off
static const char* config_str =
"# comment \n"
"dir.test = /data/local/tmp\n"
@@ -89,12 +88,8 @@ static const char* config_str =
"namespace.vndk_in_system.visible = true\n"
"namespace.vndk_in_system.search.paths = /system/${LIB}\n"
"namespace.vndk_in_system.permitted.paths = /system/${LIB}\n"
- "namespace.vndk_in_system.whitelisted = libz.so:libyuv.so\n"
- "namespace.vndk_in_system.whitelisted += libtinyxml2.so\n"
- "namespace.vndk_in_system.allowed_libs = libfoo.so:libbar.so\n"
- "namespace.vndk_in_system.allowed_libs += libtinyxml3.so\n"
+ "namespace.vndk_in_system.whitelisted = libz.so:libyuv.so:libtinyxml2.so\n"
"\n";
-// clang-format on
static bool write_version(const std::string& path, uint32_t version) {
std::string content = android::base::StringPrintf("%d", version);
@@ -217,9 +212,9 @@ static void run_linker_config_smoke_test(bool is_asan) {
ASSERT_TRUE(ns_vndk_links[0].allow_all_shared_libs());
ASSERT_TRUE(ns_vndk_in_system != nullptr) << "vndk_in_system namespace was not found";
- ASSERT_EQ(std::vector<std::string>({"libz.so", "libyuv.so", "libtinyxml2.so", "libfoo.so",
- "libbar.so", "libtinyxml3.so"}),
- ns_vndk_in_system->allowed_libs());
+ ASSERT_EQ(
+ std::vector<std::string>({"libz.so", "libyuv.so", "libtinyxml2.so"}),
+ ns_vndk_in_system->whitelisted_libs());
}
TEST(linker_config, smoke) {
diff --git a/linker/linker_debuggerd_android.cpp b/linker/linker_debuggerd_android.cpp
index cba6345c1..42ea2b7ff 100644
--- a/linker/linker_debuggerd_android.cpp
+++ b/linker/linker_debuggerd_android.cpp
@@ -33,28 +33,18 @@
#include "linker_gdb_support.h"
-#if defined(__ANDROID_APEX__)
-static debugger_process_info get_process_info() {
- return {
- .abort_msg = __libc_shared_globals()->abort_msg,
- .fdsan_table = &__libc_shared_globals()->fd_table,
- .gwp_asan_state = __libc_shared_globals()->gwp_asan_state,
- .gwp_asan_metadata = __libc_shared_globals()->gwp_asan_metadata,
- .scudo_stack_depot = __libc_shared_globals()->scudo_stack_depot,
- .scudo_region_info = __libc_shared_globals()->scudo_region_info,
- .scudo_ring_buffer = __libc_shared_globals()->scudo_ring_buffer,
- };
-}
-#endif
-
void linker_debuggerd_init() {
- // There may be a version mismatch between the bootstrap linker and the crash_dump in the APEX,
- // so don't pass in any process info from the bootstrap linker.
debuggerd_callbacks_t callbacks = {
-#if defined(__ANDROID_APEX__)
- .get_process_info = get_process_info,
-#endif
- .post_dump = notify_gdb_of_libraries,
+ .get_abort_message = []() {
+ return __libc_shared_globals()->abort_msg;
+ },
+ .post_dump = &notify_gdb_of_libraries,
+ .get_gwp_asan_state = []() {
+ return __libc_shared_globals()->gwp_asan_state;
+ },
+ .get_gwp_asan_metadata = []() {
+ return __libc_shared_globals()->gwp_asan_metadata;
+ },
};
debuggerd_init(&callbacks);
}
diff --git a/linker/linker_globals.cpp b/linker/linker_globals.cpp
index 4a17d0918..bcc2a1e6f 100644
--- a/linker/linker_globals.cpp
+++ b/linker/linker_globals.cpp
@@ -40,8 +40,6 @@ android_namespace_t g_default_namespace;
std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
-platform_properties g_platform_properties;
-
static char __linker_dl_err_buf[768];
char* linker_get_error_buffer() {
@@ -52,7 +50,7 @@ size_t linker_get_error_buffer_size() {
return sizeof(__linker_dl_err_buf);
}
-void DL_WARN_documented_change(int api_level, const char* doc_fragment, const char* fmt, ...) {
+void DL_WARN_documented_change(int api_level, const char* doc_link, const char* fmt, ...) {
std::string result{"Warning: "};
va_list ap;
@@ -62,9 +60,8 @@ void DL_WARN_documented_change(int api_level, const char* doc_fragment, const ch
android::base::StringAppendF(&result,
" and will not work when the app moves to API level %d or later "
- "(%s#%s) (allowing for now because this app's target API level is "
- "still %d)",
- api_level, kBionicChangesUrl, doc_fragment,
- get_application_target_sdk_version());
+ "(https://android.googlesource.com/platform/bionic/+/master/%s) "
+ "(allowing for now because this app's target API level is still %d)",
+ api_level, doc_link, get_application_target_sdk_version());
DL_WARN("%s", result.c_str());
}
diff --git a/linker/linker_globals.h b/linker/linker_globals.h
index 09986290c..83cedcab4 100644
--- a/linker/linker_globals.h
+++ b/linker/linker_globals.h
@@ -79,14 +79,11 @@ extern char** g_envp;
struct soinfo;
struct android_namespace_t;
-struct platform_properties;
extern android_namespace_t g_default_namespace;
extern std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
-extern platform_properties g_platform_properties;
-
// Error buffer "variable"
char* linker_get_error_buffer();
size_t linker_get_error_buffer_size();
diff --git a/linker/linker_logger.cpp b/linker/linker_logger.cpp
index 165b85d96..ec07a5547 100644
--- a/linker/linker_logger.cpp
+++ b/linker/linker_logger.cpp
@@ -41,6 +41,7 @@
#include "private/CachedProperty.h"
LinkerLogger g_linker_logger;
+bool g_greylist_disabled = false;
static uint32_t ParseProperty(const std::string& value) {
if (value.empty()) {
@@ -90,6 +91,15 @@ void LinkerLogger::ResetState() {
return;
}
+ // This is a convenient place to check whether the greylist should be disabled for testing.
+ static CachedProperty greylist_disabled("debug.ld.greylist_disabled");
+ bool old_value = g_greylist_disabled;
+ g_greylist_disabled = (strcmp(greylist_disabled.Get(), "true") == 0);
+ if (g_greylist_disabled != old_value) {
+ async_safe_format_log(ANDROID_LOG_INFO, "linker", "%s greylist",
+ g_greylist_disabled ? "Disabling" : "Enabling");
+ }
+
flags_ = 0;
// For logging, check the flag applied to all processes first.
diff --git a/linker/linker_logger.h b/linker/linker_logger.h
index f3820a293..fedbc05cf 100644
--- a/linker/linker_logger.h
+++ b/linker/linker_logger.h
@@ -63,3 +63,7 @@ class LinkerLogger {
extern LinkerLogger g_linker_logger;
extern char** g_argv;
+
+// If the system property debug.ld.greylist_disabled is true, we'll not use the greylist
+// regardless of API level.
+extern bool g_greylist_disabled;
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 2a690e9a0..98af54ac2 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -31,10 +31,9 @@
#include <link.h>
#include <sys/auxv.h>
-#include "linker.h"
-#include "linker_cfi.h"
#include "linker_debug.h"
#include "linker_debuggerd.h"
+#include "linker_cfi.h"
#include "linker_gdb_support.h"
#include "linker_globals.h"
#include "linker_phdr.h"
@@ -67,8 +66,6 @@ static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_cou
static void set_bss_vma_name(soinfo* si);
-void __libc_init_mte(const void* phdr_start, size_t phdr_count, uintptr_t load_bias);
-
// These should be preserved static to avoid emitting
// RELATIVE relocations for the part of the code running
// before linker links itself.
@@ -300,13 +297,6 @@ static ExecutableInfo load_executable(const char* orig_path) {
return result;
}
-static void platform_properties_init() {
-#if defined(__aarch64__)
- const unsigned long hwcap2 = getauxval(AT_HWCAP2);
- g_platform_properties.bti_supported = (hwcap2 & HWCAP2_BTI) != 0;
-#endif
-}
-
static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load) {
ProtectedDataGuard guard;
@@ -321,9 +311,6 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
// Initialize system properties
__system_properties_init(); // may use 'environ'
- // Initialize platform properties.
- platform_properties_init();
-
// Register the debuggerd signal handler.
linker_debuggerd_init();
@@ -394,22 +381,6 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
solinker->set_realpath(interp);
init_link_map_head(*solinker);
-#if defined(__aarch64__)
- if (exe_to_load == nullptr) {
- // Kernel does not add PROT_BTI to executable pages of the loaded ELF.
- // Apply appropriate protections here if it is needed.
- auto note_gnu_property = GnuPropertySection(somain);
- if (note_gnu_property.IsBTICompatible() &&
- (phdr_table_protect_segments(somain->phdr, somain->phnum, somain->load_bias,
- &note_gnu_property) < 0)) {
- __linker_error("error: can't protect segments for \"%s\": %s", exe_info.path.c_str(),
- strerror(errno));
- }
- }
-
- __libc_init_mte(somain->phdr, somain->phnum, somain->load_bias);
-#endif
-
// Register the main executable and the linker upfront to have
// gdb aware of them before loading the rest of the dependency
// tree.
@@ -489,6 +460,7 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load
RTLD_GLOBAL,
nullptr,
true /* add_as_children */,
+ true /* search_linked_namespaces */,
&namespaces)) {
__linker_cannot_link(g_argv[0]);
} else if (needed_libraries_count == 0) {
@@ -726,13 +698,6 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& tmp_linker_so)
// Initialize the linker's own global variables
tmp_linker_so.call_constructors();
- // Setting the linker soinfo's soname can allocate heap memory, so delay it until here.
- for (const ElfW(Dyn)* d = tmp_linker_so.dynamic; d->d_tag != DT_NULL; ++d) {
- if (d->d_tag == DT_SONAME) {
- tmp_linker_so.set_soname(tmp_linker_so.get_string(d->d_un.d_val));
- }
- }
-
// When the linker is run directly rather than acting as PT_INTERP, parse
// arguments and determine the executable to load. When it's instead acting
// as PT_INTERP, AT_ENTRY will refer to the loaded executable rather than the
diff --git a/linker/linker_main.h b/linker/linker_main.h
index 724f43c14..47d4bdb3e 100644
--- a/linker/linker_main.h
+++ b/linker/linker_main.h
@@ -63,6 +63,7 @@ bool find_libraries(android_namespace_t* ns,
int rtld_flags,
const android_dlextinfo* extinfo,
bool add_as_children,
+ bool search_linked_namespaces,
std::vector<android_namespace_t*>* namespaces = nullptr);
void solist_add_soinfo(soinfo* si);
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
index 518212971..b9936891d 100644
--- a/linker/linker_namespaces.cpp
+++ b/linker/linker_namespaces.cpp
@@ -39,9 +39,10 @@ bool android_namespace_t::is_accessible(const std::string& file) {
return true;
}
- if (!allowed_libs_.empty()) {
+ if (!whitelisted_libs_.empty()) {
const char *lib_name = basename(file.c_str());
- if (std::find(allowed_libs_.begin(), allowed_libs_.end(), lib_name) == allowed_libs_.end()) {
+ if (std::find(whitelisted_libs_.begin(), whitelisted_libs_.end(),
+ lib_name) == whitelisted_libs_.end()) {
return false;
}
}
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index 6817901a3..9561bb444 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -34,8 +34,6 @@
#include <vector>
#include <unordered_set>
-std::vector<std::string> fix_lib_paths(std::vector<std::string> paths);
-
struct android_namespace_t;
struct android_namespace_link_t {
@@ -56,6 +54,9 @@ struct android_namespace_link_t {
}
bool is_accessible(const char* soname) const {
+ if (soname == nullptr) {
+ return false;
+ }
return allow_all_shared_libs_ || shared_lib_sonames_.find(soname) != shared_lib_sonames_.end();
}
@@ -73,7 +74,7 @@ struct android_namespace_t {
public:
android_namespace_t() :
is_isolated_(false),
- is_exempt_list_enabled_(false),
+ is_greylist_enabled_(false),
is_also_used_as_anonymous_(false) {}
const char* get_name() const { return name_.c_str(); }
@@ -82,8 +83,8 @@ struct android_namespace_t {
bool is_isolated() const { return is_isolated_; }
void set_isolated(bool isolated) { is_isolated_ = isolated; }
- bool is_exempt_list_enabled() const { return is_exempt_list_enabled_; }
- void set_exempt_list_enabled(bool enabled) { is_exempt_list_enabled_ = enabled; }
+ bool is_greylist_enabled() const { return is_greylist_enabled_; }
+ void set_greylist_enabled(bool enabled) { is_greylist_enabled_ = enabled; }
bool is_also_used_as_anonymous() const { return is_also_used_as_anonymous_; }
void set_also_used_as_anonymous(bool yes) { is_also_used_as_anonymous_ = yes; }
@@ -99,10 +100,10 @@ struct android_namespace_t {
return default_library_paths_;
}
void set_default_library_paths(std::vector<std::string>&& library_paths) {
- default_library_paths_ = fix_lib_paths(std::move(library_paths));
+ default_library_paths_ = std::move(library_paths);
}
void set_default_library_paths(const std::vector<std::string>& library_paths) {
- default_library_paths_ = fix_lib_paths(library_paths);
+ default_library_paths_ = library_paths;
}
const std::vector<std::string>& get_permitted_paths() const {
@@ -115,12 +116,14 @@ struct android_namespace_t {
permitted_paths_ = permitted_paths;
}
- const std::vector<std::string>& get_allowed_libs() const { return allowed_libs_; }
- void set_allowed_libs(std::vector<std::string>&& allowed_libs) {
- allowed_libs_ = std::move(allowed_libs);
+ const std::vector<std::string>& get_whitelisted_libs() const {
+ return whitelisted_libs_;
+ }
+ void set_whitelisted_libs(std::vector<std::string>&& whitelisted_libs) {
+ whitelisted_libs_ = std::move(whitelisted_libs);
}
- void set_allowed_libs(const std::vector<std::string>& allowed_libs) {
- allowed_libs_ = allowed_libs;
+ void set_whitelisted_libs(const std::vector<std::string>& whitelisted_libs) {
+ whitelisted_libs_ = whitelisted_libs;
}
const std::vector<android_namespace_link_t>& linked_namespaces() const {
@@ -166,12 +169,12 @@ struct android_namespace_t {
private:
std::string name_;
bool is_isolated_;
- bool is_exempt_list_enabled_;
+ bool is_greylist_enabled_;
bool is_also_used_as_anonymous_;
std::vector<std::string> ld_library_paths_;
std::vector<std::string> default_library_paths_;
std::vector<std::string> permitted_paths_;
- std::vector<std::string> allowed_libs_;
+ std::vector<std::string> whitelisted_libs_;
// Loader looks into linked namespace if it was not able
// to find a library in this namespace. Note that library
// lookup in linked namespaces are limited by the list of
diff --git a/linker/linker_note_gnu_property.cpp b/linker/linker_note_gnu_property.cpp
deleted file mode 100644
index be1aebc88..000000000
--- a/linker/linker_note_gnu_property.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "linker_note_gnu_property.h"
-
-#include <elf.h>
-#include <link.h>
-
-#include "linker.h"
-#include "linker_debug.h"
-#include "linker_globals.h"
-#include "linker_soinfo.h"
-
-GnuPropertySection::GnuPropertySection(const soinfo* si)
- : GnuPropertySection(si->phdr, si->phnum, si->load_bias, si->get_realpath()) {}
-
-GnuPropertySection::GnuPropertySection(const ElfW(Phdr)* phdr, size_t phdr_count,
- const ElfW(Addr) load_bias, const char* name) {
- // Try to find PT_GNU_PROPERTY segment.
- auto note_gnu_property = FindSegment(phdr, phdr_count, load_bias, name);
- // Perform some validity checks.
- if (note_gnu_property && SanityCheck(note_gnu_property, name)) {
- // Parse section.
- Parse(note_gnu_property, name);
- }
-}
-
-const ElfW(NhdrGNUProperty)* GnuPropertySection::FindSegment(const ElfW(Phdr)* phdr,
- size_t phdr_count,
- const ElfW(Addr) load_bias,
- const char* name) const {
- // According to Linux gABI extension this segment should contain
- // .note.gnu.property section only.
- if (phdr != nullptr) {
- for (size_t i = 0; i < phdr_count; ++i) {
- if (phdr[i].p_type != PT_GNU_PROPERTY) {
- continue;
- }
-
- TRACE("\"%s\" PT_GNU_PROPERTY: found at segment index %zu", name, i);
-
- // Check segment size.
- if (phdr[i].p_memsz < sizeof(ElfW(NhdrGNUProperty))) {
- DL_ERR_AND_LOG(
- "\"%s\" PT_GNU_PROPERTY segment is too small. Segment "
- "size is %zu, minimum is %zu.",
- name, static_cast<size_t>(phdr[i].p_memsz), sizeof(ElfW(NhdrGNUProperty)));
- return nullptr;
- }
-
- // PT_GNU_PROPERTY contains .note.gnu.property which has SHF_ALLOC
- // attribute, therefore it is loaded.
- auto note_nhdr = reinterpret_cast<ElfW(NhdrGNUProperty)*>(load_bias + phdr[i].p_vaddr);
-
- // Check that the n_descsz <= p_memsz
- if ((phdr[i].p_memsz - sizeof(ElfW(NhdrGNUProperty))) < note_nhdr->nhdr.n_descsz) {
- DL_ERR_AND_LOG(
- "\"%s\" PT_GNU_PROPERTY segment p_memsz (%zu) is too small for note n_descsz (%zu).",
- name, static_cast<size_t>(phdr[i].p_memsz),
- static_cast<size_t>(note_nhdr->nhdr.n_descsz));
- return nullptr;
- }
-
- return note_nhdr;
- }
- }
-
- TRACE("\"%s\" PT_GNU_PROPERTY: not found", name);
- return nullptr;
-}
-
-bool GnuPropertySection::SanityCheck(const ElfW(NhdrGNUProperty)* note_nhdr,
- const char* name) const {
- // Check .note section type
- if (note_nhdr->nhdr.n_type != NT_GNU_PROPERTY_TYPE_0) {
- DL_ERR_AND_LOG("\"%s\" .note.gnu.property: unexpected note type. Expected %u, got %u.", name,
- NT_GNU_PROPERTY_TYPE_0, note_nhdr->nhdr.n_type);
- return false;
- }
-
- if (note_nhdr->nhdr.n_namesz != 4) {
- DL_ERR_AND_LOG("\"%s\" .note.gnu.property: unexpected name size. Expected 4, got %u.", name,
- note_nhdr->nhdr.n_namesz);
- return false;
- }
-
- if (strncmp(note_nhdr->n_name, "GNU", 4) != 0) {
- DL_ERR_AND_LOG("\"%s\" .note.gnu.property: unexpected name. Expected 'GNU', got '%s'.", name,
- note_nhdr->n_name);
- return false;
- }
-
- return true;
-}
-
-bool GnuPropertySection::Parse(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name) {
- // The total length of the program property array is in _bytes_.
- ElfW(Word) offset = 0;
- while (offset < note_nhdr->nhdr.n_descsz) {
- DEBUG("\"%s\" .note.gnu.property: processing at offset 0x%x", name, offset);
-
- // At least the "header" part must fit.
- // The ABI doesn't say that pr_datasz can't be 0.
- if ((note_nhdr->nhdr.n_descsz - offset) < sizeof(ElfW(Prop))) {
- DL_ERR_AND_LOG(
- "\"%s\" .note.gnu.property: no more space left for a "
- "Program Property Note header.",
- name);
- return false;
- }
-
- // Loop on program property array.
- const ElfW(Prop)* property = reinterpret_cast<const ElfW(Prop)*>(&note_nhdr->n_desc[offset]);
- const ElfW(Word) property_size =
- align_up(sizeof(ElfW(Prop)) + property->pr_datasz, sizeof(ElfW(Addr)));
- if ((note_nhdr->nhdr.n_descsz - offset) < property_size) {
- DL_ERR_AND_LOG(
- "\"%s\" .note.gnu.property: property descriptor size is "
- "invalid. Expected at least %u bytes, got %u.",
- name, property_size, note_nhdr->nhdr.n_descsz - offset);
- return false;
- }
-
- // Cache found properties.
- switch (property->pr_type) {
-#if defined(__aarch64__)
- case GNU_PROPERTY_AARCH64_FEATURE_1_AND: {
- if (property->pr_datasz != 4) {
- DL_ERR_AND_LOG(
- "\"%s\" .note.gnu.property: property descriptor size is "
- "invalid. Expected %u bytes for GNU_PROPERTY_AARCH64_FEATURE_1_AND, got %u.",
- name, 4, property->pr_datasz);
- return false;
- }
-
- const ElfW(Word) flags = *reinterpret_cast<const ElfW(Word)*>(&property->pr_data[0]);
- properties_.bti_compatible = (flags & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) != 0;
- if (properties_.bti_compatible) {
- INFO("[ BTI compatible: \"%s\" ]", name);
- }
- break;
- }
-#endif
- default:
- DEBUG("\"%s\" .note.gnu.property: found property pr_type %u pr_datasz 0x%x", name,
- property->pr_type, property->pr_datasz);
- break;
- }
-
- // Move offset, this should be safe to add because of previous checks.
- offset += property_size;
- }
-
- return true;
-}
-
-#if defined(__aarch64__)
-bool GnuPropertySection::IsBTICompatible() const {
- return (g_platform_properties.bti_supported && properties_.bti_compatible);
-}
-#endif
diff --git a/linker/linker_note_gnu_property.h b/linker/linker_note_gnu_property.h
deleted file mode 100644
index b8b4ef792..000000000
--- a/linker/linker_note_gnu_property.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <elf.h>
-#include <link.h>
-
-#include "linker_soinfo.h"
-
-// The Elf* structures below are derived from the document
-// Linux Extensions to gABI (https://github.com/hjl-tools/linux-abi/wiki).
-// Essentially, these types would be defined in <elf.h>, but this is not
-// the case at the moment.
-
-struct Elf32_Prop {
- Elf32_Word pr_type;
- Elf32_Word pr_datasz;
- char pr_data[0];
-};
-
-// On 32-bit machines this should be 4-byte aligned.
-struct Elf32_NhdrGNUProperty {
- Elf32_Nhdr nhdr;
- char n_name[4];
- char n_desc[0];
-};
-
-struct Elf64_Prop {
- Elf64_Word pr_type;
- Elf64_Word pr_datasz;
- char pr_data[0];
-};
-
-// On 64-bit machines this should be 8-byte aligned.
-struct Elf64_NhdrGNUProperty {
- Elf64_Nhdr nhdr;
- char n_name[4];
- char n_desc[0];
-};
-
-struct ElfProgramProperty {
-#if defined(__aarch64__)
- bool bti_compatible = false;
-#endif
-};
-
-// Representation of the .note.gnu.property section found in the segment
-// with p_type = PT_GNU_PROPERTY.
-class GnuPropertySection {
- public:
- GnuPropertySection(){};
- explicit GnuPropertySection(const soinfo* si);
- GnuPropertySection(const ElfW(Phdr)* phdr, size_t phdr_count, const ElfW(Addr) load_bias,
- const char* name);
-
-#if defined(__aarch64__)
- bool IsBTICompatible() const;
-#endif
-
- private:
- const ElfW(NhdrGNUProperty)* FindSegment(const ElfW(Phdr)* phdr, size_t phdr_count,
- const ElfW(Addr) load_bias, const char* name) const;
- bool SanityCheck(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name) const;
- bool Parse(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name);
-
- ElfProgramProperty properties_ __unused;
-};
diff --git a/linker/linker_note_gnu_property_test.cpp b/linker/linker_note_gnu_property_test.cpp
deleted file mode 100644
index 41fc47bc2..000000000
--- a/linker/linker_note_gnu_property_test.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-#include <gtest/gtest.h>
-
-#include "linker.h"
-#include "linker_globals.h"
-#include "linker_note_gnu_property.h"
-#include "platform/bionic/macros.h"
-
-#define SONAME "test_so"
-
-static char error_buffer[1024];
-
-char* linker_get_error_buffer() {
- return error_buffer;
-}
-
-size_t linker_get_error_buffer_size() {
- return std::size(error_buffer);
-}
-
-static void reset_error_buffer() {
- error_buffer[0] = '\0';
-}
-
-platform_properties g_platform_properties {
-#if defined(__aarch64__)
- // Assume "hardware" supports Armv8.5-A BTI.
- .bti_supported = true
-#endif
-};
-
-// Helper macro to make the test cleaner.
-#define PHDR_WITH_NOTE_GNU_PROPERTY(__prop) \
- reset_error_buffer(); \
- ElfW(Phdr) phdrs[] = { \
- {.p_type = PT_LOAD}, \
- { \
- .p_type = PT_GNU_PROPERTY, \
- .p_vaddr = reinterpret_cast<ElfW(Addr)>(__prop), \
- .p_memsz = sizeof(ElfW(NhdrGNUProperty)) + (__prop)->nhdr.n_descsz, \
- }, \
- {.p_type = PT_NULL}, \
- }; \
- auto note = GnuPropertySection(&phdrs[0], std::size(phdrs), 0, SONAME)
-
-// Helper to check for no error message.
-#define ASSERT_NO_ERROR_MSG() ASSERT_STREQ(error_buffer, "")
-
-// Helper to check expected error message.
-#define ASSERT_ERROR_MSG_EQ(__expected) ASSERT_STREQ(error_buffer, "\"" SONAME "\" " __expected)
-
-static void test_bti_not_supported(GnuPropertySection& note __unused) {
-#if defined(__aarch64__)
- ASSERT_FALSE(note.IsBTICompatible());
-#endif
-}
-
-#if defined(__aarch64__)
-static void test_bti_supported(GnuPropertySection& note __unused) {
- ASSERT_TRUE(note.IsBTICompatible());
-}
-#endif
-
-// Helper class to build a well-formed .note.gnu.property section.
-class GnuPropertySectionBuilder {
- public:
- GnuPropertySectionBuilder() {
- note = reinterpret_cast<ElfW(NhdrGNUProperty)*>(&section[0]);
- note->nhdr.n_namesz = 4;
- note->nhdr.n_descsz = 0;
- note->nhdr.n_type = NT_GNU_PROPERTY_TYPE_0;
- memcpy(note->n_name, "GNU", 4);
- }
-
- template <typename T>
- bool push(ElfW(Word) pr_type, ElfW(Word) pr_datasz, const T* pr_data) {
- // Must be aligned.
- const uintptr_t addition = align_up(pr_datasz, sizeof(ElfW(Addr)));
- if ((offset() + addition) > kMaxSectionSize) {
- return false;
- }
- ++entries;
- ElfW(Prop)* prop = reinterpret_cast<ElfW(Prop)*>(&section[offset()]);
- // Header
- prop->pr_type = pr_type;
- prop->pr_datasz = pr_datasz;
- step(2 * sizeof(ElfW(Word)));
- // Data
- memcpy(&section[offset()], reinterpret_cast<const void*>(pr_data), pr_datasz);
- step(pr_datasz);
- // Padding
- memset(&section[offset()], 0xAA, addition - pr_datasz);
- step(addition - pr_datasz);
- return true;
- }
-
- ElfW(NhdrGNUProperty)* data() const { return note; }
-
- void dump() const {
- std::cout << ".note.gnu.property\n";
- dump_member("n_namesz", note->nhdr.n_namesz);
- dump_member("n_descsz", note->nhdr.n_descsz);
- dump_member("n_type ", note->nhdr.n_type);
- dump_member("n_name ", note->n_name);
- dump_member("entries ", entries);
- if (entries > 0) {
- std::cout << " raw data:";
- const uintptr_t offset = note->nhdr.n_descsz + 16;
- for (uintptr_t offs = 16; offs < offset; ++offs) {
- std::cout << std::hex;
- if ((offs % 8) == 0) {
- std::cout << "\n ";
- }
- auto value = static_cast<unsigned>(section[offs]);
- std::cout << " ";
- if (value < 0x10) {
- std::cout << "0";
- }
- std::cout << static_cast<unsigned>(section[offs]);
- }
- std::cout << std::dec << "\n";
- }
- }
-
- void corrupt_n_descsz(ElfW(Word) n_descsz) { note->nhdr.n_descsz = n_descsz; }
-
- private:
- template <typename T>
- void dump_member(const char* name, T value) const {
- std::cout << " " << name << " " << value << "\n";
- }
-
- ElfW(Word) offset() const { return note->nhdr.n_descsz + 16; }
-
- template <typename T>
- void step(T value) {
- note->nhdr.n_descsz += static_cast<ElfW(Word)>(value);
- }
-
- static const size_t kMaxSectionSize = 1024;
-
- alignas(8) uint8_t section[kMaxSectionSize];
- ElfW(NhdrGNUProperty)* note;
- size_t entries = 0;
-};
-
-// Tests that the default constructed instance does not report support
-// for Armv8.5-A BTI.
-TEST(note_gnu_property, default) {
- GnuPropertySection note;
- test_bti_not_supported(note);
- ASSERT_NO_ERROR_MSG();
-}
-
-// Tests that an instance without valid phdr pointer does not report
-// support for Armv8.5-A BTI.
-TEST(note_gnu_property, phdr_null) {
- auto note = GnuPropertySection(nullptr, 0, 0, SONAME);
- test_bti_not_supported(note);
- ASSERT_NO_ERROR_MSG();
-}
-
-// Tests that an instance without finding PT_GNU_PROPERTY does not
-// report support for Armv8.5-A BTI.
-TEST(note_gnu_property, no_pt_gnu_property) {
- ElfW(Phdr) phdrs[] = {
- {.p_type = PT_LOAD},
- {.p_type = PT_NULL},
- };
-
- reset_error_buffer();
- auto note = GnuPropertySection(&phdrs[0], std::size(phdrs), 0, SONAME);
- test_bti_not_supported(note);
- ASSERT_NO_ERROR_MSG();
-}
-
-// Tests the validity check for invalid PT_GNU_PROPERTY size.
-TEST(note_gnu_property, pt_gnu_property_bad_size) {
- ElfW(Phdr) phdrs[] = {
- {.p_type = PT_LOAD},
- {
- .p_type = PT_GNU_PROPERTY,
- .p_vaddr = 0,
- .p_memsz = sizeof(ElfW(NhdrGNUProperty)) - 1, // Invalid
- },
- {.p_type = PT_NULL},
- };
-
- reset_error_buffer();
- auto note = GnuPropertySection(&phdrs[0], std::size(phdrs), 0, SONAME);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ("PT_GNU_PROPERTY segment is too small. Segment size is 15, minimum is 16.");
-}
-
-// Tests that advertised n_descsz should still fit into p_memsz.
-TEST(note_gnu_property, pt_gnu_property_too_small) {
- ElfW(NhdrGNUProperty) prop = {
- .nhdr = {.n_namesz = PT_GNU_PROPERTY, .n_descsz = 1, .n_type = NT_GNU_PROPERTY_TYPE_0},
- .n_name = "GNU",
- };
- ElfW(Phdr) phdrs[] = {
- {
- .p_type = PT_GNU_PROPERTY,
- .p_vaddr = reinterpret_cast<ElfW(Addr)>(&prop),
- .p_memsz = sizeof(ElfW(NhdrGNUProperty)), // Off by one
- },
- };
-
- reset_error_buffer();
- auto note = GnuPropertySection(&phdrs[0], std::size(phdrs), 0, SONAME);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ("PT_GNU_PROPERTY segment p_memsz (16) is too small for note n_descsz (1).");
-}
-
-// Tests the validity check for invalid .note.gnu.property type.
-TEST(note_gnu_property, pt_gnu_property_bad_type) {
- ElfW(NhdrGNUProperty) prop = {
- .nhdr =
- {
- .n_namesz = 4,
- .n_descsz = 0,
- .n_type = NT_GNU_PROPERTY_TYPE_0 - 1 // Invalid
- },
- .n_name = "GNU",
- };
- PHDR_WITH_NOTE_GNU_PROPERTY(&prop);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ(".note.gnu.property: unexpected note type. Expected 5, got 4.");
-}
-
-// Tests the validity check for invalid .note.gnu.property name size.
-TEST(note_gnu_property, pt_gnu_property_bad_namesz) {
- ElfW(NhdrGNUProperty) prop = {
- .nhdr = {.n_namesz = 3, // Invalid
- .n_descsz = 0,
- .n_type = NT_GNU_PROPERTY_TYPE_0},
- .n_name = "GNU",
- };
- PHDR_WITH_NOTE_GNU_PROPERTY(&prop);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ(".note.gnu.property: unexpected name size. Expected 4, got 3.");
-}
-
-// Tests the validity check for invalid .note.gnu.property name.
-TEST(note_gnu_property, pt_gnu_property_bad_name) {
- ElfW(NhdrGNUProperty) prop = {
- .nhdr = {.n_namesz = 4, .n_descsz = 0, .n_type = NT_GNU_PROPERTY_TYPE_0},
- .n_name = "ABC", // Invalid
- };
- PHDR_WITH_NOTE_GNU_PROPERTY(&prop);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ(".note.gnu.property: unexpected name. Expected 'GNU', got 'ABC'.");
-}
-
-// Tests the validity check for not enough space for a Program Property header.
-TEST(note_gnu_property, pt_gnu_property_pphdr_no_space) {
- ElfW(NhdrGNUProperty) prop = {
- .nhdr = {.n_namesz = 4,
- .n_descsz = 7, // Invalid
- .n_type = NT_GNU_PROPERTY_TYPE_0},
- .n_name = "GNU",
- };
- PHDR_WITH_NOTE_GNU_PROPERTY(&prop);
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ(".note.gnu.property: no more space left for a Program Property Note header.");
-}
-
-// Tests an empty .note.gnu.property.
-TEST(note_gnu_property, pt_gnu_property_no_data) {
- GnuPropertySectionBuilder prop;
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- test_bti_not_supported(note);
- ASSERT_NO_ERROR_MSG();
-}
-
-// Tests a .note.gnu.property section with elements with pr_datasz = 0.
-TEST(note_gnu_property, pt_gnu_property_no_prop) {
- GnuPropertySectionBuilder prop;
- ASSERT_TRUE(prop.push(1, 0, (void*)nullptr));
- ASSERT_TRUE(prop.push(2, 0, (void*)nullptr));
- ASSERT_TRUE(prop.push(3, 0, (void*)nullptr));
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- test_bti_not_supported(note);
- ASSERT_NO_ERROR_MSG();
-}
-
-// Tests that GNU_PROPERTY_AARCH64_FEATURE_1_AND must have pr_datasz = 4.
-TEST(note_gnu_property, pt_gnu_property_bad_pr_datasz) {
-#if defined(__aarch64__)
- GnuPropertySectionBuilder prop;
- ElfW(Word) pr_data[] = {GNU_PROPERTY_AARCH64_FEATURE_1_BTI, 0, 0};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, 12, &pr_data));
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- test_bti_not_supported(note);
- ASSERT_ERROR_MSG_EQ(
- ".note.gnu.property: property descriptor size is invalid. Expected 4 bytes for "
- "GNU_PROPERTY_AARCH64_FEATURE_1_AND, got 12.");
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
-
-// Tests a .note.gnu.property section with only GNU_PROPERTY_AARCH64_FEATURE_1_BTI property array.
-TEST(note_gnu_property, pt_gnu_property_ok_1) {
-#if defined(__aarch64__)
- GnuPropertySectionBuilder prop;
- ElfW(Word) pr_data[] = {GNU_PROPERTY_AARCH64_FEATURE_1_BTI};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, sizeof(pr_data), &pr_data));
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- ASSERT_NO_ERROR_MSG();
- test_bti_supported(note);
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
-
-// Tests a .note.gnu.property section with only GNU_PROPERTY_AARCH64_FEATURE_1_BTI property array.
-TEST(note_gnu_property, pt_gnu_property_ok_2) {
-#if defined(__aarch64__)
- GnuPropertySectionBuilder prop;
- ElfW(Word) pr_data[] = {static_cast<ElfW(Word)>(~GNU_PROPERTY_AARCH64_FEATURE_1_BTI)};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, sizeof(pr_data), &pr_data));
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- ASSERT_NO_ERROR_MSG();
- test_bti_not_supported(note);
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
-
-// Tests a .note.gnu.property section with more property arrays.
-TEST(note_gnu_property, pt_gnu_property_ok_3) {
-#if defined(__aarch64__)
- GnuPropertySectionBuilder prop;
-
- ElfW(Word) pr_data_0[8] = {0xCD};
- ASSERT_TRUE(prop.push(1, 4, &pr_data_0));
- ASSERT_TRUE(prop.push(2, 3, &pr_data_0));
- ASSERT_TRUE(prop.push(3, 8, &pr_data_0));
-
- ElfW(Word) pr_data[] = {GNU_PROPERTY_AARCH64_FEATURE_1_BTI};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, sizeof(pr_data), &pr_data));
-
- ASSERT_TRUE(prop.push(4, 1, &pr_data_0));
-
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- ASSERT_NO_ERROR_MSG();
- test_bti_supported(note);
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
-
-// Tests a .note.gnu.property but with bad property descriptor size.
-TEST(note_gnu_property, pt_gnu_property_bad_n_descsz) {
-#if defined(__aarch64__)
- GnuPropertySectionBuilder prop;
- ElfW(Word) pr_data[] = {GNU_PROPERTY_AARCH64_FEATURE_1_BTI};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, sizeof(pr_data), &pr_data));
-
- ElfW(Word) n_descsz;
- if (sizeof(ElfW(Addr)) == 4) {
- n_descsz = 11;
- } else {
- n_descsz = 15;
- }
-
- prop.corrupt_n_descsz(n_descsz);
-
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- if (sizeof(ElfW(Addr)) == 4) {
- ASSERT_ERROR_MSG_EQ(
- ".note.gnu.property: property descriptor size is invalid. Expected at least 12 bytes, got "
- "11.");
- } else {
- ASSERT_ERROR_MSG_EQ(
- ".note.gnu.property: property descriptor size is invalid. Expected at least 16 bytes, got "
- "15.");
- }
- test_bti_not_supported(note);
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
-
-// Tests if platform support is missing.
-TEST(note_gnu_property, no_platform_support) {
-#if defined(__aarch64__)
- auto bti_supported_orig = g_platform_properties.bti_supported;
- g_platform_properties.bti_supported = false;
-
- GnuPropertySectionBuilder prop;
- ElfW(Word) pr_data[] = {GNU_PROPERTY_AARCH64_FEATURE_1_BTI};
- ASSERT_TRUE(prop.push(GNU_PROPERTY_AARCH64_FEATURE_1_AND, sizeof(pr_data), &pr_data));
- PHDR_WITH_NOTE_GNU_PROPERTY(prop.data());
- ASSERT_NO_ERROR_MSG();
- test_bti_not_supported(note);
-
- g_platform_properties.bti_supported = bti_supported_orig;
-#else
- GTEST_SKIP() << "BTI is not supported on this architecture.";
-#endif
-}
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 60fd77620..9b7a461cd 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -70,9 +70,8 @@ static int GetTargetElfMachine() {
p_memsz -> segment memory size (always >= p_filesz)
p_vaddr -> segment's virtual address
p_flags -> segment flags (e.g. readable, writable, executable)
- p_align -> segment's in-memory and in-file alignment
- We will ignore the p_paddr field of ElfW(Phdr) for now.
+ We will ignore the p_paddr and p_align fields of ElfW(Phdr) for now.
The loadable segments can be seen as a list of [p_vaddr ... p_vaddr+p_memsz)
ranges of virtual addresses. A few rules apply:
@@ -138,9 +137,6 @@ static int GetTargetElfMachine() {
MAYBE_MAP_FLAG((x), PF_R, PROT_READ) | \
MAYBE_MAP_FLAG((x), PF_W, PROT_WRITE))
-// Default PMD size for x86_64 and aarch64 (2MB).
-static constexpr size_t kPmdSize = (1UL << 21);
-
ElfReader::ElfReader()
: did_read_(false), did_load_(false), fd_(-1), file_offset_(0), file_size_(0), phdr_num_(0),
phdr_table_(nullptr), shdr_table_(nullptr), shdr_num_(0), dynamic_(nullptr), strtab_(nullptr),
@@ -173,16 +169,8 @@ bool ElfReader::Load(address_space_params* address_space) {
if (did_load_) {
return true;
}
- if (ReserveAddressSpace(address_space) && LoadSegments() && FindPhdr() &&
- FindGnuPropertySection()) {
+ if (ReserveAddressSpace(address_space) && LoadSegments() && FindPhdr()) {
did_load_ = true;
-#if defined(__aarch64__)
- // For Armv8.5-A loaded executable segments may require PROT_BTI.
- if (note_gnu_property_.IsBTICompatible()) {
- did_load_ = (phdr_table_protect_segments(phdr_table_, phdr_num_, load_bias_,
- &note_gnu_property_) == 0);
- }
-#endif
}
return did_load_;
@@ -530,40 +518,11 @@ size_t phdr_table_get_load_size(const ElfW(Phdr)* phdr_table, size_t phdr_count,
return max_vaddr - min_vaddr;
}
-// Returns the maximum p_align associated with a loadable segment in the ELF
-// program header table. Used to determine whether the file should be loaded at
-// a specific virtual address alignment for use with huge pages.
-size_t phdr_table_get_maximum_alignment(const ElfW(Phdr)* phdr_table, size_t phdr_count) {
- size_t maximum_alignment = PAGE_SIZE;
-
- for (size_t i = 0; i < phdr_count; ++i) {
- const ElfW(Phdr)* phdr = &phdr_table[i];
-
- // p_align must be 0, 1, or a positive, integral power of two.
- if (phdr->p_type != PT_LOAD || ((phdr->p_align & (phdr->p_align - 1)) != 0)) {
- continue;
- }
-
- if (phdr->p_align > maximum_alignment) {
- maximum_alignment = phdr->p_align;
- }
- }
-
-#if defined(__LP64__)
- return maximum_alignment;
-#else
- return PAGE_SIZE;
-#endif
-}
-
// Reserve a virtual address range such that if it's limits were extended to the next 2**align
// boundary, it would not overlap with any existing mappings.
-static void* ReserveWithAlignmentPadding(size_t size, size_t mapping_align, size_t start_align,
- void** out_gap_start, size_t* out_gap_size) {
+static void* ReserveAligned(size_t size, size_t align) {
int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
- // Reserve enough space to properly align the library's start address.
- mapping_align = std::max(mapping_align, start_align);
- if (mapping_align == PAGE_SIZE) {
+ if (align == PAGE_SIZE) {
void* mmap_ptr = mmap(nullptr, size, PROT_NONE, mmap_flags, -1, 0);
if (mmap_ptr == MAP_FAILED) {
return nullptr;
@@ -571,66 +530,24 @@ static void* ReserveWithAlignmentPadding(size_t size, size_t mapping_align, size
return mmap_ptr;
}
- // Minimum alignment of shared library gap. For efficiency, this should match the second level
- // page size of the platform.
-#if defined(__LP64__)
- constexpr size_t kGapAlignment = 1ul << 21; // 2MB
-#else
- constexpr size_t kGapAlignment = 0;
-#endif
- // Maximum gap size, in the units of kGapAlignment.
- constexpr size_t kMaxGapUnits = 32;
// Allocate enough space so that the end of the desired region aligned up is still inside the
// mapping.
- size_t mmap_size = align_up(size, mapping_align) + mapping_align - PAGE_SIZE;
+ size_t mmap_size = align_up(size, align) + align - PAGE_SIZE;
uint8_t* mmap_ptr =
reinterpret_cast<uint8_t*>(mmap(nullptr, mmap_size, PROT_NONE, mmap_flags, -1, 0));
if (mmap_ptr == MAP_FAILED) {
return nullptr;
}
- size_t gap_size = 0;
- size_t first_byte = reinterpret_cast<size_t>(align_up(mmap_ptr, mapping_align));
- size_t last_byte = reinterpret_cast<size_t>(align_down(mmap_ptr + mmap_size, mapping_align) - 1);
- if (kGapAlignment && first_byte / kGapAlignment != last_byte / kGapAlignment) {
- // This library crosses a 2MB boundary and will fragment a new huge page.
- // Lets take advantage of that and insert a random number of inaccessible huge pages before that
- // to improve address randomization and make it harder to locate this library code by probing.
- munmap(mmap_ptr, mmap_size);
- mapping_align = std::max(mapping_align, kGapAlignment);
- gap_size =
- kGapAlignment * (is_first_stage_init() ? 1 : arc4random_uniform(kMaxGapUnits - 1) + 1);
- mmap_size = align_up(size + gap_size, mapping_align) + mapping_align - PAGE_SIZE;
- mmap_ptr = reinterpret_cast<uint8_t*>(mmap(nullptr, mmap_size, PROT_NONE, mmap_flags, -1, 0));
- if (mmap_ptr == MAP_FAILED) {
- return nullptr;
- }
- }
-
- uint8_t *gap_end, *gap_start;
- if (gap_size) {
- gap_end = align_down(mmap_ptr + mmap_size, kGapAlignment);
- gap_start = gap_end - gap_size;
- } else {
- gap_start = gap_end = mmap_ptr + mmap_size;
- }
- uint8_t* first = align_up(mmap_ptr, mapping_align);
- uint8_t* last = align_down(gap_start, mapping_align) - size;
+ uint8_t* first = align_up(mmap_ptr, align);
+ uint8_t* last = align_down(mmap_ptr + mmap_size, align) - size;
// arc4random* is not available in first stage init because /dev/urandom hasn't yet been
// created. Don't randomize then.
- size_t n = is_first_stage_init() ? 0 : arc4random_uniform((last - first) / start_align + 1);
- uint8_t* start = first + n * start_align;
- // Unmap the extra space around the allocation.
- // Keep it mapped PROT_NONE on 64-bit targets where address space is plentiful to make it harder
- // to defeat ASLR by probing for readable memory mappings.
+ size_t n = is_first_stage_init() ? 0 : arc4random_uniform((last - first) / PAGE_SIZE + 1);
+ uint8_t* start = first + n * PAGE_SIZE;
munmap(mmap_ptr, start - mmap_ptr);
- munmap(start + size, gap_start - (start + size));
- if (gap_end != mmap_ptr + mmap_size) {
- munmap(gap_end, mmap_ptr + mmap_size - gap_end);
- }
- *out_gap_start = gap_start;
- *out_gap_size = gap_size;
+ munmap(start + size, mmap_ptr + mmap_size - (start + size));
return start;
}
@@ -654,23 +571,13 @@ bool ElfReader::ReserveAddressSpace(address_space_params* address_space) {
load_size_ - address_space->reserved_size, load_size_, name_.c_str());
return false;
}
- size_t start_alignment = PAGE_SIZE;
- if (get_transparent_hugepages_supported() && get_application_target_sdk_version() >= 31) {
- size_t maximum_alignment = phdr_table_get_maximum_alignment(phdr_table_, phdr_num_);
- // Limit alignment to PMD size as other alignments reduce the number of
- // bits available for ASLR for no benefit.
- start_alignment = maximum_alignment == kPmdSize ? kPmdSize : PAGE_SIZE;
- }
- start = ReserveWithAlignmentPadding(load_size_, kLibraryAlignment, start_alignment, &gap_start_,
- &gap_size_);
+ start = ReserveAligned(load_size_, kLibraryAlignment);
if (start == nullptr) {
DL_ERR("couldn't reserve %zd bytes of address space for \"%s\"", load_size_, name_.c_str());
return false;
}
} else {
start = address_space->start_addr;
- gap_start_ = nullptr;
- gap_size_ = 0;
mapped_by_caller_ = true;
// Update the reserved address space to subtract the space used by this library.
@@ -746,13 +653,6 @@ bool ElfReader::LoadSegments() {
DL_ERR("couldn't map \"%s\" segment %zd: %s", name_.c_str(), i, strerror(errno));
return false;
}
-
- // Mark segments as huge page eligible if they meet the requirements
- // (executable and PMD aligned).
- if ((phdr->p_flags & PF_X) && phdr->p_align == kPmdSize &&
- get_transparent_hugepages_supported()) {
- madvise(seg_addr, file_length, MADV_HUGEPAGE);
- }
}
// if the segment is writable, and does not end on a page boundary,
@@ -803,21 +703,15 @@ static int _phdr_table_set_load_prot(const ElfW(Phdr)* phdr_table, size_t phdr_c
ElfW(Addr) seg_page_start = PAGE_START(phdr->p_vaddr) + load_bias;
ElfW(Addr) seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz) + load_bias;
- int prot = PFLAGS_TO_PROT(phdr->p_flags) | extra_prot_flags;
- if ((prot & PROT_WRITE) != 0) {
+ int prot = PFLAGS_TO_PROT(phdr->p_flags);
+ if ((extra_prot_flags & PROT_WRITE) != 0) {
// make sure we're never simultaneously writable / executable
prot &= ~PROT_EXEC;
}
-#if defined(__aarch64__)
- if ((prot & PROT_EXEC) == 0) {
- // Though it is not specified don't add PROT_BTI if segment is not
- // executable.
- prot &= ~PROT_BTI;
- }
-#endif
- int ret =
- mprotect(reinterpret_cast<void*>(seg_page_start), seg_page_end - seg_page_start, prot);
+ int ret = mprotect(reinterpret_cast<void*>(seg_page_start),
+ seg_page_end - seg_page_start,
+ prot | extra_prot_flags);
if (ret < 0) {
return -1;
}
@@ -829,26 +723,16 @@ static int _phdr_table_set_load_prot(const ElfW(Phdr)* phdr_table, size_t phdr_c
* You should only call this after phdr_table_unprotect_segments and
* applying all relocations.
*
- * AArch64: also called from linker_main and ElfReader::Load to apply
- * PROT_BTI for loaded main so and other so-s.
- *
* Input:
* phdr_table -> program header table
* phdr_count -> number of entries in tables
* load_bias -> load bias
- * prop -> GnuPropertySection or nullptr
* Return:
* 0 on error, -1 on failure (error code in errno).
*/
-int phdr_table_protect_segments(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, const GnuPropertySection* prop __unused) {
- int prot = 0;
-#if defined(__aarch64__)
- if ((prop != nullptr) && prop->IsBTICompatible()) {
- prot |= PROT_BTI;
- }
-#endif
- return _phdr_table_set_load_prot(phdr_table, phdr_count, load_bias, prot);
+int phdr_table_protect_segments(const ElfW(Phdr)* phdr_table,
+ size_t phdr_count, ElfW(Addr) load_bias) {
+ return _phdr_table_set_load_prot(phdr_table, phdr_count, load_bias, 0);
}
/* Change the protection of all loaded segments in memory to writable.
@@ -1152,7 +1036,7 @@ void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_co
* Return:
* pointer to the program interpreter string.
*/
-const char* phdr_table_get_interpreter_name(const ElfW(Phdr)* phdr_table, size_t phdr_count,
+const char* phdr_table_get_interpreter_name(const ElfW(Phdr) * phdr_table, size_t phdr_count,
ElfW(Addr) load_bias) {
for (size_t i = 0; i<phdr_count; ++i) {
const ElfW(Phdr)& phdr = phdr_table[i];
@@ -1195,15 +1079,6 @@ bool ElfReader::FindPhdr() {
return false;
}
-// Tries to find .note.gnu.property section.
-// It is not considered an error if such section is missing.
-bool ElfReader::FindGnuPropertySection() {
-#if defined(__aarch64__)
- note_gnu_property_ = GnuPropertySection(phdr_table_, phdr_num_, load_start(), name_.c_str());
-#endif
- return true;
-}
-
// Ensures that our program header is actually within a loadable
// segment. This should help catch badly-formed ELF files that
// would cause the linker to crash later when trying to access it.
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index 98bf020ac..5d1cfc2bd 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -37,7 +37,6 @@
#include "linker.h"
#include "linker_mapped_file_fragment.h"
-#include "linker_note_gnu_property.h"
class ElfReader {
public:
@@ -50,8 +49,6 @@ class ElfReader {
size_t phdr_count() const { return phdr_num_; }
ElfW(Addr) load_start() const { return reinterpret_cast<ElfW(Addr)>(load_start_); }
size_t load_size() const { return load_size_; }
- ElfW(Addr) gap_start() const { return reinterpret_cast<ElfW(Addr)>(gap_start_); }
- size_t gap_size() const { return gap_size_; }
ElfW(Addr) load_bias() const { return load_bias_; }
const ElfW(Phdr)* loaded_phdr() const { return loaded_phdr_; }
const ElfW(Dyn)* dynamic() const { return dynamic_; }
@@ -68,7 +65,6 @@ class ElfReader {
bool ReserveAddressSpace(address_space_params* address_space);
bool LoadSegments();
bool FindPhdr();
- bool FindGnuPropertySection();
bool CheckPhdr(ElfW(Addr));
bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
@@ -100,10 +96,6 @@ class ElfReader {
void* load_start_;
// Size in bytes of reserved address space.
size_t load_size_;
- // First page of inaccessible gap mapping reserved for this DSO.
- void* gap_start_;
- // Size in bytes of the gap mapping.
- size_t gap_size_;
// Load bias.
ElfW(Addr) load_bias_;
@@ -112,18 +104,13 @@ class ElfReader {
// Is map owned by the caller
bool mapped_by_caller_;
-
- // Only used by AArch64 at the moment.
- GnuPropertySection note_gnu_property_ __unused;
};
size_t phdr_table_get_load_size(const ElfW(Phdr)* phdr_table, size_t phdr_count,
ElfW(Addr)* min_vaddr = nullptr, ElfW(Addr)* max_vaddr = nullptr);
-size_t phdr_table_get_maximum_alignment(const ElfW(Phdr)* phdr_table, size_t phdr_count);
-
-int phdr_table_protect_segments(const ElfW(Phdr)* phdr_table, size_t phdr_count,
- ElfW(Addr) load_bias, const GnuPropertySection* prop = nullptr);
+int phdr_table_protect_segments(const ElfW(Phdr)* phdr_table,
+ size_t phdr_count, ElfW(Addr) load_bias);
int phdr_table_unprotect_segments(const ElfW(Phdr)* phdr_table, size_t phdr_count,
ElfW(Addr) load_bias);
@@ -146,5 +133,5 @@ void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_co
ElfW(Addr) load_bias, ElfW(Dyn)** dynamic,
ElfW(Word)* dynamic_flags);
-const char* phdr_table_get_interpreter_name(const ElfW(Phdr)* phdr_table, size_t phdr_count,
+const char* phdr_table_get_interpreter_name(const ElfW(Phdr) * phdr_table, size_t phdr_count,
ElfW(Addr) load_bias);
diff --git a/linker/linker_sdk_versions.cpp b/linker/linker_sdk_versions.cpp
index 0d5796e6c..29c0f4af2 100644
--- a/linker/linker_sdk_versions.cpp
+++ b/linker/linker_sdk_versions.cpp
@@ -31,8 +31,6 @@
#include <android/api-level.h>
#include <android/fdsan.h>
-#include "private/bionic_globals.h"
-
#include "linker.h"
static std::atomic<int> g_target_sdk_version(__ANDROID_API__);
@@ -47,9 +45,6 @@ void set_application_target_sdk_version(int target) {
if (target < 30) {
android_fdsan_set_error_level_from_property(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE);
}
- if (__libc_shared_globals()->set_target_sdk_version_hook) {
- __libc_shared_globals()->set_target_sdk_version_hook(target);
- }
}
int get_application_target_sdk_version() {
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index 287e757a9..4f67003b8 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -485,8 +485,11 @@ static void call_function(const char* function_name __unused,
}
template <typename F>
-static inline void call_array(const char* array_name __unused, F* functions, size_t count,
- bool reverse, const char* realpath) {
+static void call_array(const char* array_name __unused,
+ F* functions,
+ size_t count,
+ bool reverse,
+ const char* realpath) {
if (functions == nullptr) {
return;
}
@@ -692,7 +695,7 @@ void soinfo::set_soname(const char* soname) {
if (has_min_version(2)) {
soname_ = soname;
}
- strlcpy(old_name_, soname_.c_str(), sizeof(old_name_));
+ strlcpy(old_name_, soname_, sizeof(old_name_));
#else
soname_ = soname;
#endif
@@ -701,12 +704,12 @@ void soinfo::set_soname(const char* soname) {
const char* soinfo::get_soname() const {
#if defined(__work_around_b_24465209__)
if (has_min_version(2)) {
- return soname_.c_str();
+ return soname_;
} else {
return old_name_;
}
#else
- return soname_.c_str();
+ return soname_;
#endif
}
@@ -897,24 +900,6 @@ void soinfo::generate_handle() {
g_soinfo_handles_map[handle_] = this;
}
-void soinfo::set_gap_start(ElfW(Addr) gap_start) {
- CHECK(has_min_version(6));
- gap_start_ = gap_start;
-}
-ElfW(Addr) soinfo::get_gap_start() const {
- CHECK(has_min_version(6));
- return gap_start_;
-}
-
-void soinfo::set_gap_size(size_t gap_size) {
- CHECK(has_min_version(6));
- gap_size_ = gap_size;
-}
-size_t soinfo::get_gap_size() const {
- CHECK(has_min_version(6));
- return gap_size_;
-}
-
// TODO(dimitry): Move SymbolName methods to a separate file.
uint32_t calculate_elf_hash(const char* name) {
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 9c589d608..e1a3c303d 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -66,7 +66,7 @@
#define FLAG_PRELINKED 0x00000400 // prelink_image has successfully processed this soinfo
#define FLAG_NEW_SOINFO 0x40000000 // new soinfo format
-#define SOINFO_VERSION 6
+#define SOINFO_VERSION 5
ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr);
@@ -345,12 +345,6 @@ struct soinfo {
SymbolLookupLib get_lookup_lib();
- void set_gap_start(ElfW(Addr) gap_start);
- ElfW(Addr) get_gap_start() const;
-
- void set_gap_size(size_t gap_size);
- size_t get_gap_size() const;
-
private:
bool is_image_linked() const;
void set_image_linked();
@@ -401,7 +395,7 @@ struct soinfo {
uint8_t* android_relocs_;
size_t android_relocs_size_;
- std::string soname_;
+ const char* soname_;
std::string realpath_;
const ElfW(Versym)* versym_;
@@ -429,10 +423,6 @@ struct soinfo {
// version >= 5
std::unique_ptr<soinfo_tls> tls_;
std::vector<TlsDynamicResolverArg> tlsdesc_args_;
-
- // version >= 6
- ElfW(Addr) gap_start_;
- size_t gap_size_;
};
// This function is used by dlvsym() to calculate hash of sym_ver
diff --git a/linker/linker_tls.cpp b/linker/linker_tls.cpp
index 97892f49c..d2edbb335 100644
--- a/linker/linker_tls.cpp
+++ b/linker/linker_tls.cpp
@@ -128,8 +128,6 @@ void linker_setup_exe_static_tls(const char* progname) {
void linker_finalize_static_tls() {
g_static_tls_finished = true;
__libc_shared_globals()->static_tls_layout.finish_layout();
- TlsModules& modules = __libc_shared_globals()->tls_modules;
- modules.static_module_count = modules.module_count;
}
void register_soinfo_tls(soinfo* si) {
diff --git a/linker/linker_translate_path.cpp b/linker/linker_translate_path.cpp
index 4f3fdfbc3..df7d0aabe 100644
--- a/linker/linker_translate_path.cpp
+++ b/linker/linker_translate_path.cpp
@@ -31,14 +31,13 @@
#include "linker_utils.h"
#if defined(__LP64__)
-#define APEX_LIB(apex, name) \
- { "/system/lib64/" name, "/apex/" apex "/lib64/" name }
+static const char* const kSystemLibDir = "/system/lib64";
+static const char* const kI18nApexLibDir = "/apex/com.android.i18n/lib64";
#else
-#define APEX_LIB(apex, name) \
- { "/system/lib/" name, "/apex/" apex "/lib/" name }
+static const char* const kSystemLibDir = "/system/lib";
+static const char* const kI18nApexLibDir = "/apex/com.android.i18n/lib";
#endif
-
// Workaround for dlopen(/system/lib(64)/<soname>) when .so is in /apex. http://b/121248172
/**
* Translate /system path to /apex path if needed
@@ -48,22 +47,27 @@
* return true if translation is needed
*/
bool translateSystemPathToApexPath(const char* name, std::string* out_name_to_apex) {
- static constexpr const char* kPathTranslationQ[][2] = {
- APEX_LIB("com.android.i18n", "libicui18n.so"),
- APEX_LIB("com.android.i18n", "libicuuc.so")
+ static const char* const kSystemToArtApexLibs[] = {
+ "libicuuc.so",
+ "libicui18n.so",
};
+ // New mapping for new apex should be added below
+
+ // Nothing to do if target sdk version is Q or above
+ if (get_application_target_sdk_version() >= 29) {
+ return false;
+ }
- if (name == nullptr) {
+ // If the path isn't /system/lib, there's nothing to do.
+ if (name == nullptr || dirname(name) != kSystemLibDir) {
return false;
}
- auto comparator = [name](auto p) { return strcmp(name, p[0]) == 0; };
+ const char* base_name = basename(name);
- if (get_application_target_sdk_version() < __ANDROID_API_Q__) {
- if (auto it =
- std::find_if(std::begin(kPathTranslationQ), std::end(kPathTranslationQ), comparator);
- it != std::end(kPathTranslationQ)) {
- *out_name_to_apex = (*it)[1];
+ for (const char* soname : kSystemToArtApexLibs) {
+ if (strcmp(base_name, soname) == 0) {
+ *out_name_to_apex = std::string(kI18nApexLibDir) + "/" + base_name;
return true;
}
}
diff --git a/linker/linker_transparent_hugepage_support.cpp b/linker/linker_transparent_hugepage_support.cpp
deleted file mode 100644
index 65ba4cd89..000000000
--- a/linker/linker_transparent_hugepage_support.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <string>
-
-#include <android-base/file.h>
-
-#include "linker.h"
-
-bool get_transparent_hugepages_supported() {
- static bool transparent_hugepages_supported = []() {
- std::string enabled;
- if (!android::base::ReadFileToString("/sys/kernel/mm/transparent_hugepage/enabled", &enabled)) {
- return false;
- }
- return enabled.find("[never]") == std::string::npos;
- };
- return transparent_hugepages_supported;
-}
diff --git a/tests/Android.bp b/tests/Android.bp
index 476b8f5fb..8b1eebc3f 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -14,35 +14,14 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["bionic_tests_license"],
-}
-
-license {
- name: "bionic_tests_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- "SPDX-license-identifier-BSD",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_defaults {
name: "bionic_tests_defaults",
host_supported: true,
+ cpp_std: "experimental",
target: {
darwin: {
enabled: false,
},
- android: {
- header_libs: ["bionic_libc_platform_headers"],
- },
- linux_bionic: {
- header_libs: ["bionic_libc_platform_headers"],
- },
},
cflags: [
"-fstack-protector-all",
@@ -56,241 +35,25 @@ cc_defaults {
// We want to test deprecated API too.
"-Wno-deprecated-declarations",
- // Needed to test pthread_internal_t layout.
- "-Wno-invalid-offsetof",
-
// For glibc.
"-D__STDC_LIMIT_MACROS",
],
- header_libs: ["libcutils_headers"],
- // Ensure that the tests exercise shadow call stack support and
- // the hint space PAC/BTI instructions.
+ header_libs: ["bionic_libc_platform_headers"],
+ // Make the bionic tests implicitly test bionic's shadow call stack support.
arch: {
arm64: {
- cflags: [
- "-fsanitize=shadow-call-stack",
- // Disable this option for now: see b/151372823
- //"-mbranch-protection=standard",
- ],
+ cflags: ["-fsanitize=shadow-call-stack"],
},
},
stl: "libc++",
sanitize: {
address: false,
},
-
- // Use the bootstrap version of bionic because some tests call private APIs
- // that aren't exposed by the APEX bionic stubs.
bootstrap: true,
-}
-
-// -----------------------------------------------------------------------------
-// Prebuilt shared libraries for use in tests.
-// -----------------------------------------------------------------------------
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-rw_load_segment",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-unaligned_shdr_offset",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-zero_shentsize",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-zero_shstrndx",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-empty_shdr_table",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-zero_shdr_table_offset",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-zero_shdr_table_content",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
- },
- },
-}
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-textrels",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
- },
- },
-}
-
-cc_prebuilt_test_library_shared {
- name: "libtest_invalid-textrels2",
- strip: {
- none: true,
- },
- check_elf_files: false,
- relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
- arch: {
- arm: {
- srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
- },
- arm64: {
- srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
- },
- x86: {
- srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
- },
- x86_64: {
- srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
+ product_variables: {
+ experimental_mte: {
+ cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
},
},
}
@@ -317,7 +80,6 @@ cc_test_library {
srcs: [
"__aeabi_read_tp_test.cpp",
"__cxa_atexit_test.cpp",
- "__cxa_demangle_test.cpp",
"alloca_test.cpp",
"android_get_device_api_level.cpp",
"arpa_inet_test.cpp",
@@ -341,14 +103,12 @@ cc_test_library {
"fenv_test.cpp",
"_FILE_OFFSET_BITS_test.cpp",
"float_test.cpp",
- "fnmatch_test.cpp",
"ftw_test.cpp",
"getauxval_test.cpp",
"getcwd_test.cpp",
"glob_test.cpp",
"grp_pwd_test.cpp",
"grp_pwd_file_test.cpp",
- "heap_tagging_level_test.cpp",
"iconv_test.cpp",
"ifaddrs_test.cpp",
"ifunc_test.cpp",
@@ -375,9 +135,7 @@ cc_test_library {
"netinet_ip_icmp_test.cpp",
"netinet_udp_test.cpp",
"nl_types_test.cpp",
- "pidfd_test.cpp",
"poll_test.cpp",
- "prio_ctor_test.cpp",
"pthread_test.cpp",
"pty_test.cpp",
"regex_test.cpp",
@@ -408,9 +166,7 @@ cc_test_library {
"string_posix_strerror_r_test.cpp",
"strings_nofortify_test.cpp",
"strings_test.cpp",
- "struct_layout_test.cpp",
"sstream_test.cpp",
- "sys_auxv_test.cpp",
"sys_epoll_test.cpp",
"sys_mman_test.cpp",
"sys_msg_test.cpp",
@@ -440,7 +196,6 @@ cc_test_library {
"sys_uio_test.cpp",
"sys_un_test.cpp",
"sys_vfs_test.cpp",
- "sys_wait_test.cpp",
"sys_xattr_test.cpp",
"system_properties_test.cpp",
"system_properties_test2.cpp",
@@ -467,6 +222,9 @@ cc_test_library {
"libprocinfo",
"libsystemproperties",
],
+ srcs: [
+ "tagged_pointers_test.cpp",
+ ],
},
},
@@ -567,9 +325,6 @@ cc_defaults {
"-Wno-strlcpy-strlcat-size",
"-Wno-strncat-size",
],
- static_libs: [
- "libbase",
- ],
}
cc_defaults {
@@ -578,10 +333,6 @@ cc_defaults {
"-U_FORTIFY_SOURCE",
],
srcs: ["fortify_test_main.cpp"],
- static_libs: [
- "libbase",
- ],
- tidy: false,
target: {
host: {
clang_cflags: ["-D__clang__"],
@@ -620,7 +371,6 @@ cc_test_library {
"-D__clang_analyzer__",
],
srcs: ["clang_fortify_tests.cpp"],
- tidy: false,
}
cc_test_library {
@@ -662,7 +412,6 @@ cc_defaults {
"-U_FORTIFY_SOURCE",
],
srcs: ["clang_fortify_tests.cpp"],
- tidy: false,
target: {
host: {
clang_cflags: ["-D__clang__"],
@@ -845,6 +594,7 @@ cc_defaults {
],
static_libs: [
// The order of these libraries matters, do not shuffle them.
+ "libbase",
"libmeminfo",
"libziparchive",
"libz",
@@ -869,95 +619,66 @@ cc_defaults {
"elftls_dlopen_ie_error_helper",
"exec_linker_helper",
"exec_linker_helper_lib",
- "heap_tagging_async_helper",
- "heap_tagging_disabled_helper",
- "heap_tagging_static_async_helper",
- "heap_tagging_static_disabled_helper",
- "heap_tagging_static_sync_helper",
- "heap_tagging_sync_helper",
- "ld_config_test_helper",
- "ld_config_test_helper_lib1",
- "ld_config_test_helper_lib2",
- "ld_config_test_helper_lib3",
- "ld_preload_test_helper",
- "ld_preload_test_helper_lib1",
- "ld_preload_test_helper_lib2",
+ "libtest_dt_runpath_a",
+ "libtest_dt_runpath_b",
+ "libtest_dt_runpath_c",
+ "libtest_dt_runpath_x",
+ "libtest_dt_runpath_y",
"libatest_simple_zip",
"libcfi-test",
"libcfi-test-bad",
- "libdl_preempt_test_1",
- "libdl_preempt_test_2",
- "libdl_test_df_1_global",
- "libdlext_test",
"libdlext_test_different_soname",
"libdlext_test_fd",
"libdlext_test_norelro",
"libdlext_test_recursive",
"libdlext_test_runpath_zip_zipaligned",
+ "libdlext_test",
"libdlext_test_zip",
"libdlext_test_zip_zipaligned",
+ "libdl_preempt_test_1",
+ "libdl_preempt_test_2",
+ "libdl_test_df_1_global",
"libgnu-hash-table-library",
- "libns_hidden_child_app",
- "libns_hidden_child_global",
- "libns_hidden_child_internal",
- "libns_hidden_child_public",
- "libnstest_dlopened",
- "libnstest_ns_a_public1",
- "libnstest_ns_a_public1_internal",
- "libnstest_ns_b_public2",
- "libnstest_ns_b_public3",
- "libnstest_private",
- "libnstest_private_external",
- "libnstest_public",
- "libnstest_public_internal",
- "libnstest_root",
- "libnstest_root_not_isolated",
- "librelocations-ANDROID_REL",
"librelocations-ANDROID_RELR",
+ "librelocations-ANDROID_REL",
"librelocations-RELR",
"librelocations-fat",
- "libsegment_gap_inner",
- "libsegment_gap_outer",
"libsysv-hash-table-library",
+ "libtestshared",
"libtest_atexit",
- "libtest_check_order_dlsym",
"libtest_check_order_dlsym_1_left",
"libtest_check_order_dlsym_2_right",
"libtest_check_order_dlsym_3_c",
"libtest_check_order_dlsym_a",
"libtest_check_order_dlsym_b",
"libtest_check_order_dlsym_d",
- "libtest_check_order_reloc_root",
+ "libtest_check_order_dlsym",
"libtest_check_order_reloc_root_1",
"libtest_check_order_reloc_root_2",
- "libtest_check_order_reloc_siblings",
+ "libtest_check_order_reloc_root",
"libtest_check_order_reloc_siblings_1",
"libtest_check_order_reloc_siblings_2",
"libtest_check_order_reloc_siblings_3",
"libtest_check_order_reloc_siblings_a",
"libtest_check_order_reloc_siblings_b",
- "libtest_check_order_reloc_siblings_c",
"libtest_check_order_reloc_siblings_c_1",
"libtest_check_order_reloc_siblings_c_2",
+ "libtest_check_order_reloc_siblings_c",
"libtest_check_order_reloc_siblings_d",
"libtest_check_order_reloc_siblings_e",
"libtest_check_order_reloc_siblings_f",
+ "libtest_check_order_reloc_siblings",
"libtest_check_rtld_next_from_library",
"libtest_dlopen_df_1_global",
- "libtest_dlopen_from_ctor",
"libtest_dlopen_from_ctor_main",
+ "libtest_dlopen_from_ctor",
"libtest_dlopen_weak_undefined_func",
"libtest_dlsym_df_1_global",
- "libtest_dlsym_from_this",
"libtest_dlsym_from_this_child",
"libtest_dlsym_from_this_grandchild",
+ "libtest_dlsym_from_this",
"libtest_dlsym_weak_func",
- "libtest_dt_runpath_a",
- "libtest_dt_runpath_b",
- "libtest_dt_runpath_c",
"libtest_dt_runpath_d",
- "libtest_dt_runpath_x",
- "libtest_dt_runpath_y",
"libtest_elftls_dynamic",
"libtest_elftls_dynamic_filler_1",
"libtest_elftls_dynamic_filler_2",
@@ -966,60 +687,81 @@ cc_defaults {
"libtest_elftls_shared_var_ie",
"libtest_elftls_tprel",
"libtest_empty",
- "libtest_ifunc",
- "libtest_ifunc_variable",
"libtest_ifunc_variable_impl",
- "libtest_indirect_thread_local_dtor",
+ "libtest_ifunc_variable",
+ "libtest_ifunc",
"libtest_init_fini_order_child",
"libtest_init_fini_order_grand_child",
- "libtest_init_fini_order_root",
"libtest_init_fini_order_root2",
- "libtest_invalid-empty_shdr_table",
- "libtest_invalid-rw_load_segment",
- "libtest_invalid-textrels",
- "libtest_invalid-textrels2",
- "libtest_invalid-unaligned_shdr_offset",
- "libtest_invalid-zero_shdr_table_content",
- "libtest_invalid-zero_shdr_table_offset",
- "libtest_invalid-zero_shentsize",
- "libtest_invalid-zero_shstrndx",
- "libtest_missing_symbol",
- "libtest_missing_symbol_child_private",
+ "libtest_init_fini_order_root",
"libtest_missing_symbol_child_public",
+ "libtest_missing_symbol_child_private",
"libtest_missing_symbol_root",
+ "libtest_missing_symbol",
"libtest_nodelete_1",
"libtest_nodelete_2",
"libtest_nodelete_dt_flags_1",
"libtest_pthread_atfork",
- "libtest_relo_check_dt_needed_order",
"libtest_relo_check_dt_needed_order_1",
"libtest_relo_check_dt_needed_order_2",
+ "libtest_relo_check_dt_needed_order",
"libtest_simple",
- "libtest_thread_local_dtor",
- "libtest_thread_local_dtor2",
"libtest_two_parents_child",
"libtest_two_parents_parent1",
"libtest_two_parents_parent2",
"libtest_versioned_lib",
"libtest_versioned_libv1",
"libtest_versioned_libv2",
- "libtest_versioned_otherlib",
"libtest_versioned_otherlib_empty",
+ "libtest_versioned_otherlib",
"libtest_versioned_uselibv1",
- "libtest_versioned_uselibv2",
"libtest_versioned_uselibv2_other",
+ "libtest_versioned_uselibv2",
"libtest_versioned_uselibv3_other",
- "libtest_with_dependency",
- "libtest_with_dependency_loop",
"libtest_with_dependency_loop_a",
"libtest_with_dependency_loop_b",
"libtest_with_dependency_loop_c",
- "libtestshared",
- "ns_hidden_child_helper",
+ "libtest_with_dependency_loop",
+ "libtest_with_dependency",
+ "libtest_indirect_thread_local_dtor",
+ "libtest_invalid-empty_shdr_table.so",
+ "libtest_invalid-rw_load_segment.so",
+ "libtest_invalid-unaligned_shdr_offset.so",
+ "libtest_invalid-zero_shdr_table_content.so",
+ "libtest_invalid-zero_shdr_table_offset.so",
+ "libtest_invalid-zero_shentsize.so",
+ "libtest_invalid-zero_shstrndx.so",
+ "libtest_invalid-textrels.so",
+ "libtest_invalid-textrels2.so",
+ "libtest_thread_local_dtor",
+ "libtest_thread_local_dtor2",
"preinit_getauxval_test_helper",
"preinit_syscall_test_helper",
- "thread_exit_cb_helper",
- "tls_properties_helper",
+ "libnstest_private_external",
+ "libnstest_dlopened",
+ "libnstest_private",
+ "libnstest_root_not_isolated",
+ "libnstest_root",
+ "libnstest_public",
+ "libnstest_public_internal",
+ "libnstest_ns_a_public1",
+ "libnstest_ns_a_public1_internal",
+ "libnstest_ns_b_public2",
+ "libnstest_ns_b_public3",
+ "ns_hidden_child_helper",
+ "libns_hidden_child_global",
+ "libns_hidden_child_internal",
+ "libns_hidden_child_public",
+ "libns_hidden_child_app",
+ "libsegment_gap_inner",
+ "libsegment_gap_outer",
+ "ld_preload_test_helper",
+ "ld_preload_test_helper_lib1",
+ "ld_preload_test_helper_lib2",
+ "ld_config_test_helper",
+ "ld_config_test_helper_lib1",
+ "ld_config_test_helper_lib2",
+ "ld_config_test_helper_lib3",
],
}
@@ -1031,6 +773,17 @@ cc_test {
}
cc_test {
+ name: "bionic-unit-tests-scudo",
+ defaults: [
+ "bionic_unit_tests_defaults",
+ ],
+
+ shared_libs: [
+ "libc_scudo",
+ ],
+}
+
+cc_test {
name: "bionic-stress-tests",
defaults: [
"bionic_tests_defaults",
@@ -1038,10 +791,6 @@ cc_test {
// For now, these tests run forever, so do not use the isolation framework.
isolated: false,
- // Running forever, do not consider unit test.
- test_options: {
- unit_test: false,
- },
srcs: [
"malloc_stress_test.cpp",
diff --git a/tests/Android.build.prebuilt.mk b/tests/Android.build.prebuilt.mk
new file mode 100644
index 000000000..de8f5e6c5
--- /dev/null
+++ b/tests/Android.build.prebuilt.mk
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2016 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.
+#
+
+include $(CLEAR_VARS)
+LOCAL_MULTILIB := both
+LOCAL_MODULE := $(bionic_tests_module)
+LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/prebuilt-elf-files
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/prebuilt-elf-files
+LOCAL_MODULE_CLASS := EXECUTABLES
+
+LOCAL_SRC_FILES_arm := prebuilt-elf-files/arm/$(bionic_tests_module)
+LOCAL_SRC_FILES_arm64 := prebuilt-elf-files/arm64/$(bionic_tests_module)
+LOCAL_SRC_FILES_x86 := prebuilt-elf-files/x86/$(bionic_tests_module)
+LOCAL_SRC_FILES_x86_64 := prebuilt-elf-files/x86_64/$(bionic_tests_module)
+include $(BUILD_PREBUILT)
+bionic-loader-test-libs-target: $(LOCAL_MODULE)
+.PHONY: bionic-loader-test-libs-target
diff --git a/tests/Android.mk b/tests/Android.mk
index 5ad4045bd..b5571e3f6 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -16,6 +16,43 @@
LOCAL_PATH := $(call my-dir)
+# TODO(dimitry): replace with define once https://android-review.googlesource.com/247466 is reverted
+# https://github.com/google/kati/issues/83 is currently blocking it.
+
+# Move prebuilt test elf-files to $(TARGET_OUT_NATIVE_TESTS)
+bionic_tests_module := libtest_invalid-rw_load_segment.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-unaligned_shdr_offset.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-zero_shentsize.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-zero_shstrndx.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-empty_shdr_table.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-zero_shdr_table_offset.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-zero_shdr_table_content.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-textrels.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+bionic_tests_module := libtest_invalid-textrels2.so
+include $(LOCAL_PATH)/Android.build.prebuilt.mk
+
+ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
+build_host := true
+else
+build_host := false
+endif
+
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
# -----------------------------------------------------------------------------
diff --git a/tests/BionicDeathTest.h b/tests/BionicDeathTest.h
new file mode 100644
index 000000000..6826ab72c
--- /dev/null
+++ b/tests/BionicDeathTest.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef BIONIC_TESTS_BIONIC_DEATH_TEST_H_
+#define BIONIC_TESTS_BIONIC_DEATH_TEST_H_
+
+#include <signal.h>
+
+#include <gtest/gtest.h>
+
+#if !defined(__BIONIC__)
+#define sigaction64 sigaction
+#endif
+
+class BionicDeathTest : public testing::Test {
+ protected:
+ virtual void SetUp() {
+ // Suppress debuggerd stack traces. Too slow.
+ for (int signo : { SIGABRT, SIGBUS, SIGSEGV, SIGSYS }) {
+ struct sigaction64 action = { .sa_handler = SIG_DFL };
+ sigaction64(signo, &action, &previous_);
+ }
+ }
+
+ virtual void TearDown() {
+ for (int signo : { SIGABRT, SIGBUS, SIGSEGV, SIGSYS }) {
+ sigaction64(signo, &previous_, nullptr);
+ }
+ }
+
+ private:
+ struct sigaction64 previous_;
+};
+
+#endif // BIONIC_TESTS_BIONIC_DEATH_TEST_H_
diff --git a/tests/NOTICE b/tests/NOTICE
deleted file mode 100644
index a58cf46d7..000000000
--- a/tests/NOTICE
+++ /dev/null
@@ -1,356 +0,0 @@
-Copyright (C) 2012 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2013 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2013 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2015 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2015 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2016 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2016 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2017 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2019 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2020 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2021 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.
-
--------------------------------------------------------------------
-
diff --git a/tests/__cxa_demangle_test.cpp b/tests/__cxa_demangle_test.cpp
deleted file mode 100644
index 4628a61c0..000000000
--- a/tests/__cxa_demangle_test.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <cxxabi.h>
-#include <gtest/gtest.h>
-
-extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
-
-TEST(__cxa_demangle, cxa_demangle_fuzz_152588929) {
-#if defined(__aarch64__)
- char* p = __cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);
- ASSERT_STREQ("\x6<-0x1.cecececececececececececececep+11983", p);
- free(p);
-#endif
-}
-
-TEST(__cxa_demangle, DISABLED_cxa_demangle_fuzz_167977068) {
-#if defined(__aarch64__)
- char* p = __cxa_demangle("DTLeeeeeeeeeeeeeeeeeeeeeeeeeEEEEeeEEEE", 0, 0, 0);
- ASSERT_EQ(nullptr, p) << p;
- free(p);
-#endif
-}
diff --git a/tests/arpa_inet_test.cpp b/tests/arpa_inet_test.cpp
index 8dec2e303..a368b8fcc 100644
--- a/tests/arpa_inet_test.cpp
+++ b/tests/arpa_inet_test.cpp
@@ -158,95 +158,3 @@ TEST(arpa_inet, inet_ntop_overflow) {
ASSERT_STREQ("::1", inet_ntop(AF_INET6, &ss6, s6, INET6_ADDRSTRLEN));
ASSERT_STREQ("::1", inet_ntop(AF_INET6, &ss6, s6, 2*INET6_ADDRSTRLEN));
}
-
-TEST(arpa_inet, inet_nsap_addr) {
- // inet_nsap_addr() doesn't seem to be documented anywhere, but it's basically
- // text to binary for arbitrarily-long strings like "0xdeadbeef". Any
- // '.', '+', or '/' characters are ignored as punctuation. The return value is
- // the length in bytes, or 0 for all errors.
- u_char buf[32];
-
- // Missing "0x" prefix.
- ASSERT_EQ(0U, inet_nsap_addr("123", buf, sizeof(buf)));
- ASSERT_EQ(0U, inet_nsap_addr("012", buf, sizeof(buf)));
-
- // 1 byte.
- ASSERT_EQ(1U, inet_nsap_addr("0x12", buf, sizeof(buf)));
- ASSERT_EQ(0x12, buf[0]);
-
- // 10 bytes.
- ASSERT_EQ(10U, inet_nsap_addr("0x1234567890abcdef0011", buf, sizeof(buf)));
- ASSERT_EQ(0x12, buf[0]);
- ASSERT_EQ(0x34, buf[1]);
- ASSERT_EQ(0x56, buf[2]);
- ASSERT_EQ(0x78, buf[3]);
- ASSERT_EQ(0x90, buf[4]);
- ASSERT_EQ(0xab, buf[5]);
- ASSERT_EQ(0xcd, buf[6]);
- ASSERT_EQ(0xef, buf[7]);
- ASSERT_EQ(0x00, buf[8]);
- ASSERT_EQ(0x11, buf[9]);
-
- // Ignored punctuation.
- ASSERT_EQ(10U, inet_nsap_addr("0x1122.3344+5566/7788/99aa", buf, sizeof(buf)));
- ASSERT_EQ(0x11, buf[0]);
- ASSERT_EQ(0x22, buf[1]);
- ASSERT_EQ(0x33, buf[2]);
- ASSERT_EQ(0x44, buf[3]);
- ASSERT_EQ(0x55, buf[4]);
- ASSERT_EQ(0x66, buf[5]);
- ASSERT_EQ(0x77, buf[6]);
- ASSERT_EQ(0x88, buf[7]);
- ASSERT_EQ(0x99, buf[8]);
- ASSERT_EQ(0xaa, buf[9]);
-
- // Truncated.
- ASSERT_EQ(4U, inet_nsap_addr("0xdeadbeef666666666666", buf, 4));
- // Overwritten...
- ASSERT_EQ(0xde, buf[0]);
- ASSERT_EQ(0xad, buf[1]);
- ASSERT_EQ(0xbe, buf[2]);
- ASSERT_EQ(0xef, buf[3]);
- // Same as before...
- ASSERT_EQ(0x55, buf[4]);
- ASSERT_EQ(0x66, buf[5]);
- ASSERT_EQ(0x77, buf[6]);
- ASSERT_EQ(0x88, buf[7]);
- ASSERT_EQ(0x99, buf[8]);
- ASSERT_EQ(0xaa, buf[9]);
-
- // Case insensitivity.
- ASSERT_EQ(6U, inet_nsap_addr("0xaAbBcCdDeEfF", buf, 6));
- ASSERT_EQ(0xaa, buf[0]);
- ASSERT_EQ(0xbb, buf[1]);
- ASSERT_EQ(0xcc, buf[2]);
- ASSERT_EQ(0xdd, buf[3]);
- ASSERT_EQ(0xee, buf[4]);
- ASSERT_EQ(0xff, buf[5]);
-
- // Punctuation isn't allowed within a byte.
- ASSERT_EQ(0U, inet_nsap_addr("0x1.122", buf, sizeof(buf)));
- // Invalid punctuation.
- ASSERT_EQ(0U, inet_nsap_addr("0x11,22", buf, sizeof(buf)));
- // Invalid hex digit.
- ASSERT_EQ(0U, inet_nsap_addr("0x11.g2", buf, sizeof(buf)));
- ASSERT_EQ(0U, inet_nsap_addr("0x11.2g", buf, sizeof(buf)));
- // Invalid half-byte.
- ASSERT_EQ(0U, inet_nsap_addr("0x11.2", buf, sizeof(buf)));
-}
-
-TEST(arpa_inet, inet_nsap_ntoa) {
- // inet_nsap_ntoa() doesn't seem to be documented anywhere, but it's basically
- // binary to text for arbitrarily-long byte buffers.
- // The return value is a pointer to the buffer. No errors are possible.
- const unsigned char bytes[] = {0x01, 0x00, 0x02, 0x0e, 0xf0, 0x20};
- char dst[32];
- ASSERT_EQ(dst, inet_nsap_ntoa(6, bytes, dst));
- ASSERT_STREQ(dst, "0x01.0002.0EF0.20");
-}
-
-TEST(arpa_inet, inet_nsap_ntoa__nullptr) {
- // If you don't provide a destination, a static buffer is provided for you.
- const unsigned char bytes[] = {0x01, 0x00, 0x02, 0x0e, 0xf0, 0x20};
- ASSERT_STREQ("0x01.0002.0EF0.20", inet_nsap_ntoa(6, bytes, nullptr));
-}
diff --git a/tests/assert_test.cpp b/tests/assert_test.cpp
index 769852abf..94361513d 100644
--- a/tests/assert_test.cpp
+++ b/tests/assert_test.cpp
@@ -19,18 +19,14 @@
#undef NDEBUG
#include <assert.h>
-#include <android-base/silent_death_test.h>
-
-using assert_DeathTest = SilentDeathTest;
-
TEST(assert, assert_true) {
assert(true);
}
-TEST_F(assert_DeathTest, assert_false) {
+TEST(assert, assert_false) {
EXPECT_DEATH(assert(false),
"bionic/tests/assert_test.cpp:.*: "
- "virtual void assert_DeathTest_assert_false_Test::TestBody\\(\\): "
+ "virtual void assert_assert_false_Test::TestBody\\(\\): "
"assertion \"false\" failed");
}
diff --git a/tests/bionic_allocator_test.cpp b/tests/bionic_allocator_test.cpp
index fdcf86827..f71090704 100644
--- a/tests/bionic_allocator_test.cpp
+++ b/tests/bionic_allocator_test.cpp
@@ -42,19 +42,19 @@ namespace {
* this one has size below allocator cap which is 2*sizeof(void*)
*/
struct test_struct_small {
- char str[5];
+ char dummy_str[5];
};
struct test_struct_large {
- char str[1009];
+ char dummy_str[1009];
};
struct test_struct_huge {
- char str[73939];
+ char dummy_str[73939];
};
struct test_struct_512 {
- char str[503];
+ char dummy_str[503];
};
};
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index 9a6ed9ac6..e0ae3afc7 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -15,13 +15,12 @@
*/
#include <dlfcn.h>
+#include <gtest/gtest.h>
#include <sys/stat.h>
#include <vector>
-#include <android-base/silent_death_test.h>
-#include <gtest/gtest.h>
-
+#include "BionicDeathTest.h"
#include "gtest_globals.h"
#include "utils.h"
@@ -36,8 +35,6 @@ void __cfi_slowpath_diag(uint64_t CallSiteTypeId, void* Ptr, void* DiagData);
size_t __cfi_shadow_size();
}
-using cfi_test_DeathTest = SilentDeathTest;
-
static void f() {}
static void test_cfi_slowpath_with_alloc() {
@@ -48,7 +45,7 @@ static void test_cfi_slowpath_with_alloc() {
}
}
-TEST_F(cfi_test_DeathTest, basic) {
+TEST(cfi_test, basic) {
#if defined(__BIONIC__)
void* handle;
handle = dlopen("libcfi-test.so", RTLD_NOW | RTLD_LOCAL);
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 5768f1fb3..715f9c81c 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -18,24 +18,17 @@
#error "Non-clang isn't supported"
#endif
-//
// Clang compile-time and run-time tests for Bionic's FORTIFY.
//
-
-// This file is compiled in two configurations to give us reasonable coverage of clang's
-// FORTIFY implementation:
+// This file is compiled in two configurations ways to give us a sane set of tests for clang's
+// FORTIFY implementation.
//
-// 1. For compile-time checks, we use clang's diagnostic consumer
+// One configuration uses clang's diagnostic consumer
// (https://clang.llvm.org/doxygen/classclang_1_1VerifyDiagnosticConsumer.html#details)
// to check diagnostics (e.g. the expected-* comments everywhere).
//
-// 2. For run-time checks, we build and run as regular gtests.
+// Please note that this test does things like leaking memory. That's WAI.
-// Note that these tests do things like leaking memory. That's WAI.
-
-//
-// Configuration for the compile-time checks. (These comments have side effects!)
-//
// Silence all "from 'diagnose_if'" `note`s from anywhere, including headers; they're uninteresting
// for this test case, and their line numbers may change over time.
// expected-note@* 0+{{from 'diagnose_if'}}
@@ -46,8 +39,8 @@
// And finally, all explicitly-unavailable-here complaints from headers are
// uninteresting
// expected-note@* 0+{{has been explicitly marked unavailable here}}
-//
-// Note that some of these diagnostics come from clang itself, while others come from
+
+// Note that some of these diags come from clang itself, while others come from
// `diagnose_if`s sprinkled throughout Bionic.
#ifndef _FORTIFY_SOURCE
@@ -94,14 +87,42 @@
#include <wchar.h>
#ifndef COMPILATION_TESTS
-#include <android-base/silent_death_test.h>
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#define CONCAT2(x, y) x##y
#define CONCAT(x, y) CONCAT2(x, y)
-#define FORTIFY_TEST_NAME CONCAT(CONCAT(clang_fortify_test_, _FORTIFY_SOURCE), _DeathTest)
+#define FORTIFY_TEST_NAME CONCAT(clang_fortify_test_, _FORTIFY_SOURCE)
+
+namespace {
+struct FORTIFY_TEST_NAME : BionicDeathTest {
+ protected:
+ void SetUp() override {
+ stdin_saved = dup(STDIN_FILENO);
+ if (stdin_saved < 0) err(1, "failed to dup stdin");
+
+ int devnull = open("/dev/null", O_RDONLY);
+ if (devnull < 0) err(1, "failed to open /dev/null");
+
+ if (!dup2(devnull, STDIN_FILENO)) err(1, "failed to overwrite stdin");
+ static_cast<void>(close(devnull));
+
+ BionicDeathTest::SetUp();
+ }
+
+ void TearDown() override {
+ if (stdin_saved == -1) return;
+ if (!dup2(stdin_saved, STDIN_FILENO)) warn("failed to restore stdin");
+
+ static_cast<void>(close(stdin_saved));
+
+ BionicDeathTest::TearDown();
+ }
-using FORTIFY_TEST_NAME = SilentDeathTest;
+ private:
+ int stdin_saved = -1;
+};
+} // namespace
template <typename Fn>
__attribute__((noreturn)) static void ExitAfter(Fn&& f) {
@@ -125,7 +146,7 @@ __attribute__((noreturn)) static void ExitAfter(Fn&& f) {
#define EXPECT_FORTIFY_DEATH_STRUCT EXPECT_NO_DEATH
#endif
-#define FORTIFY_TEST(test_name) TEST_F(FORTIFY_TEST_NAME, test_name)
+#define FORTIFY_TEST(test_name) TEST(FORTIFY_TEST_NAME, test_name)
#else // defined(COMPILATION_TESTS)
diff --git a/tests/dirent_test.cpp b/tests/dirent_test.cpp
index 56929d138..378aea41e 100644
--- a/tests/dirent_test.cpp
+++ b/tests/dirent_test.cpp
@@ -113,18 +113,6 @@ TEST(dirent, scandirat_scandirat64) {
ASSERT_EQ(unsorted_name_list, unsorted_name_list_at64);
}
-static int is_version_filter(const dirent* de) {
- return !strcmp(de->d_name, "version");
-}
-
-TEST(dirent, scandir_filter) {
- dirent** entries;
- errno = 0;
- ASSERT_EQ(1, scandir("/proc", &entries, is_version_filter, nullptr));
- ASSERT_STREQ("version", entries[0]->d_name);
- free(entries);
-}
-
TEST(dirent, scandir_ENOENT) {
dirent** entries;
errno = 0;
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 47bf13374..6adba1906 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -27,10 +27,9 @@
#include <stdint.h>
#include <sys/stat.h>
-#include <fstream>
-#include <iostream>
-#include <regex>
#include <string>
+#include <iostream>
+#include <fstream>
#include "gtest_globals.h"
#include <android-base/file.h>
@@ -264,28 +263,17 @@ static void create_ld_config_file(const char* config_file) {
#endif
#if defined(__BIONIC__)
-// This test can't rely on ro.debuggable, because it might have been forced on
-// in a user build ("Force Debuggable"). In that configuration, ro.debuggable is
-// true, but Bionic's LD_CONFIG_FILE testing support is still disabled.
-static bool is_user_build() {
- return android::base::GetProperty("ro.build.type", "user") == std::string("user");
+static bool is_debuggable_build() {
+ return android::base::GetBoolProperty("ro.debuggable", false);
}
#endif
-// lib1.so and lib2.so are now searchable by having another namespace 'ns2'
+// _lib1.so and _lib2.so are now searchable by having another namespace 'ns2'
// whose search paths include the 'ns2/' subdir.
-//
-// lib1.so is linked with DF_1_GLOBAL, so both it and the executable are added
-// to every namespace.
-//
-// namespace configuration ('*' indicates primary ns)
-// - default: exe[*], lib1.so
-// - ns2: exe, lib1.so[*], lib2.so[*]
-//
TEST(dl, exec_with_ld_config_file) {
#if defined(__BIONIC__)
SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
- if (is_user_build()) {
+ if (!is_debuggable_build()) {
GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
}
std::string helper = GetTestlibRoot() +
@@ -297,32 +285,17 @@ TEST(dl, exec_with_ld_config_file) {
ExecTestHelper eth;
eth.SetArgs({ helper.c_str(), nullptr });
eth.SetEnv({ env.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0,
- "foo lib1\n"
- "lib1_call_funcs\n"
- "foo lib1\n"
- "bar lib2\n");
+ eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "12345");
#endif
}
-// lib3.so has same foo and bar symbols as lib2.so. lib3.so is LD_PRELOADed.
-// This test ensures that LD_PRELOADed libs are available to all namespaces.
-//
-// namespace configuration ('*' indicates primary ns)
-// - default: exe[*], lib3.so[*], lib1.so
-// - ns2: exe, lib3.so, lib1.so[*], lib2.so[*]
-//
-// Ensure that, in both namespaces, a call to foo calls the lib3.so symbol,
-// which then calls the lib1.so symbol using RTLD_NEXT. Ensure that RTLD_NEXT
-// finds nothing when called from lib1.so.
-//
-// For the bar symbol, lib3.so's primary namespace is the default namespace, but
-// lib2.so is not in the default namespace, so using RTLD_NEXT from lib3.so
-// doesn't find the symbol in lib2.so.
+// _lib3.so has same symbol as lib2.so but returns 54321. _lib3.so is
+// LD_PRELOADed. This test is to ensure LD_PRELOADed libs are available to
+// additional namespaces other than the default namespace.
TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#if defined(__BIONIC__)
SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
- if (is_user_build()) {
+ if (!is_debuggable_build()) {
GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
}
std::string helper = GetTestlibRoot() +
@@ -335,17 +308,7 @@ TEST(dl, exec_with_ld_config_file_with_ld_preload) {
ExecTestHelper eth;
eth.SetArgs({ helper.c_str(), nullptr });
eth.SetEnv({ env.c_str(), env2.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0,
- "foo lib3\n"
- "foo lib1\n"
- "lib1_call_funcs\n"
- "foo lib3\n"
- "foo lib1\n"
- "bar lib3\n"
- "lib3_call_funcs\n"
- "foo lib3\n"
- "foo lib1\n"
- "bar lib3\n");
+ eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "54321");
#endif
}
@@ -359,8 +322,8 @@ TEST(dl, disable_ld_config_file) {
// This test is only for CTS.
GTEST_SKIP() << "test is not supported with root uid";
}
- if (!is_user_build()) {
- GTEST_SKIP() << "test requires user build";
+ if (is_debuggable_build()) {
+ GTEST_SKIP() << "test is not supported on debuggable build";
}
std::string error_message = std::string("CANNOT LINK EXECUTABLE ") +
@@ -386,8 +349,7 @@ static void RelocationsTest(const char* lib, const char* expectation) {
ExecTestHelper eth;
eth.SetArgs({ "readelf", "-SW", path.c_str(), nullptr });
eth.Run([&]() { execvpe("readelf", eth.GetArgs(), eth.GetEnv()); }, 0, nullptr);
-
- ASSERT_TRUE(std::regex_search(eth.GetOutput(), std::regex(expectation))) << eth.GetOutput();
+ ASSERT_TRUE(eth.GetOutput().find(expectation) != std::string::npos) << eth.GetOutput();
// Can we load it?
void* handle = dlopen(lib, RTLD_NOW);
@@ -400,29 +362,31 @@ static void RelocationsTest(const char* lib, const char* expectation) {
}
TEST(dl, relocations_RELR) {
- RelocationsTest("librelocations-RELR.so", "\\.relr\\.dyn * RELR");
+ RelocationsTest("librelocations-RELR.so",
+ ".relr.dyn RELR");
}
TEST(dl, relocations_ANDROID_RELR) {
- RelocationsTest("librelocations-ANDROID_RELR.so", "\\.relr\\.dyn * ANDROID_RELR");
+ RelocationsTest("librelocations-ANDROID_RELR.so",
+ ".relr.dyn ANDROID_RELR");
}
TEST(dl, relocations_ANDROID_REL) {
RelocationsTest("librelocations-ANDROID_REL.so",
#if __LP64__
- "\\.rela\\.dyn * ANDROID_RELA"
+ ".rela.dyn ANDROID_RELA"
#else
- "\\.rel\\.dyn * ANDROID_REL"
+ ".rel.dyn ANDROID_REL"
#endif
- );
+ );
}
TEST(dl, relocations_fat) {
RelocationsTest("librelocations-fat.so",
#if __LP64__
- "\\.rela\\.dyn * RELA"
+ ".rela.dyn RELA"
#else
- "\\.rel\\.dyn * REL"
+ ".rel.dyn REL"
#endif
- );
+ );
}
diff --git a/tests/dlext_private.h b/tests/dlext_private.h
index 262af4c25..b338ae01f 100644
--- a/tests/dlext_private.h
+++ b/tests/dlext_private.h
@@ -56,10 +56,10 @@ enum {
*/
ANDROID_NAMESPACE_TYPE_SHARED = 2,
- /* This flag instructs linker to enable exempt-list workaround for the namespace.
+ /* This flag instructs linker to enable grey-list workaround for the namespace.
* See http://b/26394120 for details.
*/
- ANDROID_NAMESPACE_TYPE_EXEMPT_LIST_ENABLED = 0x08000000,
+ ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED = 0x08000000,
ANDROID_NAMESPACE_TYPE_SHARED_ISOLATED = ANDROID_NAMESPACE_TYPE_SHARED |
ANDROID_NAMESPACE_TYPE_ISOLATED,
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index e3caf0eb1..293c17b41 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -237,24 +237,6 @@ TEST(dlfcn, dlopen_from_nullptr_android_api_level_28) {
ASSERT_TRUE(dlopen(nullptr, RTLD_NOW) != nullptr);
}
-// Test system path translation for backward compatibility. http://b/130219528
-TEST(dlfcn, dlopen_system_libicuuc_android_api_level_28) {
- android_set_application_target_sdk_version(28);
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) != nullptr);
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) != nullptr);
-}
-
-TEST(dlfcn, dlopen_system_libicuuc_android_api_level_29) {
- android_set_application_target_sdk_version(29);
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) == nullptr);
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) == nullptr);
-}
-
-TEST(dlfcn, dlopen_system_libicuuc_android_api_level_current) {
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicuuc.so", RTLD_NOW) == nullptr);
- ASSERT_TRUE(dlopen(PATH_TO_SYSTEM_LIB "libicui18n.so", RTLD_NOW) == nullptr);
-}
-
TEST(dlfcn, dlopen_from_zip_absolute_path) {
const std::string lib_zip_path = "/libdlext_test_zip/libdlext_test_zip_zipaligned.zip";
const std::string lib_path = GetTestlibRoot() + lib_zip_path;
@@ -717,12 +699,13 @@ std::string DlExtRelroSharingTest::FindMappingName(void* ptr) {
uint64_t addr = reinterpret_cast<uint64_t>(ptr);
std::string found_name = "<not found>";
- EXPECT_TRUE(android::procinfo::ReadMapFile("/proc/self/maps",
- [&](const android::procinfo::MapInfo& mapinfo) {
- if (addr >= mapinfo.start && addr < mapinfo.end) {
- found_name = mapinfo.name;
- }
- }));
+ EXPECT_TRUE(android::procinfo::ReadMapFile(
+ "/proc/self/maps",
+ [&](uint64_t start, uint64_t end, uint16_t, uint16_t, ino_t, const char* name) {
+ if (addr >= start && addr < end) {
+ found_name = name;
+ }
+ }));
return found_name;
}
@@ -1227,7 +1210,7 @@ TEST(dlext, ns_unload_between_namespaces_missing_symbol_indirect) {
dlerror());
}
-TEST(dlext, ns_exempt_list_enabled) {
+TEST(dlext, ns_greylist_enabled) {
ASSERT_TRUE(android_init_anonymous_namespace(g_core_shared_libs.c_str(), nullptr));
const std::string ns_search_path = GetTestlibRoot() + "/private_namespace_libs";
@@ -1236,7 +1219,7 @@ TEST(dlext, ns_exempt_list_enabled) {
android_create_namespace("namespace",
nullptr,
ns_search_path.c_str(),
- ANDROID_NAMESPACE_TYPE_ISOLATED | ANDROID_NAMESPACE_TYPE_EXEMPT_LIST_ENABLED,
+ ANDROID_NAMESPACE_TYPE_ISOLATED | ANDROID_NAMESPACE_TYPE_GREYLIST_ENABLED,
nullptr,
nullptr);
@@ -1246,26 +1229,26 @@ TEST(dlext, ns_exempt_list_enabled) {
extinfo.flags = ANDROID_DLEXT_USE_NAMESPACE;
extinfo.library_namespace = ns;
- // An app targeting M can open libnativehelper.so because it's on the exempt-list.
+ // An app targeting M can open libnativehelper.so because it's on the greylist.
android_set_application_target_sdk_version(23);
void* handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle != nullptr) << dlerror();
- // Check that loader did not load another copy of libdl.so while loading exempted library.
+ // Check that loader did not load another copy of libdl.so while loading greylisted library.
void* dlsym_ptr = dlsym(handle, "dlsym");
ASSERT_TRUE(dlsym_ptr != nullptr) << dlerror();
ASSERT_EQ(&dlsym, dlsym_ptr);
dlclose(handle);
- // An app targeting N no longer has the exempt-list.
+ // An app targeting N no longer has the greylist.
android_set_application_target_sdk_version(24);
handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle == nullptr);
ASSERT_STREQ("dlopen failed: library \"libnativehelper.so\" not found", dlerror());
}
-TEST(dlext, ns_exempt_list_disabled_by_default) {
+TEST(dlext, ns_greylist_disabled_by_default) {
ASSERT_TRUE(android_init_anonymous_namespace(g_core_shared_libs.c_str(), nullptr));
const std::string ns_search_path = GetTestlibRoot() + "/private_namespace_libs";
@@ -2021,7 +2004,7 @@ TEST(dlext, ns_anonymous) {
}
}
- // Some validity checks.
+ // some sanity checks..
ASSERT_TRUE(addr_start > 0);
ASSERT_TRUE(addr_end > 0);
ASSERT_TRUE(maps_to_copy.size() > 0);
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 35e12eb4a..d7b9bae64 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -1623,7 +1623,9 @@ TEST(dlext, compat_elf_hash_and_relocation_tables) {
#endif // defined(__arm__)
TEST(dlfcn, dlopen_invalid_rw_load_segment) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-rw_load_segment.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-rw_load_segment.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\": W+E load segments are not allowed";
@@ -1631,7 +1633,9 @@ TEST(dlfcn, dlopen_invalid_rw_load_segment) {
}
TEST(dlfcn, dlopen_invalid_unaligned_shdr_offset) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-unaligned_shdr_offset.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-unaligned_shdr_offset.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1640,7 +1644,9 @@ TEST(dlfcn, dlopen_invalid_unaligned_shdr_offset) {
}
TEST(dlfcn, dlopen_invalid_zero_shentsize) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-zero_shentsize.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-zero_shentsize.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1649,7 +1655,9 @@ TEST(dlfcn, dlopen_invalid_zero_shentsize) {
}
TEST(dlfcn, dlopen_invalid_zero_shstrndx) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-zero_shstrndx.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-zero_shstrndx.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1658,7 +1666,9 @@ TEST(dlfcn, dlopen_invalid_zero_shstrndx) {
}
TEST(dlfcn, dlopen_invalid_empty_shdr_table) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-empty_shdr_table.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-empty_shdr_table.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1667,7 +1677,9 @@ TEST(dlfcn, dlopen_invalid_empty_shdr_table) {
}
TEST(dlfcn, dlopen_invalid_zero_shdr_table_offset) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-zero_shdr_table_offset.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-zero_shdr_table_offset.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1676,7 +1688,9 @@ TEST(dlfcn, dlopen_invalid_zero_shdr_table_offset) {
}
TEST(dlfcn, dlopen_invalid_zero_shdr_table_content) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-zero_shdr_table_content.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-zero_shdr_table_content.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1685,7 +1699,9 @@ TEST(dlfcn, dlopen_invalid_zero_shdr_table_content) {
}
TEST(dlfcn, dlopen_invalid_textrels) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-textrels.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-textrels.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
@@ -1694,7 +1710,9 @@ TEST(dlfcn, dlopen_invalid_textrels) {
}
TEST(dlfcn, dlopen_invalid_textrels2) {
- const std::string libpath = GetPrebuiltElfDir() + "/libtest_invalid-textrels2.so";
+ const std::string libpath = GetTestlibRoot() +
+ "/" + kPrebuiltElfDir +
+ "/libtest_invalid-textrels2.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
diff --git a/tests/error_test.cpp b/tests/error_test.cpp
index e114f064c..e03c8d44f 100644
--- a/tests/error_test.cpp
+++ b/tests/error_test.cpp
@@ -30,9 +30,7 @@
#include <error.h>
-#include <android-base/silent_death_test.h>
-
-using error_DeathTest = SilentDeathTest;
+#include "BionicDeathTest.h"
static size_t g_test_error_print_progname_invocation_count;
diff --git a/tests/eventfd_test.cpp b/tests/eventfd_test.cpp
index eb423c15f..3c303c25e 100644
--- a/tests/eventfd_test.cpp
+++ b/tests/eventfd_test.cpp
@@ -51,7 +51,7 @@ TEST(eventfd, cloexec) {
constexpr unsigned int kInitialValue = 2;
int fd = eventfd(kInitialValue, EFD_CLOEXEC);
ASSERT_NE(-1, fd);
- ASSERT_TRUE(CloseOnExec(fd));
+ AssertCloseOnExec(fd, true);
eventfd_t value = 123;
ASSERT_EQ(0, eventfd_read(fd, &value));
@@ -61,7 +61,7 @@ TEST(eventfd, cloexec) {
fd = eventfd(kInitialValue, EFD_NONBLOCK | EFD_CLOEXEC);
ASSERT_NE(-1, fd);
- ASSERT_TRUE(CloseOnExec(fd));
+ AssertCloseOnExec(fd, true);
value = 123;
ASSERT_EQ(0, eventfd_read(fd, &value));
diff --git a/tests/fdsan_test.cpp b/tests/fdsan_test.cpp
index 016970ffb..134d62117 100644
--- a/tests/fdsan_test.cpp
+++ b/tests/fdsan_test.cpp
@@ -16,6 +16,8 @@
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
+
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -25,12 +27,10 @@
#if defined(__BIONIC__)
#include <android/fdsan.h>
-#include <bionic/reserved_signals.h>
#endif
#include <unordered_map>
-#include <android-base/silent_death_test.h>
#include <android-base/unique_fd.h>
#define FDSAN_TEST(test_name) TEST_F(FdsanTest, test_name)
@@ -38,7 +38,7 @@
EXPECT_DEATH((android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_FATAL), expression), \
(regex))
-struct fdsan : public ::testing::Test {
+struct FdsanTest : public ::testing::Test {
void SetUp() override {
#if defined(__BIONIC__)
// The bionic unit test running forks for each test by default, which turns
@@ -48,38 +48,28 @@ struct fdsan : public ::testing::Test {
}
};
-struct fdsan_DeathTest : public SilentDeathTest {
-#if defined(__BIONIC__)
- void SetUp() override {
- android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_FATAL);
- signal(BIONIC_SIGNAL_DEBUGGER, SIG_DFL); // Disable debuggerd.
- SilentDeathTest::SetUp();
- }
-#endif
-};
-
-TEST_F(fdsan, unowned_untagged_close) {
+TEST_F(FdsanTest, unowned_untagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
ASSERT_EQ(0, close(fd));
#endif
}
-TEST_F(fdsan, unowned_tagged_close) {
+TEST_F(FdsanTest, unowned_tagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
ASSERT_EQ(0, android_fdsan_close_with_tag(fd, 0));
#endif
}
-TEST_F(fdsan_DeathTest, unowned_improperly_tagged_close) {
+TEST_F(FdsanTest, unowned_improperly_tagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
EXPECT_FDSAN_DEATH(android_fdsan_close_with_tag(fd, 0xdeadbeef), "actually unowned");
#endif
}
-TEST_F(fdsan_DeathTest, unowned_incorrect_exchange) {
+TEST_F(FdsanTest, unowned_incorrect_exchange) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
EXPECT_FDSAN_DEATH(android_fdsan_exchange_owner_tag(fd, 0xbadc0de, 0xdeadbeef),
@@ -87,7 +77,7 @@ TEST_F(fdsan_DeathTest, unowned_incorrect_exchange) {
#endif
}
-TEST_F(fdsan_DeathTest, owned_untagged_close) {
+TEST_F(FdsanTest, owned_untagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
android_fdsan_exchange_owner_tag(fd, 0, 0xdeadbeef);
@@ -95,7 +85,7 @@ TEST_F(fdsan_DeathTest, owned_untagged_close) {
#endif
}
-TEST_F(fdsan, owned_tagged_close) {
+TEST_F(FdsanTest, owned_tagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
android_fdsan_exchange_owner_tag(fd, 0, 0xdeadbeef);
@@ -103,7 +93,7 @@ TEST_F(fdsan, owned_tagged_close) {
#endif
}
-TEST_F(fdsan_DeathTest, owned_improperly_tagged_close) {
+TEST_F(FdsanTest, owned_improperly_tagged_close) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
android_fdsan_exchange_owner_tag(fd, 0, 0xdeadbeef);
@@ -111,7 +101,7 @@ TEST_F(fdsan_DeathTest, owned_improperly_tagged_close) {
#endif
}
-TEST_F(fdsan_DeathTest, owned_incorrect_exchange) {
+TEST_F(FdsanTest, owned_incorrect_exchange) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
android_fdsan_exchange_owner_tag(fd, 0, 0xdeadbeef);
@@ -120,7 +110,7 @@ TEST_F(fdsan_DeathTest, owned_incorrect_exchange) {
#endif
}
-TEST_F(fdsan_DeathTest, fopen) {
+TEST_F(FdsanTest, fopen) {
#if defined(__BIONIC__)
FILE* f = fopen("/dev/null", "r");
ASSERT_TRUE(f);
@@ -128,7 +118,7 @@ TEST_F(fdsan_DeathTest, fopen) {
#endif
}
-TEST_F(fdsan_DeathTest, closedir) {
+TEST_F(FdsanTest, closedir) {
#if defined(__BIONIC__)
DIR* dir = opendir("/dev/");
ASSERT_TRUE(dir);
@@ -136,7 +126,7 @@ TEST_F(fdsan_DeathTest, closedir) {
#endif
}
-TEST_F(fdsan, overflow) {
+TEST_F(FdsanTest, overflow) {
#if defined(__BIONIC__)
std::unordered_map<int, uint64_t> fds;
for (int i = 0; i < 4096; ++i) {
@@ -152,7 +142,7 @@ TEST_F(fdsan, overflow) {
#endif
}
-TEST_F(fdsan_DeathTest, owner_value_high) {
+TEST_F(FdsanTest, owner_value_high) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD, ~0ULL);
@@ -162,7 +152,7 @@ TEST_F(fdsan_DeathTest, owner_value_high) {
#endif
}
-TEST_F(fdsan_DeathTest, owner_value_low) {
+TEST_F(FdsanTest, owner_value_low) {
#if defined(__BIONIC__)
int fd = open("/dev/null", O_RDONLY);
uint64_t tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD, 1);
@@ -172,7 +162,7 @@ TEST_F(fdsan_DeathTest, owner_value_low) {
#endif
}
-TEST_F(fdsan_DeathTest, unique_fd_unowned_close) {
+TEST_F(FdsanTest, unique_fd_unowned_close) {
#if defined(__BIONIC__)
android::base::unique_fd fd(open("/dev/null", O_RDONLY));
android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_FATAL);
@@ -180,19 +170,19 @@ TEST_F(fdsan_DeathTest, unique_fd_unowned_close) {
#endif
}
-TEST_F(fdsan, unique_fd_untag_on_release) {
+TEST_F(FdsanTest, unique_fd_untag_on_release) {
android::base::unique_fd fd(open("/dev/null", O_RDONLY));
close(fd.release());
}
-TEST_F(fdsan, unique_fd_move) {
+TEST_F(FdsanTest, unique_fd_move) {
android::base::unique_fd fd(open("/dev/null", O_RDONLY));
android::base::unique_fd fd_moved = std::move(fd);
ASSERT_EQ(-1, fd.get());
ASSERT_GT(fd_moved.get(), -1);
}
-TEST_F(fdsan_DeathTest, unique_fd_unowned_close_after_move) {
+TEST_F(FdsanTest, unique_fd_unowned_close_after_move) {
#if defined(__BIONIC__)
android::base::unique_fd fd(open("/dev/null", O_RDONLY));
android::base::unique_fd fd_moved = std::move(fd);
@@ -204,7 +194,7 @@ TEST_F(fdsan_DeathTest, unique_fd_unowned_close_after_move) {
#endif
}
-TEST_F(fdsan, vfork) {
+TEST_F(FdsanTest, vfork) {
android::base::unique_fd fd(open("/dev/null", O_RDONLY));
pid_t rc = vfork();
diff --git a/tests/fdtrack_test.cpp b/tests/fdtrack_test.cpp
index 9fcb40283..44aa033a0 100644
--- a/tests/fdtrack_test.cpp
+++ b/tests/fdtrack_test.cpp
@@ -28,16 +28,12 @@
#include <unistd.h>
#if defined(__BIONIC__)
-#include <sys/pidfd.h>
-
#include "platform/bionic/fdtrack.h"
-#include "platform/bionic/reserved_signals.h"
#endif
#include <vector>
#include <android-base/cmsg.h>
-#include <android-base/logging.h>
#include <android-base/unique_fd.h>
using android::base::ReceiveFileDescriptors;
@@ -45,30 +41,15 @@ using android::base::SendFileDescriptors;
using android::base::unique_fd;
#if defined(__BIONIC__)
-void DumpEvent(std::vector<android_fdtrack_event>* events, size_t index) {
- auto& event = (*events)[index];
- if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
- fprintf(stderr, " event %zu: fd %d created by %s\n", index, event.fd,
- event.data.create.function_name);
- } else if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CLOSE) {
- fprintf(stderr, " event %zu: fd %d closed\n", index, event.fd);
- } else {
- errx(1, "unexpected fdtrack event type: %d", event.type);
- }
-}
-
-std::vector<android_fdtrack_event> FdtrackRun(void (*func)(), bool reenable = true) {
+std::vector<android_fdtrack_event> FdtrackRun(void (*func)()) {
// Each bionic test is run in separate process, so we can safely use a static here.
- // However, since they're all forked, we need to reenable fdtrack.
- if (reenable) {
- android_fdtrack_set_globally_enabled(true);
- }
-
static std::vector<android_fdtrack_event> events;
events.clear();
android_fdtrack_hook_t previous = nullptr;
- android_fdtrack_hook_t hook = [](android_fdtrack_event* event) { events.push_back(*event); };
+ android_fdtrack_hook_t hook = [](android_fdtrack_event* event) {
+ events.push_back(*event);
+ };
if (!android_fdtrack_compare_exchange_hook(&previous, hook)) {
errx(1, "failed to exchange hook: previous hook was %p", previous);
@@ -85,30 +66,6 @@ std::vector<android_fdtrack_event> FdtrackRun(void (*func)(), bool reenable = tr
errx(1, "failed to reset hook");
}
- // Filter out temporary fds created and closed as a result of the call.
- // (e.g. accept creating a socket to tell netd about the newly accepted socket)
- size_t i = 0;
- while (i + 1 < events.size()) {
- auto& event = events[i];
- if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
- for (size_t j = i + 1; j < events.size(); ++j) {
- if (event.fd == events[j].fd) {
- if (events[j].type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) {
- fprintf(stderr, "error: multiple create events for the same fd:\n");
- DumpEvent(&events, i);
- DumpEvent(&events, j);
- exit(1);
- }
-
- events.erase(events.begin() + j);
- events.erase(events.begin() + i);
- continue;
- }
- }
- }
- ++i;
- }
-
return std::move(events);
}
@@ -134,21 +91,6 @@ TEST(fdtrack, close) {
#endif
}
-TEST(fdtrack, fork) {
-#if defined(__BIONIC__)
- ASSERT_EXIT(
- []() {
- static int fd = open("/dev/null", O_WRONLY | O_CLOEXEC);
- ASSERT_NE(-1, fd);
-
- auto events = FdtrackRun([]() { close(fd); }, false);
- ASSERT_EQ(0U, events.size());
- exit(0);
- }(),
- testing::ExitedWithCode(0), "");
-#endif
-}
-
TEST(fdtrack, enable_disable) {
#if defined(__BIONIC__)
static int fd1 = -1;
@@ -198,13 +140,21 @@ void SetFdResult(std::vector<int>* output, std::vector<int> fds) {
static std::vector<int> expected_fds; \
auto events = FdtrackRun([]() { SetFdResult(&expected_fds, expression); }); \
for (auto& fd : expected_fds) { \
- ASSERT_NE(-1, fd) << strerror(errno); \
+ ASSERT_NE(-1, fd); \
} \
if (events.size() != expected_fds.size()) { \
fprintf(stderr, "too many events received: expected %zu, got %zu:\n", expected_fds.size(), \
events.size()); \
for (size_t i = 0; i < events.size(); ++i) { \
- DumpEvent(&events, i); \
+ auto& event = events[i]; \
+ if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CREATE) { \
+ fprintf(stderr, " event %zu: fd %d created by %s\n", i, event.fd, \
+ event.data.create.function_name); \
+ } else if (event.type == ANDROID_FDTRACK_EVENT_TYPE_CLOSE) { \
+ fprintf(stderr, " event %zu: fd %d closed\n", i, event.fd); \
+ } else { \
+ errx(1, "unexpected fdtrack event type: %d", event.type); \
+ } \
} \
FAIL(); \
return; \
@@ -231,37 +181,6 @@ FDTRACK_TEST(open, open("/dev/null", O_WRONLY | O_CLOEXEC));
FDTRACK_TEST(openat, openat(AT_EMPTY_PATH, "/dev/null", O_WRONLY | O_CLOEXEC));
FDTRACK_TEST(socket, socket(AF_UNIX, SOCK_STREAM, 0));
-FDTRACK_TEST(pidfd_open, ({
- int rc = pidfd_open(getpid(), 0);
- if (rc == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_open not available";
- }
- rc;
-}));
-
-FDTRACK_TEST(pidfd_getfd, ({
- android_fdtrack_set_enabled(false);
- int pidfd_self = pidfd_open(getpid(), 0);
- if (pidfd_self == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_open not available";
- }
- android_fdtrack_set_enabled(true);
-
- int rc = pidfd_getfd(pidfd_self, STDIN_FILENO, 0);
- if (rc == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_getfd not available";
- }
-
- android_fdtrack_set_enabled(false);
- close(pidfd_self);
- android_fdtrack_set_enabled(true);
-
- rc;
-}));
-
FDTRACK_TEST(dup, dup(STDOUT_FILENO));
FDTRACK_TEST(dup2, dup2(STDOUT_FILENO, STDERR_FILENO));
FDTRACK_TEST(dup3, dup3(STDOUT_FILENO, STDERR_FILENO, 0));
@@ -297,11 +216,12 @@ FDTRACK_TEST(epoll_create1, epoll_create1(0));
FDTRACK_TEST(eventfd, eventfd(0, 0));
-#if defined(__BIONIC__)
-static int CreateListener() {
+#if 0
+// Why is this generating an extra socket/close event?
+FDTRACK_TEST(accept, ({
android_fdtrack_set_enabled(false);
int listener = socket(AF_INET, SOCK_STREAM, 0);
- CHECK_NE(-1, listener);
+ ASSERT_NE(-1, listener);
sockaddr_in addr = {
.sin_family = AF_INET,
@@ -310,23 +230,21 @@ static int CreateListener() {
};
socklen_t addrlen = sizeof(addr);
- CHECK_NE(-1, bind(listener, reinterpret_cast<sockaddr*>(&addr), addrlen)) << strerror(errno);
- CHECK_NE(-1, getsockname(listener, reinterpret_cast<sockaddr*>(&addr), &addrlen));
- CHECK_EQ(static_cast<size_t>(addrlen), sizeof(addr));
- CHECK_NE(-1, listen(listener, 1));
+ ASSERT_NE(-1, bind(listener, reinterpret_cast<sockaddr*>(&addr), addrlen)) << strerror(errno);
+ ASSERT_NE(-1, getsockname(listener, reinterpret_cast<sockaddr*>(&addr), &addrlen));
+ ASSERT_EQ(static_cast<size_t>(addrlen), sizeof(addr));
+ ASSERT_NE(-1, listen(listener, 1));
int connector = socket(AF_INET, SOCK_STREAM, 0);
- CHECK_NE(-1, connector);
- CHECK_NE(-1, connect(connector, reinterpret_cast<sockaddr*>(&addr), addrlen));
- android_fdtrack_set_enabled(true);
+ ASSERT_NE(-1, connector);
+ ASSERT_NE(-1, connect(connector, reinterpret_cast<sockaddr*>(&addr), addrlen));
- return listener;
-}
+ android_fdtrack_set_enabled(true);
+ int accepted = accept(listener, nullptr, nullptr);
+ accepted;
+}));
#endif
-FDTRACK_TEST_NAME(accept, "accept4", accept(CreateListener(), nullptr, nullptr));
-FDTRACK_TEST(accept4, accept4(CreateListener(), nullptr, nullptr, 0));
-
FDTRACK_TEST(recvmsg, ({
android_fdtrack_set_enabled(false);
int sockets[2];
diff --git a/tests/fenv_test.cpp b/tests/fenv_test.cpp
index d49597091..e983a1c08 100644
--- a/tests/fenv_test.cpp
+++ b/tests/fenv_test.cpp
@@ -22,20 +22,19 @@
#include <stdint.h>
static void TestRounding(float expectation1, float expectation2) {
- // Volatile to prevent compile-time evaluation.
+ // volatile to prevent compiler optimizations.
volatile float f = 1.968750f;
volatile float m = 0x1.0p23f;
- float x;
- DoNotOptimize(x = f + m);
+ volatile float x = f + m;
ASSERT_FLOAT_EQ(expectation1, x);
- DoNotOptimize(x = x - m);
+ x = x - m;
ASSERT_EQ(expectation2, x);
}
static void DivideByZero() {
- // Volatile to prevent compile-time evaluation.
+ // volatile to prevent compiler optimizations.
volatile float zero = 0.0f;
- DoNotOptimize(123.0f / zero);
+ volatile float result __attribute__((unused)) = 123.0f / zero;
}
TEST(fenv, fesetround_fegetround_FE_TONEAREST) {
@@ -202,7 +201,6 @@ TEST(fenv, feenableexcept_fegetexcept) {
ASSERT_NE(-1, pid) << strerror(errno);
if (pid == 0) {
- signal(SIGFPE, SIG_DFL); // Disable debuggerd.
feclearexcept(FE_ALL_EXCEPT);
ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT));
ASSERT_EQ(0, feenableexcept(FE_INVALID));
diff --git a/tests/fnmatch_test.cpp b/tests/fnmatch_test.cpp
deleted file mode 100644
index 7395a9515..000000000
--- a/tests/fnmatch_test.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <gtest/gtest.h>
-
-#include <fnmatch.h>
-
-TEST(fnmatch, basic) {
- EXPECT_EQ(0, fnmatch("abc", "abc", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("abc", "abd", 0));
-}
-
-TEST(fnmatch, casefold) {
- EXPECT_EQ(FNM_NOMATCH, fnmatch("abc", "aBc", 0));
- EXPECT_EQ(0, fnmatch("abc", "aBc", FNM_CASEFOLD));
-}
-
-TEST(fnmatch, character_class) {
- // Literal.
- EXPECT_EQ(0, fnmatch("ab[cd]", "abc", 0));
- EXPECT_EQ(0, fnmatch("ab[cd]", "abd", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab[cd]", "abe", 0));
-
- // Inverted literal.
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab[^cd]", "abc", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab[^cd]", "abd", 0));
- EXPECT_EQ(0, fnmatch("ab[^cd]", "abe", 0));
-
- // Range.
- EXPECT_EQ(0, fnmatch("a[0-9]b", "a0b", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("a[0-9]b", "aOb", 0));
-
- // Inverted range.
- EXPECT_EQ(0, fnmatch("a[^0-9]b", "aOb", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("a[^0-9]b", "a0b", 0));
-
- // Named.
- EXPECT_EQ(0, fnmatch("a[[:digit:]]b", "a0b", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("a[[:digit:]]b", "aOb", 0));
-
- // Inverted named.
- EXPECT_EQ(FNM_NOMATCH, fnmatch("a[^[:digit:]]b", "a0b", 0));
- EXPECT_EQ(0, fnmatch("a[^[:digit:]]b", "aOb", 0));
-}
-
-TEST(fnmatch, wild_any) {
- EXPECT_EQ(0, fnmatch("ab*", "ab", 0));
- EXPECT_EQ(0, fnmatch("ab*", "abc", 0));
- EXPECT_EQ(0, fnmatch("ab*", "abcd", 0));
- EXPECT_EQ(0, fnmatch("ab*", "ab/cd", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab*", "ab/cd", FNM_PATHNAME));
-}
-
-TEST(fnmatch, wild_one) {
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?", "ab", 0));
- EXPECT_EQ(0, fnmatch("ab?", "abc", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?", "abcd", 0));
- EXPECT_EQ(0, fnmatch("ab?d", "abcd", 0));
- EXPECT_EQ(0, fnmatch("ab?cd", "ab/cd", 0));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?cd", "ab/cd", FNM_PATHNAME));
-}
-
-TEST(fnmatch, leading_dir) {
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab", "abcd", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab*", "abcd", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("*ab*", "1/2/3/4/abcd", FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("*ab*", "1/2/3/4/abcd", FNM_PATHNAME | FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?", "abcd", FNM_LEADING_DIR));
-
- EXPECT_EQ(0, fnmatch("ab", "ab/cd", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab", "ab/cd", FNM_PATHNAME | FNM_LEADING_DIR));
- // TODO(b/175302045) fix this case and enable this test.
- // EXPECT_EQ(0, fnmatch("*ab", "1/2/3/4/ab/cd", FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("*ab", "1/2/3/4/ab/cd", FNM_PATHNAME | FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab*", "ab/cd/ef", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab*", "ab/cd/ef", FNM_PATHNAME | FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("*ab*", "1/2/3/4/ab/cd/ef", FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("*ab*", "1/2/3/4/ab/cd/ef", FNM_PATHNAME | FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?", "ab/cd/ef", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab?", "abx/cd/ef", FNM_LEADING_DIR));
-
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab/", "ab/cd/ef", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab/*", "ab/cd/ef", FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab/?", "ab/cd/ef", FNM_LEADING_DIR));
-
- // TODO(b/175302045) fix this case and enable this test.
- // EXPECT_EQ(0, fnmatch("ab*c", "ab/1/2/3/c/d/e", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab?c", "ab/c/ef", FNM_LEADING_DIR));
-
- EXPECT_EQ(0, fnmatch("ab*c*", "ab/1/2/3/c/d/e", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab?c*", "ab/c/ef", FNM_LEADING_DIR));
-
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab*c/", "ab/1/2/3/c/d/e", FNM_LEADING_DIR));
- EXPECT_EQ(FNM_NOMATCH, fnmatch("ab?c/", "ab/c/ef", FNM_LEADING_DIR));
-
- EXPECT_EQ(0, fnmatch("ab*c/*", "ab/1/2/3/c/d/e", FNM_LEADING_DIR));
- EXPECT_EQ(0, fnmatch("ab?c/*", "ab/c/ef", FNM_LEADING_DIR));
-}
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index 4abee67dc..9a4b781fc 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -14,7 +14,16 @@
* limitations under the License.
*/
+// -Werror is on whether we like it or not, and we're intentionally doing awful
+// things in this file. GCC is dumb and doesn't have a specific error class for
+// the fortify failures (it's just -Werror), so we can't use anything more
+// constrained than disabling all the warnings in the file :( It also won't let
+// us use system_header in a .cpp file, so we have to #include this from
+// fortify_test_main.cpp.
+#pragma GCC system_header
+
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#include <fcntl.h>
#include <malloc.h>
@@ -27,8 +36,6 @@
#include <sys/types.h>
#include <time.h>
-#include <android-base/silent_death_test.h>
-
#if __BIONIC__
#define ASSERT_FORTIFY(expr) ASSERT_EXIT(expr, testing::KilledBySignal(SIGABRT), "FORTIFY")
#else
@@ -41,7 +48,7 @@
#define DEATHTEST_EVALUATOR(name) DEATHTEST_PASTER(name)
#define DEATHTEST DEATHTEST_EVALUATOR(TEST_NAME)
-using DEATHTEST = SilentDeathTest;
+class DEATHTEST : public BionicDeathTest {};
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE == 2
struct foo {
@@ -205,9 +212,8 @@ TEST_F(DEATHTEST, memchr_fortified2) {
foo myfoo;
volatile int asize = sizeof(myfoo.a) + 1;
memcpy(myfoo.a, "0123456789", sizeof(myfoo.a));
- ASSERT_FORTIFY(printf("%s", static_cast<const char*>(memchr(myfoo.a, 'a', asize))));
- ASSERT_FORTIFY(printf(
- "%s", static_cast<const char*>(memchr(static_cast<const void*>(myfoo.a), 'a', asize))));
+ ASSERT_FORTIFY(printf("%s", memchr(myfoo.a, 'a', asize)));
+ ASSERT_FORTIFY(printf("%s", memchr(static_cast<const void*>(myfoo.a), 'a', asize)));
#else // __BIONIC__
GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
@@ -218,9 +224,8 @@ TEST_F(DEATHTEST, memrchr_fortified2) {
foo myfoo;
volatile int asize = sizeof(myfoo.a) + 1;
memcpy(myfoo.a, "0123456789", sizeof(myfoo.a));
- ASSERT_FORTIFY(printf("%s", static_cast<const char*>(memrchr(myfoo.a, 'a', asize))));
- ASSERT_FORTIFY(printf(
- "%s", static_cast<const char*>(memrchr(static_cast<const void*>(myfoo.a), 'a', asize))));
+ ASSERT_FORTIFY(printf("%s", memrchr(myfoo.a, 'a', asize)));
+ ASSERT_FORTIFY(printf("%s", memrchr(static_cast<const void*>(myfoo.a), 'a', asize)));
#else // __BIONIC__
GTEST_SKIP() << "glibc is broken";
#endif // __BIONIC__
diff --git a/tests/ftw_test.cpp b/tests/ftw_test.cpp
index 200ed4b61..dfc4d723f 100644
--- a/tests/ftw_test.cpp
+++ b/tests/ftw_test.cpp
@@ -49,7 +49,7 @@ static void MakeTree(const char* root) {
ASSERT_EQ(0, close(fd));
}
-void smoke_test_ftw(const char* fpath, const struct stat* sb, int tflag) {
+void sanity_check_ftw(const char* fpath, const struct stat* sb, int tflag) {
ASSERT_TRUE(fpath != nullptr);
ASSERT_TRUE(sb != nullptr);
@@ -75,28 +75,28 @@ void smoke_test_ftw(const char* fpath, const struct stat* sb, int tflag) {
}
}
-void smoke_test_nftw(const char* fpath, const struct stat* sb, int tflag, FTW* ftwbuf) {
- smoke_test_ftw(fpath, sb, tflag);
+void sanity_check_nftw(const char* fpath, const struct stat* sb, int tflag, FTW* ftwbuf) {
+ sanity_check_ftw(fpath, sb, tflag);
ASSERT_EQ('/', fpath[ftwbuf->base - 1]) << fpath;
}
int check_ftw(const char* fpath, const struct stat* sb, int tflag) {
- smoke_test_ftw(fpath, sb, tflag);
+ sanity_check_ftw(fpath, sb, tflag);
return 0;
}
int check_ftw64(const char* fpath, const struct stat64* sb, int tflag) {
- smoke_test_ftw(fpath, reinterpret_cast<const struct stat*>(sb), tflag);
+ sanity_check_ftw(fpath, reinterpret_cast<const struct stat*>(sb), tflag);
return 0;
}
int check_nftw(const char* fpath, const struct stat* sb, int tflag, FTW* ftwbuf) {
- smoke_test_nftw(fpath, sb, tflag, ftwbuf);
+ sanity_check_nftw(fpath, sb, tflag, ftwbuf);
return 0;
}
int check_nftw64(const char* fpath, const struct stat64* sb, int tflag, FTW* ftwbuf) {
- smoke_test_nftw(fpath, reinterpret_cast<const struct stat*>(sb), tflag, ftwbuf);
+ sanity_check_nftw(fpath, reinterpret_cast<const struct stat*>(sb), tflag, ftwbuf);
return 0;
}
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index bf65720f9..cab717524 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -409,8 +409,8 @@ static void expect_ids(T ids, bool is_group) {
}
expect_range(AID_ISOLATED_START, AID_ISOLATED_END);
- // Prior to R, we didn't have a mechanism to create vendor AIDs in the system or other non-vendor
- // partitions, therefore we disabled the rest of these checks for older API levels.
+ // TODO(73062966): We still don't have a good way to create vendor AIDs in the system or other
+ // non-vendor partitions, therefore we keep this check disabled.
if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= 29) {
return;
}
@@ -466,7 +466,14 @@ TEST(pwd, getpwent_iterate) {
EXPECT_STREQ("/data", pwd->pw_dir) << "pwd->pw_uid: " << pwd->pw_uid;
}
- EXPECT_EQ(0U, uids.count(pwd->pw_uid)) << "pwd->pw_uid: " << pwd->pw_uid;
+ // TODO(b/27999086): fix this check with the OEM range
+ // If OEMs add their own AIDs to private/android_filesystem_config.h, this check will fail.
+ // Long term we want to create a better solution for OEMs adding AIDs, but we're not there
+ // yet, so therefore we do not check for uid's in the OEM range.
+ if (!(pwd->pw_uid >= 2900 && pwd->pw_uid <= 2999) &&
+ !(pwd->pw_uid >= 5000 && pwd->pw_uid <= 5999)) {
+ EXPECT_EQ(0U, uids.count(pwd->pw_uid)) << "pwd->pw_uid: " << pwd->pw_uid;
+ }
uids.emplace(pwd->pw_uid);
}
endpwent();
@@ -809,7 +816,14 @@ TEST(grp, getgrent_iterate) {
EXPECT_STREQ(grp->gr_name, grp->gr_mem[0]) << "grp->gr_gid: " << grp->gr_gid;
EXPECT_TRUE(grp->gr_mem[1] == nullptr) << "grp->gr_gid: " << grp->gr_gid;
- EXPECT_EQ(0U, gids.count(grp->gr_gid)) << "grp->gr_gid: " << grp->gr_gid;
+ // TODO(b/27999086): fix this check with the OEM range
+ // If OEMs add their own AIDs to private/android_filesystem_config.h, this check will fail.
+ // Long term we want to create a better solution for OEMs adding AIDs, but we're not there
+ // yet, so therefore we do not check for gid's in the OEM range.
+ if (!(grp->gr_gid >= 2900 && grp->gr_gid <= 2999) &&
+ !(grp->gr_gid >= 5000 && grp->gr_gid <= 5999)) {
+ EXPECT_EQ(0U, gids.count(grp->gr_gid)) << "grp->gr_gid: " << grp->gr_gid;
+ }
gids.emplace(grp->gr_gid);
}
endgrent();
@@ -820,24 +834,6 @@ TEST(grp, getgrent_iterate) {
#endif
}
-TEST(grp, getgrouplist) {
-#if defined(__BIONIC__)
- // Query the number of groups.
- int ngroups = 0;
- ASSERT_EQ(-1, getgrouplist("root", 123, nullptr, &ngroups));
- ASSERT_EQ(1, ngroups);
-
- // Query the specific groups (just the one you pass in on Android).
- ngroups = 8;
- gid_t groups[ngroups];
- ASSERT_EQ(1, getgrouplist("root", 123, groups, &ngroups));
- ASSERT_EQ(1, ngroups);
- ASSERT_EQ(123u, groups[0]);
-#else
- GTEST_SKIP() << "bionic-only test (groups too unpredictable)";
-#endif
-}
-
#if defined(__BIONIC__)
static void TestAidNamePrefix(const std::string& file_path) {
std::string file_contents;
diff --git a/tests/gtest_globals.cpp b/tests/gtest_globals.cpp
index 5b5ede8d4..607544a65 100644
--- a/tests/gtest_globals.cpp
+++ b/tests/gtest_globals.cpp
@@ -24,13 +24,12 @@
#include <string>
std::string GetTestlibRoot() {
- // Typically the executable is /data/nativetest[64]/bionic-unit-tests/bionic-unit-tests, and the
- // test libraries are in /data/nativetest[64]/bionic-loader-test-libs.
- std::string path = android::base::GetExecutableDirectory() + "/..";
+ // Calculate ANDROID_DATA assuming the binary is in "$ANDROID_DATA/somedir/binary-dir/binary"
+ std::string path = android::base::Dirname(android::base::GetExecutablePath()) + "/..";
std::string out_path;
if (!android::base::Realpath(path.c_str(), &out_path)) {
- printf("Failed to get realpath for \"%s\"\n", path.c_str());
+ printf("Failed to get realpath for \"%s\"", path.c_str());
abort();
}
@@ -38,7 +37,7 @@ std::string GetTestlibRoot() {
std::string real_path;
if (!android::base::Realpath(out_path, &real_path)) {
- printf("\"%s\": does not exists\n", out_path.c_str());
+ printf("\"%s\": does not exists", out_path.c_str());
abort();
}
diff --git a/tests/gtest_globals.h b/tests/gtest_globals.h
index 1bebb7006..b3c7b102d 100644
--- a/tests/gtest_globals.h
+++ b/tests/gtest_globals.h
@@ -19,10 +19,8 @@
#include <string>
-std::string GetTestlibRoot();
+constexpr const char* kPrebuiltElfDir = "prebuilt-elf-files";
-inline std::string GetPrebuiltElfDir() {
- return GetTestlibRoot() + "/prebuilt-elf-files";
-}
+std::string GetTestlibRoot();
#endif // _BIONIC_TESTS_GTEST_GLOBALS_H
diff --git a/tests/gtest_globals_cts.cpp b/tests/gtest_globals_cts.cpp
index 78bb3ca50..8e67f299f 100644
--- a/tests/gtest_globals_cts.cpp
+++ b/tests/gtest_globals_cts.cpp
@@ -16,6 +16,17 @@
#include "gtest_globals.h"
+#include <string>
+#include <vector>
+
+// Use the normal gtest format so that cts can parse the results.
+extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
+ static const char* initial_args[] = {"--gtest_format"};
+ *args = initial_args;
+ *num_args = 1;
+ return true;
+}
+
std::string GetTestlibRoot() {
return "/data/local/tmp/lib/bionic-loader-test-libs";
}
diff --git a/tests/headers/Android.bp b/tests/headers/Android.bp
index 76e41ca8d..b44c29601 100644
--- a/tests/headers/Android.bp
+++ b/tests/headers/Android.bp
@@ -1,5 +1 @@
-package {
- default_applicable_licenses: ["bionic_tests_license"],
-}
-
subdirs = ["*"]
diff --git a/tests/headers/posix/Android.bp b/tests/headers/posix/Android.bp
index 0809cdbae..8f3a2f29b 100644
--- a/tests/headers/posix/Android.bp
+++ b/tests/headers/posix/Android.bp
@@ -14,10 +14,6 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["bionic_tests_license"],
-}
-
cc_library_static {
name: "libbionic_tests_headers_posix",
srcs: ["*.c"],
diff --git a/tests/headers/posix/strings_h.c b/tests/headers/posix/strings_h.c
index 2051c8b3a..0a2fa841b 100644
--- a/tests/headers/posix/strings_h.c
+++ b/tests/headers/posix/strings_h.c
@@ -32,10 +32,6 @@
static void strings_h() {
FUNCTION(ffs, int (*f)(int));
-#if !defined(__GLIBC__)
- FUNCTION(ffsl, int (*f)(long));
- FUNCTION(ffsll, int (*f)(long long));
-#endif
FUNCTION(strcasecmp, int (*f)(const char*, const char*));
FUNCTION(strcasecmp_l, int (*f)(const char*, const char*, locale_t));
FUNCTION(strncasecmp, int (*f)(const char*, const char*, size_t));
diff --git a/tests/heap_tagging_level_test.cpp b/tests/heap_tagging_level_test.cpp
deleted file mode 100644
index 5f5904f9a..000000000
--- a/tests/heap_tagging_level_test.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <malloc.h>
-#include <sys/prctl.h>
-
-#if defined(__BIONIC__)
-#include "gtest_globals.h"
-#include "platform/bionic/mte.h"
-#include "utils.h"
-
-#include "SignalUtils.h"
-
-#include <bionic/malloc_tagged_pointers.h>
-
-static bool KernelSupportsTaggedPointers() {
-#ifdef __aarch64__
- int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
- return res >= 0 && res & PR_TAGGED_ADDR_ENABLE;
-#else
- return false;
-#endif
-}
-
-static bool SetHeapTaggingLevel(HeapTaggingLevel level) {
- return mallopt(M_BIONIC_SET_HEAP_TAGGING_LEVEL, level);
-}
-#endif
-
-TEST(heap_tagging_level, tagged_pointer_dies) {
-#if defined(__BIONIC__)
- if (!KernelSupportsTaggedPointers()) {
- GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
- }
-
-#ifdef __aarch64__
- if (mte_supported()) {
- GTEST_SKIP() << "Tagged pointers are not used on MTE hardware.";
- }
-
- void *x = malloc(1);
-
- // Ensure that `x` has a pointer tag.
- EXPECT_NE(reinterpret_cast<uintptr_t>(x) >> 56, 0u);
-
- x = untag_address(x);
- EXPECT_DEATH(free(x), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
-
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
- EXPECT_DEATH(free(untag_address(malloc(1))), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
-
- x = malloc(1);
- void *y = malloc(1);
- // Disable heap tagging.
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
- // Ensure an older tagged pointer can still be freed.
- free(x);
- // Tag mismatch is not detected on old pointers.
- free(untag_address(y));
-#endif // defined(__aarch64__)
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif // defined(__BIONIC__)
-}
-
-#if defined(__BIONIC__) && defined(__aarch64__)
-void ExitWithSiCode(int, siginfo_t* info, void*) {
- _exit(info->si_code);
-}
-#endif
-
-TEST(heap_tagging_level, sync_async_bad_accesses_die) {
-#if defined(__BIONIC__) && defined(__aarch64__)
- if (!mte_supported() || !running_with_mte()) {
- GTEST_SKIP() << "requires MTE to be enabled";
- }
-
- std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
-
- // We assume that scudo is used on all MTE enabled hardware; scudo inserts a header with a
- // mismatching tag before each allocation.
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
- EXPECT_EXIT(
- {
- ScopedSignalHandler ssh(SIGSEGV, ExitWithSiCode, SA_SIGINFO);
- p[-1] = 42;
- },
- testing::ExitedWithCode(SEGV_MTESERR), "");
-
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
- EXPECT_EXIT(
- {
- ScopedSignalHandler ssh(SIGSEGV, ExitWithSiCode, SA_SIGINFO);
- p[-1] = 42;
- },
- testing::ExitedWithCode(SEGV_MTEAERR), "");
-
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
- volatile int oob ATTRIBUTE_UNUSED = p[-1];
-#else
- GTEST_SKIP() << "bionic/arm64 only";
-#endif
-}
-
-TEST(heap_tagging_level, none_pointers_untagged) {
-#if defined(__BIONIC__)
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
- std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
- EXPECT_EQ(untag_address(p.get()), p.get());
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
-TEST(heap_tagging_level, tagging_level_transitions) {
-#if defined(__BIONIC__) && defined(__aarch64__)
- if (!KernelSupportsTaggedPointers()) {
- GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
- }
-
- EXPECT_FALSE(SetHeapTaggingLevel(static_cast<HeapTaggingLevel>(12345)));
-
- if (mte_supported() && running_with_mte()) {
- // ASYNC -> ...
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
-
- // SYNC -> ...
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
- } else if (!mte_supported()) {
- // TBI -> ...
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
- }
-
- // TBI -> NONE on non-MTE, ASYNC|SYNC|NONE -> NONE on MTE.
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
-
- // NONE -> ...
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_TBI));
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_ASYNC));
- EXPECT_FALSE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
-#else
- GTEST_SKIP() << "bionic/arm64 only";
-#endif
-}
-
-TEST(heap_tagging_level, tagging_level_transition_sync_none) {
-#if defined(__BIONIC__) && defined(__aarch64__)
- // We can't test SYNC -> NONE in tagging_level_transitions because we can only make one transition
- // to NONE (which we use to test ASYNC -> NONE), so we test it here separately.
- if (!mte_supported() || !running_with_mte()) {
- GTEST_SKIP() << "requires MTE to be enabled";
- }
-
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_SYNC));
- EXPECT_TRUE(SetHeapTaggingLevel(M_HEAP_TAGGING_LEVEL_NONE));
-#else
- GTEST_SKIP() << "bionic/arm64 only";
-#endif
-}
-
-enum class MemtagNote { NONE, ASYNC, SYNC };
-class MemtagNoteTest : public testing::TestWithParam<std::tuple<MemtagNote, bool>> {};
-
-TEST_P(MemtagNoteTest, SEGV) {
-#if defined(__BIONIC__) && defined(__aarch64__)
- if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE)) {
- GTEST_SKIP() << "requires MTE support";
- }
-
- const char* kNoteSuffix[] = {"disabled", "async", "sync"};
- const char* kExpectedOutput[] = {"normal exit\n", "SEGV_MTEAERR\n", "SEGV_MTESERR\n"};
-
- MemtagNote note = std::get<0>(GetParam());
- bool isStatic = std::get<1>(GetParam());
- std::string helper_base = std::string("heap_tagging_") + (isStatic ? "static_" : "") +
- kNoteSuffix[static_cast<int>(note)] + "_helper";
- fprintf(stderr, "=== %s\n", helper_base.c_str());
- std::string helper = GetTestlibRoot() + "/" + helper_base + "/" + helper_base;
- chmod(helper.c_str(), 0755);
- ExecTestHelper eth;
- eth.SetArgs({helper.c_str(), nullptr});
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0,
- kExpectedOutput[static_cast<int>(note)]);
-#endif
-}
-
-INSTANTIATE_TEST_SUITE_P(, MemtagNoteTest,
- testing::Combine(testing::Values(MemtagNote::NONE, MemtagNote::ASYNC,
- MemtagNote::SYNC),
- testing::Bool()));
diff --git a/tests/iconv_test.cpp b/tests/iconv_test.cpp
index bd9900039..768b4fddd 100644
--- a/tests/iconv_test.cpp
+++ b/tests/iconv_test.cpp
@@ -451,13 +451,5 @@ TEST(iconv, iconv_initial_shift_state) {
EXPECT_EQ(0, errno);
EXPECT_EQ(sizeof(out_buf), out_bytes);
- // Is a null pointer and so is in_bytes. This isn't specified by POSIX, but
- // glibc and macOS both allow that, where Android historically didn't.
- // https://issuetracker.google.com/180598400
- errno = 0;
- ASSERT_EQ(static_cast<size_t>(0), iconv(c, nullptr, nullptr, &out, &out_bytes));
- EXPECT_EQ(0, errno);
- EXPECT_EQ(sizeof(out_buf), out_bytes);
-
EXPECT_EQ(0, iconv_close(c));
}
diff --git a/tests/ifunc_test.cpp b/tests/ifunc_test.cpp
index e3c437e71..e69271f02 100644
--- a/tests/ifunc_test.cpp
+++ b/tests/ifunc_test.cpp
@@ -44,8 +44,7 @@ TEST(ifunc, function) {
static uint64_t g_hwcap;
static __ifunc_arg_t g_arg;
-extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg)
- __attribute__((no_sanitize("hwaddress"))) {
+extern "C" fn_ptr_t hwcap_resolver(uint64_t hwcap, __ifunc_arg_t* arg) {
g_hwcap = hwcap;
g_arg = *arg;
return ret42;
diff --git a/tests/leak_test.cpp b/tests/leak_test.cpp
index 4ebf41f59..e0a3d5772 100644
--- a/tests/leak_test.cpp
+++ b/tests/leak_test.cpp
@@ -109,21 +109,23 @@ std::ostream& operator<<(std::ostream& os, const LeakChecker& lc) {
// http://b/36045112
TEST(pthread_leak, join) {
- SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
-
LeakChecker lc;
- for (int i = 0; i < 100; ++i) {
- pthread_t thread;
- ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
- ASSERT_EQ(0, pthread_join(thread, nullptr));
+ for (size_t pass = 0; pass < 2; ++pass) {
+ for (int i = 0; i < 100; ++i) {
+ pthread_t thread;
+ ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* { return nullptr; }, nullptr));
+ ASSERT_EQ(0, pthread_join(thread, nullptr));
+ }
+
+ // A native bridge implementation might need a warm up pass to reach a steady state.
+ // http://b/37920774.
+ if (pass == 0) lc.Reset();
}
}
// http://b/36045112
TEST(pthread_leak, detach) {
- SKIP_WITH_NATIVE_BRIDGE; // http://b/37920774
-
LeakChecker lc;
// Ancient devices with only 2 cores need a lower limit.
@@ -156,7 +158,8 @@ TEST(pthread_leak, detach) {
WaitUntilAllThreadsExited(tids, thread_count);
- // TODO(b/158573595): the test is flaky without the warmup pass.
+ // A native bridge implementation might need a warm up pass to reach a steady state.
+ // http://b/37920774.
if (pass == 0) lc.Reset();
}
}
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index fabcd048e..c427282c1 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -14,10 +14,6 @@
// limitations under the License.
//
-package {
- default_applicable_licenses: ["bionic_tests_license"],
-}
-
cc_defaults {
name: "bionic_testlib_defaults",
host_supported: true,
@@ -83,22 +79,6 @@ cc_test_library {
shared_libs: ["libtest_elftls_shared_var"],
}
-cc_test {
- name: "thread_exit_cb_helper",
- defaults: ["bionic_testlib_defaults"],
- srcs: ["thread_exit_cb_helper.cpp"],
- cflags: ["-fno-emulated-tls"],
-}
-
-cc_test {
- name: "tls_properties_helper",
- defaults: ["bionic_testlib_defaults"],
- srcs: ["tls_properties_helper.cpp"],
- cflags: ["-fno-emulated-tls"],
- shared_libs: ["libtest_elftls_shared_var"],
-}
-
-
cc_test_library {
name: "libtest_elftls_dynamic_filler_1",
defaults: ["bionic_testlib_defaults"],
@@ -1288,7 +1268,6 @@ cc_test_library {
name: "libtest_check_rtld_next_from_library",
defaults: ["bionic_testlib_defaults"],
srcs: ["check_rtld_next_from_library.cpp"],
- native_coverage: false,
}
// -----------------------------------------------------------------------------
@@ -1482,8 +1461,6 @@ cc_test_library {
srcs: ["ld_config_test_helper_lib1.cpp"],
shared_libs: ["ld_config_test_helper_lib2"],
relative_install_path: "bionic-loader-test-libs/ns2",
- // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
- ldflags: ["-Wl,-z,global"]
}
cc_test_library {
@@ -1585,85 +1562,3 @@ cc_test_library {
defaults: ["bionic_testlib_defaults"],
srcs: ["relocations.cpp"],
}
-
-cc_defaults {
- name: "bionic_targets_only",
- enabled: false,
- target: {
- android: {
- enabled: true,
- },
- linux_bionic: {
- enabled: true,
- },
- },
-}
-
-cc_test {
- name: "heap_tagging_sync_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- sanitize: {
- memtag_heap: true,
- diag: {
- memtag_heap: true,
- },
- },
-}
-
-cc_test {
- name: "heap_tagging_async_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- sanitize: {
- memtag_heap: true,
- diag: {
- memtag_heap: false,
- },
- },
-}
-
-cc_test {
- name: "heap_tagging_disabled_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- sanitize: {
- memtag_heap: false,
- },
-}
-
-cc_test {
- name: "heap_tagging_static_sync_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- static_executable: true,
- sanitize: {
- memtag_heap: true,
- diag: {
- memtag_heap: true,
- },
- },
-}
-
-cc_test {
- name: "heap_tagging_static_async_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- static_executable: true,
- sanitize: {
- memtag_heap: true,
- diag: {
- memtag_heap: false,
- },
- },
-}
-
-cc_test {
- name: "heap_tagging_static_disabled_helper",
- defaults: ["bionic_testlib_defaults", "bionic_targets_only"],
- srcs: ["heap_tagging_helper.cpp"],
- static_executable: true,
- sanitize: {
- memtag_heap: false,
- },
-}
diff --git a/tests/libs/Android.build.dlext_testzip.mk b/tests/libs/Android.build.dlext_testzip.mk
index 66ed343d9..8775c2958 100644
--- a/tests/libs/Android.build.dlext_testzip.mk
+++ b/tests/libs/Android.build.dlext_testzip.mk
@@ -24,9 +24,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := NATIVE_TESTS
LOCAL_MODULE := libdlext_test_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
@@ -52,9 +49,6 @@ include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := NATIVE_TESTS
LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
@@ -100,3 +94,4 @@ $(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(lib_y) $(
$(hide) touch $(dir $@)/zipdir/empty_file.txt
$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
+
diff --git a/tests/libs/dlopen_b.cpp b/tests/libs/dlopen_b.cpp
index 092c96c95..cd81e16c1 100644
--- a/tests/libs/dlopen_b.cpp
+++ b/tests/libs/dlopen_b.cpp
@@ -1,14 +1,15 @@
#include <dlfcn.h>
extern "C" void *dlopen_b() {
- // Work around for http://b/20049306, which isn't going to be fixed.
- static int defeat_sibling_call_optimization = 0;
+ // TODO (dimitry): this is to work around http://b/20049306
+ // remove once it is fixed
+ static int dummy = 0;
// This is supposed to succeed because this library has DT_RUNPATH
// for libtest_dt_runpath_x.so which should be taken into account
// by dlopen.
void *handle = dlopen("libtest_dt_runpath_x.so", RTLD_NOW);
if (handle != nullptr) {
- defeat_sibling_call_optimization++;
+ dummy++;
return handle;
}
return nullptr;
diff --git a/tests/libs/elftls_dynamic.cpp b/tests/libs/elftls_dynamic.cpp
index 25004848c..6da2f6f40 100644
--- a/tests/libs/elftls_dynamic.cpp
+++ b/tests/libs/elftls_dynamic.cpp
@@ -41,8 +41,8 @@ extern "C" char* get_large_tls_var_addr() {
// section, but does not have an entry in the dynsym table and whose
// solib-relative address appears to overlap with the large TLS variable.
extern "C" void* get_local_addr() {
- static char buf[1024];
- return &buf[512];
+ static char dummy[1024];
+ return &dummy[512];
}
// This variable comes from libtest_elftls_shared_var.so, which is part of
diff --git a/tests/libs/heap_tagging_helper.cpp b/tests/libs/heap_tagging_helper.cpp
deleted file mode 100644
index 1a970f258..000000000
--- a/tests/libs/heap_tagging_helper.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <sys/cdefs.h>
-#include <unistd.h>
-#include <memory>
-
-void action(int signo, siginfo_t* info __unused, void*) {
-#ifdef __ANDROID__
- if (signo == 11 && info->si_code == SEGV_MTEAERR) {
- fprintf(stderr, "SEGV_MTEAERR\n");
- _exit(0);
- }
-
- if (signo == 11 && info->si_code == SEGV_MTESERR) {
- fprintf(stderr, "SEGV_MTESERR\n");
- _exit(0);
- }
-#endif
-
- fprintf(stderr, "signo %d\n", signo);
- _exit(0);
-}
-
-__attribute__((optnone)) int main() {
- struct sigaction sa = {};
- sa.sa_sigaction = action;
- sa.sa_flags = SA_SIGINFO;
- sigaction(SIGSEGV, &sa, nullptr);
-
- std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
- volatile int oob = p[-1];
- (void)oob;
-
- fprintf(stderr, "normal exit\n");
- return 0;
-}
diff --git a/tests/libs/ld_config_test_helper.cpp b/tests/libs/ld_config_test_helper.cpp
index 124912180..87e512eff 100644
--- a/tests/libs/ld_config_test_helper.cpp
+++ b/tests/libs/ld_config_test_helper.cpp
@@ -22,9 +22,7 @@
#endif
#include <unistd.h>
-extern "C" void foo();
-void lib1_call_funcs();
-__attribute__((weak)) void lib3_call_funcs();
+extern int get_value_from_lib();
int main() {
bool skip_vdso_check = false;
@@ -47,9 +45,6 @@ int main() {
dlclose(handle);
}
- foo();
- lib1_call_funcs();
- if (lib3_call_funcs) lib3_call_funcs();
-
+ printf("%d", get_value_from_lib());
return 0;
}
diff --git a/tests/libs/ld_config_test_helper_lib1.cpp b/tests/libs/ld_config_test_helper_lib1.cpp
index ffa9a457f..fc5401a26 100644
--- a/tests/libs/ld_config_test_helper_lib1.cpp
+++ b/tests/libs/ld_config_test_helper_lib1.cpp
@@ -1,19 +1,4 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
-// use.
-
-__attribute__((weak)) extern "C" void foo() {
- printf("foo lib1\n");
- void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "foo"));
- if (next != nullptr) next();
-}
-
-__attribute__((weak)) extern "C" void bar();
-
-void lib1_call_funcs() {
- printf("lib1_call_funcs\n");
- foo();
- bar();
+extern int get_value_from_another_lib();
+int get_value_from_lib() {
+ return get_value_from_another_lib();
}
diff --git a/tests/libs/ld_config_test_helper_lib2.cpp b/tests/libs/ld_config_test_helper_lib2.cpp
index d5bca2c36..a620a6cf5 100644
--- a/tests/libs/ld_config_test_helper_lib2.cpp
+++ b/tests/libs/ld_config_test_helper_lib2.cpp
@@ -1,11 +1,3 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
-// use.
-
-__attribute__((weak)) extern "C" void bar() {
- printf("bar lib2\n");
- void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
- if (next != nullptr) next();
+int get_value_from_another_lib() {
+ return 12345;
}
diff --git a/tests/libs/ld_config_test_helper_lib3.cpp b/tests/libs/ld_config_test_helper_lib3.cpp
index 94e15704d..93d1cd81d 100644
--- a/tests/libs/ld_config_test_helper_lib3.cpp
+++ b/tests/libs/ld_config_test_helper_lib3.cpp
@@ -1,23 +1,3 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
-// use.
-
-__attribute__((weak)) extern "C" void foo() {
- printf("foo lib3\n");
- void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "foo"));
- if (next != nullptr) next();
-}
-
-__attribute__((weak)) extern "C" void bar() {
- printf("bar lib3\n");
- void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
- if (next != nullptr) next();
-}
-
-void lib3_call_funcs() {
- printf("lib3_call_funcs\n");
- foo();
- bar();
+int get_value_from_another_lib() {
+ return 54321;
}
diff --git a/tests/libs/segment_gap_outer.cpp b/tests/libs/segment_gap_outer.cpp
index 3ba90d01b..fb448e778 100644
--- a/tests/libs/segment_gap_outer.cpp
+++ b/tests/libs/segment_gap_outer.cpp
@@ -1,9 +1,10 @@
#include <android/dlext.h>
#include <dlfcn.h>
+#include <jni.h>
#include <stdlib.h>
-extern "C" void __attribute__((section(".custom_text"))) text_before_start_of_gap() {}
-char __attribute__((section(".custom_bss"))) end_of_gap[0x1000];
+extern "C" void text_before_start_of_gap() {}
+char end_of_gap[0x1000];
extern "C" void* get_inner() {
android_dlextinfo info = {};
diff --git a/tests/libs/segment_gap_outer.lds b/tests/libs/segment_gap_outer.lds
index 527f29ee6..0f175af2f 100644
--- a/tests/libs/segment_gap_outer.lds
+++ b/tests/libs/segment_gap_outer.lds
@@ -2,25 +2,25 @@ SECTIONS {
# This starts off fairly normal: rodata, text, dynamic, data, bss with
# appropriate alignment between them.
. = SIZEOF_HEADERS;
- .rodata : {*(.rodata .rodata.*)}
+ .rodata : {}
. = ALIGN(0x1000);
- .text : {*(.text .text.*)}
+ .text : {}
. = ALIGN(0x1000);
- .dynamic : {*(.dynamic)}
+ .dynamic : {}
. = ALIGN(0x1000);
- .data : {*(.data .data.*)}
- .bss : {*(.bss .bss.*)}
+ .data : {}
+ .bss : {}
# Now create the gap. We need a text segment first to prevent the linker from
- # merging .bss with .custom_bss.
+ # merging .bss with .bss.end_of_gap.
. = ALIGN(0x1000);
- .custom_text : {
- *(.custom_text);
+ .text.text_before_start_of_gap : {
+ *(.text.text_before_start_of_gap);
}
- # Place custom_bss at the end of the gap.
+ # Place end_of_gap at the end of the gap.
. = 0x1000000;
- .custom_bss : {
- *(.custom_bss);
+ .bss.end_of_gap : {
+ *(.bss.*end_of_gap*);
}
}
diff --git a/tests/libs/tls_properties_helper.cpp b/tests/libs/tls_properties_helper.cpp
deleted file mode 100644
index 5982de463..000000000
--- a/tests/libs/tls_properties_helper.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-// Prevent tests from being compiled with glibc because thread_properties.h
-// only exists in Bionic.
-#if defined(__BIONIC__)
-
-#include <sys/thread_properties.h>
-
-#include <assert.h>
-#include <dlfcn.h>
-#include <elf.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/prctl.h>
-#include <sys/ptrace.h>
-#include <sys/uio.h>
-#include <sys/user.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-// Helper binary to use TLS-related functions in thread_properties
-
-// Tests __get_static_tls_bound.
-thread_local int local_var;
-void test_static_tls_bounds() {
- local_var = 123;
- void* start_addr = nullptr;
- void* end_addr = nullptr;
-
- __libc_get_static_tls_bounds(reinterpret_cast<void**>(&start_addr),
- reinterpret_cast<void**>(&end_addr));
- assert(start_addr != nullptr);
- assert(end_addr != nullptr);
-
- assert(&local_var >= start_addr && &local_var < end_addr);
-
- printf("done_get_static_tls_bounds\n");
-}
-
-// Tests iterate_dynamic tls chunks.
-// Export a var from the shared so.
-__thread char large_tls_var[4 * 1024 * 1024];
-// found_count has to be Global variable so that the non-capturing lambda
-// can access it.
-int found_count = 0;
-void test_iter_tls() {
- void* lib = dlopen("libtest_elftls_dynamic.so", RTLD_LOCAL | RTLD_NOW);
- large_tls_var[1025] = 'a';
- auto cb = +[](void* dtls_begin, void* dtls_end, size_t dso_id, void* arg) {
- if (&large_tls_var >= dtls_begin && &large_tls_var < dtls_end) ++found_count;
- };
- __libc_iterate_dynamic_tls(gettid(), cb, nullptr);
-
- // It should be found exactly once.
- assert(found_count == 1);
- printf("done_iterate_dynamic_tls\n");
-}
-
-void* parent_addr = nullptr;
-void test_iterate_another_thread_tls() {
- large_tls_var[1025] = 'b';
- parent_addr = &large_tls_var;
- found_count = 0;
-
- pid_t pid = fork();
- assert(pid != -1);
- int status;
- if (pid) {
- // Parent.
- assert(pid == wait(&status));
- assert(0 == status);
- } else {
- // Child.
- pid_t parent_pid = getppid();
- assert(0 == ptrace(PTRACE_ATTACH, parent_pid));
- assert(parent_pid == waitpid(parent_pid, &status, 0));
-
- auto cb = +[](void* dtls_begin, void* dtls_end, size_t dso_id, void* arg) {
- if (parent_addr >= dtls_begin && parent_addr < dtls_end) ++found_count;
- };
- __libc_iterate_dynamic_tls(parent_pid, cb, nullptr);
- // It should be found exactly once.
- assert(found_count == 1);
- printf("done_iterate_another_thread_tls\n");
- }
-}
-int main() {
- test_static_tls_bounds();
- test_iter_tls();
- test_iterate_another_thread_tls();
- return 0;
-}
-
-#else
-int main() {
- return 0;
-}
-#endif // __BIONIC__
diff --git a/tests/link_test.cpp b/tests/link_test.cpp
index 127a3d989..75bb4d618 100644
--- a/tests/link_test.cpp
+++ b/tests/link_test.cpp
@@ -258,7 +258,7 @@ TEST(link, dl_unwind_find_exidx) {
ASSERT_TRUE(entries != nullptr);
ASSERT_GT(count, 0);
- // Validity checks.
+ // Sanity checks
uintptr_t func = reinterpret_cast<uintptr_t>(read_exidx_func);
bool found = false;
for (int i = 0; i < count; ++i) {
diff --git a/tests/make_fortify_compile_test.mk b/tests/make_fortify_compile_test.mk
index ec0ba45a0..8270f29d7 100644
--- a/tests/make_fortify_compile_test.mk
+++ b/tests/make_fortify_compile_test.mk
@@ -9,10 +9,6 @@ LOCAL_CXX := $(LOCAL_PATH)/touch-obj-on-success \
LOCAL_CLANG := true
LOCAL_MODULE := bionic-compile-time-tests$(FORTIFY_LEVEL)-clang++
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
-LOCAL_TIDY := false
LOCAL_CPPFLAGS := -Wall -Wno-error
LOCAL_CPPFLAGS += -fno-color-diagnostics -ferror-limit=10000 -Xclang -verify
LOCAL_CPPFLAGS += -DCOMPILATION_TESTS=1 -Wformat-nonliteral
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index e896c90f4..738a57b2b 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -95,8 +95,7 @@ static void VerifyPtrs(TestDataType* test_data) {
test_data->total_allocated_bytes = 0;
// Find all of the maps that are from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
- bool) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0 ||
strncmp(name, "[anon:GWP-ASan", 14) == 0) {
malloc_iterate(start, end - start, SavePointers, test_data);
@@ -193,8 +192,7 @@ TEST(malloc_iterate, invalid_pointers) {
TestDataType test_data = {};
// Only attempt to get memory data for maps that are not from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
- bool) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0 &&
strncmp(name, "[anon:GWP-ASan", 14) != 0) {
size_t total = test_data.total_allocated_bytes;
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index d73f2436d..594441487 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -20,7 +20,6 @@
#include <limits.h>
#include <malloc.h>
#include <pthread.h>
-#include <semaphore.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
@@ -32,10 +31,8 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <algorithm>
#include <atomic>
#include <thread>
-#include <vector>
#include <tinyxml2.h>
@@ -46,10 +43,9 @@
#if defined(__BIONIC__)
#include "SignalUtils.h"
-#include "dlext_private.h"
#include "platform/bionic/malloc.h"
-#include "platform/bionic/mte.h"
+#include "platform/bionic/mte_kernel.h"
#include "platform/bionic/reserved_signals.h"
#include "private/bionic_config.h"
@@ -88,24 +84,6 @@ TEST(malloc, calloc_std) {
free(ptr);
}
-TEST(malloc, calloc_mem_init_disabled) {
-#if defined(__BIONIC__)
- // calloc should still zero memory if mem-init is disabled.
- // With jemalloc the mallopts will fail but that shouldn't affect the
- // execution of the test.
- mallopt(M_THREAD_DISABLE_MEM_INIT, 1);
- size_t alloc_len = 100;
- char *ptr = reinterpret_cast<char*>(calloc(1, alloc_len));
- for (size_t i = 0; i < alloc_len; i++) {
- ASSERT_EQ(0, ptr[i]);
- }
- free(ptr);
- mallopt(M_THREAD_DISABLE_MEM_INIT, 0);
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
TEST(malloc, calloc_illegal) {
SKIP_WITH_HWASAN;
errno = 0;
@@ -684,46 +662,6 @@ TEST(malloc, mallopt_purge) {
#endif
}
-#if defined(__BIONIC__)
-static void GetAllocatorVersion(bool* allocator_scudo) {
- TemporaryFile tf;
- ASSERT_TRUE(tf.fd != -1);
- FILE* fp = fdopen(tf.fd, "w+");
- tf.release();
- ASSERT_TRUE(fp != nullptr);
- ASSERT_EQ(0, malloc_info(0, fp));
- ASSERT_EQ(0, fclose(fp));
-
- std::string contents;
- ASSERT_TRUE(android::base::ReadFileToString(tf.path, &contents));
-
- tinyxml2::XMLDocument doc;
- ASSERT_EQ(tinyxml2::XML_SUCCESS, doc.Parse(contents.c_str()));
-
- auto root = doc.FirstChildElement();
- ASSERT_NE(nullptr, root);
- ASSERT_STREQ("malloc", root->Name());
- std::string version(root->Attribute("version"));
- *allocator_scudo = (version == "scudo-1");
-}
-#endif
-
-TEST(malloc, mallopt_scudo_only_options) {
-#if defined(__BIONIC__)
- SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
- bool allocator_scudo;
- GetAllocatorVersion(&allocator_scudo);
- if (!allocator_scudo) {
- GTEST_SKIP() << "scudo allocator only test";
- }
- ASSERT_EQ(1, mallopt(M_CACHE_COUNT_MAX, 100));
- ASSERT_EQ(1, mallopt(M_CACHE_SIZE_MAX, 1024 * 1024 * 2));
- ASSERT_EQ(1, mallopt(M_TSDS_COUNT_MAX, 8));
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
-}
-
TEST(malloc, reallocarray_overflow) {
#if HAVE_REALLOCARRAY
// Values that cause overflow to a result small enough (8 on LP64) that malloc would "succeed".
@@ -927,8 +865,12 @@ TEST(malloc, DISABLED_alloc_after_fork) {
std::thread* t = new std::thread([&stop] {
while (!stop) {
for (size_t size = kMinAllocationSize; size <= kMaxAllocationSize; size <<= 1) {
- void* ptr;
- DoNotOptimize(ptr = malloc(size));
+ void* ptr = malloc(size);
+ if (ptr == nullptr) {
+ return;
+ }
+ // Make sure this value is not optimized away.
+ asm volatile("" : : "r,m"(ptr) : "memory");
free(ptr);
}
}
@@ -941,9 +883,10 @@ TEST(malloc, DISABLED_alloc_after_fork) {
pid_t pid;
if ((pid = fork()) == 0) {
for (size_t size = kMinAllocationSize; size <= kMaxAllocationSize; size <<= 1) {
- void* ptr;
- DoNotOptimize(ptr = malloc(size));
+ void* ptr = malloc(size);
ASSERT_TRUE(ptr != nullptr);
+ // Make sure this value is not optimized away.
+ asm volatile("" : : "r,m"(ptr) : "memory");
// Make sure we can touch all of the allocation.
memset(ptr, 0x1, size);
ASSERT_LE(size, malloc_usable_size(ptr));
@@ -1259,115 +1202,69 @@ TEST(android_mallopt, set_allocation_limit_multiple_threads) {
#endif
}
-void TestHeapZeroing(int num_iterations, int (*get_alloc_size)(int iteration)) {
- std::vector<void*> allocs;
- constexpr int kMaxBytesToCheckZero = 64;
- const char kBlankMemory[kMaxBytesToCheckZero] = {};
-
- for (int i = 0; i < num_iterations; ++i) {
- int size = get_alloc_size(i);
- allocs.push_back(malloc(size));
- memset(allocs.back(), 'X', std::min(size, kMaxBytesToCheckZero));
- }
-
- for (void* alloc : allocs) {
- free(alloc);
- }
- allocs.clear();
-
- for (int i = 0; i < num_iterations; ++i) {
- int size = get_alloc_size(i);
- allocs.push_back(malloc(size));
- ASSERT_EQ(0, memcmp(allocs.back(), kBlankMemory, std::min(size, kMaxBytesToCheckZero)));
- }
-
- for (void* alloc : allocs) {
- free(alloc);
+#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+template <int SiCode> void CheckSiCode(int, siginfo_t* info, void*) {
+ if (info->si_code != SiCode) {
+ _exit(2);
}
+ _exit(1);
}
-TEST(malloc, zero_init) {
-#if defined(__BIONIC__)
- SKIP_WITH_HWASAN << "hwasan does not implement mallopt";
- bool allocator_scudo;
- GetAllocatorVersion(&allocator_scudo);
- if (!allocator_scudo) {
- GTEST_SKIP() << "scudo allocator only test";
+static bool SetTagCheckingLevel(int level) {
+ int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
+ if (tagged_addr_ctrl < 0) {
+ return false;
}
- mallopt(M_BIONIC_ZERO_INIT, 1);
-
- // Test using a block of 4K small (1-32 byte) allocations.
- TestHeapZeroing(/* num_iterations */ 0x1000, [](int iteration) -> int {
- return 1 + iteration % 32;
- });
-
- // Also test large allocations that land in the scudo secondary, as this is
- // the only part of Scudo that's changed by enabling zero initialization with
- // MTE. Uses 32 allocations, totalling 60MiB memory. Decay time (time to
- // release secondary allocations back to the OS) was modified to 0ms/1ms by
- // mallopt_decay. Ensure that we delay for at least a second before releasing
- // pages to the OS in order to avoid implicit zeroing by the kernel.
- mallopt(M_DECAY_TIME, 1000);
- TestHeapZeroing(/* num_iterations */ 32, [](int iteration) -> int {
- return 1 << (19 + iteration % 4);
- });
-
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
+ tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | level;
+ return prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) == 0;
}
-
-// Note that MTE is enabled on cc_tests on devices that support MTE.
-TEST(malloc, disable_mte) {
-#if defined(__BIONIC__)
- if (!mte_supported()) {
- GTEST_SKIP() << "This function can only be tested with MTE";
- }
-
- sem_t sem;
- ASSERT_EQ(0, sem_init(&sem, 0, 0));
-
- pthread_t thread;
- ASSERT_EQ(0, pthread_create(
- &thread, nullptr,
- [](void* ptr) -> void* {
- auto* sem = reinterpret_cast<sem_t*>(ptr);
- sem_wait(sem);
- return reinterpret_cast<void*>(prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0));
- },
- &sem));
-
- ASSERT_EQ(1, mallopt(M_BIONIC_SET_HEAP_TAGGING_LEVEL, M_HEAP_TAGGING_LEVEL_NONE));
- ASSERT_EQ(0, sem_post(&sem));
-
- int my_tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
- ASSERT_EQ(PR_MTE_TCF_NONE, my_tagged_addr_ctrl & PR_MTE_TCF_MASK);
-
- void* retval;
- ASSERT_EQ(0, pthread_join(thread, &retval));
- int thread_tagged_addr_ctrl = reinterpret_cast<uintptr_t>(retval);
- ASSERT_EQ(my_tagged_addr_ctrl, thread_tagged_addr_ctrl);
-#else
- GTEST_SKIP() << "bionic extension";
#endif
-}
-TEST(malloc, allocation_slack) {
-#if defined(__BIONIC__)
- bool allocator_scudo;
- GetAllocatorVersion(&allocator_scudo);
- if (!allocator_scudo) {
- GTEST_SKIP() << "scudo allocator only test";
+TEST(android_mallopt, tag_level) {
+#if defined(__BIONIC__) && defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+ if (!(getauxval(AT_HWCAP2) & HWCAP2_MTE)) {
+ GTEST_SKIP() << "requires MTE support";
+ return;
}
- // Test that older target SDK levels let you access a few bytes off the end of
- // a large allocation.
- android_set_application_target_sdk_version(29);
- auto p = std::make_unique<char[]>(131072);
- volatile char *vp = p.get();
- volatile char oob ATTRIBUTE_UNUSED = vp[131072];
+ std::unique_ptr<int[]> p = std::make_unique<int[]>(4);
+
+ // First, check that memory tagging is enabled and the default tag checking level is async.
+ // We assume that scudo is used on all MTE enabled hardware; scudo inserts a header with a
+ // mismatching tag before each allocation.
+ EXPECT_EXIT(
+ {
+ ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTEAERR>, SA_SIGINFO);
+ p[-1] = 42;
+ },
+ testing::ExitedWithCode(1), "");
+
+ EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_SYNC));
+ EXPECT_EXIT(
+ {
+ ScopedSignalHandler ssh(SIGSEGV, CheckSiCode<SEGV_MTESERR>, SA_SIGINFO);
+ p[-1] = 42;
+ },
+ testing::ExitedWithCode(1), "");
+
+ EXPECT_TRUE(SetTagCheckingLevel(PR_MTE_TCF_NONE));
+ volatile int oob ATTRIBUTE_UNUSED = p[-1];
+
+ HeapTaggingLevel tag_level = M_HEAP_TAGGING_LEVEL_TBI;
+ EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+
+ tag_level = M_HEAP_TAGGING_LEVEL_NONE;
+ EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+ std::unique_ptr<int[]> p2 = std::make_unique<int[]>(4);
+ EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(p2.get()) >> 56);
+
+ tag_level = M_HEAP_TAGGING_LEVEL_ASYNC;
+ EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+
+ tag_level = M_HEAP_TAGGING_LEVEL_NONE;
+ EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
#else
- GTEST_SKIP() << "bionic extension";
+ GTEST_SKIP() << "arm64 only";
#endif
}
diff --git a/tests/math_test.cpp b/tests/math_test.cpp
index 9f7e65b2b..1dd45b408 100644
--- a/tests/math_test.cpp
+++ b/tests/math_test.cpp
@@ -1473,40 +1473,16 @@ TEST(MATH_TEST, lgammal_r_17471883) {
ASSERT_EQ(-1, sign);
}
-TEST(MATH_TEST, tgamma_NaN) {
- ASSERT_TRUE(isnan(tgamma(nan(""))));
- ASSERT_TRUE(isnanf(tgammaf(nanf(""))));
- ASSERT_TRUE(isnanl(tgammal(nanl(""))));
-}
-
-TEST(MATH_TEST, tgamma_inf) {
- ASSERT_TRUE(isinf(tgamma(HUGE_VAL)));
- ASSERT_TRUE(isinff(tgammaf(HUGE_VALF)));
- ASSERT_TRUE(isinfl(tgammal(HUGE_VALL)));
-}
-
-TEST(MATH_TEST, tgamma_negative) {
- ASSERT_TRUE(isnan(tgamma(-1.0)));
- ASSERT_TRUE(isnanf(tgammaf(-1.0f)));
- ASSERT_TRUE(isnanl(tgammal(-1.0L)));
-}
-
TEST(MATH_TEST, tgamma) {
ASSERT_DOUBLE_EQ(24.0, tgamma(5.0));
- ASSERT_DOUBLE_EQ(120.0, tgamma(6.0));
- ASSERT_TRUE(isinf(tgamma(172.0)));
}
TEST(MATH_TEST, tgammaf) {
ASSERT_FLOAT_EQ(24.0f, tgammaf(5.0f));
- ASSERT_FLOAT_EQ(120.0f, tgammaf(6.0f));
- ASSERT_TRUE(isinff(tgammaf(172.0f)));
}
TEST(MATH_TEST, tgammal) {
ASSERT_DOUBLE_EQ(24.0L, tgammal(5.0L));
- ASSERT_DOUBLE_EQ(120.0L, tgammal(6.0L));
- ASSERT_TRUE(isinf(tgammal(172.0L)));
}
TEST(MATH_TEST, j0) {
diff --git a/tests/mte_test.cpp b/tests/mte_test.cpp
index ade95326c..8928805e5 100644
--- a/tests/mte_test.cpp
+++ b/tests/mte_test.cpp
@@ -14,15 +14,10 @@
* limitations under the License.
*/
-#include <sys/cdefs.h>
-
-#if defined(__BIONIC__)
-
#include <gtest/gtest.h>
#include <android-base/macros.h>
#include <bionic/mte.h>
-#include "utils.h"
__attribute__((no_sanitize("hwaddress")))
static void test_tag_mismatch() {
@@ -38,7 +33,7 @@ static void test_tag_mismatch() {
#endif
}
#if defined(__aarch64__)
- if (mte_supported() && running_with_mte()) {
+ if (mte_supported()) {
EXPECT_DEATH(
{
volatile int load ATTRIBUTE_UNUSED = *mistagged_p;
@@ -49,12 +44,5 @@ static void test_tag_mismatch() {
}
TEST(mte_test, ScopedDisableMTE) {
- // With native_bridge, native and emulated parts exchange data, including pointers.
- // This implies tagging on native and emulated architectures should match, which is
- // not the case at the moment.
- SKIP_WITH_NATIVE_BRIDGE;
-
test_tag_mismatch();
}
-
-#endif // __BIONIC__
diff --git a/tests/netinet_ether_test.cpp b/tests/netinet_ether_test.cpp
index af020ec93..faa3db47f 100644
--- a/tests/netinet_ether_test.cpp
+++ b/tests/netinet_ether_test.cpp
@@ -34,7 +34,7 @@ TEST(netinet_ether, ether_aton__ether_ntoa) {
TEST(netinet_ether, ether_aton_r__ether_ntoa_r) {
ether_addr addr;
memset(&addr, 0, sizeof(addr));
- ether_addr* a = ether_aton_r("12:34:56:78:9a:Bc", &addr);
+ ether_addr* a = ether_aton_r("12:34:56:78:9a:bc", &addr);
ASSERT_EQ(&addr, a);
ASSERT_EQ(0x12, addr.ether_addr_octet[0]);
ASSERT_EQ(0x34, addr.ether_addr_octet[1]);
@@ -49,11 +49,3 @@ TEST(netinet_ether, ether_aton_r__ether_ntoa_r) {
ASSERT_EQ(buf, p);
ASSERT_STREQ("12:34:56:78:9a:bc", buf);
}
-
-TEST(netinet_ether, ether_aton_r_failures) {
- ether_addr addr;
- ASSERT_TRUE(ether_aton_r("12:34:56:78:9a;bc", &addr) == nullptr);
- ASSERT_TRUE(ether_aton_r("12:34:56:78:9a:bc ", &addr) == nullptr);
- ASSERT_TRUE(ether_aton_r("g2:34:56:78:9a:bc ", &addr) == nullptr);
- ASSERT_TRUE(ether_aton_r("1G:34:56:78:9a:bc ", &addr) == nullptr);
-}
diff --git a/tests/netinet_in_test.cpp b/tests/netinet_in_test.cpp
index 437e18022..260608210 100644
--- a/tests/netinet_in_test.cpp
+++ b/tests/netinet_in_test.cpp
@@ -31,15 +31,8 @@ static constexpr uint32_t be32 = 0x78563412;
static constexpr uint64_t be64 = 0xf0debc9a78563412;
TEST(netinet_in, bindresvport) {
- // This isn't something we can usually test (because you need to be root),
- // so just check the symbol's there.
+ // This isn't something we can usually test, so just check the symbol's there.
ASSERT_EQ(-1, bindresvport(-1, nullptr));
-
- // Only AF_INET is supported.
- sockaddr_in sin = {.sin_family = AF_INET6};
- errno = 0;
- ASSERT_EQ(-1, bindresvport(-1, &sin));
- ASSERT_EQ(EPFNOSUPPORT, errno);
}
TEST(netinet_in, in6addr_any) {
diff --git a/tests/pidfd_test.cpp b/tests/pidfd_test.cpp
deleted file mode 100644
index b9fadb4a0..000000000
--- a/tests/pidfd_test.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#if defined(__BIONIC__)
-#include <sys/pidfd.h>
-#endif
-
-#include <android-base/silent_death_test.h>
-#include <android-base/unique_fd.h>
-
-using android::base::unique_fd;
-using namespace std::chrono_literals;
-
-using pidfd_DeathTest = SilentDeathTest;
-
-TEST(pidfd, pidfd_open) {
-#if defined(__BIONIC__)
- pid_t child = fork();
- ASSERT_NE(-1, child);
- if (child == 0) {
- _exit(42);
- }
-
- unique_fd pidfd(pidfd_open(child, 0));
- if (pidfd.get() == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_open not available";
- }
-
- siginfo_t siginfo;
- int rc = waitid(P_PIDFD, pidfd.get(), &siginfo, WEXITED);
- if (rc == -1) {
- ASSERT_EQ(EINVAL, errno) << strerror(errno);
- GTEST_SKIP() << "P_PIDFD not available";
- }
-
- ASSERT_EQ(child, siginfo.si_pid);
-#endif
-}
-
-TEST(pidfd, pidfd_getfd) {
-#if defined(__BIONIC__)
- unique_fd r, w;
- ASSERT_TRUE(android::base::Pipe(&r, &w));
- unique_fd self(pidfd_open(getpid(), 0));
- if (self.get() == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_open not available";
- }
-
- unique_fd dup(pidfd_getfd(self.get(), r.get(), 0));
- if (dup.get() == -1) {
- ASSERT_EQ(ENOSYS, errno) << strerror(errno);
- GTEST_SKIP() << "pidfd_getfd not available";
- }
-
- ASSERT_NE(r.get(), dup.get());
- ASSERT_EQ(3, write(w.get(), "foo", 3));
- char buf[4];
- ASSERT_EQ(3, read(dup.get(), buf, sizeof(buf)));
- ASSERT_EQ(0, memcmp(buf, "foo", 3));
-#endif
-}
-
-TEST_F(pidfd_DeathTest, pidfd_send_signal) {
-#if defined(__BIONIC__)
- unique_fd self(pidfd_open(getpid(), 0));
- if (self.get() == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_open not available";
- }
-
- if (pidfd_send_signal(self.get(), 0, nullptr, 0) == -1) {
- ASSERT_EQ(ENOSYS, errno);
- GTEST_SKIP() << "pidfd_send_signal not available";
- }
-
- ASSERT_EXIT(({
- // gtest will fork a child off for ASSERT_EXIT: `self` refers to the parent.
- unique_fd child(pidfd_open(getpid(), 0));
- pidfd_send_signal(child.get(), SIGINT, nullptr, 0);
- }),
- testing::KilledBySignal(SIGINT), "");
-
-#endif
-}
diff --git a/tests/prio_ctor_test.cpp b/tests/prio_ctor_test.cpp
deleted file mode 100644
index 0dfa66d9d..000000000
--- a/tests/prio_ctor_test.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <stdint.h>
-
-static const char* record[4] = {};
-static int idx = 0;
-
-__attribute__((constructor(1000))) static void prio1000() {
- record[idx++] = "prio1000";
-}
-
-__attribute__((constructor(1))) static void prio1() {
- record[idx++] = "prio1";
-}
-
-__attribute__((constructor)) static void noprio() {
- record[idx++] = "noprio";
-}
-
-TEST(prio_ctor, order) {
- EXPECT_EQ(idx, 3);
- EXPECT_STREQ(record[0], "prio1");
- EXPECT_STREQ(record[1], "prio1000");
- EXPECT_STREQ(record[2], "noprio");
-}
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 1a00460bc..d8257381c 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -38,15 +38,13 @@
#include <android-base/macros.h>
#include <android-base/parseint.h>
#include <android-base/scopeguard.h>
-#include <android-base/silent_death_test.h>
#include <android-base/strings.h>
#include "private/bionic_constants.h"
+#include "BionicDeathTest.h"
#include "SignalUtils.h"
#include "utils.h"
-using pthread_DeathTest = SilentDeathTest;
-
TEST(pthread, pthread_key_create) {
pthread_key_t key;
ASSERT_EQ(0, pthread_key_create(&key, nullptr));
@@ -354,6 +352,9 @@ struct TestBug37410 {
// Even though this isn't really a death test, we have to say "DeathTest" here so gtest knows to
// run this test (which exits normally) in its own process.
+
+class pthread_DeathTest : public BionicDeathTest {};
+
TEST_F(pthread_DeathTest, pthread_bug_37410) {
// http://code.google.com/p/android/issues/detail?id=37410
ASSERT_EXIT(TestBug37410::main(), ::testing::ExitedWithCode(0), "");
@@ -2467,7 +2468,7 @@ TEST(pthread, pthread_mutex_clocklock_invalid) {
#endif // __BIONIC__
}
-TEST_F(pthread_DeathTest, pthread_mutex_using_destroyed_mutex) {
+TEST(pthread, pthread_mutex_using_destroyed_mutex) {
#if defined(__BIONIC__)
pthread_mutex_t m;
ASSERT_EQ(0, pthread_mutex_init(&m, nullptr));
@@ -2820,9 +2821,6 @@ TEST(pthread, pthread_attr_getdetachstate__pthread_attr_setdetachstate) {
}
TEST(pthread, pthread_create__mmap_failures) {
- // After thread is successfully created, native_bridge might need more memory to run it.
- SKIP_WITH_NATIVE_BRIDGE;
-
pthread_attr_t attr;
ASSERT_EQ(0, pthread_attr_init(&attr));
ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
@@ -2974,48 +2972,3 @@ TEST(pthread, pthread_attr_setinheritsched__takes_effect_despite_SCHED_RESET_ON_
spin_helper.UnSpin();
ASSERT_EQ(0, pthread_join(t, nullptr));
}
-
-extern "C" bool android_run_on_all_threads(bool (*func)(void*), void* arg);
-
-TEST(pthread, run_on_all_threads) {
-#if defined(__BIONIC__)
- pthread_t t;
- ASSERT_EQ(
- 0, pthread_create(
- &t, nullptr,
- [](void*) -> void* {
- pthread_attr_t detached;
- if (pthread_attr_init(&detached) != 0 ||
- pthread_attr_setdetachstate(&detached, PTHREAD_CREATE_DETACHED) != 0) {
- return reinterpret_cast<void*>(errno);
- }
-
- for (int i = 0; i != 1000; ++i) {
- pthread_t t1, t2;
- if (pthread_create(
- &t1, &detached, [](void*) -> void* { return nullptr; }, nullptr) != 0 ||
- pthread_create(
- &t2, nullptr, [](void*) -> void* { return nullptr; }, nullptr) != 0 ||
- pthread_join(t2, nullptr) != 0) {
- return reinterpret_cast<void*>(errno);
- }
- }
-
- if (pthread_attr_destroy(&detached) != 0) {
- return reinterpret_cast<void*>(errno);
- }
- return nullptr;
- },
- nullptr));
-
- for (int i = 0; i != 1000; ++i) {
- ASSERT_TRUE(android_run_on_all_threads([](void* arg) { return arg == nullptr; }, nullptr));
- }
-
- void *retval;
- ASSERT_EQ(0, pthread_join(t, &retval));
- ASSERT_EQ(nullptr, retval);
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
-}
diff --git a/tests/pty_test.cpp b/tests/pty_test.cpp
index d5d8994be..29f86f16a 100644
--- a/tests/pty_test.cpp
+++ b/tests/pty_test.cpp
@@ -28,34 +28,34 @@
#include "utils.h"
TEST(pty, openpty) {
- int pty, tty;
+ int master, slave;
char name[32];
struct winsize w = { 123, 456, 9999, 999 };
- ASSERT_EQ(0, openpty(&pty, &tty, name, nullptr, &w));
- ASSERT_NE(-1, pty);
- ASSERT_NE(-1, tty);
- ASSERT_NE(pty, tty);
+ ASSERT_EQ(0, openpty(&master, &slave, name, nullptr, &w));
+ ASSERT_NE(-1, master);
+ ASSERT_NE(-1, slave);
+ ASSERT_NE(master, slave);
char tty_name[32];
- ASSERT_EQ(0, ttyname_r(tty, tty_name, sizeof(tty_name)));
+ ASSERT_EQ(0, ttyname_r(slave, tty_name, sizeof(tty_name)));
ASSERT_STREQ(tty_name, name);
struct winsize w_actual;
- ASSERT_EQ(0, ioctl(tty, TIOCGWINSZ, &w_actual));
+ ASSERT_EQ(0, ioctl(slave, TIOCGWINSZ, &w_actual));
ASSERT_EQ(w_actual.ws_row, w.ws_row);
ASSERT_EQ(w_actual.ws_col, w.ws_col);
ASSERT_EQ(w_actual.ws_xpixel, w.ws_xpixel);
ASSERT_EQ(w_actual.ws_ypixel, w.ws_ypixel);
- close(pty);
- close(tty);
+ close(master);
+ close(slave);
}
TEST(pty, forkpty) {
pid_t sid = getsid(0);
- int pty;
- pid_t pid = forkpty(&pty, nullptr, nullptr, nullptr);
+ int master;
+ pid_t pid = forkpty(&master, nullptr, nullptr, nullptr);
ASSERT_NE(-1, pid);
if (pid == 0) {
@@ -68,12 +68,12 @@ TEST(pty, forkpty) {
AssertChildExited(pid, 0);
- close(pty);
+ close(master);
}
struct PtyReader_28979140_Arg {
int main_cpu_id;
- int fd;
+ int slave_fd;
uint32_t data_count;
bool finished;
std::atomic<bool> matched;
@@ -90,7 +90,7 @@ static void PtyReader_28979140(PtyReader_28979140_Arg* arg) {
while (counter <= arg->data_count) {
char buf[4096]; // Use big buffer to read to hit the bug more easily.
size_t to_read = std::min(sizeof(buf), (arg->data_count + 1 - counter) * sizeof(uint32_t));
- ASSERT_TRUE(android::base::ReadFully(arg->fd, buf, to_read));
+ ASSERT_TRUE(android::base::ReadFully(arg->slave_fd, buf, to_read));
size_t num_of_value = to_read / sizeof(uint32_t);
uint32_t* p = reinterpret_cast<uint32_t*>(buf);
while (num_of_value-- > 0) {
@@ -99,7 +99,7 @@ static void PtyReader_28979140(PtyReader_28979140_Arg* arg) {
}
}
}
- close(arg->fd);
+ close(arg->slave_fd);
arg->finished = true;
}
@@ -114,16 +114,16 @@ TEST(pty, bug_28979140) {
constexpr uint32_t TEST_DATA_COUNT = 2000000;
// 1. Open raw pty.
- int pty;
- int tty;
- ASSERT_EQ(0, openpty(&pty, &tty, nullptr, nullptr, nullptr));
+ int master;
+ int slave;
+ ASSERT_EQ(0, openpty(&master, &slave, nullptr, nullptr, nullptr));
termios tattr;
- ASSERT_EQ(0, tcgetattr(tty, &tattr));
+ ASSERT_EQ(0, tcgetattr(slave, &tattr));
cfmakeraw(&tattr);
- ASSERT_EQ(0, tcsetattr(tty, TCSADRAIN, &tattr));
+ ASSERT_EQ(0, tcsetattr(slave, TCSADRAIN, &tattr));
- // 2. Make two threads running on different cpus:
- // pty thread uses first available cpu, and tty thread uses other cpus.
+ // 2. Make master thread and slave thread running on different cpus:
+ // master thread uses first available cpu, and slave thread uses other cpus.
PtyReader_28979140_Arg arg;
arg.main_cpu_id = -1;
for (int i = 0; i < CPU_SETSIZE; i++) {
@@ -134,9 +134,9 @@ TEST(pty, bug_28979140) {
}
ASSERT_GE(arg.main_cpu_id, 0);
- // 3. Create thread for tty reader.
+ // 3. Create thread for slave reader.
pthread_t thread;
- arg.fd = tty;
+ arg.slave_fd = slave;
arg.data_count = TEST_DATA_COUNT;
arg.matched = true;
ASSERT_EQ(0, pthread_create(&thread, nullptr,
@@ -147,7 +147,7 @@ TEST(pty, bug_28979140) {
CPU_SET(arg.main_cpu_id, &cpus);
ASSERT_EQ(0, sched_setaffinity(0, sizeof(cpu_set_t), &cpus));
- // 4. Send data to tty reader.
+ // 4. Send data to slave.
// Send a bunch of data at a time, so it is easier to catch the bug that some data isn't seen
// by the reader thread on another cpu.
uint32_t counter_buf[100];
@@ -156,11 +156,11 @@ TEST(pty, bug_28979140) {
for (size_t i = 0; i < sizeof(counter_buf) / sizeof(counter_buf[0]); ++i) {
counter_buf[i] = counter++;
}
- ASSERT_TRUE(android::base::WriteFully(pty, &counter_buf, sizeof(counter_buf)));
+ ASSERT_TRUE(android::base::WriteFully(master, &counter_buf, sizeof(counter_buf)));
ASSERT_TRUE(arg.matched) << "failed at count = " << counter;
}
ASSERT_EQ(0, pthread_join(thread, nullptr));
ASSERT_TRUE(arg.finished);
ASSERT_TRUE(arg.matched);
- close(pty);
+ close(master);
}
diff --git a/tests/sched_test.cpp b/tests/sched_test.cpp
index 03e8062d8..9309a7ff5 100644
--- a/tests/sched_test.cpp
+++ b/tests/sched_test.cpp
@@ -301,7 +301,3 @@ TEST(sched, sched_getscheduler_sched_setscheduler) {
// don't behave as POSIX specifies. http://b/26203902.
ASSERT_EQ(0, sched_setscheduler(getpid(), original_policy, &p));
}
-
-TEST(sched, sched_getaffinity_failure) {
- ASSERT_EQ(-1, sched_getaffinity(getpid(), 0, nullptr));
-}
diff --git a/tests/search_test.cpp b/tests/search_test.cpp
index 8b8359d50..1509199c9 100644
--- a/tests/search_test.cpp
+++ b/tests/search_test.cpp
@@ -114,11 +114,6 @@ TEST(search, tfind_tsearch_twalk_tdestroy) {
ASSERT_EQ(3U, g_free_calls);
}
-TEST(search, tdestroy_null) {
- // It's okay to pass a null node, and your callback will not be called.
- tdestroy(nullptr, nullptr);
-}
-
struct pod_node {
explicit pod_node(int i) : i(i) {}
int i;
@@ -290,26 +285,3 @@ TEST(search, hcreate_r_hsearch_r_hdestroy_r) {
AssertEntry(e, "a", "B");
hdestroy_r(&h2);
}
-
-TEST(search, hsearch_resizing) {
- ASSERT_NE(0, hcreate(1));
-
- std::vector<char*> entries;
- // Add enough entries to ensure that we've had to resize.
- for (char ch = ' '; ch <= '~'; ++ch) {
- char* p;
- asprintf(&p, "%c", ch);
- ENTRY e;
- e.data = e.key = p;
- ASSERT_TRUE(hsearch(e, ENTER) != nullptr);
- entries.push_back(p);
- }
-
- // Check they're all there.
- for (auto& p : entries) {
- ENTRY* e = hsearch(ENTRY{.key = p, .data = nullptr}, FIND);
- AssertEntry(e, p, p);
- }
-
- for (auto& p : entries) free(p);
-}
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index f3f60208d..6ec8b2a85 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -17,18 +17,14 @@
#include <semaphore.h>
#include <errno.h>
+#include <gtest/gtest.h>
#include <limits.h>
#include <pthread.h>
#include <time.h>
#include <unistd.h>
-#include <android-base/silent_death_test.h>
-#include <gtest/gtest.h>
-
-#include "SignalUtils.h"
#include "private/bionic_constants.h"
-
-using semaphore_DeathTest = SilentDeathTest;
+#include "SignalUtils.h"
TEST(semaphore, sem_init) {
sem_t s;
@@ -162,7 +158,7 @@ TEST(semaphore, sem_clockwait) {
#endif // __BIONIC__
}
-TEST_F(semaphore_DeathTest, sem_timedwait_null_timeout) {
+TEST(semaphore_DeathTest, sem_timedwait_null_timeout) {
sem_t s;
ASSERT_EQ(0, sem_init(&s, 0, 0));
diff --git a/tests/setjmp_test.cpp b/tests/setjmp_test.cpp
index ee126eb11..24767044b 100644
--- a/tests/setjmp_test.cpp
+++ b/tests/setjmp_test.cpp
@@ -18,15 +18,9 @@
#include <setjmp.h>
#include <stdlib.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-#include <android-base/silent_death_test.h>
#include "SignalUtils.h"
-using setjmp_DeathTest = SilentDeathTest;
-
TEST(setjmp, setjmp_smoke) {
int value;
jmp_buf jb;
@@ -232,7 +226,7 @@ TEST(setjmp, setjmp_fp_registers) {
#define __JB_SIGFLAG 8
#endif
-TEST_F(setjmp_DeathTest, setjmp_cookie) {
+TEST(setjmp, setjmp_cookie) {
jmp_buf jb;
int value = setjmp(jb);
ASSERT_EQ(0, value);
@@ -247,7 +241,7 @@ TEST_F(setjmp_DeathTest, setjmp_cookie) {
EXPECT_DEATH(longjmp(jb, 0), "");
}
-TEST_F(setjmp_DeathTest, setjmp_cookie_checksum) {
+TEST(setjmp, setjmp_cookie_checksum) {
jmp_buf jb;
int value = setjmp(jb);
@@ -271,57 +265,3 @@ TEST(setjmp, setjmp_stack) {
if (value == 0) call_longjmp(buf);
EXPECT_EQ(123, value);
}
-
-TEST(setjmp, bug_152210274) {
- // Ensure that we never have a mangled value in the stack pointer.
-#if defined(__BIONIC__)
- struct sigaction sa = {.sa_flags = SA_SIGINFO, .sa_sigaction = [](int, siginfo_t*, void*) {}};
- ASSERT_EQ(0, sigaction(SIGPROF, &sa, 0));
-
- constexpr size_t kNumThreads = 20;
-
- // Start a bunch of threads calling setjmp/longjmp.
- auto jumper = [](void* arg) -> void* {
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, SIGPROF);
- pthread_sigmask(SIG_UNBLOCK, &set, nullptr);
-
- jmp_buf buf;
- for (size_t count = 0; count < 100000; ++count) {
- if (setjmp(buf) != 0) {
- perror("setjmp");
- abort();
- }
- if (*static_cast<pid_t*>(arg) == 100) longjmp(buf, 1);
- }
- return nullptr;
- };
- pid_t tids[kNumThreads] = {};
- for (size_t i = 0; i < kNumThreads; ++i) {
- pthread_t t;
- ASSERT_EQ(0, pthread_create(&t, nullptr, jumper, &tids[i]));
- tids[i] = pthread_gettid_np(t);
- }
-
- // Start the interrupter thread.
- auto interrupter = [](void* arg) -> void* {
- pid_t* tids = static_cast<pid_t*>(arg);
- for (size_t count = 0; count < 1000; ++count) {
- for (size_t i = 0; i < kNumThreads; i++) {
- if (tgkill(getpid(), tids[i], SIGPROF) == -1 && errno != ESRCH) {
- perror("tgkill failed");
- abort();
- }
- }
- usleep(100);
- }
- return nullptr;
- };
- pthread_t t;
- ASSERT_EQ(0, pthread_create(&t, nullptr, interrupter, tids));
- pthread_join(t, nullptr);
-#else
- GTEST_SKIP() << "tests uses functions not in glibc";
-#endif
-}
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index ffbb667e0..3c660346d 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -154,6 +154,44 @@ TEST(signal, raise_in_signal_handler) {
raise(SIGALRM);
}
+TEST(signal, sigwait_SIGALRM) {
+ ScopedSignalHandler ssh(SIGALRM, [](int sig) { ASSERT_EQ(SIGALRM, sig); });
+
+ sigset_t wait_set;
+ sigemptyset(&wait_set);
+ sigaddset(&wait_set, SIGALRM);
+
+ alarm(1);
+
+ int received_signal;
+ errno = 0;
+ ASSERT_EQ(0, sigwait(&wait_set, &received_signal));
+ ASSERT_EQ(0, errno);
+ ASSERT_EQ(SIGALRM, received_signal);
+}
+
+TEST(signal, sigwait64_SIGRTMIN) {
+ ScopedSignalHandler ssh(SIGRTMIN, [](int sig) { ASSERT_EQ(SIGRTMIN, sig); });
+
+ sigset64_t wait_set;
+ sigemptyset64(&wait_set);
+ sigaddset64(&wait_set, SIGRTMIN);
+
+ pid_t tid = gettid();
+ std::thread thread([&tid]() {
+ sleep(1);
+ tgkill(getpid(), tid, SIGRTMIN);
+ });
+
+ int received_signal;
+ errno = 0;
+ ASSERT_EQ(0, sigwait64(&wait_set, &received_signal));
+ ASSERT_EQ(0, errno);
+ ASSERT_EQ(SIGRTMIN, received_signal);
+
+ thread.join();
+}
+
static int g_sigsuspend_signal_handler_call_count = 0;
TEST(signal, sigsuspend_sigpending) {
@@ -582,7 +620,8 @@ static void SigqueueSignalHandler(int signum, siginfo_t* info, void*) {
TEST(signal, sigqueue) {
ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
- sigval_t sigval = {.sival_int = 1};
+ sigval_t sigval;
+ sigval.sival_int = 1;
errno = 0;
ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
ASSERT_EQ(0, errno);
@@ -591,7 +630,8 @@ TEST(signal, sigqueue) {
TEST(signal, pthread_sigqueue_self) {
ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
- sigval_t sigval = {.sival_int = 1};
+ sigval_t sigval;
+ sigval.sival_int = 1;
errno = 0;
ASSERT_EQ(0, pthread_sigqueue(pthread_self(), SIGALRM, sigval));
ASSERT_EQ(0, errno);
@@ -600,7 +640,8 @@ TEST(signal, pthread_sigqueue_self) {
TEST(signal, pthread_sigqueue_other) {
ScopedSignalHandler ssh(SIGALRM, SigqueueSignalHandler, SA_SIGINFO);
- sigval_t sigval = {.sival_int = 1};
+ sigval_t sigval;
+ sigval.sival_int = 1;
sigset_t mask;
sigfillset(&mask);
@@ -623,44 +664,6 @@ TEST(signal, pthread_sigqueue_other) {
ASSERT_EQ(1, g_sigqueue_signal_handler_call_count);
}
-TEST(signal, sigwait_SIGALRM) {
- SignalMaskRestorer smr;
-
- // Block SIGALRM.
- sigset_t just_SIGALRM;
- sigemptyset(&just_SIGALRM);
- sigaddset(&just_SIGALRM, SIGALRM);
- ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, nullptr));
-
- // Raise SIGALRM.
- sigval_t sigval = {.sival_int = 1};
- ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
-
- // Get pending SIGALRM.
- int sig;
- ASSERT_EQ(0, sigwait(&just_SIGALRM, &sig));
- ASSERT_EQ(SIGALRM, sig);
-}
-
-TEST(signal, sigwait64_SIGRTMIN) {
- SignalMaskRestorer smr;
-
- // Block SIGRTMIN.
- sigset64_t just_SIGRTMIN;
- sigemptyset64(&just_SIGRTMIN);
- sigaddset64(&just_SIGRTMIN, SIGRTMIN);
- ASSERT_EQ(0, sigprocmask64(SIG_BLOCK, &just_SIGRTMIN, nullptr));
-
- // Raise SIGRTMIN.
- sigval_t sigval = {.sival_int = 1};
- ASSERT_EQ(0, sigqueue(getpid(), SIGRTMIN, sigval));
-
- // Get pending SIGRTMIN.
- int sig;
- ASSERT_EQ(0, sigwait64(&just_SIGRTMIN, &sig));
- ASSERT_EQ(SIGRTMIN, sig);
-}
-
TEST(signal, sigwaitinfo) {
SignalMaskRestorer smr;
@@ -671,7 +674,8 @@ TEST(signal, sigwaitinfo) {
ASSERT_EQ(0, sigprocmask(SIG_BLOCK, &just_SIGALRM, nullptr));
// Raise SIGALRM.
- sigval_t sigval = {.sival_int = 1};
+ sigval_t sigval;
+ sigval.sival_int = 1;
ASSERT_EQ(0, sigqueue(getpid(), SIGALRM, sigval));
// Get pending SIGALRM.
@@ -693,7 +697,8 @@ TEST(signal, sigwaitinfo64_SIGRTMIN) {
ASSERT_EQ(0, sigprocmask64(SIG_BLOCK, &just_SIGRTMIN, nullptr));
// Raise SIGRTMIN.
- sigval_t sigval = {.sival_int = 1};
+ sigval_t sigval;
+ sigval.sival_int = 1;
ASSERT_EQ(0, sigqueue(getpid(), SIGRTMIN, sigval));
// Get pending SIGRTMIN.
@@ -803,13 +808,15 @@ TEST(signal, rt_tgsigqueueinfo) {
#endif
TEST(signal, sigset_size) {
- // The setjmp implementations assume that sigset_t can fit in a
- // long. This is true because ARM and x86 have broken rt signal support,
- // and AArch64 and x86_64 both have a SIGRTMAX defined as 64.
+ // The setjmp implementations for ARM, AArch64, x86, and x86_64 assume that sigset_t can fit in a
+ // long. This is true because ARM and x86 have broken rt signal support, and AArch64 and x86_64
+ // both have a SIGRTMAX defined as 64.
+#if defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#if defined(__BIONIC__)
static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
#endif
static_assert(sizeof(sigset64_t)*8 >= 64, "sigset64_t too small for real-time signals");
+#endif
}
TEST(signal, sigignore_EINVAL) {
diff --git a/tests/stack_protector_test.cpp b/tests/stack_protector_test.cpp
index a95e0373c..9fe7bb105 100644
--- a/tests/stack_protector_test.cpp
+++ b/tests/stack_protector_test.cpp
@@ -19,6 +19,7 @@
*/
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#include <pthread.h>
#include <stdint.h>
@@ -26,8 +27,6 @@
#include <unistd.h>
#include <set>
-#include <android-base/silent_death_test.h>
-
#include "private/bionic_tls.h"
extern "C" pid_t gettid(); // glibc defines this but doesn't declare it anywhere.
@@ -100,7 +99,7 @@ TEST(stack_protector, global_guard) {
#endif
}
-using stack_protector_DeathTest = SilentDeathTest;
+class stack_protector_DeathTest : public BionicDeathTest {};
TEST_F(stack_protector_DeathTest, modify_stack_protector) {
// In another file to prevent inlining, which removes stack protection.
diff --git a/tests/stack_unwinding_test.cpp b/tests/stack_unwinding_test.cpp
index 2f891a6e1..e620ecd09 100644
--- a/tests/stack_unwinding_test.cpp
+++ b/tests/stack_unwinding_test.cpp
@@ -66,28 +66,13 @@ static int noinline unwind_one_frame_deeper() {
return count;
}
-static void UnwindTest() {
+TEST(stack_unwinding, easy) {
int count = 0;
_Unwind_Backtrace(FrameCounter, &count);
int deeper_count = unwind_one_frame_deeper();
ASSERT_EQ(count + 1, deeper_count);
}
-TEST(stack_unwinding, easy) {
- UnwindTest();
-}
-
-TEST(stack_unwinding, thread) {
- pthread_t thread;
- ASSERT_EQ(0, pthread_create(&thread, nullptr, [](void*) -> void* {
- UnwindTest();
- return nullptr;
- }, nullptr));
- void *retval;
- ASSERT_EQ(0, pthread_join(thread, &retval));
- EXPECT_EQ(nullptr, retval);
-}
-
struct UnwindData {
volatile bool signal_handler_complete = false;
int expected_frame_count = 0;
@@ -113,7 +98,7 @@ static void verify_unwind_data(const UnwindData& unwind_data) {
EXPECT_EQ(unwind_data.handler_frame_count + 1, unwind_data.handler_one_deeper_frame_count);
}
-static void noinline SignalUnwindTest() {
+static void noinline UnwindTest() {
g_unwind_data = {};
_Unwind_Backtrace(FrameCounter, &g_unwind_data.expected_frame_count);
@@ -127,14 +112,22 @@ static void noinline SignalUnwindTest() {
}
TEST(stack_unwinding, unwind_through_signal_frame) {
+#if defined(__i386__)
+ GTEST_SKIP() << "Temporarily skip test since it fails on x86 see b/132763120.";
+#endif
+
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler);
- SignalUnwindTest();
+ UnwindTest();
}
// On LP32, the SA_SIGINFO flag gets you __restore_rt instead of __restore.
TEST(stack_unwinding, unwind_through_signal_frame_SA_SIGINFO) {
+#if defined(__i386__)
+ GTEST_SKIP() << "Temporarily skip test since it fails on x86 see b/132763120.";
+#endif
+
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler, SA_SIGINFO);
- SignalUnwindTest();
+ UnwindTest();
}
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 7b98df24b..8a6b267cc 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -181,7 +181,7 @@ TEST(stdatomic, atomic_fetch_and) {
// And a rudimentary test of acquire-release memory ordering:
-constexpr static uint_least32_t BIG = 30'000'000ul; // Assumed even below.
+constexpr static uint_least32_t BIG = 10000000ul; // Assumed even below.
struct three_atomics {
atomic_uint_least32_t x;
@@ -192,7 +192,7 @@ struct three_atomics {
atomic_uint_least32_t z;
};
-// Very simple acquire/release memory ordering smoke test.
+// Very simple acquire/release memory ordering sanity check.
static void* writer(void* arg) {
three_atomics* a = reinterpret_cast<three_atomics*>(arg);
for (uint_least32_t i = 0; i <= BIG; i+=2) {
@@ -239,7 +239,7 @@ static void* reader(void* arg) {
}
TEST(stdatomic, ordering) {
- // Run a memory ordering smoke test.
+ // Run a memory ordering sanity test.
void* result;
three_atomics a;
atomic_init(&a.x, 0ul);
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 5736e1787..75abbd235 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -33,10 +33,9 @@
#include <vector>
#include <android-base/file.h>
-#include <android-base/silent_death_test.h>
-#include <android-base/test_utils.h>
#include <android-base/unique_fd.h>
+#include "BionicDeathTest.h"
#include "utils.h"
// This #include is actually a test too. We have to duplicate the
@@ -56,8 +55,8 @@
using namespace std::string_literals;
-using stdio_DeathTest = SilentDeathTest;
-using stdio_nofortify_DeathTest = SilentDeathTest;
+class stdio_DeathTest : public BionicDeathTest {};
+class stdio_nofortify_DeathTest : public BionicDeathTest {};
static void SetFileTo(const char* path, const char* content) {
FILE* fp;
@@ -295,34 +294,6 @@ TEST(STDIO_TEST, snprintf_a) {
EXPECT_STREQ("<0x1.3831e147ae148p+13>", buf);
}
-// http://b/152588929
-TEST(STDIO_TEST, snprintf_La) {
-#if defined(__LP64__)
- char buf[BUFSIZ];
- union {
- uint64_t a[2];
- long double v;
- } u;
-
- u.a[0] = UINT64_C(0x9b9b9b9b9b9b9b9b);
- u.a[1] = UINT64_C(0xdfdfdfdfdfdfdfdf);
- EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v));
- EXPECT_STREQ("<-0x1.dfdfdfdfdfdf9b9b9b9b9b9b9b9bp+8160>", buf);
-
- u.a[0] = UINT64_C(0xffffffffffffffff);
- u.a[1] = UINT64_C(0x7ffeffffffffffff);
- EXPECT_EQ(41, snprintf(buf, sizeof(buf), "<%La>", u.v));
- EXPECT_STREQ("<0x1.ffffffffffffffffffffffffffffp+16383>", buf);
-
- u.a[0] = UINT64_C(0x0000000000000000);
- u.a[1] = UINT64_C(0x0000000000000000);
- EXPECT_EQ(8, snprintf(buf, sizeof(buf), "<%La>", u.v));
- EXPECT_STREQ("<0x0p+0>", buf);
-#else
- GTEST_SKIP() << "no ld128";
-#endif
-}
-
TEST(STDIO_TEST, snprintf_lc) {
char buf[BUFSIZ];
wint_t wc = L'a';
@@ -361,7 +332,7 @@ TEST(STDIO_TEST, snprintf_S) { // Synonym for %ls.
EXPECT_STREQ("<hi>", buf);
}
-TEST_F(STDIO_DEATHTEST, snprintf_n) {
+TEST(STDIO_TEST, snprintf_n) {
#if defined(__BIONIC__)
// http://b/14492135 and http://b/31832608.
char buf[32];
@@ -372,11 +343,6 @@ TEST_F(STDIO_DEATHTEST, snprintf_n) {
#endif
}
-TEST(STDIO_TEST, snprintf_measure) {
- char buf[16];
- ASSERT_EQ(11, snprintf(buf, 0, "Hello %s", "world"));
-}
-
TEST(STDIO_TEST, snprintf_smoke) {
char buf[BUFSIZ];
@@ -1161,6 +1127,7 @@ TEST(STDIO_TEST, sscanf_mc) {
free(p1);
}
+
TEST(STDIO_TEST, sscanf_mlc) {
// This is so useless that clang doesn't even believe it exists...
#pragma clang diagnostic push
@@ -1194,6 +1161,7 @@ TEST(STDIO_TEST, sscanf_mlc) {
#pragma clang diagnostic pop
}
+
TEST(STDIO_TEST, sscanf_ms) {
CheckScanfM(sscanf, "hello", "%ms", 1, "hello");
CheckScanfM(sscanf, "hello", "%4ms", 1, "hell");
@@ -1956,64 +1924,34 @@ TEST(STDIO_TEST, open_memstream_EINVAL) {
#endif
}
-TEST(STDIO_TEST, fdopen_add_CLOEXEC) {
- // This fd doesn't have O_CLOEXEC...
+TEST(STDIO_TEST, fdopen_CLOEXEC) {
int fd = open("/proc/version", O_RDONLY);
- ASSERT_FALSE(CloseOnExec(fd));
- // ...but the new one does.
- FILE* fp = fdopen(fd, "re");
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
- fclose(fp);
-}
+ ASSERT_TRUE(fd != -1);
-TEST(STDIO_TEST, fdopen_remove_CLOEXEC) {
- // This fd has O_CLOEXEC...
- int fd = open("/proc/version", O_RDONLY | O_CLOEXEC);
- ASSERT_TRUE(CloseOnExec(fd));
- // ...but the new one doesn't.
- FILE* fp = fdopen(fd, "r");
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
- fclose(fp);
-}
+ // This fd doesn't have O_CLOEXEC...
+ AssertCloseOnExec(fd, false);
+
+ FILE* fp = fdopen(fd, "re");
+ ASSERT_TRUE(fp != nullptr);
-TEST(STDIO_TEST, freopen_add_CLOEXEC) {
- // This FILE* doesn't have O_CLOEXEC...
- FILE* fp = fopen("/proc/version", "r");
- ASSERT_FALSE(CloseOnExec(fileno(fp)));
// ...but the new one does.
- fp = freopen("/proc/version", "re", fp);
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
+ AssertCloseOnExec(fileno(fp), true);
fclose(fp);
}
-TEST(STDIO_TEST, freopen_remove_CLOEXEC) {
- // This FILE* has O_CLOEXEC...
- FILE* fp = fopen("/proc/version", "re");
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
- // ...but the new one doesn't.
- fp = freopen("/proc/version", "r", fp);
- ASSERT_FALSE(CloseOnExec(fileno(fp)));
- fclose(fp);
-}
+TEST(STDIO_TEST, freopen_CLOEXEC) {
+ FILE* fp = fopen("/proc/version", "r");
+ ASSERT_TRUE(fp != nullptr);
-TEST(STDIO_TEST, freopen_null_filename_add_CLOEXEC) {
// This FILE* doesn't have O_CLOEXEC...
- FILE* fp = fopen("/proc/version", "r");
- ASSERT_FALSE(CloseOnExec(fileno(fp)));
+ AssertCloseOnExec(fileno(fp), false);
+
+ fp = freopen("/proc/version", "re", fp);
+
// ...but the new one does.
- fp = freopen(nullptr, "re", fp);
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
- fclose(fp);
-}
+ AssertCloseOnExec(fileno(fp), true);
-TEST(STDIO_TEST, freopen_null_filename_remove_CLOEXEC) {
- // This FILE* has O_CLOEXEC...
- FILE* fp = fopen("/proc/version", "re");
- ASSERT_TRUE(CloseOnExec(fileno(fp)));
- // ...but the new one doesn't.
- fp = freopen(nullptr, "r", fp);
- ASSERT_FALSE(CloseOnExec(fileno(fp)));
fclose(fp);
}
@@ -2425,7 +2363,7 @@ TEST(STDIO_TEST, remove) {
ASSERT_EQ(ENOENT, errno);
}
-TEST_F(STDIO_DEATHTEST, snprintf_30445072_known_buffer_size) {
+TEST(STDIO_DEATHTEST, snprintf_30445072_known_buffer_size) {
char buf[16];
ASSERT_EXIT(snprintf(buf, atol("-1"), "hello"),
testing::KilledBySignal(SIGABRT),
@@ -2437,7 +2375,7 @@ TEST_F(STDIO_DEATHTEST, snprintf_30445072_known_buffer_size) {
);
}
-TEST_F(STDIO_DEATHTEST, snprintf_30445072_unknown_buffer_size) {
+TEST(STDIO_DEATHTEST, snprintf_30445072_unknown_buffer_size) {
std::string buf = "world";
ASSERT_EXIT(snprintf(&buf[0], atol("-1"), "hello"),
testing::KilledBySignal(SIGABRT),
@@ -2567,16 +2505,6 @@ TEST(STDIO_TEST, puts) {
eth.Run([&]() { exit(puts("a b c")); }, 0, "a b c\n");
}
-TEST(STDIO_TEST, putchar) {
- ExecTestHelper eth;
- eth.Run([&]() { exit(putchar('A')); }, 65, "A");
-}
-
-TEST(STDIO_TEST, putchar_unlocked) {
- ExecTestHelper eth;
- eth.Run([&]() { exit(putchar('B')); }, 66, "B");
-}
-
TEST(STDIO_TEST, unlocked) {
TemporaryFile tf;
@@ -2777,160 +2705,3 @@ TEST(STDIO_TEST, renameat2_flags) {
ASSERT_NE(0, RENAME_WHITEOUT);
#endif
}
-
-TEST(STDIO_TEST, fdopen_failures) {
- FILE* fp;
- int fd = open("/proc/version", O_RDONLY);
- ASSERT_TRUE(fd != -1);
-
- // Nonsense mode.
- errno = 0;
- fp = fdopen(fd, "nonsense");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-
- // Mode that isn't a subset of the fd's actual mode.
- errno = 0;
- fp = fdopen(fd, "w");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-
- // Can't set append on the underlying fd.
- errno = 0;
- fp = fdopen(fd, "a");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-
- // Bad fd.
- errno = 0;
- fp = fdopen(-1, "re");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EBADF, errno);
-
- close(fd);
-}
-
-TEST(STDIO_TEST, fmemopen_invalid_mode) {
- errno = 0;
- FILE* fp = fmemopen(nullptr, 16, "nonsense");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-}
-
-TEST(STDIO_TEST, fopen_invalid_mode) {
- errno = 0;
- FILE* fp = fopen("/proc/version", "nonsense");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-}
-
-TEST(STDIO_TEST, freopen_invalid_mode) {
- FILE* fp = fopen("/proc/version", "re");
- ASSERT_TRUE(fp != nullptr);
-
- errno = 0;
- fp = freopen("/proc/version", "nonsense", fp);
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(EINVAL, errno);
-}
-
-TEST(STDIO_TEST, asprintf_smoke) {
- char* p = nullptr;
- ASSERT_EQ(11, asprintf(&p, "hello %s", "world"));
- ASSERT_STREQ("hello world", p);
- free(p);
-}
-
-TEST(STDIO_TEST, fopen_ENOENT) {
- errno = 0;
- FILE* fp = fopen("/proc/does-not-exist", "re");
- ASSERT_TRUE(fp == nullptr);
- ASSERT_EQ(ENOENT, errno);
-}
-
-static void tempnam_test(bool has_TMPDIR, const char* dir, const char* prefix, const char* re) {
- if (has_TMPDIR) {
- setenv("TMPDIR", "/my/tmp/dir", 1);
- } else {
- unsetenv("TMPDIR");
- }
- char* s1 = tempnam(dir, prefix);
- char* s2 = tempnam(dir, prefix);
- ASSERT_MATCH(s1, re);
- ASSERT_MATCH(s2, re);
- ASSERT_STRNE(s1, s2);
- free(s1);
- free(s2);
-}
-
-TEST(STDIO_TEST, tempnam__system_directory_system_prefix_with_TMPDIR) {
- tempnam_test(true, nullptr, nullptr, "^/my/tmp/dir/.*");
-}
-
-TEST(STDIO_TEST, tempnam__system_directory_system_prefix_without_TMPDIR) {
- tempnam_test(false, nullptr, nullptr, "^/data/local/tmp/.*");
-}
-
-TEST(STDIO_TEST, tempnam__system_directory_user_prefix_with_TMPDIR) {
- tempnam_test(true, nullptr, "prefix", "^/my/tmp/dir/prefix.*");
-}
-
-TEST(STDIO_TEST, tempnam__system_directory_user_prefix_without_TMPDIR) {
- tempnam_test(false, nullptr, "prefix", "^/data/local/tmp/prefix.*");
-}
-
-TEST(STDIO_TEST, tempnam__user_directory_system_prefix_with_TMPDIR) {
- tempnam_test(true, "/a/b/c", nullptr, "^/my/tmp/dir/.*");
-}
-
-TEST(STDIO_TEST, tempnam__user_directory_system_prefix_without_TMPDIR) {
- tempnam_test(false, "/a/b/c", nullptr, "^/a/b/c/.*");
-}
-
-TEST(STDIO_TEST, tempnam__user_directory_user_prefix_with_TMPDIR) {
- tempnam_test(true, "/a/b/c", "prefix", "^/my/tmp/dir/prefix.*");
-}
-
-TEST(STDIO_TEST, tempnam__user_directory_user_prefix_without_TMPDIR) {
- tempnam_test(false, "/a/b/c", "prefix", "^/a/b/c/prefix.*");
-}
-
-static void tmpnam_test(char* s) {
- char s1[L_tmpnam], s2[L_tmpnam];
-
- strcpy(s1, tmpnam(s));
- strcpy(s2, tmpnam(s));
- ASSERT_MATCH(s1, "/tmp/.*");
- ASSERT_MATCH(s2, "/tmp/.*");
- ASSERT_STRNE(s1, s2);
-}
-
-TEST(STDIO_TEST, tmpnam) {
- tmpnam_test(nullptr);
-}
-
-TEST(STDIO_TEST, tmpnam_buf) {
- char buf[L_tmpnam];
- tmpnam_test(buf);
-}
-
-TEST(STDIO_TEST, freopen_null_filename_mode) {
- TemporaryFile tf;
- FILE* fp = fopen(tf.path, "r");
- ASSERT_TRUE(fp != nullptr);
-
- // "r" = O_RDONLY
- char buf[1];
- ASSERT_EQ(0, read(fileno(fp), buf, 1));
- ASSERT_EQ(-1, write(fileno(fp), "hello", 1));
- // "r+" = O_RDWR
- fp = freopen(nullptr, "r+", fp);
- ASSERT_EQ(0, read(fileno(fp), buf, 1));
- ASSERT_EQ(1, write(fileno(fp), "hello", 1));
- // "w" = O_WRONLY
- fp = freopen(nullptr, "w", fp);
- ASSERT_EQ(-1, read(fileno(fp), buf, 1));
- ASSERT_EQ(1, write(fileno(fp), "hello", 1));
-
- fclose(fp);
-}
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index 6c7966d72..3f1ec866d 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -31,9 +31,9 @@
#include <android-base/file.h>
#include <android-base/macros.h>
-#include <android-base/silent_death_test.h>
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#include "math_data_test.h"
#include "utils.h"
@@ -447,7 +447,7 @@ static void TestBug57421_main() {
// Even though this isn't really a death test, we have to say "DeathTest" here so gtest knows to
// run this test (which exits normally) in its own process.
-using stdlib_DeathTest = SilentDeathTest;
+class stdlib_DeathTest : public BionicDeathTest {};
TEST_F(stdlib_DeathTest, getenv_after_main_thread_exits) {
// https://code.google.com/p/android/issues/detail?id=57421
@@ -456,12 +456,12 @@ TEST_F(stdlib_DeathTest, getenv_after_main_thread_exits) {
TEST(stdlib, mkostemp64) {
MyTemporaryFile tf([](char* path) { return mkostemp64(path, O_CLOEXEC); });
- ASSERT_TRUE(CloseOnExec(tf.fd));
+ AssertCloseOnExec(tf.fd, true);
}
TEST(stdlib, mkostemp) {
MyTemporaryFile tf([](char* path) { return mkostemp(path, O_CLOEXEC); });
- ASSERT_TRUE(CloseOnExec(tf.fd));
+ AssertCloseOnExec(tf.fd, true);
}
TEST(stdlib, mkstemp64) {
@@ -489,12 +489,6 @@ TEST(stdlib, system) {
ASSERT_EQ(1, WEXITSTATUS(status));
}
-TEST(stdlib, system_NULL) {
- // "The system() function shall always return non-zero when command is NULL."
- // http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
- ASSERT_NE(0, system(nullptr));
-}
-
TEST(stdlib, atof) {
ASSERT_DOUBLE_EQ(1.23, atof("1.23"));
}
@@ -806,25 +800,10 @@ static void CheckStrToInt(T fn(const char* s, char** end, int base)) {
ASSERT_EQ(T(0), fn("123", &end_p, 37));
ASSERT_EQ(EINVAL, errno);
- // Both leading + or - are always allowed (even for the strtou* family).
- ASSERT_EQ(T(-123), fn("-123", &end_p, 10));
- ASSERT_EQ(T(123), fn("+123", &end_p, 10));
-
// If we see "0x" *not* followed by a hex digit, we shouldn't swallow the 'x'.
ASSERT_EQ(T(0), fn("0xy", &end_p, 16));
ASSERT_EQ('x', *end_p);
- // Hexadecimal (both the 0x and the digits) is case-insensitive.
- ASSERT_EQ(T(0xab), fn("0xab", &end_p, 0));
- ASSERT_EQ(T(0xab), fn("0Xab", &end_p, 0));
- ASSERT_EQ(T(0xab), fn("0xAB", &end_p, 0));
- ASSERT_EQ(T(0xab), fn("0XAB", &end_p, 0));
- ASSERT_EQ(T(0xab), fn("0xAb", &end_p, 0));
- ASSERT_EQ(T(0xab), fn("0XAb", &end_p, 0));
-
- // Octal lives! (Sadly.)
- ASSERT_EQ(T(0666), fn("0666", &end_p, 0));
-
if (std::numeric_limits<T>::is_signed) {
// Minimum (such as -128).
std::string min{std::to_string(std::numeric_limits<T>::min())};
@@ -899,18 +878,6 @@ TEST(stdlib, strtoumax_smoke) {
CheckStrToInt(strtoumax);
}
-TEST(stdlib, atoi) {
- // Implemented using strtol in bionic, so extensive testing unnecessary.
- ASSERT_EQ(123, atoi("123four"));
- ASSERT_EQ(0, atoi("hello"));
-}
-
-TEST(stdlib, atol) {
- // Implemented using strtol in bionic, so extensive testing unnecessary.
- ASSERT_EQ(123L, atol("123four"));
- ASSERT_EQ(0L, atol("hello"));
-}
-
TEST(stdlib, abs) {
ASSERT_EQ(INT_MAX, abs(-INT_MAX));
ASSERT_EQ(INT_MAX, abs(INT_MAX));
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index 22be85241..0ed0598f6 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -64,11 +64,6 @@ TEST(STRING_TEST, strerror) {
ASSERT_STREQ("Unknown error 134", strerror(EHWPOISON + 1));
}
-TEST(STRING_TEST, strerror_l) {
- // bionic just forwards to strerror(3).
- ASSERT_STREQ("Success", strerror_l(0, LC_GLOBAL_LOCALE));
-}
-
#if defined(__BIONIC__)
static void* ConcurrentStrErrorFn(void*) {
bool equal = (strcmp("Unknown error 2002", strerror(2002)) == 0);
@@ -1543,31 +1538,13 @@ TEST(STRING_TEST, memmem_strstr_empty_needle) {
}
TEST(STRING_TEST, memmem_smoke) {
- const char haystack[] = "big\0daddy/giant\0haystacks!";
-
- // The current memmem() implementation has special cases for needles of
- // lengths 0, 1, 2, 3, and 4, plus a long needle case. We test matches at the
- // beginning, middle, and end of the haystack.
-
- ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "", 0));
-
+ const char haystack[] = "big\0daddy\0giant\0haystacks";
+ ASSERT_EQ(haystack, memmem(haystack, sizeof(haystack), "", 0));
+ ASSERT_EQ(haystack + 3, memmem(haystack, sizeof(haystack), "", 1));
ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "b", 1));
- ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "bi", 2));
- ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "big", 3));
- ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "big\0", 4));
- ASSERT_EQ(haystack + 0, memmem(haystack, sizeof(haystack), "big\0d", 5));
-
- ASSERT_EQ(haystack + 2, memmem(haystack, sizeof(haystack), "g", 1));
- ASSERT_EQ(haystack + 10, memmem(haystack, sizeof(haystack), "gi", 2));
- ASSERT_EQ(haystack + 10, memmem(haystack, sizeof(haystack), "gia", 3));
- ASSERT_EQ(haystack + 10, memmem(haystack, sizeof(haystack), "gian", 4));
- ASSERT_EQ(haystack + 10, memmem(haystack, sizeof(haystack), "giant", 5));
-
- ASSERT_EQ(haystack + 25, memmem(haystack, sizeof(haystack), "!", 1));
- ASSERT_EQ(haystack + 24, memmem(haystack, sizeof(haystack), "s!", 2));
- ASSERT_EQ(haystack + 23, memmem(haystack, sizeof(haystack), "ks!", 3));
- ASSERT_EQ(haystack + 22, memmem(haystack, sizeof(haystack), "cks!", 4));
- ASSERT_EQ(haystack + 21, memmem(haystack, sizeof(haystack), "acks!", 5));
+ ASSERT_EQ(haystack + 1, memmem(haystack, sizeof(haystack), "i", 1));
+ ASSERT_EQ(haystack + 4, memmem(haystack, sizeof(haystack), "da", 2));
+ ASSERT_EQ(haystack + 8, memmem(haystack, sizeof(haystack), "y\0g", 3));
}
TEST(STRING_TEST, strstr_smoke) {
@@ -1612,44 +1589,16 @@ TEST(STRING_TEST, strcoll_smoke) {
ASSERT_TRUE(strcoll("aac", "aab") > 0);
}
-TEST(STRING_TEST, strcoll_l_smoke) {
- // bionic just forwards to strcoll(3).
- ASSERT_TRUE(strcoll_l("aab", "aac", LC_GLOBAL_LOCALE) < 0);
- ASSERT_TRUE(strcoll_l("aab", "aab", LC_GLOBAL_LOCALE) == 0);
- ASSERT_TRUE(strcoll_l("aac", "aab", LC_GLOBAL_LOCALE) > 0);
-}
-
TEST(STRING_TEST, strxfrm_smoke) {
const char* src1 = "aab";
char dst1[16] = {};
- // Dry run.
- ASSERT_EQ(strxfrm(dst1, src1, 0), 3U);
- ASSERT_STREQ(dst1, "");
- // Really do it.
- ASSERT_EQ(strxfrm(dst1, src1, sizeof(dst1)), 3U);
-
+ ASSERT_GT(strxfrm(dst1, src1, sizeof(dst1)), 0U);
const char* src2 = "aac";
char dst2[16] = {};
- // Dry run.
- ASSERT_EQ(strxfrm(dst2, src2, 0), 3U);
- ASSERT_STREQ(dst2, "");
- // Really do it.
- ASSERT_EQ(strxfrm(dst2, src2, sizeof(dst2)), 3U);
-
- // The "transform" of two different strings should cause different outputs.
+ ASSERT_GT(strxfrm(dst2, src2, sizeof(dst2)), 0U);
ASSERT_TRUE(strcmp(dst1, dst2) < 0);
}
-TEST(STRING_TEST, strxfrm_l_smoke) {
- // bionic just forwards to strxfrm(3), so this is a subset of the
- // strxfrm test.
- const char* src1 = "aab";
- char dst1[16] = {};
- ASSERT_EQ(strxfrm_l(dst1, src1, 0, LC_GLOBAL_LOCALE), 3U);
- ASSERT_STREQ(dst1, "");
- ASSERT_EQ(strxfrm_l(dst1, src1, sizeof(dst1), LC_GLOBAL_LOCALE), 3U);
-}
-
TEST(STRING_TEST, memccpy_smoke) {
char dst[32];
diff --git a/tests/strings_test.cpp b/tests/strings_test.cpp
index 0226d1aed..ac327d411 100644
--- a/tests/strings_test.cpp
+++ b/tests/strings_test.cpp
@@ -38,48 +38,6 @@ TEST(STRINGS_TEST, ffs) {
ASSERT_EQ(32, ffs(0x80000000));
}
-TEST(STRINGS_TEST, ffsl) {
- ASSERT_EQ( 0, ffsl(0x00000000L));
- ASSERT_EQ( 1, ffsl(0x00000001L));
- ASSERT_EQ( 6, ffsl(0x00000020L));
- ASSERT_EQ(11, ffsl(0x00000400L));
- ASSERT_EQ(16, ffsl(0x00008000L));
- ASSERT_EQ(17, ffsl(0x00010000L));
- ASSERT_EQ(22, ffsl(0x00200000L));
- ASSERT_EQ(27, ffsl(0x04000000L));
- ASSERT_EQ(32, ffsl(0x80000000L));
-#if defined(__LP64__)
- ASSERT_EQ(33, ffsl(0x0000000100000000L));
- ASSERT_EQ(38, ffsl(0x0000002000000000L));
- ASSERT_EQ(43, ffsl(0x0000040000000000L));
- ASSERT_EQ(48, ffsl(0x0000800000000000L));
- ASSERT_EQ(49, ffsl(0x0001000000000000L));
- ASSERT_EQ(54, ffsl(0x0020000000000000L));
- ASSERT_EQ(59, ffsl(0x0400000000000000L));
- ASSERT_EQ(64, ffsl(0x8000000000000000L));
-#endif
-}
-
-TEST(STRINGS_TEST, ffsll) {
- ASSERT_EQ( 0, ffsll(0x0000000000000000LL));
- ASSERT_EQ( 1, ffsll(0x0000000000000001LL));
- ASSERT_EQ( 6, ffsll(0x0000000000000020LL));
- ASSERT_EQ(11, ffsll(0x0000000000000400LL));
- ASSERT_EQ(16, ffsll(0x0000000000008000LL));
- ASSERT_EQ(17, ffsll(0x0000000000010000LL));
- ASSERT_EQ(22, ffsll(0x0000000000200000LL));
- ASSERT_EQ(27, ffsll(0x0000000004000000LL));
- ASSERT_EQ(32, ffsll(0x0000000080000000LL));
- ASSERT_EQ(33, ffsll(0x0000000100000000LL));
- ASSERT_EQ(38, ffsll(0x0000002000000000LL));
- ASSERT_EQ(43, ffsll(0x0000040000000000LL));
- ASSERT_EQ(48, ffsll(0x0000800000000000LL));
- ASSERT_EQ(49, ffsll(0x0001000000000000LL));
- ASSERT_EQ(54, ffsll(0x0020000000000000LL));
- ASSERT_EQ(59, ffsll(0x0400000000000000LL));
- ASSERT_EQ(64, ffsll(0x8000000000000000LL));
-}
-
TEST(STRINGS_TEST, strcasecmp) {
ASSERT_EQ(0, strcasecmp("hello", "HELLO"));
ASSERT_LT(strcasecmp("hello1", "hello2"), 0);
diff --git a/tests/struct_layout_test.cpp b/tests/struct_layout_test.cpp
deleted file mode 100644
index 00fd4d5f2..000000000
--- a/tests/struct_layout_test.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include <stdio.h>
-
-#if defined(__BIONIC__)
-#include "bionic/pthread_internal.h"
-
-// Ensure that the layout of these data structures is architecture independent and only depends on
-// the bitness of the architecture.
-template <typename CheckSize, typename CheckOffset>
-void tests(CheckSize check_size, CheckOffset check_offset) {
-#define CHECK_SIZE(name, size) \
- check_size(#name, sizeof(name), size);
-#define CHECK_OFFSET(name, field, offset) \
- check_offset(#name, #field, offsetof(name, field), offset);
-#ifdef __LP64__
- CHECK_SIZE(pthread_internal_t, 776);
- CHECK_OFFSET(pthread_internal_t, next, 0);
- CHECK_OFFSET(pthread_internal_t, prev, 8);
- CHECK_OFFSET(pthread_internal_t, tid, 16);
- CHECK_OFFSET(pthread_internal_t, attr, 24);
- CHECK_OFFSET(pthread_internal_t, join_state, 80);
- CHECK_OFFSET(pthread_internal_t, cleanup_stack, 88);
- CHECK_OFFSET(pthread_internal_t, start_routine, 96);
- CHECK_OFFSET(pthread_internal_t, start_routine_arg, 104);
- CHECK_OFFSET(pthread_internal_t, return_value, 112);
- CHECK_OFFSET(pthread_internal_t, start_mask, 120);
- CHECK_OFFSET(pthread_internal_t, alternate_signal_stack, 128);
- CHECK_OFFSET(pthread_internal_t, shadow_call_stack_guard_region, 136);
- CHECK_OFFSET(pthread_internal_t, stack_top, 144);
- CHECK_OFFSET(pthread_internal_t, startup_handshake_lock, 156);
- CHECK_OFFSET(pthread_internal_t, mmap_base, 168);
- CHECK_OFFSET(pthread_internal_t, mmap_size, 176);
- CHECK_OFFSET(pthread_internal_t, mmap_base_unguarded, 184);
- CHECK_OFFSET(pthread_internal_t, mmap_size_unguarded, 192);
- CHECK_OFFSET(pthread_internal_t, vma_name_buffer, 200);
- CHECK_OFFSET(pthread_internal_t, thread_local_dtors, 232);
- CHECK_OFFSET(pthread_internal_t, current_dlerror, 240);
- CHECK_OFFSET(pthread_internal_t, dlerror_buffer, 248);
- CHECK_OFFSET(pthread_internal_t, bionic_tls, 760);
- CHECK_OFFSET(pthread_internal_t, errno_value, 768);
- CHECK_SIZE(bionic_tls, 12200);
- CHECK_OFFSET(bionic_tls, key_data, 0);
- CHECK_OFFSET(bionic_tls, locale, 2080);
- CHECK_OFFSET(bionic_tls, basename_buf, 2088);
- CHECK_OFFSET(bionic_tls, dirname_buf, 6184);
- CHECK_OFFSET(bionic_tls, mntent_buf, 10280);
- CHECK_OFFSET(bionic_tls, mntent_strings, 10320);
- CHECK_OFFSET(bionic_tls, ptsname_buf, 11344);
- CHECK_OFFSET(bionic_tls, ttyname_buf, 11376);
- CHECK_OFFSET(bionic_tls, strerror_buf, 11440);
- CHECK_OFFSET(bionic_tls, strsignal_buf, 11695);
- CHECK_OFFSET(bionic_tls, group, 11952);
- CHECK_OFFSET(bionic_tls, passwd, 12040);
- CHECK_OFFSET(bionic_tls, fdtrack_disabled, 12192);
- CHECK_OFFSET(bionic_tls, padding, 12193);
-#else
- CHECK_SIZE(pthread_internal_t, 668);
- CHECK_OFFSET(pthread_internal_t, next, 0);
- CHECK_OFFSET(pthread_internal_t, prev, 4);
- CHECK_OFFSET(pthread_internal_t, tid, 8);
- CHECK_OFFSET(pthread_internal_t, attr, 16);
- CHECK_OFFSET(pthread_internal_t, join_state, 40);
- CHECK_OFFSET(pthread_internal_t, cleanup_stack, 44);
- CHECK_OFFSET(pthread_internal_t, start_routine, 48);
- CHECK_OFFSET(pthread_internal_t, start_routine_arg, 52);
- CHECK_OFFSET(pthread_internal_t, return_value, 56);
- CHECK_OFFSET(pthread_internal_t, start_mask, 60);
- CHECK_OFFSET(pthread_internal_t, alternate_signal_stack, 68);
- CHECK_OFFSET(pthread_internal_t, shadow_call_stack_guard_region, 72);
- CHECK_OFFSET(pthread_internal_t, stack_top, 76);
- CHECK_OFFSET(pthread_internal_t, startup_handshake_lock, 84);
- CHECK_OFFSET(pthread_internal_t, mmap_base, 92);
- CHECK_OFFSET(pthread_internal_t, mmap_size, 96);
- CHECK_OFFSET(pthread_internal_t, mmap_base_unguarded, 100);
- CHECK_OFFSET(pthread_internal_t, mmap_size_unguarded, 104);
- CHECK_OFFSET(pthread_internal_t, vma_name_buffer, 108);
- CHECK_OFFSET(pthread_internal_t, thread_local_dtors, 140);
- CHECK_OFFSET(pthread_internal_t, current_dlerror, 144);
- CHECK_OFFSET(pthread_internal_t, dlerror_buffer, 148);
- CHECK_OFFSET(pthread_internal_t, bionic_tls, 660);
- CHECK_OFFSET(pthread_internal_t, errno_value, 664);
- CHECK_SIZE(bionic_tls, 11080);
- CHECK_OFFSET(bionic_tls, key_data, 0);
- CHECK_OFFSET(bionic_tls, locale, 1040);
- CHECK_OFFSET(bionic_tls, basename_buf, 1044);
- CHECK_OFFSET(bionic_tls, dirname_buf, 5140);
- CHECK_OFFSET(bionic_tls, mntent_buf, 9236);
- CHECK_OFFSET(bionic_tls, mntent_strings, 9260);
- CHECK_OFFSET(bionic_tls, ptsname_buf, 10284);
- CHECK_OFFSET(bionic_tls, ttyname_buf, 10316);
- CHECK_OFFSET(bionic_tls, strerror_buf, 10380);
- CHECK_OFFSET(bionic_tls, strsignal_buf, 10635);
- CHECK_OFFSET(bionic_tls, group, 10892);
- CHECK_OFFSET(bionic_tls, passwd, 10952);
- CHECK_OFFSET(bionic_tls, fdtrack_disabled, 11076);
- CHECK_OFFSET(bionic_tls, padding, 11077);
-#endif // __LP64__
-#undef CHECK_SIZE
-#undef CHECK_OFFSET
-}
-#endif // defined(__BIONIC__)
-
-TEST(struct_layout, sizes_offsets) {
-#if defined(__BIONIC__)
- bool failed = false;
-
- auto check_size = [&](const char* name, size_t size, size_t expected_size) {
- EXPECT_EQ(expected_size, size) << "sizeof(" << name << ")";
- if (size != expected_size) {
- failed = true;
- }
- };
- auto check_offset = [&](const char* name, const char* field, size_t offset,
- size_t expected_offset) {
- EXPECT_EQ(expected_offset, offset) << "offsetof(" << name << ", " << field << ")";
- if (offset != expected_offset) {
- failed = true;
- }
- };
- tests(check_size, check_offset);
-
- if (failed) {
- printf(
- "Please update the tests function in bionic/tests/struct_layout_test.cpp with the "
- "following contents:\n");
-
- auto print_size = [&](const char* name, size_t size, size_t expected_size) {
- (void)expected_size;
- printf(" CHECK_SIZE(%s, %zu);\n", name, size);
- };
- auto print_offset = [&](const char* name, const char* field, size_t offset,
- size_t expected_offset) {
- (void)expected_offset;
- printf(" CHECK_OFFSET(%s, %s, %zu);\n", name, field, offset);
- };
- tests(print_size, print_offset);
- }
-#else
- GTEST_SKIP() << "bionic-only test";
-#endif
-}
diff --git a/tests/sys_epoll_test.cpp b/tests/sys_epoll_test.cpp
index fb2a48fd0..18cf380b0 100644
--- a/tests/sys_epoll_test.cpp
+++ b/tests/sys_epoll_test.cpp
@@ -83,14 +83,14 @@ TEST(sys_epoll, epoll_event_data) {
TEST(sys_epoll, epoll_create1) {
int fd;
fd = epoll_create(1);
- ASSERT_FALSE(CloseOnExec(fd));
+ AssertCloseOnExec(fd, false);
close(fd);
fd = epoll_create1(0);
- ASSERT_FALSE(CloseOnExec(fd));
+ AssertCloseOnExec(fd, false);
close(fd);
fd = epoll_create1(EPOLL_CLOEXEC);
- ASSERT_TRUE(CloseOnExec(fd));
+ AssertCloseOnExec(fd, true);
close(fd);
}
diff --git a/tests/sys_procfs_test.cpp b/tests/sys_procfs_test.cpp
index 5e0a0b024..8054869eb 100644
--- a/tests/sys_procfs_test.cpp
+++ b/tests/sys_procfs_test.cpp
@@ -18,7 +18,7 @@
#include <sys/procfs.h>
-TEST(sys_procfs, types) {
+TEST(sys_procfs, smoke) {
elf_greg_t reg;
memset(&reg, 0, sizeof(reg));
@@ -37,16 +37,3 @@ TEST(sys_procfs, types) {
static_assert(sizeof(prgregset_t) == sizeof(elf_gregset_t), "");
static_assert(sizeof(prfpregset_t) == sizeof(elf_fpregset_t), "");
}
-
-TEST(sys_procfs, constants) {
- // NGREG != ELF_NGREG (https://github.com/android/ndk/issues/1347)
- static_assert(sizeof(gregset_t) / sizeof(greg_t) == NGREG);
-
-#if defined(__arm__)
- static_assert(sizeof(user_regs) / sizeof(elf_greg_t) == ELF_NGREG);
-#elif defined(__aarch64__)
- static_assert(sizeof(user_pt_regs) / sizeof(elf_greg_t) == ELF_NGREG);
-#else
- static_assert(sizeof(user_regs_struct) / sizeof(elf_greg_t) == ELF_NGREG);
-#endif
-}
diff --git a/tests/sys_socket_test.cpp b/tests/sys_socket_test.cpp
index 421a8178e..034254735 100644
--- a/tests/sys_socket_test.cpp
+++ b/tests/sys_socket_test.cpp
@@ -109,7 +109,7 @@ static void TestAccept4(struct sockaddr_un* addr, int fd) {
ASSERT_NE(fd_acc, -1) << strerror(errno);
// Check that SOCK_CLOEXEC was set properly.
- ASSERT_TRUE(CloseOnExec(fd_acc));
+ AssertCloseOnExec(fd_acc, true);
close(fd_acc);
}
diff --git a/tests/sys_stat_test.cpp b/tests/sys_stat_test.cpp
index f36007e1c..71591c0c2 100644
--- a/tests/sys_stat_test.cpp
+++ b/tests/sys_stat_test.cpp
@@ -109,6 +109,7 @@ TEST(sys_stat, statx) {
int rc = statx(AT_FDCWD, "/proc/version", AT_STATX_SYNC_AS_STAT, STATX_ALL, &sx);
if (rc == -1 && errno == ENOSYS) {
GTEST_SKIP() << "statx returned ENOSYS";
+ return;
}
ASSERT_EQ(0, rc);
struct stat64 sb;
@@ -120,11 +121,6 @@ TEST(sys_stat, statx) {
#endif
}
-TEST(sys_stat, fchmod_EBADF) {
- ASSERT_EQ(-1, fchmod(-1, 0751));
- ASSERT_EQ(EBADF, errno);
-}
-
TEST(sys_stat, fchmodat_EFAULT_file) {
ASSERT_EQ(-1, fchmodat(AT_FDCWD, (char *) 0x1, 0751, 0));
ASSERT_EQ(EFAULT, errno);
diff --git a/tests/sys_thread_properties_test.cpp b/tests/sys_thread_properties_test.cpp
deleted file mode 100644
index cf1a6ba63..000000000
--- a/tests/sys_thread_properties_test.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#include <gtest/gtest.h>
-
-#include "gtest_globals.h"
-#include "utils.h"
-
-TEST(thread_properties_test, iterate_dts) {
-#if defined(__BIONIC__)
- const char expected_out[] =
- "got test_static_tls_bounds\niterate_cb i = 0\ndone_iterate_dynamic_tls\n";
- std::string helper = GetTestLibRoot() + "tls_properties_helper/tls_properties_helper";
- chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
-
- ExecTestHelper eth;
- eth.SetArgs({helper.c_str(), nullptr});
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out);
-#endif
-}
-
-TEST(thread_properties_test, thread_exit_cb) {
-#if defined(__BIONIC__)
- // tests/libs/thread_exit_cb_helper.cpp
- const char expected_out[] = "exit_cb_1 called exit_cb_2 called exit_cb_3 called";
- std::string helper = GetTestLibRoot() + "thread_exit_cb_helper/thread_exit_cb_helper";
- chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
-
- ExecTestHelper eth;
- eth.SetArgs({helper.c_str(), nullptr});
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, expected_out);
-
-#endif
-}
diff --git a/tests/sys_vfs_test.cpp b/tests/sys_vfs_test.cpp
index f82f50546..a521967bf 100644
--- a/tests/sys_vfs_test.cpp
+++ b/tests/sys_vfs_test.cpp
@@ -44,26 +44,12 @@ TEST(sys_vfs, statfs) {
Check(sb);
}
-TEST(sys_vfs, statfs_failure) {
- struct statfs sb;
- errno = 0;
- ASSERT_EQ(-1, statfs("/does-not-exist", &sb));
- ASSERT_EQ(ENOENT, errno);
-}
-
TEST(sys_vfs, statfs64) {
struct statfs64 sb;
ASSERT_EQ(0, statfs64("/proc", &sb));
Check(sb);
}
-TEST(sys_vfs, statfs64_failure) {
- struct statfs64 sb;
- errno = 0;
- ASSERT_EQ(-1, statfs64("/does-not-exist", &sb));
- ASSERT_EQ(ENOENT, errno);
-}
-
TEST(sys_vfs, fstatfs) {
struct statfs sb;
int fd = open("/proc", O_RDONLY);
@@ -72,13 +58,6 @@ TEST(sys_vfs, fstatfs) {
Check(sb);
}
-TEST(sys_vfs, fstatfs_failure) {
- struct statfs sb;
- errno = 0;
- ASSERT_EQ(-1, fstatfs(-1, &sb));
- ASSERT_EQ(EBADF, errno);
-}
-
TEST(sys_vfs, fstatfs64) {
struct statfs64 sb;
int fd = open("/proc", O_RDONLY);
@@ -86,10 +65,3 @@ TEST(sys_vfs, fstatfs64) {
close(fd);
Check(sb);
}
-
-TEST(sys_vfs, fstatfs64_failure) {
- struct statfs sb;
- errno = 0;
- ASSERT_EQ(-1, fstatfs(-1, &sb));
- ASSERT_EQ(EBADF, errno);
-}
diff --git a/tests/sys_wait_test.cpp b/tests/sys_wait_test.cpp
deleted file mode 100644
index c0069721d..000000000
--- a/tests/sys_wait_test.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <gtest/gtest.h>
-
-#include <sys/wait.h>
-
-TEST(sys_wait, waitid) {
- pid_t pid = fork();
- ASSERT_NE(pid, -1);
-
- if (pid == 0) _exit(66);
-
- siginfo_t si = {};
- ASSERT_EQ(0, waitid(P_PID, pid, &si, WEXITED));
- ASSERT_EQ(pid, si.si_pid);
- ASSERT_EQ(66, si.si_status);
- ASSERT_EQ(CLD_EXITED, si.si_code);
-}
diff --git a/tests/sys_xattr_test.cpp b/tests/sys_xattr_test.cpp
index 45cf3799a..8f4a33684 100644
--- a/tests/sys_xattr_test.cpp
+++ b/tests/sys_xattr_test.cpp
@@ -55,13 +55,13 @@ TEST(sys_xattr, fsetxattr_toosmallbuf) {
ASSERT_EQ(ERANGE, errno);
}
-TEST(sys_xattr, fsetxattr_invalid_fd) {
+TEST(sys_xattr, fsetxattr_invalidfd) {
char buf[10];
errno = 0;
- ASSERT_EQ(-1, fsetxattr(-1, "user.foo", "0123", 5, 0));
+ ASSERT_EQ(-1, fsetxattr(65535, "user.foo", "0123", 5, 0));
ASSERT_EQ(EBADF, errno);
errno = 0;
- ASSERT_EQ(-1, fgetxattr(-1, "user.foo", buf, sizeof(buf)));
+ ASSERT_EQ(-1, fgetxattr(65535, "user.foo", buf, sizeof(buf)));
ASSERT_EQ(EBADF, errno);
}
@@ -127,10 +127,3 @@ TEST(sys_xattr, flistattr_opath) {
#endif
close(fd);
}
-
-TEST(sys_xattr, flistattr_invalid_fd) {
- char buf[65536]; // 64kB is max possible xattr list size. See "man 7 xattr".
- errno = 0;
- ASSERT_EQ(-1, flistxattr(-1, buf, sizeof(buf)));
- ASSERT_EQ(EBADF, errno);
-}
diff --git a/tests/system_properties_test.cpp b/tests/system_properties_test.cpp
index aa8fef4dc..6d696c79f 100644
--- a/tests/system_properties_test.cpp
+++ b/tests/system_properties_test.cpp
@@ -15,6 +15,7 @@
*/
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#include <errno.h>
#include <sys/wait.h>
@@ -24,7 +25,6 @@
#include <thread>
#include <android-base/file.h>
-#include <android-base/silent_death_test.h>
using namespace std::literals;
@@ -425,7 +425,7 @@ bool KilledByFault::operator()(int exit_status) const {
WTERMSIG(exit_status) == SIGABRT);
}
-using properties_DeathTest = SilentDeathTest;
+class properties_DeathTest : public BionicDeathTest {};
TEST_F(properties_DeathTest, read_only) {
#if defined(__BIONIC__)
diff --git a/tests/tagged_pointers_test.cpp b/tests/tagged_pointers_test.cpp
new file mode 100644
index 000000000..56d10374d
--- /dev/null
+++ b/tests/tagged_pointers_test.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#include <gtest/gtest.h>
+#include <sys/prctl.h>
+
+#include "platform/bionic/malloc.h"
+#include "platform/bionic/mte.h"
+#include "utils.h"
+
+#include <bionic/malloc_tagged_pointers.h>
+
+static bool KernelSupportsTaggedPointers() {
+#ifdef __aarch64__
+#define PR_SET_TAGGED_ADDR_CTRL 55
+#define PR_TAGGED_ADDR_ENABLE (1UL << 0)
+ int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
+ return res >= 0 && res & PR_TAGGED_ADDR_ENABLE;
+#else
+ return false;
+#endif
+}
+
+TEST(tagged_pointers, check_tagged_pointer_dies) {
+ if (!KernelSupportsTaggedPointers()) {
+ GTEST_SKIP() << "Kernel doesn't support tagged pointers.";
+ }
+
+#ifdef __aarch64__
+ if (mte_supported()) {
+ GTEST_SKIP() << "Tagged pointers are not used on MTE hardware.";
+ }
+
+ void *x = malloc(1);
+
+ // Ensure that `x` has a pointer tag.
+ EXPECT_NE(reinterpret_cast<uintptr_t>(x) >> 56, 0u);
+
+ x = untag_address(x);
+ EXPECT_DEATH(free(x), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
+
+ HeapTaggingLevel tag_level = M_HEAP_TAGGING_LEVEL_TBI;
+ EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+ EXPECT_DEATH(free(untag_address(malloc(1))), "Pointer tag for 0x[a-zA-Z0-9]* was truncated");
+
+ tag_level = M_HEAP_TAGGING_LEVEL_ASYNC;
+ EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+
+ x = malloc(1);
+ void *y = malloc(1);
+ // Disable heap tagging.
+ tag_level = M_HEAP_TAGGING_LEVEL_NONE;
+ EXPECT_TRUE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+ // Ensure an older tagged pointer can still be freed.
+ free(x);
+ // Tag mismatch is not detected on old pointers.
+ free(untag_address(y));
+ // New pointers are not tagged.
+ x = malloc(1);
+ EXPECT_EQ(untag_address(x), x);
+ free(x);
+
+ // Switching back to checked mode is not possible.
+ tag_level = M_HEAP_TAGGING_LEVEL_TBI;
+ EXPECT_FALSE(android_mallopt(M_SET_HEAP_TAGGING_LEVEL, &tag_level, sizeof(tag_level)));
+ // We remain in the unchecked mode.
+ x = malloc(1);
+ EXPECT_EQ(untag_address(x), x);
+ free(x);
+#endif // defined(__aarch64__)
+}
diff --git a/tests/threads_test.cpp b/tests/threads_test.cpp
index c1e9b123a..5fafff38d 100644
--- a/tests/threads_test.cpp
+++ b/tests/threads_test.cpp
@@ -60,8 +60,7 @@ static int exit_arg(void* arg) {
#include <thread>
-#include <android-base/silent_death_test.h>
-
+#include "BionicDeathTest.h"
#include "SignalUtils.h"
TEST(threads, call_once) {
@@ -362,7 +361,7 @@ TEST(threads, thrd_create__thrd_exit) {
#endif
}
-using threads_DeathTest = SilentDeathTest;
+class threads_DeathTest : public BionicDeathTest {};
TEST(threads_DeathTest, thrd_exit_main_thread) {
#if !defined(HAVE_THREADS_H)
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index b16fe16bc..378b4ac22 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -31,6 +31,8 @@
#include "SignalUtils.h"
#include "utils.h"
+#include "private/bionic_constants.h"
+
using namespace std::chrono_literals;
TEST(time, time) {
@@ -140,7 +142,7 @@ TEST(time, mktime_10310929) {
t.tm_mday = 10;
#if !defined(__LP64__)
- // 32-bit bionic has a signed 32-bit time_t.
+ // 32-bit bionic stupidly had a signed 32-bit time_t.
ASSERT_EQ(-1, mktime(&t));
ASSERT_EQ(EOVERFLOW, errno);
#else
@@ -361,105 +363,6 @@ TEST(time, strptime_V_G_g) {
EXPECT_TRUE(memcmp(&tm, &zero, sizeof(tm)) == 0);
}
-TEST(time, strptime_Z) {
-#if defined(__BIONIC__)
- // glibc doesn't handle %Z at all.
- // The BSDs only handle hard-coded "GMT" and "UTC", plus whatever two strings
- // are in the global `tzname` (which correspond to the current $TZ).
- struct tm tm;
- setenv("TZ", "Europe/Berlin", 1);
-
- // "GMT" always works.
- tm = {};
- ASSERT_EQ('\0', *strptime("GMT", "%Z", &tm));
- EXPECT_STREQ("GMT", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(0, tm.tm_gmtoff);
-
- // As does "UTC".
- tm = {};
- ASSERT_EQ('\0', *strptime("UTC", "%Z", &tm));
- EXPECT_STREQ("UTC", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(0, tm.tm_gmtoff);
-
- // Europe/Berlin is known as "CET" when there's no DST.
- tm = {};
- ASSERT_EQ('\0', *strptime("CET", "%Z", &tm));
- EXPECT_STREQ("CET", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(3600, tm.tm_gmtoff);
-
- // Europe/Berlin is known as "CEST" when there's no DST.
- tm = {};
- ASSERT_EQ('\0', *strptime("CEST", "%Z", &tm));
- EXPECT_STREQ("CEST", tm.tm_zone);
- EXPECT_EQ(1, tm.tm_isdst);
- EXPECT_EQ(3600, tm.tm_gmtoff);
-
- // And as long as we're in Europe/Berlin, those are the only time zone
- // abbreviations that are recognized.
- tm = {};
- ASSERT_TRUE(strptime("PDT", "%Z", &tm) == nullptr);
-#endif
-}
-
-TEST(time, strptime_z) {
- struct tm tm;
- setenv("TZ", "Europe/Berlin", 1);
-
- // "UT" is what RFC822 called UTC.
- tm = {};
- ASSERT_EQ('\0', *strptime("UT", "%z", &tm));
- EXPECT_STREQ("UTC", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(0, tm.tm_gmtoff);
- // "GMT" is RFC822's other name for UTC.
- tm = {};
- ASSERT_EQ('\0', *strptime("GMT", "%z", &tm));
- EXPECT_STREQ("UTC", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(0, tm.tm_gmtoff);
-
- // "Z" ("Zulu") is a synonym for UTC.
- tm = {};
- ASSERT_EQ('\0', *strptime("Z", "%z", &tm));
- EXPECT_STREQ("UTC", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(0, tm.tm_gmtoff);
-
- // "PST"/"PDT" and the other common US zone abbreviations are all supported.
- tm = {};
- ASSERT_EQ('\0', *strptime("PST", "%z", &tm));
- EXPECT_STREQ("PST", tm.tm_zone);
- EXPECT_EQ(0, tm.tm_isdst);
- EXPECT_EQ(-28800, tm.tm_gmtoff);
- tm = {};
- ASSERT_EQ('\0', *strptime("PDT", "%z", &tm));
- EXPECT_STREQ("PDT", tm.tm_zone);
- EXPECT_EQ(1, tm.tm_isdst);
- EXPECT_EQ(-25200, tm.tm_gmtoff);
-
- // +-hh
- tm = {};
- ASSERT_EQ('\0', *strptime("+01", "%z", &tm));
- EXPECT_EQ(3600, tm.tm_gmtoff);
- EXPECT_TRUE(tm.tm_zone == nullptr);
- EXPECT_EQ(0, tm.tm_isdst);
- // +-hhmm
- tm = {};
- ASSERT_EQ('\0', *strptime("+0130", "%z", &tm));
- EXPECT_EQ(5400, tm.tm_gmtoff);
- EXPECT_TRUE(tm.tm_zone == nullptr);
- EXPECT_EQ(0, tm.tm_isdst);
- // +-hh:mm
- tm = {};
- ASSERT_EQ('\0', *strptime("+01:30", "%z", &tm));
- EXPECT_EQ(5400, tm.tm_gmtoff);
- EXPECT_TRUE(tm.tm_zone == nullptr);
- EXPECT_EQ(0, tm.tm_isdst);
-}
-
void SetTime(timer_t t, time_t value_s, time_t value_ns, time_t interval_s, time_t interval_ns) {
itimerspec ts;
ts.it_value.tv_sec = value_s;
@@ -758,22 +661,22 @@ TEST(time, timer_delete_from_timer_thread) {
TEST(time, clock_gettime) {
// Try to ensure that our vdso clock_gettime is working.
- timespec ts0;
timespec ts1;
+ ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts1));
timespec ts2;
- ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts0));
- ASSERT_EQ(0, syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts1));
- ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts2));
-
- // Check we have a nice monotonic timestamp sandwich.
- ASSERT_LE(ts0.tv_sec, ts1.tv_sec);
- if (ts0.tv_sec == ts1.tv_sec) {
- ASSERT_LE(ts0.tv_nsec, ts1.tv_nsec);
- }
- ASSERT_LE(ts1.tv_sec, ts2.tv_sec);
- if (ts1.tv_sec == ts2.tv_sec) {
- ASSERT_LE(ts1.tv_nsec, ts2.tv_nsec);
+ ASSERT_EQ(0, syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts2));
+
+ // What's the difference between the two?
+ ts2.tv_sec -= ts1.tv_sec;
+ ts2.tv_nsec -= ts1.tv_nsec;
+ if (ts2.tv_nsec < 0) {
+ --ts2.tv_sec;
+ ts2.tv_nsec += NS_PER_S;
}
+
+ // To try to avoid flakiness we'll accept answers within 10,000,000ns (0.01s).
+ ASSERT_EQ(0, ts2.tv_sec);
+ ASSERT_LT(ts2.tv_nsec, 10'000'000);
}
TEST(time, clock_gettime_CLOCK_REALTIME) {
@@ -849,15 +752,11 @@ TEST(time, clock_getres_unknown) {
}
TEST(time, clock) {
- // clock(3) is hard to test, but a 1s sleep should cost less than 10ms on average.
- static const clock_t N = 5;
- static const clock_t mean_limit_ms = 10;
+ // clock(3) is hard to test, but a 1s sleep should cost less than 5ms.
clock_t t0 = clock();
- for (size_t i = 0; i < N; ++i) {
- sleep(1);
- }
+ sleep(1);
clock_t t1 = clock();
- ASSERT_LT(t1 - t0, N * mean_limit_ms * (CLOCKS_PER_SEC / 1000));
+ ASSERT_LT(t1 - t0, 5 * (CLOCKS_PER_SEC / 1000));
}
static pid_t GetInvalidPid() {
@@ -1106,8 +1005,3 @@ TEST(time, timespec_get) {
GTEST_SKIP() << "glibc doesn't have timespec_get until 2.21";
#endif
}
-
-TEST(time, difftime) {
- ASSERT_EQ(1.0, difftime(1, 0));
- ASSERT_EQ(-1.0, difftime(0, 1));
-}
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 7d1e6128b..6b2856169 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -16,6 +16,7 @@
#include <gtest/gtest.h>
+#include "BionicDeathTest.h"
#include "SignalUtils.h"
#include "utils.h"
@@ -36,7 +37,6 @@
#include <chrono>
#include <android-base/file.h>
-#include <android-base/silent_death_test.h>
#include <android-base/strings.h>
#include "private/get_cpu_count_from_string.h"
@@ -53,8 +53,6 @@
#define UNISTD_DEATHTEST unistd_DeathTest
#endif
-using UNISTD_DEATHTEST = SilentDeathTest;
-
using namespace std::chrono_literals;
static void* get_brk() {
@@ -678,10 +676,14 @@ TEST(UNISTD_TEST, gettid_caching_and_pthread_create) {
ASSERT_NE(static_cast<uint64_t>(parent_tid), reinterpret_cast<uint64_t>(result));
}
+static void optimization_barrier(void* arg) {
+ asm volatile("" : : "r"(arg) : "memory");
+}
+
__attribute__((noinline)) static void HwasanVforkTestChild() {
// Allocate a tagged region on stack and leave it there.
char x[10000];
- DoNotOptimize(x);
+ optimization_barrier(x);
_exit(0);
}
@@ -698,7 +700,7 @@ __attribute__((noinline, no_sanitize("hwaddress"))) static void HwasanVforkTestP
// Allocate a region on stack, but don't tag it (see the function attribute).
// This depends on unallocated stack space at current function entry being untagged.
char x[10000];
- DoNotOptimize(x);
+ optimization_barrier(x);
// Verify that contents of x[] are untagged.
HwasanReadMemory(x, sizeof(x));
}
@@ -713,6 +715,8 @@ TEST(UNISTD_TEST, hwasan_vfork) {
}
}
+class UNISTD_DEATHTEST : public BionicDeathTest {};
+
TEST_F(UNISTD_DEATHTEST, abort) {
ASSERT_EXIT(abort(), testing::KilledBySignal(SIGABRT), "");
}
@@ -1166,10 +1170,10 @@ TEST(UNISTD_TEST, dup2_same) {
TEST(UNISTD_TEST, dup3) {
int fd = open("/proc/version", O_RDONLY);
ASSERT_EQ(666, dup3(fd, 666, 0));
- ASSERT_FALSE(CloseOnExec(666));
+ AssertCloseOnExec(666, false);
close(666);
ASSERT_EQ(667, dup3(fd, 667, O_CLOEXEC));
- ASSERT_TRUE(CloseOnExec(667));
+ AssertCloseOnExec(667, true);
close(667);
close(fd);
}
@@ -1346,11 +1350,6 @@ TEST(UNISTD_TEST, execve_failure) {
ASSERT_EQ(EACCES, errno);
}
-static void append_llvm_cov_env_var(std::string& env_str) {
- if (getenv("LLVM_PROFILE_FILE") != nullptr)
- env_str.append("__LLVM_PROFILE_RT_INIT_ONCE=__LLVM_PROFILE_RT_INIT_ONCE\n");
-}
-
TEST(UNISTD_TEST, execve_args) {
// int execve(const char* path, char* argv[], char* envp[]);
@@ -1362,12 +1361,7 @@ TEST(UNISTD_TEST, execve_args) {
// Test environment variable setting too.
eth.SetArgs({"printenv", nullptr});
eth.SetEnv({"A=B", nullptr});
-
- std::string expected_output("A=B\n");
- append_llvm_cov_env_var(expected_output);
-
- eth.Run([&]() { execve(BIN_DIR "printenv", eth.GetArgs(), eth.GetEnv()); }, 0,
- expected_output.c_str());
+ eth.Run([&]() { execve(BIN_DIR "printenv", eth.GetArgs(), eth.GetEnv()); }, 0, "A=B\n");
}
TEST(UNISTD_TEST, execl_failure) {
@@ -1392,13 +1386,8 @@ TEST(UNISTD_TEST, execle_failure) {
TEST(UNISTD_TEST, execle) {
ExecTestHelper eth;
eth.SetEnv({"A=B", nullptr});
-
- std::string expected_output("A=B\n");
- append_llvm_cov_env_var(expected_output);
-
// int execle(const char* path, const char* arg, ..., char* envp[]);
- eth.Run([&]() { execle(BIN_DIR "printenv", "printenv", nullptr, eth.GetEnv()); }, 0,
- expected_output.c_str());
+ eth.Run([&]() { execle(BIN_DIR "printenv", "printenv", nullptr, eth.GetEnv()); }, 0, "A=B\n");
}
TEST(UNISTD_TEST, execv_failure) {
@@ -1461,11 +1450,7 @@ TEST(UNISTD_TEST, execvpe) {
// Test environment variable setting too.
eth.SetArgs({"printenv", nullptr});
eth.SetEnv({"A=B", nullptr});
-
- std::string expected_output("A=B\n");
- append_llvm_cov_env_var(expected_output);
-
- eth.Run([&]() { execvpe("printenv", eth.GetArgs(), eth.GetEnv()); }, 0, expected_output.c_str());
+ eth.Run([&]() { execvpe("printenv", eth.GetArgs(), eth.GetEnv()); }, 0, "A=B\n");
}
TEST(UNISTD_TEST, execvpe_ENOEXEC) {
@@ -1553,11 +1538,7 @@ TEST(UNISTD_TEST, fexecve_args) {
ASSERT_NE(-1, printenv_fd);
eth.SetArgs({"printenv", nullptr});
eth.SetEnv({"A=B", nullptr});
-
- std::string expected_output("A=B\n");
- append_llvm_cov_env_var(expected_output);
-
- eth.Run([&]() { fexecve(printenv_fd, eth.GetArgs(), eth.GetEnv()); }, 0, expected_output.c_str());
+ eth.Run([&]() { fexecve(printenv_fd, eth.GetArgs(), eth.GetEnv()); }, 0, "A=B\n");
close(printenv_fd);
}
diff --git a/tests/utils.h b/tests/utils.h
index 592ac0e56..5014ef743 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -21,21 +21,10 @@
#include <fcntl.h>
#include <inttypes.h>
#include <sys/mman.h>
-#include <sys/prctl.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#if defined(__BIONIC__)
-#include <sys/system_properties.h>
-#endif
-
-#if defined(__BIONIC__)
-#include <bionic/macros.h>
-#else
-#define untag_address(p) p
-#endif
-
#include <atomic>
#include <string>
#include <regex>
@@ -77,16 +66,14 @@ static inline bool running_with_hwasan() {
#define SKIP_WITH_HWASAN if (running_with_hwasan()) GTEST_SKIP()
-static inline bool running_with_native_bridge() {
-#if defined(__BIONIC__)
- static const prop_info* pi = __system_property_find("ro.dalvik.vm.isa." ABI_STRING);
- return pi != nullptr;
+static inline void* untag_address(void* addr) {
+#if defined(__LP64__)
+ constexpr uintptr_t mask = (static_cast<uintptr_t>(1) << 56) - 1;
+ addr = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) & mask);
#endif
- return false;
+ return addr;
}
-#define SKIP_WITH_NATIVE_BRIDGE if (running_with_native_bridge()) GTEST_SKIP()
-
#if defined(__linux__)
#include <sys/sysmacros.h>
@@ -186,14 +173,10 @@ static inline void AssertChildExited(int pid, int expected_exit_status,
}
}
-static inline bool CloseOnExec(int fd) {
+static inline void AssertCloseOnExec(int fd, bool close_on_exec) {
int flags = fcntl(fd, F_GETFD);
- // This isn't ideal, but the alternatives are worse:
- // * If we return void and use ASSERT_NE here, we get failures at utils.h:191
- // rather than in the relevant test.
- // * If we ignore failures of fcntl(), well, that's obviously a bad idea.
- if (flags == -1) abort();
- return flags & FD_CLOEXEC;
+ ASSERT_NE(flags, -1);
+ ASSERT_EQ(close_on_exec ? FD_CLOEXEC : 0, flags & FD_CLOEXEC);
}
// The absolute path to the executable
@@ -295,23 +278,3 @@ class FdLeakChecker {
size_t start_count_ = CountOpenFds();
};
-
-// From <benchmark/benchmark.h>.
-template <class Tp>
-static inline void DoNotOptimize(Tp const& value) {
- asm volatile("" : : "r,m"(value) : "memory");
-}
-template <class Tp>
-static inline void DoNotOptimize(Tp& value) {
- asm volatile("" : "+r,m"(value) : : "memory");
-}
-
-static inline bool running_with_mte() {
-#ifdef __aarch64__
- int level = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
- return level >= 0 && (level & PR_TAGGED_ADDR_ENABLE) &&
- (level & PR_MTE_TCF_MASK) != PR_MTE_TCF_NONE;
-#else
- return false;
-#endif
-}
diff --git a/tests/utmp_test.cpp b/tests/utmp_test.cpp
index 6d0d6f127..0fa55c74b 100644
--- a/tests/utmp_test.cpp
+++ b/tests/utmp_test.cpp
@@ -24,10 +24,8 @@ TEST(utmp, login_tty) {
ASSERT_EQ(-1, login_tty(-1));
}
-TEST(utmp, smoke) {
- ASSERT_EQ(-1, utmpname("hello"));
+TEST(utmp, setutent_getutent_endutent) {
setutent();
- ASSERT_EQ(NULL, getutent());
+ getutent();
endutent();
- ASSERT_EQ(NULL, pututline(NULL));
}
diff --git a/tests/wchar_test.cpp b/tests/wchar_test.cpp
index d0b5a4a39..9b4fc4f8e 100644
--- a/tests/wchar_test.cpp
+++ b/tests/wchar_test.cpp
@@ -228,22 +228,14 @@ TEST(wchar, limits) {
}
TEST(wchar, wcsstr) {
- const wchar_t* haystack = L"big daddy/giant haystacks!";
- const wchar_t* empty_haystack = L"";
+ const wchar_t* haystack = L"matches hello world, not the second hello world";
+ const wchar_t* empty_needle = L"";
+ const wchar_t* good_needle = L"ll";
+ const wchar_t* bad_needle = L"wort";
- // The empty needle is a special case.
- ASSERT_EQ(haystack, wcsstr(haystack, L""));
- ASSERT_EQ(empty_haystack, wcsstr(empty_haystack, L""));
-
- ASSERT_EQ(haystack, wcsstr(haystack, L"b"));
- ASSERT_EQ(haystack, wcsstr(haystack, L"big"));
- ASSERT_EQ(haystack + 9, wcsstr(haystack, L"/"));
- ASSERT_EQ(haystack + 9, wcsstr(haystack, L"/giant"));
- ASSERT_EQ(haystack + 25, wcsstr(haystack, L"!"));
- ASSERT_EQ(haystack + 19, wcsstr(haystack, L"stacks!"));
-
- ASSERT_EQ(nullptr, wcsstr(haystack, L"monkey"));
- ASSERT_EQ(nullptr, wcsstr(empty_haystack, L"monkey"));
+ ASSERT_EQ(haystack, wcsstr(haystack, empty_needle));
+ ASSERT_EQ(&haystack[10], wcsstr(haystack, good_needle));
+ ASSERT_EQ(nullptr, wcsstr(haystack, bad_needle));
}
TEST(wchar, wcsstr_80199) {
@@ -654,8 +646,6 @@ TEST(wchar, wcsncpy_smoke) {
EXPECT_EQ(dst, wcsncpy(dst, src, 6));
dst[6] = L'\0';
EXPECT_STREQ(dst, L"Source");
- EXPECT_EQ(dst, wcsncpy(dst, L"clobber", 0));
- EXPECT_STREQ(dst, L"Source");
wmemset(dst, L'x', NUM_WCHARS(sizeof(dst)));
EXPECT_EQ(dst, wcsncpy(dst, src, src_len + 4));
@@ -1034,169 +1024,3 @@ TEST(wchar, wcwidth_korean_common_non_syllables) {
EXPECT_EQ(2, wcwidth(L'ㅜ')); // Korean "crying" emoticon.
EXPECT_EQ(2, wcwidth(L'ㅋ')); // Korean "laughing" emoticon.
}
-
-TEST(wchar, wcswidth) {
- EXPECT_EQ(2, wcswidth(L"abc", 2));
- EXPECT_EQ(2, wcswidth(L"ab\t", 2));
- EXPECT_EQ(-1, wcswidth(L"a\tb", 2));
-}
-
-TEST(wchar, wcslcpy) {
-#if defined(__BIONIC__)
- wchar_t dst[32];
- ASSERT_EQ(11U, wcslcpy(dst, L"hello world", 3));
- ASSERT_STREQ(L"he", dst);
- ASSERT_EQ(11U, wcslcpy(dst, L"hello world", 32));
- ASSERT_STREQ(L"hello world", dst);
-#else
- GTEST_SKIP() << "no wcslcpy in glibc";
-#endif
-}
-
-TEST(wchar, wcscat) {
- wchar_t dst[32];
- ASSERT_EQ(dst, wcscat(dst, L"hello"));
- ASSERT_STREQ(dst, L"hello");
- ASSERT_EQ(dst, wcscat(dst, L" world"));
- ASSERT_STREQ(dst, L"hello world");
-}
-
-TEST(wchar, wcscpy) {
- wchar_t dst[32];
- ASSERT_EQ(dst, wcscpy(dst, L"hello"));
- ASSERT_STREQ(dst, L"hello");
- ASSERT_EQ(dst, wcscpy(dst, L"world"));
- ASSERT_STREQ(dst, L"world");
-}
-
-TEST(wchar, wcscasecmp) {
- ASSERT_EQ(0, wcscasecmp(L"hello", L"HELLO"));
- ASSERT_TRUE(wcscasecmp(L"hello1", L"HELLO2") < 0);
- ASSERT_TRUE(wcscasecmp(L"hello2", L"HELLO1") > 0);
- ASSERT_TRUE(wcscasecmp(L"hello", L"HELL") > 0);
- ASSERT_TRUE(wcscasecmp(L"hell", L"HELLO") < 0);
-}
-
-TEST(wchar, wcscspn) {
- ASSERT_EQ(0U, wcscspn(L"hello world", L"abcdefghijklmnopqrstuvwxyz"));
- ASSERT_EQ(5U, wcscspn(L"hello world", L" "));
- ASSERT_EQ(11U, wcscspn(L"hello world", L"!"));
-}
-
-TEST(wchar, wcsspn) {
- ASSERT_EQ(0U, wcsspn(L"hello world", L"!"));
- ASSERT_EQ(5U, wcsspn(L"hello world", L"abcdefghijklmnopqrstuvwxyz"));
- ASSERT_EQ(11U, wcsspn(L"hello world", L"abcdefghijklmnopqrstuvwxyz "));
-}
-
-TEST(wchar, wcsdup) {
- wchar_t* s = wcsdup(L"hello");
- ASSERT_STREQ(s, L"hello");
- free(s);
-}
-
-TEST(wchar, wcslcat) {
-#if defined(__BIONIC__)
- wchar_t dst[4] = {};
- ASSERT_EQ(1U, wcslcat(dst, L"a", 4));
- ASSERT_EQ(7U, wcslcat(dst, L"bcdefg", 4));
- ASSERT_STREQ(dst, L"abc");
-#else
- GTEST_SKIP() << "no wcslcpy in glibc";
-#endif
-}
-
-TEST(wchar, wcsncasecmp) {
- ASSERT_EQ(0, wcsncasecmp(L"foo", L"bar", 0));
-
- ASSERT_EQ(0, wcsncasecmp(L"hello1", L"HELLO2", 5));
- ASSERT_TRUE(wcsncasecmp(L"hello1", L"HELLO2", 6) < 0);
- ASSERT_TRUE(wcsncasecmp(L"hello2", L"HELLO1", 6) > 0);
- ASSERT_TRUE(wcsncasecmp(L"hello", L"HELL", 5) > 0);
- ASSERT_TRUE(wcsncasecmp(L"hell", L"HELLO", 5) < 0);
-}
-
-TEST(wchar, wcsncat) {
- wchar_t dst[32];
- ASSERT_EQ(dst, wcsncat(dst, L"hello, world!", 5));
- ASSERT_STREQ(dst, L"hello");
- ASSERT_EQ(dst, wcsncat(dst, L"hello, world!", 0));
- ASSERT_STREQ(dst, L"hello");
- ASSERT_EQ(dst, wcsncat(dst, L", world!", 8));
- ASSERT_STREQ(dst, L"hello, world!");
-}
-
-TEST(wchar, wcsncmp) {
- ASSERT_EQ(0, wcsncmp(L"foo", L"bar", 0));
- ASSERT_EQ(0, wcsncmp(L"aaaa", L"aaab", 3));
- ASSERT_TRUE(wcsncmp(L"aaaa", L"aaab", 4) < 0);
- ASSERT_TRUE(wcsncmp(L"aaab", L"aaaa", 4) > 0);
-}
-
-TEST(wchar, wcsnlen) {
- ASSERT_EQ(2U, wcsnlen(L"hello", 2));
- ASSERT_EQ(5U, wcsnlen(L"hello", 5));
- ASSERT_EQ(5U, wcsnlen(L"hello", 666));
-}
-
-TEST(wchar, wcspbrk) {
- const wchar_t* s = L"hello, world!";
- ASSERT_EQ(nullptr, wcspbrk(s, L"-"));
- ASSERT_EQ(s, wcspbrk(s, L"abch"));
- ASSERT_EQ(s + 2, wcspbrk(s, L"l"));
- ASSERT_EQ(s + 5, wcspbrk(s, L",. !"));
-}
-
-TEST(wchar, wcstok) {
- wchar_t s[] = L"this is\ta\nstring";
- wchar_t* p;
- ASSERT_EQ(s, wcstok(s, L"\t\n ", &p));
- ASSERT_STREQ(s, L"this");
- ASSERT_STREQ(p, L"is\ta\nstring");
- ASSERT_EQ(s + 5, wcstok(nullptr, L"\t\n ", &p));
- ASSERT_STREQ(s + 5, L"is");
- ASSERT_STREQ(p, L"a\nstring");
- ASSERT_EQ(s + 8, wcstok(nullptr, L"\t\n ", &p));
- ASSERT_STREQ(s + 8, L"a");
- ASSERT_STREQ(p, L"string");
- ASSERT_EQ(s + 10, wcstok(nullptr, L"\t\n ", &p));
- ASSERT_STREQ(s + 10, L"string");
- ASSERT_EQ(nullptr, p);
-}
-
-TEST(wchar, wmemchr) {
- const wchar_t* s = L"hello, world!";
- ASSERT_EQ(s, wmemchr(s, L'h', 13));
- ASSERT_EQ(s + 5, wmemchr(s, L',', 13));
- ASSERT_EQ(s + 12, wmemchr(s, L'!', 13));
- ASSERT_EQ(nullptr, wmemchr(s, L'a', 13));
-}
-
-TEST(wchar, wmemcmp) {
- ASSERT_EQ(0, wmemcmp(L"aaaa", L"aaab", 3));
- ASSERT_TRUE(wmemcmp(L"aaaa", L"aaab", 4) < 0);
- ASSERT_TRUE(wmemcmp(L"aaab", L"aaaa", 4) > 0);
-}
-
-TEST(wchar, wmemcpy) {
- wchar_t dst[32] = {};
- ASSERT_EQ(dst, wmemcpy(dst, L"hello", 5));
- ASSERT_STREQ(dst, L"hello");
-}
-
-TEST(wchar, wmemmove) {
- wchar_t dst[32] = {};
- ASSERT_EQ(dst, wmemmove(dst, L"hello", 5));
- ASSERT_STREQ(dst, L"hello");
-}
-
-TEST(wchar, wmemset) {
- wchar_t dst[4] = {};
- ASSERT_EQ(dst, wmemset(dst, 0x12345678, 3));
- ASSERT_EQ(dst[0], wchar_t(0x12345678));
- ASSERT_EQ(dst[1], wchar_t(0x12345678));
- ASSERT_EQ(dst[2], wchar_t(0x12345678));
- ASSERT_EQ(dst[3], wchar_t(0));
- ASSERT_EQ(dst, wmemset(dst, L'y', 0));
- ASSERT_EQ(dst[0], wchar_t(0x12345678));
-}
diff --git a/tools/Android.bp b/tools/Android.bp
index dcd2a7d84..c540c3cea 100644
--- a/tools/Android.bp
+++ b/tools/Android.bp
@@ -1,18 +1,3 @@
-package {
- default_applicable_licenses: ["bionic_tools_license"],
-}
-
-license {
- name: "bionic_tools_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-Apache-2.0",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
subdirs = ["*"]
filegroup {
diff --git a/tools/NOTICE b/tools/NOTICE
deleted file mode 100644
index a4ec954d2..000000000
--- a/tools/NOTICE
+++ /dev/null
@@ -1,32 +0,0 @@
-Copyright (C) 2016 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.
-
--------------------------------------------------------------------
-
-Copyright (C) 2018 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.
-
--------------------------------------------------------------------
-
diff --git a/tools/generate-version-script.py b/tools/generate-version-script.py
index def621e1f..acfe21859 100755
--- a/tools/generate-version-script.py
+++ b/tools/generate-version-script.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# This tool is used to generate the version scripts for libc, libm, libdl,
# and libstdc++ for every architecture.
diff --git a/tools/update_notice.sh b/tools/update_notice.sh
index c45311a68..a309bc26e 100755
--- a/tools/update_notice.sh
+++ b/tools/update_notice.sh
@@ -1,14 +1,7 @@
#!/bin/bash
-set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/..
-python3 ./libc/tools/generate_notice.py benchmarks > benchmarks/NOTICE
-python3 ./libc/tools/generate_notice.py libc > libc/NOTICE
-python3 ./libc/tools/generate_notice.py libdl > libdl/NOTICE
-python3 ./libc/tools/generate_notice.py libfdtrack > libfdtrack/NOTICE
-python3 ./libc/tools/generate_notice.py libm > libm/NOTICE
-python3 ./libc/tools/generate_notice.py libstdc++ > libstdc++/NOTICE
-python3 ./libc/tools/generate_notice.py linker > linker/NOTICE
-python3 ./libc/tools/generate_notice.py tests > tests/NOTICE
-python3 ./libc/tools/generate_notice.py tools > tools/NOTICE
+./libc/tools/generate-NOTICE.py libc libm > libc/NOTICE
+
git diff --exit-code HEAD libc/NOTICE
+exit $?
diff --git a/tools/versioner/Android.bp b/tools/versioner/Android.bp
index cc4dbfa55..061709a91 100644
--- a/tools/versioner/Android.bp
+++ b/tools/versioner/Android.bp
@@ -1,7 +1,3 @@
-package {
- default_applicable_licenses: ["bionic_tools_license"],
-}
-
subdirs = [
"src",
]
diff --git a/tools/versioner/run_tests.py b/tools/versioner/run_tests.py
index 396f895f1..f3bb6db89 100755
--- a/tools/versioner/run_tests.py
+++ b/tools/versioner/run_tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python2
import os
import subprocess
diff --git a/tools/versioner/src/Android.bp b/tools/versioner/src/Android.bp
index 0173c414c..a78ab5dd4 100644
--- a/tools/versioner/src/Android.bp
+++ b/tools/versioner/src/Android.bp
@@ -1,7 +1,3 @@
-package {
- default_applicable_licenses: ["bionic_tools_license"],
-}
-
cc_binary_host {
name: "versioner",
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index ec2e38dbe..3c6f64348 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -72,7 +72,7 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
// <math.h> maps fool onto foo on 32-bit, since long double is the same as double.
if (auto asm_attr = decl->getAttr<AsmLabelAttr>()) {
- return asm_attr->getLabel().str();
+ return asm_attr->getLabel();
}
// The decl might not have a name (e.g. bitfields).
@@ -84,7 +84,7 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
return mangled;
}
- return identifier->getName().str();
+ return identifier->getName();
}
return "<unnamed>";
@@ -173,7 +173,7 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
&arch_availability[Arch::x86_64].introduced } },
};
- if (auto it = prefix_map.find(fragments[0].str()); it != prefix_map.end()) {
+ if (auto it = prefix_map.find(fragments[0]); it != prefix_map.end()) {
int value;
if (fragments[1].getAsInteger(10, value)) {
errx(1, "invalid __ANDROID_AVAILABILITY_DUMP__ annotation: '%s'",
@@ -190,8 +190,8 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
auto symbol_it = database.symbols.find(declaration_name);
if (symbol_it == database.symbols.end()) {
Symbol symbol = {.name = declaration_name };
- bool unused;
- std::tie(symbol_it, unused) = database.symbols.insert({declaration_name, symbol});
+ bool dummy;
+ std::tie(symbol_it, dummy) = database.symbols.insert({ declaration_name, symbol });
}
auto expansion_range = src_manager.getExpansionRange(range);
@@ -201,7 +201,7 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
}
Location location = {
- .filename = filename.str(),
+ .filename = filename,
.start = {
.line = src_manager.getExpansionLineNumber(expansion_range.getBegin()),
.column = src_manager.getExpansionColumnNumber(expansion_range.getBegin()),
diff --git a/tools/versioner/src/Driver.cpp b/tools/versioner/src/Driver.cpp
index 24dc5ecd8..184c3d4e5 100644
--- a/tools/versioner/src/Driver.cpp
+++ b/tools/versioner/src/Driver.cpp
@@ -42,7 +42,6 @@
#include <llvm/ADT/SmallVector.h>
#include <llvm/ADT/StringRef.h>
#include <llvm/Option/Option.h>
-#include <llvm/Support/Host.h>
#include <llvm/Support/VirtualFileSystem.h>
#include "Arch.h"
@@ -149,7 +148,7 @@ static void generateTargetCC1Flags(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSyste
cmd.push_back("-");
auto diags = constructDiags();
- driver::Driver driver("versioner", llvm::sys::getDefaultTargetTriple(), *diags, "versioner", vfs);
+ driver::Driver driver("versioner", llvm::sys::getDefaultTargetTriple(), *diags, vfs);
driver.setCheckInputsExist(false);
llvm::SmallVector<const char*, 32> driver_args;
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index eb88c4669..4ee3446f1 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -237,7 +237,7 @@ static std::string generateGuardCondition(const DeclarationAvailability& avail)
return "("s + Join(expressions, ") || (") + ")";
}
-// Assumes that nothing weird is happening (e.g. having the semicolon be in a macro).
+// Assumes that nothing crazy is happening (e.g. having the semicolon be in a macro)
static FileLocation findNextSemicolon(const std::deque<std::string>& lines, FileLocation start) {
unsigned current_line = start.line;
unsigned current_column = start.column;
@@ -373,8 +373,8 @@ static void mergeGuards(std::deque<std::string>& file_lines, GuardMap& guard_map
guard_map.erase(current);
guard_map.erase(next);
- bool unused;
- std::tie(current, unused) = guard_map.insert(std::make_pair(merged, avail));
+ bool dummy;
+ std::tie(current, dummy) = guard_map.insert(std::make_pair(merged, avail));
next = current;
++next;
}
@@ -446,7 +446,7 @@ bool preprocessHeaders(const std::string& dst_dir, const std::string& src_dir,
continue;
}
- std::string rel_path = path.substr(src_dir.length() + 1).str();
+ std::string rel_path = path.substr(src_dir.length() + 1);
std::string dst_path = dst_dir + "/" + rel_path;
llvm::StringRef parent_path = llvm::sys::path::parent_path(dst_path);
if (llvm::sys::fs::create_directories(parent_path)) {
@@ -471,13 +471,13 @@ bool preprocessHeaders(const std::string& dst_dir, const std::string& src_dir,
GuardMap guard_map;
for (const auto& it : orig_guard_map) {
Location loc = it.first;
- loc.end = findNextSemicolon(file_lines[file_path.str()], loc.end);
+ loc.end = findNextSemicolon(file_lines[file_path], loc.end);
guard_map[loc] = it.second;
}
// TODO: Make sure that the Locations don't overlap.
// TODO: Merge adjacent non-identical guards.
- mergeGuards(file_lines[file_path.str()], guard_map);
+ mergeGuards(file_lines[file_path], guard_map);
if (!file_path.startswith(src_dir)) {
errx(1, "input file %s is not in %s\n", file_path.str().c_str(), src_dir.c_str());
@@ -487,7 +487,7 @@ bool preprocessHeaders(const std::string& dst_dir, const std::string& src_dir,
llvm::StringRef rel_path = file_path.substr(src_dir.size(), file_path.size() - src_dir.size());
std::string output_path = (llvm::Twine(dst_dir) + rel_path).str();
- rewriteFile(output_path, file_lines[file_path.str()], guard_map);
+ rewriteFile(output_path, file_lines[file_path], guard_map);
}
return true;
diff --git a/tools/versioner/src/Utils.cpp b/tools/versioner/src/Utils.cpp
index dc6b5ddd9..ca186a461 100644
--- a/tools/versioner/src/Utils.cpp
+++ b/tools/versioner/src/Utils.cpp
@@ -64,7 +64,7 @@ std::vector<std::string> collectHeaders(const std::string& directory,
if (ent->fts_info & FTS_D) {
if (ignored_directories.count(ent->fts_path) != 0) {
- // fts_read guarantees that `ent` is valid and okay to hold on to until
+ // fts_read guarantees that `ent` is valid and sane to hold on to until
// after it's returned with FTS_DP set.
skipping = ent;
}
diff --git a/tools/versioner/src/versioner.cpp b/tools/versioner/src/versioner.cpp
index c818197a0..473f1f920 100644
--- a/tools/versioner/src/versioner.cpp
+++ b/tools/versioner/src/versioner.cpp
@@ -141,7 +141,7 @@ static CompilationRequirements collectRequirements(const Arch& arch,
}
auto new_end = std::remove_if(headers.begin(), headers.end(), [&arch](llvm::StringRef header) {
- for (const auto& it : ignored_headers) {
+ for (const auto& it : header_blacklist) {
if (it.second.find(arch) == it.second.end()) {
continue;
}
@@ -276,7 +276,7 @@ static std::vector<T> Intersection(const std::set<T>& a, const std::set<T>& b) {
return intersection;
}
-// Perform a validity check on a symbol's declarations, enforcing the following invariants:
+// Perform a sanity check on a symbol's declarations, enforcing the following invariants:
// 1. At most one inline definition of the function exists (overloaded inline functions for
// _FORTIFY_SOURCE do not count because they are usually introduced to intercept the original
// functions or usually have enable_if attributes).
@@ -334,7 +334,7 @@ static bool checkSymbol(const Symbol& symbol) {
return true;
}
-static bool validityCheck(const HeaderDatabase* database) {
+static bool sanityCheck(const HeaderDatabase* database) {
bool error = false;
std::string cwd = getWorkingDir() + "/";
@@ -676,8 +676,8 @@ int main(int argc, char** argv) {
if (dump) {
declaration_database->dump(location.header_path + "/");
} else {
- if (!validityCheck(declaration_database.get())) {
- printf("versioner: validity check failed\n");
+ if (!sanityCheck(declaration_database.get())) {
+ printf("versioner: sanity check failed\n");
failed = true;
}
diff --git a/tools/versioner/src/versioner.h b/tools/versioner/src/versioner.h
index e9c4989e3..5e534989e 100644
--- a/tools/versioner/src/versioner.h
+++ b/tools/versioner/src/versioner.h
@@ -33,11 +33,15 @@ extern bool add_include;
} \
} while (0)
-static const std::unordered_map<std::string, std::set<Arch>> ignored_headers = {
+static const std::unordered_map<std::string, std::set<Arch>> header_blacklist = {
// Internal header.
- // TODO: we should probably just admit we're never getting rid of this.
{ "sys/_system_properties.h", supported_archs },
// time64.h #errors when included on LP64 archs.
{ "time64.h", { Arch::arm64, Arch::x86_64 } },
};
+
+static const std::unordered_set<std::string> missing_symbol_whitelist = {
+ // atexit comes from crtbegin.
+ "atexit",
+};
diff --git a/tools/versioner/tests/multiple_decl_mismatch/expected_fail b/tools/versioner/tests/multiple_decl_mismatch/expected_fail
index 30e72336e..1d1f266c5 100644
--- a/tools/versioner/tests/multiple_decl_mismatch/expected_fail
+++ b/tools/versioner/tests/multiple_decl_mismatch/expected_fail
@@ -5,4 +5,4 @@ versioner: failed to calculate symbol availability
obsoleted = 12
extern declaration @ headers/foo.h:5:1
obsoleted = 9
-versioner: validity check failed
+versioner: sanity check failed
diff --git a/tools/versioner/tests/multiple_definition/expected_fail b/tools/versioner/tests/multiple_definition/expected_fail
index 5abb833d8..cb4acc643 100644
--- a/tools/versioner/tests/multiple_definition/expected_fail
+++ b/tools/versioner/tests/multiple_definition/expected_fail
@@ -4,4 +4,4 @@ versioner: conflicting inline definitions for symbol foo:
no availability
static definition @ headers/bar.h:5:1
no availability
-versioner: validity check failed
+versioner: sanity check failed
diff --git a/tools/versioner/tests/version_mismatch/expected_fail b/tools/versioner/tests/version_mismatch/expected_fail
index 95d284b31..f2143a394 100644
--- a/tools/versioner/tests/version_mismatch/expected_fail
+++ b/tools/versioner/tests/version_mismatch/expected_fail
@@ -5,4 +5,4 @@ versioner: failed to calculate symbol availability
introduced = 9
extern declaration @ headers/foo.h:8:1
introduced = 10
-versioner: validity check failed
+versioner: sanity check failed