Commit graph

41210 commits

Author SHA1 Message Date
Elliott Hughes
f5b4e3ce58 Add %b/%B to async-safe logging.
Missed this when we added the new C23 binary output to the printf()
family.

Also fix %X to use "0X" instead of "0x" and add missing tests.

Test: used by new LD_SHOW_AUXV functionality
Change-Id: I6623b92acec7daf534536697de0f87352a2653ad
2023-08-23 14:08:40 -07:00
Kalesh Singh
00f5906754 bionic: CFIShadow: Remove use of PAGE_SIZE macro.
The alignment of kShadowSize to a page sized multiple is
not explicitly needed, since mmap() will return a page-sized
multiple mapping.

kCfiCheckAlign remains 4k as this is chosen by the clang
compiler. [1] [2]

[1] 3568976375/clang/lib/CodeGen/CGExpr.cpp (L3433)

[2] https://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#cfi-shadow

Bug: 296275298
Test: Boot 16kb device, check no cfi failures.
Test: atest -c bionic-unit-tests
Change-Id: Iac0c129c413afe01389f529f5c64051c4ffff2df
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-23 13:59:57 -07:00
Treehugger Robot
ce43c196d1 Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a am: c08ab40d9c am: 2f031ba684 am: 2bab8ce262 am: 22cc8ff2fd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: Id0ccdee3b33d0e510f5624acba66560b49b0457b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 18:08:20 +00:00
Treehugger Robot
22cc8ff2fd Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a am: c08ab40d9c am: 2f031ba684 am: 2bab8ce262
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: Ibc879c474cd94f6fdbafd6cf231a056c758b2740
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 17:12:02 +00:00
Treehugger Robot
2bab8ce262 Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a am: c08ab40d9c am: 2f031ba684
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: I110cbdfbcd742f4dbe64da011dc7534f13698adb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 16:43:32 +00:00
Treehugger Robot
2f031ba684 Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a am: c08ab40d9c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: Id362805712b98eb446de69e521720965a24b7084
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 16:05:05 +00:00
Treehugger Robot
c08ab40d9c Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: I68dd793cd66d062986c4750a1ae097b9d2e8a335
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 15:24:33 +00:00
Treehugger Robot
0398f8ab3a Merge "linker: add LD_SHOW_AUXV support." into main 2023-08-23 14:46:29 +00:00
Juan Yescas
304f21df3c Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18 am: 81fffa2108 am: 160ab18874 am: 1b8591f26d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I9d4ee180804a966c7964c5db7af68f52444a4a3f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 05:58:46 +00:00
Juan Yescas
1b8591f26d Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18 am: 81fffa2108 am: 160ab18874
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I5298f156a2cf30fdcbc2a5e58ab053304e05f1f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 05:11:14 +00:00
Juan Yescas
160ab18874 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18 am: 81fffa2108
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I9c7e97a3634f7dc8e0392e71da8189603eacc802
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 04:42:38 +00:00
Juan Yescas
81fffa2108 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I5fdf2faf162c8398b80749fc1e8c39a5a8ddb138
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 04:06:32 +00:00
Kalesh Singh
ac516c4239 Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0 am: 5c7512474e am: 9ac016c5df am: 542dc8ea3f am: f4fa351c9c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: I33f2ad296febef576d344601004c4d99ba249caa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 03:27:00 +00:00
Juan Yescas
6ffba3ea18 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: Ia6a079dc076482a42756b69b962984aba9f7a173
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 03:26:18 +00:00
Juan Yescas
fe690875d5 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main 2023-08-23 02:44:58 +00:00
Kalesh Singh
f4fa351c9c Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0 am: 5c7512474e am: 9ac016c5df am: 542dc8ea3f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: I4dc99bf0374924347ad09db0674915d9a3591ec4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 02:40:23 +00:00
Kalesh Singh
542dc8ea3f Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0 am: 5c7512474e am: 9ac016c5df
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: If505b579bc0e15b4153497383014cde283fa646a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 02:12:19 +00:00
Kalesh Singh
9ac016c5df Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0 am: 5c7512474e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: I5fc54937038715daa694b06b9b92edfc8cbd168c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 01:36:17 +00:00
Kalesh Singh
5c7512474e Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: Id6d3f0cd81258f4b0b1e351addaf8cc664fd65eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 00:56:50 +00:00
Kalesh Singh
8cd1ddcbf0 Merge "bionic: libc_init_static: Use page_size()" into main 2023-08-23 00:16:26 +00:00
Elliott Hughes
838dbacbfd linker: add LD_SHOW_AUXV support.
Yes, `od -t d8 /proc/self/auxv` is clever:
```
$ adb shell od -t d8 /proc/self/auxv
0000000                      33            488593047552
0000020                      51                    4720
0000040                      16                 1155071
0000060                       6                    4096
0000100                      17                     100
0000120                       3            375971917888
0000140                       4                      56
0000160                       5                      12
0000200                       7            488593051648
0000220                       8                       0
0000240                       9            375972184064
0000260                      11                       0
0000300                      12                       0
0000320                      13                       0
0000340                      14                       0
0000360                      23                       0
0000400                      25            549220780840
0000420                      26                       0
0000440                      31            549220786153
0000460                      15            549220780856
0000500                       0                       0
0000520
$
```
But this is a lot easier to read:
```
$ adb shell LD_SHOW_AUXV=1 date
AT_SYSINFO_EHDR      0x7065010000
AT_MINSIGSTKSZ       4720
AT_HWCAP             0b100011001111111111111
AT_PAGESZ            4096
AT_CLKTCK            100
AT_PHDR              0x5c79d60040
AT_PHENT             56
AT_PHNUM             12
AT_BASE              0x7065011000
AT_FLAGS             0
AT_ENTRY             0x5c79da1000
AT_UID               0
AT_EUID              0
AT_GID               0
AT_EGID              0
AT_SECURE            0
AT_RANDOM            0x7ff814eb98
AT_HWCAP2            0
AT_EXECFN            "/system/bin/date"
AT_PLATFORM          "aarch64"
Tue Aug 22 20:43:22 GMT 2023
```

