diff --git a/0001-not-use-gettimeofday-in-random-id.patch b/0001-not-use-gettimeofday-in-random-id.patch new file mode 100644 index 0000000000000000000000000000000000000000..305823f972e6c16ea922a4603a4ab26578df676f --- /dev/null +++ b/0001-not-use-gettimeofday-in-random-id.patch @@ -0,0 +1,35 @@ +Date: Tue, 17 Dec 2019 17:29:16 +0800 +--- + resolv/res_mkquery.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c +index 213abeef..7ba40640 100644 +--- a/resolv/res_mkquery.c ++++ b/resolv/res_mkquery.c +@@ -95,6 +95,7 @@ + + #include + #include ++#include + #if HP_TIMING_AVAIL + # define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; } + #endif +@@ -124,9 +125,12 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname, + #ifdef RANDOM_BITS + RANDOM_BITS (randombits); + #else +- struct timeval tv; +- __gettimeofday (&tv, NULL); +- randombits = (tv.tv_sec << 8) ^ tv.tv_usec; ++ struct timespec tv; ++ clock_gettime (CLOCK_MONOTONIC, &tv); ++ /* Shuffle the lower bits to minimize the clock bias. */ ++ uint32_t ret = tv.tv_nsec ^ tv.tv_sec; ++ ret ^= (ret << 24) | (ret >> 8); ++ randombits = ret; + #endif + + hp->id = randombits; +-- +2.19.1 \ No newline at end of file diff --git a/glibc.spec b/glibc.spec index 9ecc6cf6555bdbe1b7d15d4bd0f31c2bd9783122..bbe0e80161402af0b54924409695a819c428967e 100644 --- a/glibc.spec +++ b/glibc.spec @@ -59,7 +59,7 @@ ############################################################################## Name: glibc Version: 2.28 -Release: 32 +Release: 33 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -73,6 +73,8 @@ Source5: glibc-bench-compare Source6: LicenseList Source7: LanguageList +Patch6000: 0001-not-use-gettimeofday-in-random-id.patch + Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext @@ -912,6 +914,12 @@ fi %changelog +* Tue Mar 10 2020 majun - 2.28-33 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: not use gettimeofday in random id + * Wed Feb 26 2020 Wang Shuo - 2.28-32 - Type:bugfix - ID:NA