Commit graph

579 commits

Author SHA1 Message Date
Christopher Ferris
7f4c837186 Update to v6.9 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.9

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: If53a38bbb65c3c653ce790fe5c6e51597901a14e
2024-06-03 14:22:19 -07:00
Dan Albert
2237fcf1fa Revert "Use inline keyword without underscores consistently"
This reverts commit 58f06e1112.

Bare `inline` is not ANSI C compatible, and NDK users may be using
that.

Test: treehugger
Change-Id: I82c5424522142001cd59da63ef3fd440014451ad
2024-05-14 17:55:54 +00:00
Christopher Ferris
785e161dd8 Merge "Update to v6.8 kernel headers." into main 2024-04-18 16:35:43 +00:00
Nick Desaulniers
58f06e1112 Use inline keyword without underscores consistently
s/__inline__/inline
s/__inline/inline

Change-Id: I5d8d930a7a41d678a0795e7a608dacbb9eb8cb37
2024-04-17 10:51:09 -07:00
Christopher Ferris
b830ddf90e Update to v6.8 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.8

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: I0022cdb20c19726f526acaab2866f1e25794b77e
2024-04-16 09:49:56 -07:00
Christopher Ferris
0f79521706 Update to v6.7 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.7

NOTE: The file bionic/libc/kernel/uapi/linux/usb/f_accessory.h was
deleted in the 6.7 kernel along with the functionality. However,
there is no current replacement. For now keep the file here, but at
some point when the new implementation is ready, this file will need to
be moved to the places that still need to be backwards compatible.

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: Ibf5684ed140616c02bb9464bbd6422a9281a29cf
2024-01-18 12:45:00 -08:00
Elliott Hughes
5850f6f3be Use the canonical idiom for sockaddr_storage.
This works out a bit silly/ugly because the bits/ header file has the
wrong name, so I've also changed the map from kernel struct to boolean
to be a map from kernel struct to filename. That not only fixes this,
it's a bit more readable too. (Just yesterday, when I had no real reason
to change it, I was asking myself "why is this a boolean?"!)

Bug: http://b/236042740
Test: treehugger
Change-Id: I3eee25b493ea97d46cc5dc5fde07f7c5e77d2a46
2023-12-05 23:13:01 +00:00
Elliott Hughes
001fabaa90 Merge "Avoid multiple definitions of struct tcphdr." into main 2023-12-05 23:09:32 +00:00
Elliott Hughes
3906f3bc83 Merge "Avoid multiple definitions of sigaction." into main 2023-11-29 19:03:26 +00:00
Elliott Hughes
b4a9b17a55 Avoid multiple definitions of struct tcphdr.
No-one's hit this in practice, that I know of, but there are very few
instances of this old workaround for kernel/userspace mismatches still
present, and (as part of the much harder and less effective `struct
sigaction` cleanup), we should just remove them.

Bug: http://b/236042740
Test: treehugger
Change-Id: I6c71d4353044cf57cfa8a9796a4c3d6a4d51cd86
2023-11-28 15:41:54 -08:00
Elliott Hughes
df53b16fca Avoid multiple definitions of sigaction.
Before this change, we have the kernel's sigaction in the uapi headers,
and our own sigaction in <bits/signal_types.h> and we rely on callers
making sure to use `#define` to move the kernel type out of the way if
they include a uapi header directly. This is obviously error-prone and
undesireable, and not what we usually do now.

What we _usually_ do now is use the header scrubber's ability to replace
a struct definition with a `#include <bits/STRUCT.h>`, but that doesn't
work here because struct sigaction relies on a lot of other types,
some of which also come from uapi headers.

So instead use our second best trick, which is to "move the kernel struct
out of the way" at header scrubbing time instead. This means that someone
who does `#include <linux/signal.h>` or `#include <asm/signal.h>` won't
get `struct sigaction` (they'll only have `struct __kernel_sigaction`
instead), but it does mean that they can't get two incompatible
definitions if they include a uapi header both directly and indirectly.

