Commit graph

4971 commits

Author SHA1 Message Date
Elliott Hughes
d3e64a3f40 Add x86_64 to the bionic headers.
Manual changes:

  cpp.py: cope with macros that refer to other macros.

  defaults.py: x86 no longer always implies __i386__; use __i386__ to replace
  the kernel CONFIG_X86_32 flag.

  asm/page.h: the upstream page.h isn't a uapi header and no longer includes
  the stuff we were using it for. Let's just have our own static file, since
  it's the same for all our architectures (both 32- and 64-bit).

  sys/select.h: we used to use the various FD_SET-related macros from the
  kernel header files, but they've gone. Adjust by adding trivial equivalent
  definitions.

Automated changes:

  libc/kernel/arch-x86, libc/kernel/common: regenerated from
  external/kernel-headers.

Change-Id: I84fc0ed52dc742e043b4ae300fd3b58ee99b7fcd
2013-09-30 18:42:13 -07:00
Elliott Hughes
76218efbeb Merge "Fix inttypes.h and stdint.h for 64-bit (and C++11)." 2013-09-30 21:53:06 +00:00
Elliott Hughes
a9a02acc9f Fix inttypes.h and stdint.h for 64-bit (and C++11).
Change-Id: I394630348413c9aafcac137ce1ca5f0a93d9ab6f
2013-09-30 14:46:47 -07:00
Elliott Hughes
4d016c6a83 Merge "Upgrade to tzcode2013f plus Android modifications (from tzcode2013d plus Android modifications)." 2013-09-27 22:38:45 +00:00
Nick Kralevich
6aed6077fb Merge "Fix unnecessary call to __strncpy_chk2" 2013-09-27 22:13:19 +00:00
Nick Kralevich
d13c2b1ba6 Fix unnecessary call to __strncpy_chk2
If "n" is smaller than the size of "src", then we'll
never read off the end of src. It makes no sense to call
__strncpy_chk2 in those circumstances.

For example, consider the following code:

int main() {
  char src[10];
  char dst[5];
  memcpy(src, "0123456789", sizeof(src));
  strncpy(dst, src, sizeof(dst));
  dst[4] = '\0';
  printf("%s\n", dst);
  return 0;
}

In this code, it's clear that the strncpy will never read off
the end of src.

Change-Id: I9cf58857a0c5216b4576d21d3c1625e2913ccc03
2013-09-27 13:21:24 -07:00
Nick Kralevich
8427b7450f Merge "libc: fortify recvfrom()" 2013-09-27 16:05:44 +00:00
Elliott Hughes
e0d0b15de6 Upgrade to tzcode2013f plus Android modifications (from tzcode2013d plus Android modifications).
localtime.c and strftime.c are still quite different from upstream because of
our extensions, but the other files continue to be identical, and the two
exceptions should be otherwise identical.

From the tzcode2013e release notes:

  Changes affecting Godthab time stamps after 2037 if version mismatch

    Allow POSIX-like TZ strings where the transition time's hour can
    range from -167 through 167, instead of the POSIX-required 0
    through 24.  E.g., TZ='FJT-12FJST,M10.3.1/146,M1.3.4/75' for the
    new Fiji rules.  This is a more-compact way to represent
    far-future time stamps for America/Godthab, America/Santiago,
    Antarctica/Palmer, Asia/Gaza, Asia/Hebron, Asia/Jerusalem,
    Pacific/Easter, and Pacific/Fiji.  Other zones are unaffected by
    this change.  (Derived from a suggestion by Arthur David Olson.)

    Allow POSIX-like TZ strings where daylight saving time is in
    effect all year.  E.g., TZ='WART4WARST,J1/0,J365/25' for Western
    Argentina Summer Time all year.  This supports a more-compact way
    to represent the 2013d data for America/Argentina/San_Luis.
    Because of the change for San Luis noted above this change does not
    affect the current data.  (Thanks to Andrew Main (Zefram) for
    suggestions that improved this change.)

    Where these two TZ changes take effect, there is a minor extension
    to the tz file format in that it allows new values for the
    embedded TZ-format string, and the tz file format version number
    has therefore been increased from 2 to 3 as a precaution.
    Version-2-based client code should continue to work as before for
    all time stamps before 2038.  Existing version-2-based client code
    (tzcode, GNU/Linux, Solaris) has been tested on version-3-format
    files, and typically works in practice even for time stamps after
    2037; the only known exception is America/Godthab.

  Changes affecting API

    Support for floating-point time_t has been removed.
    It was always dicey, and POSIX no longer requires it.
    (Thanks to Eric Blake for suggesting to the POSIX committee to
    remove it, and thanks to Alan Barrett, Clive D.W. Feather, Andy
    Heninger, Arthur David Olson, and Alois Treindl, for reporting
    bugs and elucidating some of the corners of the old floating-point
    implementation.)

    The signatures of 'offtime', 'timeoff', and 'gtime' have been
    changed back to the old practice of using 'long' to represent UT
    offsets.  This had been inadvertently and mistakenly changed to
    'int_fast32_t'.  (Thanks to Christos Zoulos.)

    The code avoids undefined behavior on integer overflow in some
    more places, including gmtime, localtime, mktime and zdump.

  Changes affecting code internals

    Minor changes pacify GCC 4.7.3 and GCC 4.8.1.

  Changes affecting documentation and commentary

    Documentation and commentary is more careful to distinguish UT in
    general from UTC in particular.  (Thanks to Steve Allen.)

