Hi,
Attached is the updated patch against 1.0.41 release. This takes care of
the following.
Explicitly include stdint header as logic uses INT[64]_MAX, just
in case for future, even though the chain of headers from existing
includes brings in the definition indirectly as of now.
Cross check for time gap between prngplus reseeding, periodically,
has the internal state is being consumed, so that if there is too
much time gap, then prng reseeding can be forced, before the normal
reseed window is reached. This is useful for long running programs
which trigger dns queries only intermittently.
If clock_gettime is not available, then reseed more frequently, by
default. A platform developer may change the reseed frequence, to
be bit more less often in this case, if needed, by tweaking the
defines in the source.
--
Keep ;-)
HanishKVC
Hi,
This is a small update to the dynamic dns query id patch, to take care of
the below two aspects.
Explicitly include stdint header as the logic uses INT64_MAX, just in case
for future, even though the chain of headers from existing includes brings
in the definition indirectly as of now.
Cross check for time gap between prngplus reseeding, periodically, has the
internal state is being consumed, so that if there is too much time gap,
then prng reseeding can be forced, before the normal
reseed window is reached. This is useful for long running programs which
trigger dns queries only intermittently.
--
Keep ;-)
HanishKVC
Hi,
If no one has any specific issues, with the latest dynamic DNS query id
related patch? it may be useful to apply the same and make a new release.
As it resolves a security concern, to an extent.
Based on my experience with embedded systems over the years, I have tried
to ensure that the patch can be configured for use with different kinds of
embedded systems, with different constraints.
--
Keep ;-)
HanishKVC
This macro exists since Linux 2.6.25 [1] and is defined in glibc
since 2.14 [2] for sparc and most supported architectures.
RLIMIT_RTTIME has been added later for mips [3] and alpha [4].
For example, RLIMIT_RTTIME is needed to build qemu 7.0.0 with
Linux user-land emulation support [5].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id…
[2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=67f86a251e0d36107fe2…
[3] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=8969f4df1a526aa60dd0…
[4] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=53c2cb7641bd86639815…
[5] https://git.qemu.org/?p=qemu.git;a=commitdiff;h=244fd08323088db73590ff2317d…
Signed-off-by: Romain Naour <romain.naour(a)gmail.com>
---
libc/sysdeps/linux/alpha/bits/resource.h | 8 +++++++-
libc/sysdeps/linux/common/bits/resource.h | 8 +++++++-
libc/sysdeps/linux/mips/bits/resource.h | 8 +++++++-
libc/sysdeps/linux/sparc/bits/resource.h | 8 +++++++-
libc/sysdeps/linux/sparc64/bits/resource.h | 8 +++++++-
5 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/libc/sysdeps/linux/alpha/bits/resource.h b/libc/sysdeps/linux/alpha/bits/resource.h
index 74f4eed69..78b790d86 100644
--- a/libc/sysdeps/linux/alpha/bits/resource.h
+++ b/libc/sysdeps/linux/alpha/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/libc/sysdeps/linux/common/bits/resource.h b/libc/sysdeps/linux/common/bits/resource.h
index df0ba56d9..92b67eb23 100644
--- a/libc/sysdeps/linux/common/bits/resource.h
+++ b/libc/sysdeps/linux/common/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/libc/sysdeps/linux/mips/bits/resource.h b/libc/sysdeps/linux/mips/bits/resource.h
index b204aefd6..48a97f62e 100644
--- a/libc/sysdeps/linux/mips/bits/resource.h
+++ b/libc/sysdeps/linux/mips/bits/resource.h
@@ -99,7 +99,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/libc/sysdeps/linux/sparc/bits/resource.h b/libc/sysdeps/linux/sparc/bits/resource.h
index 1005aeced..9bff26d00 100644
--- a/libc/sysdeps/linux/sparc/bits/resource.h
+++ b/libc/sysdeps/linux/sparc/bits/resource.h
@@ -98,7 +98,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/libc/sysdeps/linux/sparc64/bits/resource.h b/libc/sysdeps/linux/sparc64/bits/resource.h
index 366e5c2d9..255fb9734 100644
--- a/libc/sysdeps/linux/sparc64/bits/resource.h
+++ b/libc/sysdeps/linux/sparc64/bits/resource.h
@@ -98,7 +98,13 @@ enum __rlimit_resource
__RLIMIT_RTPRIO = 14,
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
- __RLIMIT_NLIMITS = 15,
+ /* Maximum CPU time in µs that a process scheduled under a real-time
+ scheduling policy may consume without making a blocking system
+ call before being forcibly descheduled. */
+ __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+ __RLIMIT_NLIMITS = 16,
__RLIM_NLIMITS = __RLIMIT_NLIMITS
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
#define RLIM_NLIMITS __RLIM_NLIMITS
--
2.35.3
Hi,
This is a consolidated patch (named 20220511-FullPatch-....), with these
additional features
a) Had forgotten about 32bit targets in my last patch, as long could be
32bit in them. So have updated the prngplus logic to explicitly specify
int64_t wrt one way transform. Also have increased the prng run length
between reseeding in this case.
b) At the same time if the target / compiler doesnt support int64_t, then
added the option wrt prngplus to fallback to a simple xor based transform,
but with a reduced prng run between reseeding.
c) Also have added conditional compile wrt the different random or
otherwise dns query id generation helpers, So that only the selected
strategy will be included in the build.
--
Keep ;-)
HanishKVC
Hi,
This is a consolidated patch containing an updated version of the logic,
which adds a one way transform to avoid exposing the internal random
sequence wrt the default PrngPlus mode. The transform used should logically
not impact randomness in general, and the same has been verified to an
extent by checking with TestU01 and DieHarder based rng test logics.
With this, functionally the logic is ready. Please do cross check, and
integrate if no issues are found.
--
Keep ;-)
HanishKVC
Hi,
A little bit of cleanup wrt the logic and messages/notes. Also have
tightened the reseed window wrt prng to be within its internal state size.
This is a consolidated patch.
--
Keep ;-)
HanishKVC