Commit graph

2162 commits

Author SHA1 Message Date
Elliott Hughes
45d99c06be Merge "Use in_addr in ip_mreq_source and ip_msfilter." 2017-12-14 20:40:39 +00:00
Elliott Hughes
64f355ffbd Use in_addr in ip_mreq_source and ip_msfilter.
This adds a new mechanism to say "replace struct S with #include <bits/S.h>".

Also switch epoll_event over to the new mechanism.

Also use the kernel's struct sockaddr_storage directly rather than behind
an unnecessary #define.

This patch also removes some dead code in the header scrubber. This code
still needs rewriting completely. I learned that a "block" isn't necessarily
a single struct definition, say; it might be a run of them. It seems like
a block is a run of preprocessor directives or a run of regular code.

Bug: https://issuetracker.google.com/36987220
Test: new test
Change-Id: Ic6a5c09559766a4babe3cd4c3ea538b885e07308
2017-12-14 10:07:27 -08:00
Elliott Hughes
79b13b9e0e Explicitly disable the Mac build.
Bug: N/A
Test: N/A
Change-Id: Ib188cf9ada5b4e801d6f1c7e58a9a474f96a16f0
2017-12-13 16:08:38 -08:00
Treehugger Robot
3ba327198a Merge "Test POSIX 1003.1 2016 chapter 13 "Headers"." 2017-12-13 22:42:23 +00:00
Elliott Hughes
21b56ebbd4 Test POSIX 1003.1 2016 chapter 13 "Headers".
And fix one thing that this found: apparently <stdlib.h> should also
make the various *WAIT* macros available.

Bug: N/A
Test: builds
Change-Id: Id879bf3c1bddd1170261a809e7280150a74d6b3d
2017-12-13 09:01:35 -08:00
Elliott Hughes
bf9cb9e404 More scanf cleanup.
Merge CT_CCL and CT_STRING handling before we add %m.

Also fix an accidental scanf/wscanf difference.

Add currently-disabled tests for questionable behavior noticed during
code review that isn't a regression, but should be fixed later.

Bug: http://b/68672236
Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202240
Test: ran tests
Change-Id: I3eec9b7dfce84f63c68426406224822c52551d64
2017-12-12 17:10:51 -08:00
dimitry
965d06da1e Fix logic in loading dependencies crossing namespace boundaries
This change addresses multiple problems introduced by
02586a2a34

1. In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.

2. In the case where load_tasks includes libraries from 3 and more
namespaces it results in incorrect linking of libraries shared between
second and third/forth and so on namespaces.

The root cause of these problems was recursive call to find_libraries.
It does not do what it is expected to do. It does not form new load_tasks
list and immediately jumps to linking local_group. Not only this skips
reference counting it also will include unlinked but accessible library
from third (and fourth and fifth) namespaces in invalid local group. The
best case scenario here is that for 3 or more namesapces this will
fail to link. The worse case scenario it will link the library
incorrectly with will lead to very hard to catch bugs.

This change removes recursive call and replaces it with explicit list of
local_groups which should be linked. It also revisits the way we do
reference counting - with this change the reference counts are updated after
after libraries are successfully loaded.

Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.

Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: Iea25ced181a98c6503cce6e2b832c91d697342d5
2017-12-10 22:04:55 +01:00
Elliott Hughes
d351581aa9 Merge "Add a few missing <time.h> tests." 2017-12-09 00:08:03 +00:00
Elliott Hughes
066d5ec4a1 Merge "Add sscanf %[ tests and fix the bug that fell out." 2017-12-09 00:07:59 +00:00
Elliott Hughes
b787c6fe4b Merge "A few new bionic tests." 2017-12-09 00:07:52 +00:00
Elliott Hughes
5a29d541fc Add a few missing <time.h> tests.
Bug: N/A
Test: ran tests
Change-Id: I0c1a17503eaceedac39320efa704313384c5b7be
2017-12-07 16:05:57 -08:00
Aleksandra Tsvetkova
608b4514cb A few new bionic tests.
Trivial tests for <alloca.h> and <byteswap.h>, plus slightly improved
test coverage for <inttypes.h> and <stdlib.h>.