From the tzcode2013f release notes:

  Changes affecting API

    The types of the global variables 'timezone' and 'altzone' (if present)
    have been changed back to 'long'.  This is required for 'timezone'
    by POSIX, and for 'altzone' by common practice, e.g., Solaris 11.
    These variables were originally 'long' in the tz code, but were
    mistakenly changed to 'time_t' in 1987; nobody reported the
    incompatibility until now.  The difference matters on x32, where
    'long' is 32 bits and 'time_t' is 64.  (Thanks to Elliott Hughes.)

Change-Id: I14937c42a391ddb865e4d89f0783961bcc6baa21
2013-09-27 00:04:30 -07:00
Elliott Hughes
ad1244b2e7 Merge "Upgrade to tzdata2013f." 2013-09-27 06:30:00 +00:00
Elliott Hughes
4ced7ef05a Upgrade to tzdata2013f.
From the release notes:

  Changes affecting near-future time stamps

    Tocantins will very likely not observe DST starting this spring.
    (Thanks to Steffen Thorsen.)

    Jordan will likely stay at UTC+3 indefinitely, and will not fall
    back this fall.

    Palestine will fall back at 00:00, not 01:00.  (Thanks to Steffen Thorsen.)

Change-Id: Iccee57578eef2ab51c519a23f151bc1963262ffe
2013-09-26 23:22:23 -07:00
Elliott Hughes
abd4b2542b Merge "Upgrade to tzdata2013e." 2013-09-27 06:20:18 +00:00
Elliott Hughes
35b123ef1e Upgrade to tzdata2013e.
From the release notes:

  Changes affecting near-future time stamps

    This year Fiji will start DST on October 27, not October 20.
    (Thanks to David Wheeler for the heads-up.)  For now, guess that
    Fiji will continue to spring forward the Sunday before the fourth
    Monday in October.

  Changes affecting time stamps before 1970

    Pacific/Johnston is now a link to Pacific/Honolulu.  This corrects
    some errors before 1947.

    Some zones have been turned into links, when they differ from
    existing zones only in older data that was likely invented or that
    differs only in LMT or transition from LMT.  These changes affect
    only time stamps before 1943.  The affected zones are:
    Africa/Juba, America/Anguilla, America/Aruba, America/Dominica,
    America/Grenada, America/Guadeloupe, America/Marigot,
    America/Montserrat, America/St_Barthelemy, America/St_Kitts,
    America/St_Lucia, America/St_Thomas, America/St_Vincent,
    America/Tortola, and Europe/Vaduz.  (Thanks to Alois Treindl for
    confirming that the old Europe/Vaduz zone was wrong and the new
    link is better for WWII-era times.)

    Change Kingston Mean Time from -5:07:12 to -5:07:11.  This affects
    America/Cayman, America/Jamaica and America/Grand_Turk time stamps
    from 1890 to 1912.

    Change the UT offset of Bern Mean Time from 0:29:44 to 0:29:46.
    This affects Europe/Zurich time stamps from 1853 to 1894.  (Thanks
    to Alois Treindl).

    Change the date of the circa-1850 Zurich transition from 1849-09-12
    to 1853-07-16, overriding Shanks with data from Messerli about
    postal and telegraph time in Switzerland.

  Data changes affecting behavior of tzselect and similar programs

    Country code BQ is now called the more-common name "Caribbean Netherlands"
    rather than the more-official "Bonaire, St Eustatius & Saba".

    Remove from zone.tab the names America/Montreal, America/Shiprock,
    and Antarctica/South_Pole, as they are equivalent to existing
    same-country-code zones for post-1970 time stamps.  The data for
    these names are unchanged, so the names continue to work as before.

Change-Id: If78a517687532afcc0b22c7df664b5955f6e1564
2013-09-26 22:41:09 -07:00
Elliott Hughes
7b538021bd Merge "Make it easier to add syscalls for another architecture." 2013-09-26 15:59:33 +00:00
Elliott Hughes
d612165c67 Make it easier to add syscalls for another architecture.
Much of the per-architecture duplication can be removed, so let's do so
before we add the 64-bit architectures.