Test: adb shell LD_SHOW_AUXV=1 date
Change-Id: I51c4e8cbb799eb1dc360c9417cc6f82bebdcda73
2023-08-22 14:25:01 -07:00
Treehugger Robot
44f2404296 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d am: 1882061f69 am: ca3bdafdd4 am: 628c6925e0 am: 6ed3136d47
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: I204f541caff1a602758e1a019f7f04c7b9ee4e55
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 21:14:19 +00:00
Treehugger Robot
6ed3136d47 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d am: 1882061f69 am: ca3bdafdd4 am: 628c6925e0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: Ib6275ebb6da1f42ad5ce52932f15f91d70cba9b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 20:27:05 +00:00
Juan Yescas
8d3866bacb bionic: Set PTHREAD_STACK_MIN for page agnostic targets
Page size agnostic targets will have a pthread stack equals
to 65536. Page size agnostic targets will only support ARM64 arch.

For not agnostic builds, PTHREAD_STACK_MIN will remain the same.

Bug: 296907948
Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m

      source build/envsetup.sh
      aosp_cf_x86_64_phone-userdebug
      m

Change-Id: Ifcc04a9d924501f686cdfec34428d3f29154fdf0
2023-08-22 20:04:13 +00:00
Treehugger Robot
628c6925e0 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d am: 1882061f69 am: ca3bdafdd4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: I8df4e0c516510fb8529b90e435468033d3c00c4d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 20:00:21 +00:00
Treehugger Robot
ca3bdafdd4 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d am: 1882061f69
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: I1988355fdcb36019a49cb1f2236f79ab8e50bcd2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 19:23:53 +00:00
Treehugger Robot
1882061f69 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: Ia6249f73cbc0072fd93e4527b15ed7737675b5ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:44:57 +00:00
Treehugger Robot
9fd0f4b90d Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main 2023-08-22 18:21:22 +00:00
Treehugger Robot
1611e0ee52 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441 am: 0fee718de7 am: fdbfa3c887 am: ebec2073e5 am: 668cee3bb2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: I78e107a567a085455345092a36cba9962601d844
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:10:02 +00:00
Juan Yescas
9e24def386 Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c am: c48775c9fa am: 94f8520923 am: 83395bc0c3 am: 31a450554d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: I41be7b98903fd23e2ae3c9f5763c4cbf2e95b90e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:09:37 +00:00
Elliott Hughes
8c4e1adab2 Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38 am: c512636d31 am: 96591865e3 am: b889ba04ca am: 28765348af
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: I4010768df4e17016fa731f8ba7451f752464177f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:08:30 +00:00
Treehugger Robot
668cee3bb2 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441 am: 0fee718de7 am: fdbfa3c887 am: ebec2073e5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: If5b57892e195ca0df7b5c49bbce41aac5d4ed65d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 17:22:35 +00:00
Juan Yescas
31a450554d Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c am: c48775c9fa am: 94f8520923 am: 83395bc0c3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: I250159fc6a291c3f9b9fb3cda11470f92e70c76e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 17:22:23 +00:00
Elliott Hughes
28765348af Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38 am: c512636d31 am: 96591865e3 am: b889ba04ca
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: I00e555e7a6e3c1cc6a6a8c2cacc90e75cbd0cf85
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 17:21:24 +00:00
Treehugger Robot
ebec2073e5 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441 am: 0fee718de7 am: fdbfa3c887
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: I62a6216ef25689600cbe90eca93c1783f8009b46
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:55:03 +00:00
Juan Yescas
83395bc0c3 Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c am: c48775c9fa am: 94f8520923
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: Ie810cb6b31cfe0ba194962245118a30d4251ce0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:54:52 +00:00
Elliott Hughes
b889ba04ca Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38 am: c512636d31 am: 96591865e3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: Ieaec3a17b013418880ab3952bfccad7d3e9473f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:54:37 +00:00
Treehugger Robot
fdbfa3c887 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441 am: 0fee718de7
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: Ifd98e695b6aa7ce9a91601b04cf260d1d5284973
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:18:25 +00:00
Juan Yescas
94f8520923 Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c am: c48775c9fa
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: I5335fae1d3d91b6e5d57d9f6f1db3a81281564e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:18:14 +00:00
Elliott Hughes
96591865e3 Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38 am: c512636d31
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: I7d756e7da09eb504c00d722c2804896c24c730be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 16:18:01 +00:00
Treehugger Robot
0fee718de7 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: I1b994a05c71f8c1e0d7931dd7da44b94afa51664
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 15:40:35 +00:00
Juan Yescas
c48775c9fa Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: I9aabd3e94563154d1fd1ccb04a66f8f8e5ec3c46
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 15:40:22 +00:00
Elliott Hughes
c512636d31 Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: I8db701b3fefd4bbe79918864aa83de5556dab000
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 15:38:36 +00:00
Elliott Hughes
1245abf7e3 <sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>.
If we're going to need PAGE_SIZE in other places, we don't want the
namespace pollution of pulling in all of <sys/user.h>. (The experimental
support for non-4KiB pages found an existing place -- <pthread.h> --
where we were assuming PAGE_SIZE is already available, as if
<sys/user.h> has already been included, so that was actually an existing
bug.)

