Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package jitterentropy for openSUSE:Factory 
checked in at 2023-03-25 18:54:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/jitterentropy (Old)
 and      /work/SRC/openSUSE:Factory/.jitterentropy.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "jitterentropy"

Sat Mar 25 18:54:21 2023 rev:5 rq:1073935 version:3.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/jitterentropy/jitterentropy.changes      
2022-09-12 19:08:32.494585804 +0200
+++ /work/SRC/openSUSE:Factory/.jitterentropy.new.31432/jitterentropy.changes   
2023-03-25 18:54:24.186364948 +0100
@@ -1,0 +2,11 @@
+Wed Mar 22 11:17:59 UTC 2023 - Pedro Monreal <[email protected]>
+
+- Fix a stack corruption on s390x: [bsc#1209627]
+  * Output size of the STCKE command on s390x is 16 bytes, compared
+    to 8 bytes of the STCK command. Fix a stack corruption in the
+    s390x version of jent_get_nstime(). Add some more detailed
+    information on the STCKE command.
+  * github.com/smuellerDD/jitterentropy-library/commit/7bf9f85
+  * Add jitterentropy-fix-a-stack-corruption-on-s390x.patch
+
+-------------------------------------------------------------------

New:
----
  jitterentropy-fix-a-stack-corruption-on-s390x.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ jitterentropy.spec ++++++
--- /var/tmp/diff_new_pack.dDauzt/_old  2023-03-25 18:54:24.850368418 +0100
+++ /var/tmp/diff_new_pack.dDauzt/_new  2023-03-25 18:54:24.858368460 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package jitterentropy
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,8 @@
 URL:            https://github.com/smuellerDD/jitterentropy-library
 Source0:        
https://github.com/smuellerDD/jitterentropy-library/archive/refs/tags/v%{version}.tar.gz
 Source1:        baselibs.conf
+#PATCH-FIX-UPSTREAM github.com/smuellerDD/jitterentropy-library/commit/7bf9f85
+Patch0:         jitterentropy-fix-a-stack-corruption-on-s390x.patch
 
 %description
 The Jitter RNG provides a noise source using the CPU execution

++++++ jitterentropy-fix-a-stack-corruption-on-s390x.patch ++++++
>From 7bf9f85d32bc6b809ca687d772bc41bd9c0ecdd8 Mon Sep 17 00:00:00 2001
From: Vladis Dronov <[email protected]>
Date: Tue, 27 Dec 2022 13:45:03 +0100
Subject: [PATCH] fix a stack corruption on s390x

Output size of the STCKE command on s390x is 16 bytes, compared to 8 bytes
of the STCK command. Fix a stack corruption in the s390x version of
jent_get_nstime(). Add some more detailed information on the STCKE command.

Signed-off-by: Stephan Mueller <[email protected]>
---
 jitterentropy-base-user.h | 43 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 5 deletions(-)

diff --git a/jitterentropy-base-user.h b/jitterentropy-base-user.h
index b7d21e8..625767a 100644
--- a/jitterentropy-base-user.h
+++ b/jitterentropy-base-user.h
@@ -129,13 +129,46 @@ static inline void jent_get_nstime(uint64_t *out)
 
 static inline void jent_get_nstime(uint64_t *out)
 {
-       uint64_t clk;
+       /*
+        * This is MVS+STCK code! Enable it with -S in the compiler.
+        *
+        * uint64_t clk;
+        * __asm__ volatile("stck %0" : "=m" (clk) : : "cc");
+        * *out = (uint64_t)(clk);
+        */
+
+       /*
+        * This is GCC+STCKE code. STCKE command and data format:
+        * z/Architecture - Principles of Operation
+        * http://publibz.boulder.ibm.com/epubs/pdf/dz9zr007.pdf
+        *
+        * The current value of bits 0-103 of the TOD clock is stored in bytes
+        * 1-13 of the sixteen-byte output:
+        *
+        * bits 0-7: zeros (reserved for future extention)
+        * bits 8-111: TOD Clock value
+        * bits 112-127: Programmable Field
+        *
+        * Output bit 59 (TOD-Clock bit 51) effectively increments every
+        * microsecond. Bits 60 to 111 of STCKE output are fractions of
+        * a miscrosecond: bit 59 is 1.0us, bit 60 is .5us, bit 61 is .25us,
+        * bit 62 is .125us, bit 63 is 62.5ns, etc.
+        *
+        * Some of these bits can be implemented, some not. 64 bits of
+        * the TOD clock are implemented usually nowadays, these are
+        * bits 8-71 of the output.
+        *
+        * The stepping value of TOD-clock bit position 63, if implemented,
+        * is 2^-12 microseconds, or approximately 244 picoseconds. This value
+        * is called a clock unit.
+        */
+
+       uint8_t clk[16];
 
-       /* this is MVS code! enable with -S in the compiler */
-       /*__asm__ volatile("stck %0" : "=m" (clk) : : "cc"); */
-       /* this is gcc */
        asm volatile("stcke %0" : "=Q" (clk) : : "cc");
-       *out = (uint64_t)(clk);
+
+       /* s390x is big-endian, so just perfom a byte-by-byte copy */
+       *out = *(uint64_t *)(clk + 1);
 }
 
 #elif defined(__powerpc)

Reply via email to