So although this doesn't do what I'd set out to do, it's still an
improvement in some cases, and it's our preferred idiom in most cases
anyway. (I'll come back once this is in to tidy up the two other kernel
structs where we're still using the deprecated "rename out of the way
using #define" trick, but this change is already hairy enough, and
there's a possibility it will break code that didn't care that it was
getting the kernel `struct sigaction` rather than the userspace one.)

Bug: http://b/236042740
Test: treehugger
Change-Id: Icff50e330c09c587e8f77ba0fb7cffffd9c3b708
2023-11-28 14:20:43 -08:00
Elliott Hughes
844e8fc324 Stop the kernel header scrubber from duplicating includes.
We'll probably never hit this (because the case I hit it with, struct
sigaction, isn't amenable to the "replace with #include <bits/STRUCT.h>"
trick), but in case we do, and because a set expresses our intent better
than a list, keep the list^Wset of generated includes in a set.

Bug: http://b/236042740
Test: treehugger
Change-Id: I21f5c08515eab1b28e6a36fc00149b6bc7740b7e
2023-11-28 14:01:46 -08:00
Elliott Hughes
180edefbd2 Remove extraneous text from header comments.
Test: treehugger
Change-Id: I8e27e8ac15f5f1380046accbd7875da1c3b512f2
2023-11-02 00:08:05 +00:00
Christopher Ferris
67d1e5eb74 Update to v6.6 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.6

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: Ib5ff5a23f382721d98d1e428a295c6794b190d8d
2023-10-31 13:36:37 -07:00
Edward Liaw
d903a736fb Add test for replacing macro arguments
Add test for aosp/2792161

Bug: 297317502
Test: cpp.py
Change-Id: I2eadd3b9371ec2f8b8c24107888cad5e3ae26f60
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-10-17 20:09:42 +00:00
Edward Liaw
c291c39137 Replace macro arguments when applying replaceTokens
replaceTokens was only replacing tokens for cpp name clashes in the
macro body.  This change will also replace tokens in the arguments.

Bug: 297317502
Test: bionic/libc/kernel/tools/update_all.py
Change-Id: I102d000a8a4cea507b00c867df2a16106d8aed89
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-10-17 17:42:40 +00:00
Elliott Hughes
b10c99d077 Keep ioprio_value; <linux/ioprio.h> relies on this.
We were keeping the macros that call this function, but not the function
itself. That's not helpful.

Bug: http://b/297317502
Test: treehugger
Change-Id: Icf8f734a129fe73ec740bb7cfbb11deb01a98cb3
2023-10-13 00:11:01 +00:00
Spandan Das
40467b2602 Delete cc_api_* bionic bazel targets
These targets were created for multi-tree. This use case is not very
relevant anymore, so cleanup these BUILD files

Test: m nothing
Test: presubmits
Bug: 284029211
Change-Id: Id2680df9cfe291ca10b4f007bbd05a338b2498c1
2023-10-05 23:22:05 +00:00
Christopher Ferris
8666d0462f Update to v6.5 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.5

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: Ia0397ce27e088bc20338bbd2d125be6f169c4ba0
2023-09-06 19:33:21 -07:00
Christopher Ferris
37c3f3c67e Update to v6.4 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.4

Test: Bionic unit tests pass.
Change-Id: I991f8eaa2b272a464166addb13e6bdc63734444d
2023-07-10 10:59:05 -07:00
Christopher Ferris
b7cef6d910 Update to v6.3 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.3