Bug: N/A
Test: ran tests
Change-Id: Idac4141ffc760c4f7756332477ce5112950d61a5
Signed-off-by: Aleksandra Tsvetkova <aleksandra.tsvetkova@intel.com>
2017-12-07 15:44:20 -08:00
Elliott Hughes
0d3ba1f047 Add sscanf %[ tests and fix the bug that fell out.
Strictly, POSIX says "If a '-' is in the scanlist and is not the first
wide character, nor the second where the first wide character is a '^',
nor the last wide character, the behavior is implementation-defined",
but it seems unreasonable for swscanf to interpret `a-c` differently
from sscanf. Make ours behave the same as each other by making swscanf
work the same as sscanf.

Bug: http://b/68672236
Test: ran tests
Change-Id: Ia84805897628d7128e901b468e02504373730e61
2017-12-07 14:13:57 -08:00
Elliott Hughes
1d318329a7 Merge "Make our fortify FD_ISSET const, and expose the fd_mask type."
am: c1f6219c32

Change-Id: Iee9d523a0802c7ce2ebe309c503e324ef7cec7c7
2017-12-05 17:37:21 +00:00
Elliott Hughes
a6714d106b Make our fortify FD_ISSET const, and expose the fd_mask type.
Bug: http://b/70171464
Test: ran tests
Change-Id: Ifbee29d9888ce7cf76b99844dd9700128256a486
2017-12-04 14:16:38 -08:00
Elliott Hughes
ff2c21a098 Merge "Fix posix_spawn signal defaulting."
am: 27d4977f1f

Change-Id: Id963439eec57521ad2192fb99ac983aae02d6394
2017-11-30 16:38:27 +00:00
Elliott Hughes
f3fc8dc2ca Merge "Break up clock_getcpuclockid tests."
am: 9fd5626507

Change-Id: Ia5a0ccf404db96f5222e76d4d75f270ba791bc51
2017-11-30 16:36:54 +00:00
Elliott Hughes
27d4977f1f Merge "Fix posix_spawn signal defaulting." 2017-11-30 16:35:21 +00:00
Elliott Hughes
9fd5626507 Merge "Break up clock_getcpuclockid tests." 2017-11-30 16:31:35 +00:00
Elliott Hughes
7bfacaabf2 Fix posix_spawn signal defaulting.
Add a new stress test, and fix the code to pass it. We need to ensure that
we reset signal handlers for caught signals before unblocking signals in
the child, we need to ensure that this happens even if you haven't passed
a pthread_spawn_attr_t, and we need to ensure that this happens if you
pass in an empty sigdefault set.

Bug: http://b/68707996
Test: ran tests
Change-Id: I348e9b17b1bdf221591da42c0ada133d98471d66
2017-11-29 18:36:38 -08:00
Elliott Hughes
b441359be7 Break up clock_getcpuclockid tests.
Bug: http://b/69569394
Test: ran tests
Change-Id: If273cf8162e7d10aa4aa037181aefea6533a3487
2017-11-29 18:20:25 -08:00
Yabin Cui
92ce17f63e Merge "Remove timeout signal in ptrace test."
am: bd6a5e0f70

Change-Id: I484dbfdde61383e472a026c6ae40ab1646f17422
2017-11-29 22:06:48 +00:00
Yabin Cui
bd6a5e0f70 Merge "Remove timeout signal in ptrace test." 2017-11-29 21:55:49 +00:00
Mark Salyzyn
dde6b60ded Merge "bionic: test: report kernel sha for clock_getcpuclockid failure"
am: 810802c1d0

Change-Id: I10df92f1200614a89353085aff3a083a525b333d
2017-11-29 19:34:36 +00:00
Elliott Hughes
65ba81b4e8 Merge "Revert "Fix bug with double unload on unsuccessful dlopen""
am: 4eb332439a

Change-Id: I21ba611931b2e5794ef49cae9bcafc8748ebe804
2017-11-29 19:34:10 +00:00
Treehugger Robot
810802c1d0 Merge "bionic: test: report kernel sha for clock_getcpuclockid failure" 2017-11-29 19:19:29 +00:00
Elliott Hughes
4eb332439a Merge "Revert "Fix bug with double unload on unsuccessful dlopen"" 2017-11-29 19:16:33 +00:00
Yabin Cui
143b454ae5 Remove timeout signal in ptrace test.
Bionic gtest runner kills a test when it runs over 90s, so there
is no need to use timeout signal in ptrace test.

Bug: http://b/69525592
Test: run bionic-unit-tests.
Change-Id: I767b81a412724ee40fb0f031103a1f05bd7358c4
2017-11-29 11:05:57 -08:00
Elliott Hughes
27f1806b90 Revert "Fix bug with double unload on unsuccessful dlopen"
This reverts commit 58554ccb8a.

causes /vendor/bin/qseecomd to hit the new abort:

[    8.983301] c5    603 DEBUG: Abort message: 'soinfo=0x7147894cd0 is not in soinfo_list (double unload?)'

Bug: http://b/69909887
Bug: http://b/69787209
Change-Id: Ied38f797e0a071a1acc5ed41adf1b45e855143c7
2017-11-29 18:48:33 +00:00
Dimitry Ivanov
f1e645c67b Merge "Fix bug with double unload on unsuccessful dlopen"
am: dc89324e93

Change-Id: Ibff72e8a13cdc737d950dc71f2612fc99740109f
2017-11-29 09:37:01 +00:00
Dimitry Ivanov
dc89324e93 Merge "Fix bug with double unload on unsuccessful dlopen" 2017-11-29 09:29:34 +00:00
Elliott Hughes
cdfc8c1ff4 Merge "Fix Mac build."
am: c6097b0f9f

Change-Id: Idceb5a06770b5ed0b2ca175e0badbaf6168e580b
2017-11-29 04:28:09 +00:00
Elliott Hughes
4af70b4e15 Fix Mac build.
Bug: N/A
Test: builds
Change-Id: I98e44bc7ec2534443a1973aacf4bb97853b3a51f
2017-11-28 18:02:16 -08:00
Elliott Hughes
f2a2e41823 Merge "Always wrap waitpid in TEMP_FAILURE_RETRY."
am: 0a25aa60a2

Change-Id: I868173901e178d7fa73bf8128429f83c33232448
2017-11-29 00:30:56 +00:00
Mark Salyzyn
71b81a2bb2 bionic: test: report kernel sha for clock_getcpuclockid failure
For aarch64 only.

Once we activate support for vdso call for clock_getres, we also will
have to deal with kernel bugs in the implementation. If the kernel is
prior to the vdso unification of arm, aarch64 and aarch32, estimated
to land in 4.15, then the assembler implementation for aarch64 will
need two upstream kernel fixes e1b6b6ce and c80ed088. We report the
required url for the upstream kernel fixes upon test failure.

Test: bionic-unit-tests --gtest_filter=time.*
Bug: 20045882
Bug: 63737556
Bug: 69626243
Change-Id: Id93056f432491679e349545cbd1d682074634c58
2017-11-28 14:09:09 -08:00
Elliott Hughes
cabc77f917 Always wrap waitpid in TEMP_FAILURE_RETRY.
Strictly not needed in the WNOHANG case, but it's probably best to have
every waitpid wrapped for future copy & pasters.

Bug: https://issuetracker.google.com/69525592
Test: ran tests
Change-Id: I013b0a52d2753e3d32638e9b84c79af7327fb405
2017-11-28 12:55:19 -08:00
dimitry
58554ccb8a Fix bug with double unload on unsuccessful dlopen
In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.

Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.

Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: I886787ee021b050667f967bce7aa2708390886ea
2017-11-28 21:47:01 +01:00
Mark Salyzyn
4ef1ab7d4d Merge "bionic: test: add clock_getres"
am: 26b80da44a

Change-Id: I592828ac6f6ed0e38a487ea44f328f9c5498f052
2017-11-28 19:14:03 +00:00
Treehugger Robot
26b80da44a Merge "bionic: test: add clock_getres" 2017-11-28 19:05:18 +00:00
Jiyong Park
9a051ec31a Merge "Fix: dl#disable_ld_config_file"
am: f5a6fd2001

Change-Id: I6edd4db7064b96ff0bbcbca562e841e94404ba50
2017-11-28 09:42:30 +00:00
Jiyong Park
9828386bd4 Fix: dl#disable_ld_config_file
linker now quits with exit(1) instead of abort().
This is a leftover of
https://android-review.googlesource.com/c/platform/bionic/+/497893

Bug: 69635156
Test: run dl#disable_ld_config_file in a user build
Change-Id: If65c50805ffe89a601f4a9bfc1c6f0bb8dc16b77
2017-11-28 13:37:03 +09:00
Mark Salyzyn
6a5a99faf3 bionic: test: add clock_getres
Add clock_getres test combinations. Add clock_gettime_unknown test
to ensure the errno is propagated correctly for that call as well.

Test: bionic-unit-tests --gtest_filter=time.*
Bug: 63737556
Bug: 69626243
Change-Id: I0256b7f03ac7e57bc5b36069b13fe576c29b9c75
2017-11-27 20:36:41 -08:00
Yabin Cui
0c0fd96f1d Merge "Improve pty unit test to catch the bug more easily."
am: 8fb8c61e48

Change-Id: If75ed98331b3205ce053f07ec242c566a272ed18
2017-11-22 18:03:28 +00:00
Yabin Cui
8fb8c61e48 Merge "Improve pty unit test to catch the bug more easily." 2017-11-22 17:58:56 +00:00
Yabin Cui
57a4006c10 Improve pty unit test to catch the bug more easily.
Bug: http://b/69260651
Test: run bionic-unit-tests.

Change-Id: Ifb89cc2952508b6e5a093c57053fb93cb61cd28c
2017-11-21 18:04:15 -08:00
Yabin Cui
6c7651f380 Merge "Fix support for typed tests and parameterized tests."
am: f40402a39f

Change-Id: I22d108267a6de4fb8d92cb9e53557de7691f3f0f
2017-11-17 02:54:34 +00:00
Treehugger Robot
f40402a39f Merge "Fix support for typed tests and parameterized tests." 2017-11-17 02:40:35 +00:00
Chih-Hung Hsieh
c24a5b12ed Merge "Use -Werror in bionic/tests"
am: e070051254

Change-Id: I0185c176163b05792d17d613d02551939b67c955
2017-11-17 00:26:21 +00:00
Yabin Cui
5e235c85bb Fix support for typed tests and parameterized tests.
Bug: http://b/69425095
Test: run bionic_unit_tests --bionic-selftest
Change-Id: Ifa23288f2ad84978b7748da0ea93d650fae926a8
2017-11-16 16:20:28 -08:00
Treehugger Robot
e070051254 Merge "Use -Werror in bionic/tests" 2017-11-17 00:19:33 +00:00