Test: treehugger
Change-Id: Icd90ffbca1f2cf3645fadb2e432f6f45a4d63eb6
2023-08-22 15:31:51 +00:00
Treehugger Robot
d4c9419441 Merge "riscv64: increase jmp_buf size." into main 2023-08-22 15:23:43 +00:00
Juan Yescas
ac587f827c Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main 2023-08-22 15:22:44 +00:00
Elliott Hughes
d53ad05e38 Merge "riscv64: fix ifuncs, improve the ifunc tests." into main 2023-08-22 14:55:28 +00:00
Juan Yescas
3649db34a1 bionic: Use max_page_size() instead of PAGE_SIZE
Android V will support page size agnostic targets. The bionic macro
PAGE_SIZE won't be defined for the agnostic targets.

The PAGE_SIZE macro will be replaced by max_page_size() instead.

- For not agnostic builds, max_page_size() will be replaced by 4096.
- For agnostic builds, it will  be replaced by 16384

Bug: 296907948
Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m

      source build/envsetup.sh
      aosp_cf_x86_64_phone-userdebug
      m

Change-Id: I81731a2ec59decd19ab9fd714d4f2ac20df873b7
2023-08-22 05:34:55 +00:00
Kalesh Singh
183f58bb2a bionic: libc_init_static: Use page_size()
Use the real page size from getauxval() for memtag stack
MTE protection.

Bug: 296275298
Test: atest -c bionic-unit-tests
Change-Id: I1711291b918b09e5464f1d15358dd1ff7fa2f371
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-21 16:55:41 -07:00
Ryan Prichard
01eef7f0dc Merge "linker_main: acquire loader lock earlier and release it later" into main am: e722c756a5 am: a11ce307e9 am: f6da9dc129 am: c810696404 am: e396b28dbd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2717362

Change-Id: Ic93f2d2624e24496b770db2917162ed0974a2987
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-21 23:27:39 +00:00