Test: Bionic unit tests pass.
Change-Id: I5270ef291a77343e47ef3a5fbd02b8cacf218ec5
2023-05-09 19:04:15 +00:00
Elliott Hughes
873c1ca3cb Add SYS_riscv_flush_icache.
Fix the uapi import script to look at the riscv/asm/ directory too, and
re-run it to add the missing SYS_riscv_* entry (there's only this one)
to glibc-syscalls.h.

Test: treehugger
Change-Id: Ie52c6ca1943c05bb615932174e49e7fb79725a7b
2023-04-25 12:13:56 -07:00
Elliott Hughes
0f0c18f695 uapi headers: simplify the <linux/compiler.h> stuff.
We don't really need <linux/compiler.h> and <linux/compiler_types.h>. We
already have a mechanism to remove unused macros, so let's do that. We
don't currently have a way to remove unused #includes, so we still need
<linux/compiler.h> and <linux/compiler_types.h> files (but I've clarified
the comments in them).

I've kept the empty definitions of `__user` and `__force` for source
compatibility. (We had one security test at least that was assuming
a kernel struct definition will "just work".)

Bug: http://b/262917450
Test: treehugger
Change-Id: Iacbbbc1aeef9a4fac52dabd7811ab875cc267d4f
2023-03-30 12:47:08 -07:00
Elliott Hughes
875d40559e Use <bits/timespec.h> from uapi headers too.
Bug: https://github.com/android/ndk/issues/1852
Test: treehugger
Change-Id: I554b31d2c4c443d37506e97a36099efbd3ad0e11
2023-03-20 15:07:16 +00:00
Christopher Ferris
8b7fdc9124 Update to v6.2 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.2

Test: Bionic unit tests pass.
Change-Id: I9f665add01ebeb155dd8a934308897f90000a557
2023-02-21 13:36:32 -08:00
Treehugger Robot
6f78f756a2 Merge "Replace __packed with __attribute__((__packed__)) in uapi headers" 2022-12-17 01:49:22 +00:00
Colin Cross
4ac332279d Replace __packed with __attribute__((__packed__)) in uapi headers
Linux uapi headers use __packed as an abbreviation for
__attribute__((__packed__)).  In the upstream kernel headers this
is defined in linux/compiler_attributes.h, but it is not defined
in the uapi headers.  Bionic defines it in sys/cdefs.h, which will
almost always provide the needed definition, but there are uapi
headers that use __packed and do not include any system headers
that would include sys/cdefs.h.  Musl's sys/cdefs.h does not
define __packed, which leads to linker errors when __packed is
treated as a variable name.

Replace __packed with __attribute__((__packed__)) when importing
uapi headers to break the dependency on sys/cdefs.h.

Test: m USE_HOST_MUSL=true on oriole-userdebug in internal master
Change-Id: I45f80f4e5aec868b80ce8eb9d757a3e08ae3e1a9
2022-12-16 11:51:40 -08:00
Christopher Ferris
6cd53a5f6b Update to v6.1 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.1

Test: Bionic unit tests pass.
Change-Id: I9414fb5e698a9806b85eb09e37d763849f08a468
2022-12-12 23:39:16 +00:00
Christopher Ferris
09db6416bc Merge "Update to v6.0 kernel headers." 2022-11-03 01:20:02 +00:00
Pat Tjin
00fde2aff6 Modify path for python clang support package
Due to commit 594844244237091347b62e8fbbc8a2851258db50 (update
stable to r468909b) the path for python3-clang support was moved from
   prebuilts/clang/host/linux-x86/clang-stable/lib64/python3/site-packages
to:
   prebuilts/clang/host/linux-x86/clang-stable/lib/python3/site-packages

Change the imports to point to the correct place.

Without the change:
  Traceback (most recent call last):
    File "bionic/libc/kernel/tools/./clean_header.py", line 72, in <module>
      import sys, cpp, kernel, glob, os, re, getopt
    File "bionic/libc/kernel/tools/cpp.py", line 19, in <module>
      import clang.cindex
  ModuleNotFoundError: No module named 'clang'

Bug: 254401594
Test: execute clean_headers.py
Signed-off-by: Pat Tjin <pattjin@google.com>
Change-Id: Ibf1423fbe78ee009366e26905c4a09e68ac8ff9b
2022-10-21 18:27:24 +00:00
Elliott Hughes
473dcc59f3 Remove Commodore 64 support.
https://en.wikipedia.org/wiki/KERNAL

Test: treehugger
Change-Id: I42fc21daa051eca29e6bda7f29c81dd8f353c14e
2022-10-19 16:13:09 +00:00
Elliott Hughes
bba6ddff12 Kernel header scrubber: remove unused map entries.
I was going to add riscv64 and define __riscv_xlen to 64 here, but our
"preprocessor" in python can't simpify `MACRO_NAME == 123` expressions
anyway. Rather than add another empty map, remove the other unused maps
and explain why this functionality is still useful as long as the legacy
32-bit ABIs are still with us.

Test: treehugger
Change-Id: I553059942920e7d323a0ca8a6fd5f39bc2d35063
2022-10-06 20:40:44 +00:00
Christopher Ferris
7447a1ceea Update to v6.0 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.0

Test: Boots on coral.
Test: Bionic unit tests pass.
Change-Id: I282de83f23b432bef58214108a93700bdadddf0f
2022-10-05 16:58:32 -07:00
Elliott Hughes
de1df210bb Remove a mips-specific hack.
Rather than add risc-v to this map, let's just remove the map!

Test: treehugger
Change-Id: I118c74c61af95a96f8e31ae6e422619ed86c6a3b
2022-10-05 00:05:05 +00:00
Elliott Hughes
dc810a3c13 Remove unused variable.
Looks like we're not using this any more, so rather than add risc-v,
let's just remove this list.

Test: treehugger
Change-Id: I24bb22235c55d48c7dcbae94514ce8dcd03521c3
2022-10-04 20:21:20 +00:00
Treehugger Robot
4d974e29d5 Merge "Clarify the docs for updating kernel headers." 2022-10-03 18:00:52 +00:00
Elliott Hughes
93fb6b9459 Clarify the docs for updating kernel headers.
When I followed these instructions for risc-v, I mistakenly thought
that the auto-download option was a convenience that would get the
currently-approved headers, not the absolute latest. Make it clearer in
the documentation that this is for experts only, not for production.

Test: N/A
Change-Id: Iedce8ca0403b83e13bbe339cf343f85a37e99334
2022-10-01 15:29:37 +00:00
Elliott Hughes
5e7f8f116d Initial import of the risc-v uapi headers.
From external/kernel-headers.

Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: treehugger
Change-Id: Id73a86c9df77825853004137f8b801b24bba93f9
2022-10-01 15:10:58 +00:00
Elliott Hughes
05ef5d46c9 Add riscv64 to the list of uapi architectures.
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: Xia Lifang <lifang_xia@linux.alibaba.com>
Signed-off-by: Chen Guoyin <chenguoyin.cgy@linux.alibaba.com>
Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
Signed-off-by: Lu Xufan <luxufan@iscas.ac.cn>
Test: bionic/libc/kernel/tools/generate_uapi_headers.sh
Change-Id: I926e1ceaab78b1bb9ae00cf39eb14005aae38e48
2022-09-30 21:37:57 +00:00
Christopher Ferris
80ae69d11e Update to v5.19 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.19

Test: Builds on coral.
Test: All bionic unit tests pass on a coral device.
Test: Able to log in to wembley system.
Change-Id: I6fa6f6edb59f2cef990a7ba96877d9f2d3974c62
2022-08-10 12:58:45 -07:00
Christopher Ferris
3fc4e11607 Add support for removing structs that cross blocks.
The latest kernel has a struct that needs to be removed,
but the struct crosses blocks. Add support for removing a
struct that does cross blocks. This support is very primitive,
and will not parse any really complicated struct that uses
defines in complicated ways.

Combine the kernel_structs_to_remove and kernel_struct_replacements
structure into a single map. This allows marking a structure
to be removed as replaced with an #include <bits/STRUCT.h>.

The new support for the remove of structures is all in the
removeStructs function.

Raise an exception if the struct parsing does not work properly.

Add new unit tests for all of the new code.

In addition, fix the algorithm for deleting the uapi directory
before it gets updated. A new file BUILD was checking in that
directory, so delete everything in the directory except that
BUILD file.

Test: Unit tests pass.
Test: Running update_all.py results in the no unexpected changes.
Change-Id: I9a8cef0321beaf71d03b5b874327747a7edb6119
2022-08-09 17:49:31 -07:00
Christopher Ferris
e0cb4e1094 Fix old python2 test issue.
The map function returns a list in python2, but not in python3.
Force the test in cpp.py get_blocks() function to return a list.

Test: All cpp.py unit tests pass.
Change-Id: I1a63b92ac6cdb785830846fbd7e726eca7520e96
2022-08-05 12:59:05 -07:00
Spandan Das
3523e8e393 Declare libc's contributions to API surface(s) in Multi-tree
As part of go/multitree-design, build dependencies between API domains
must be via stable API surfaces. The contributions to the API surfaces
will be declared in BUILD files so that we can skip the
migration from Soong->Bazel entirely for this (go/multi-tree-api-export)

libc is one such component of the system API domain that contributes to
the public API surface. This CL declares libc's contributions (its
headers/.map.txt/other_metadata). These BUILD files were generated
manually by looking at existing Android.bp files.