Change-Id: Ieb796503c8e5353ea38c3bab768bb9a690c9a767
2013-09-26 08:57:17 -07:00
Elliott Hughes
a1c1a3344d Merge "Add a unit test for %n." 2013-09-26 05:10:28 +00:00
Michael Wright
c612a133dc Merge "Update capability.h" 2013-09-25 23:29:32 +00:00
Michael Wright
8bd5aa6a76 Update capability.h
To upstream SHA 6e4664525b1db28f8c4e1130957f70a94c19213e (v3.11)

Change-Id: Ic0d95464bc9001246df898489b2ea603a97ca231
2013-09-25 14:55:55 -07:00
Elliott Hughes
7248a2d4d0 Add a unit test for %n.
Change-Id: I9335e089d66c98d34577f5e1d1a54b8f507b94f6
2013-09-24 18:01:33 -07:00
Nick Kralevich
60f4f9a5b9 libc: fortify recvfrom()
Fortify calls to recv() and recvfrom().

We use __bos0 to match glibc's behavior, and because I haven't
tested using __bos.

Change-Id: Iad6ae96551a89af17a9c347b80cdefcf2020c505
2013-09-24 16:45:01 -07:00
Elliott Hughes
759111cadf Merge "Simplify the SYSCALLS.TXT format." 2013-09-24 18:25:50 +00:00
Elliott Hughes
c8d98679fa Merge "Update taskstats.h from Linux 3.11.1" 2013-09-24 14:29:29 +00:00
Elliott Hughes
5e52279256 Simplify the SYSCALLS.TXT format.
This will make addition of new architectures less unpleasant.

Change-Id: I77c866a63b686e8e70709d08fcf52e8a2d37310a
2013-09-24 00:35:31 -07:00
Elliott Hughes
43e5baddbc Merge "Fix %hhd formats in the printf family." 2013-09-23 23:34:00 +00:00
Elliott Hughes
1d13c64d78 Fix %hhd formats in the printf family.
Found by adapting the simple unit tests for libc logging to test
snprintf too. Fix taken from upstream OpenBSD without updating
the rest of stdio.

Change-Id: Ie339a8e9393a36080147aae4d6665118e5d93647
2013-09-23 16:02:39 -07:00
Elliott Hughes
fc2ceae778 Merge "Remove two -D flags for unused macros." 2013-09-23 18:14:57 +00:00
Elliott Hughes
3f33165acd Remove two -D flags for unused macros.
Change-Id: Ia95b0f0e2003cadd875e84437afa1853c8fe2598
2013-09-23 11:12:09 -07:00
Sami Kyostila
50a1b776fd Update taskstats.h from Linux 3.11.1
Change-Id: I50853efe20fa2524f6288f78505a774a72071367
2013-09-23 11:01:59 +01:00
Christopher Ferris
c2de11d3a4 Merge "__memcpy_chk: Fix signed cmp of unsigned values." 2013-09-21 03:36:31 +00:00
Christopher Ferris
16e185c908 __memcpy_chk: Fix signed cmp of unsigned values.
I accidentally did a signed comparison of the size_t values passed in
for three of the _chk functions. Changing them to unsigned compares.

Add three new tests to verify this failure is fixed.

Bug: 10691831

Merge from internal master.

(cherry-picked from 883ef2499c)

Change-Id: Id9a96b549435f5d9b61dc132cf1082e0e30889f5
2013-09-20 20:12:09 -07:00
Christopher Ferris
ad999b6062 Merge "Fix all debug directives." 2013-09-21 02:41:54 +00:00
Christopher Ferris
a57c9c084b Fix all debug directives.
The backtrace when a fortify check failed was not correct. This change
adds all of the necessary directives to get a correct backtrace.

Fix the strcmp directives and change all labels to local labels.

Testing:
- Verify that the runtime can decode the stack for __memcpy_chk, __memset_chk,
  __strcpy_chk, __strcat_chk fortify failures.
- Verify that gdb can decode the stack properly when hitting a fortify check.
- Verify that the runtime can decode the stack for a seg fault for all of the
  _chk functions and for memcpy/memset.
- Verify that gdb can decode the stack for a seg fault for all of the _chk
  functions and for memcpy/memset.
- Verify that the runtime can decode the stack for a seg fault for strcmp.
- Verify that gdb can decode the stack for a seg fault in strcmp.

Bug: 10342460
Bug: 10345269

Merge from internal master.

(cherry-picked from 05332f2ce7)