Test: STANDALONE_BAZEL=1 tools/bazel cquery
//bionic/libc:libc_contributions --output=starlark
--starlark:expr="providers(target).get(\"//build/bazel/rules/apis:cc_api_contribution.bzl%CcApiContributionInfo\")"
2>/dev/null | less

Change-Id: If2a429b782651872fd6d8bf8c291439fdf838d85
2022-06-29 20:40:11 +00:00
Christopher Ferris
10a76e674d Update to v5.18 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.18

The file bionic/libc/kernel/uapi/linux/android/binder.h had a bug
in the original 5.18 kernel headers. This was fixed upstream, so
add a comment to the structure but leave the incorrect field the
same as the 5.17 kernel headers.

Bug: 234125620

Test: Builds.
Test: All bionic unit tests pass on a coral device.
Test: Able to log in to wembley system.
Change-Id: Ia72cafbe71fd894c599e15aa5334d7bbcbe74778
2022-06-08 13:31:52 -07:00
Greg Kaiser
55b5639cca Revert "Update to v5.18 kernel headers."
Revert "Update to v5.18 kernel headers."

Revert submission 2106847-kernel_update

Reason for revert: b/234125620
Reverted Changes:
I5844ca1fc:Update to v5.18 kernel headers.
I5700813ee:Update to v5.18 kernel headers.
Bug: 234125620

Change-Id: I07a39aa9c01939455b5a2a9da5fc04be497ca399
2022-05-27 20:41:14 +00:00
Christopher Ferris
5d3679612f Update to v5.18 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.18

Test: Builds.
Test: All bionic unit tests pass on a coral device.
Change-Id: I5700813eec0fb0db55bee4d75b129400b7a239bd
2022-05-25 14:30:25 -07:00
Christopher Ferris
9dfa2e55ed Set VIDEO_MAX_FRAME value back to 64.
This value was changed from 64 to 32, but it really should not
have gone down. So fixing back to 64 manually, and then the
next kernel header update should remove the comment but leave
the value unchanged.

Bug: 228783882

Test: Compiles.
Change-Id: I2d81d7bc76fcaa905dce0abb094d61d02c481a5e
2022-04-21 10:42:09 -07:00
Christopher Ferris
1ed5534657 Update to v5.17 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.17

Test: Boots on a flame and all bionic unit tests pass.
Change-Id: I7057d7308241f3acfa600597d287994c39ababbc
2022-03-22 16:48:40 -07:00
Christopher Ferris
a479261feb Update to v5.16 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.16

Test: Builds and bionic unit tests pass.
Change-Id: I2522c4f2a0efb9f8a193e1f2d65868e478217502
2022-01-10 13:51:15 -08:00
Christopher Ferris
2abfa9e4f8 Update to v5.15 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.15

Test: Builds, and ran bionic unit tests on flame.
Change-Id: I86901ea6d89fb0f7384b90a47bef35d194083c24
2021-11-02 15:53:58 -07:00