Change-Id: Ibc919b117cfe72b9ae97e35bd48185477177c5ca
2013-09-20 18:59:58 -07:00
Christopher Ferris
7493568ba8 Merge "Update all debug directives." 2013-09-21 01:58:56 +00:00
Christopher Ferris
bd7fe1d3c4 Update all debug directives.
The libcorkscrew stack unwinder does not understand cfi directives,
so add .save directives so that it can function properly.

Also add the directives in to strcmp.S and fix a missing set of
directives in cortex-a9/memcpy_base.S.

Bug: 10345269

Merge from internal master.

(cherry-picked from 5f7ccea3ff)

Change-Id: If48a216203216a643807f5d61906015984987189
2013-09-20 13:49:38 -07:00
Nick Kralevich
bef76b54a6 Merge "Add linux/sock_diag.h" 2013-09-20 15:20:03 +00:00
Elliott Hughes
aad3c52e9d Merge "Ensure we have the off64_t variant of every function that takes an off_t." 2013-09-20 00:37:28 +00:00
Nick Kralevich
8470f01cca Add linux/sock_diag.h
This file was generated using bionic/libc/kernel/tools/update_all.py

Change-Id: Iad33e96253978ed9a76d429d66eed9f245685c10
2013-09-19 16:44:53 -07:00
Elliott Hughes
b4f7616fd6 Ensure we have the off64_t variant of every function that takes an off_t.
Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
2013-09-19 16:27:24 -07:00
Elliott Hughes
f8e71bac14 Merge "Add mmap64()" 2013-09-19 21:22:42 +00:00
Daniel Leung
afcc0cccda Add mmap64()
This adds mmap64() to bionic so that it is possible to have
large offset passed to kernel. However, the syscall mechanism
only passes 32-bit number to kernel. So effectively, the
largest offset that can be passed is about 43 bits (since
offset is signed, and the number passed to kernel is number
of pages (page size == 4K => 12 bits)).

Change-Id: Ib54f4e9b54acb6ef8b0324f3b89c9bc810b07281
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2013-09-19 14:11:26 -07:00
Elliott Hughes
d5ddf40ecf Merge "Fix host tests that need the shell." 2013-09-19 19:04:10 +00:00
Elliott Hughes
269851bf95 Merge "Declare __page_shift and __page_size with C linkage." 2013-09-19 19:03:19 +00:00
Bernhard Rosenkraenzer
9ae59c02ca Declare __page_shift and __page_size with C linkage.
__page_shift and __page_size were accidentally declared in unistd.h with
C linkage - their implementation needs to use the same linkage.

Going forward, though, let's stop the inlining madness and let's kill
the non-standard __getpageshift(). This patch takes getpagesize(3) out
of line and removes __getpageshift but fixes __page_shift and __page_size
for backwards binary compatibility.

Change-Id: I35ed66a08989ced1db422eb03e4d154a5d6b5bda
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
2013-09-19 11:55:36 -07:00
Elliott Hughes
a259472ca0 Merge "Fix mismatch between declaration and forward declaration" 2013-09-19 18:41:06 +00:00
Elliott Hughes
e60c4f0a6c Fix host tests that need the shell.
By making the /system/bin/sh available.

Change-Id: I99200c1ddc922a2f6b5cea8ff2da98aedbe70e7b
2013-09-19 11:28:20 -07:00
Elliott Hughes
045f311b0a Merge "Use $ANDROID_DATA and $ANDROID_ROOT to find the tzdata." 2013-09-19 18:19:00 +00:00
Elliott Hughes
cf178bf7d0 Use $ANDROID_DATA and $ANDROID_ROOT to find the tzdata.
This lets us run binaries linked against bionic on an x86 host.

Change-Id: Icd60cf99a90d747c77304c05b4f764e4d26af985
2013-09-19 11:17:42 -07:00
Nick Kralevich
814bbd521a Merge "Update netlink.h from tip-of-tree external/kernel-headers" 2013-09-19 04:04:07 +00:00
Elliott Hughes
4a509d898e Merge "Add bionic-unit-tests-run-on-host special target" 2013-09-19 02:16:00 +00:00
Pavel Chupin
f22fb68751 Add bionic-unit-tests-run-on-host special target
Allows running the tests linked with bionic .so on the host if host and
target are compatible. See more comments and usage limitation inlined.

make bionic-unit-tests-run-on-host should do build and run.

Change-Id: I5946fa72e009d324baa9da18f460294b3c1a615e
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2013-09-18 19:09:24 -07:00
Nick Kralevich
45e52faeb7 Update netlink.h from tip-of-tree external/kernel-headers
This file was generated using bionic/libc/kernel/tools/update_all.py

The only change is a new netlink.h file, from external/kernel-headers.
Please see the commit message there for details.

Change-Id: I83645b88f0baff838131197913ebd70be69abd3f
2013-09-18 17:14:02 -07:00