Your message dated Tue, 20 Jun 2023 20:32:26 +0200
with message-id <808d5eb3-b319-6722-fbcf-3d3021c73...@debian.org>
and subject line Re: Bug#1036356: stress-ng: autopkgtest failures on 32 bit 
architectures
has caused the Debian Bug report #1036356,
regarding stress-ng: autopkgtest failures on 32 bit architectures
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1036356: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036356
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: stress-ng
Version: 0.15.07-1
Severity: serious
Tags: patch
Justification: autopkgtest failures
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu mantic ubuntu-patch
X-Debbugs-Cc: bdr...@debian.org

Dear Maintainer,

The autopkg tests on 32 bit architectures fail. In Ubuntu, the attached
patch was applied to fix the autopkgtest:

  * Cherry-pick upstream commit "stress-pthread: use 64 bit tid_addr to fix
    stack clobbering on 32 bit platforms" and "stress-pthread: fix big endian
    tid addr for 32 bit systems" to fix test failures on 32 bit architectures
    (LP: #2019079)


Thanks for considering the patch.

-- 
Benjamin Drung
Debian & Ubuntu Developer
diff -Nru stress-ng-0.15.07/debian/patches/series 
stress-ng-0.15.07/debian/patches/series
--- stress-ng-0.15.07/debian/patches/series     1970-01-01 01:00:00.000000000 
+0100
+++ stress-ng-0.15.07/debian/patches/series     2023-05-17 18:45:53.000000000 
+0200
@@ -0,0 +1,2 @@
+stress-pthread_use_64_bit_tid_addr.patch
+stress-pthread_fix_big_endian_tid_addr_for_32_bit_systems.patch
diff -Nru 
stress-ng-0.15.07/debian/patches/stress-pthread_fix_big_endian_tid_addr_for_32_bit_systems.patch
 
stress-ng-0.15.07/debian/patches/stress-pthread_fix_big_endian_tid_addr_for_32_bit_systems.patch
--- 
stress-ng-0.15.07/debian/patches/stress-pthread_fix_big_endian_tid_addr_for_32_bit_systems.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
stress-ng-0.15.07/debian/patches/stress-pthread_fix_big_endian_tid_addr_for_32_bit_systems.patch
    2023-05-17 18:45:53.000000000 +0200
@@ -0,0 +1,46 @@
+From 63c0b414f6ec70dbd0498d59ca34fffbf2642b61 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.i.k...@gmail.com>
+Date: Wed, 10 May 2023 20:39:13 +0100
+Subject: [PATCH] stress-pthread: fix big endian tid addr for 32 bit systems
+
+The PR_GET_TID_ADDR does not have 32 bit compat, so it always returns
+a 64 bit tid addr. For 32 bit systems this needs to be either truncated
+for 32 little endian or shifted down to the bottom 32 bits for big endian
+systems such as big endian HPPA or MIPS32.
+
+Signed-off-by: Colin Ian King <colin.i.k...@gmail.com>
+Origin: upstream, 
https://github.com/ColinIanKing/stress-ng/commit/63c0b414f6ec70dbd0498d59ca34fffbf2642b61
+---
+ stress-pthread.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/stress-pthread.c b/stress-pthread.c
+index 5c0ee9e4..2190c333 100644
+--- a/stress-pthread.c
++++ b/stress-pthread.c
+@@ -177,14 +177,23 @@ static void OPTIMIZE3 stress_pthread_tid_address(const 
stress_args_t *args)
+       uint64_t tid_addr = 0;
+ 
+       if (LIKELY(prctl(PR_GET_TID_ADDRESS, &tid_addr, 0, 0, 0) == 0)) {
+-              if (tid_addr) {
++              unsigned long set_tid_addr;
++
++              if (sizeof(void *) == 4)  {
++                      set_tid_addr = stress_little_endian() ?
++                              (tid_addr & 0xffffffff) : (tid_addr >> 32);
++              } else {
++                      set_tid_addr = (unsigned long)tid_addr;
++              }
++
++              if (set_tid_addr) {
+                       pid_t tid1, tid2;
+ 
+                       /* Nullify */
+                       VOID_RET(pid_t, (pid_t)syscall(__NR_set_tid_address, 
NULL));
+ 
+                       /* This always succeeds */
+-                      tid1 = (pid_t)syscall(__NR_set_tid_address, tid_addr);
++                      tid1 = (pid_t)syscall(__NR_set_tid_address, 
set_tid_addr);
+ 
+                       errno = 0;
+                       tid2 = shim_gettid();
diff -Nru 
stress-ng-0.15.07/debian/patches/stress-pthread_use_64_bit_tid_addr.patch 
stress-ng-0.15.07/debian/patches/stress-pthread_use_64_bit_tid_addr.patch
--- stress-ng-0.15.07/debian/patches/stress-pthread_use_64_bit_tid_addr.patch   
1970-01-01 01:00:00.000000000 +0100
+++ stress-ng-0.15.07/debian/patches/stress-pthread_use_64_bit_tid_addr.patch   
2023-05-17 16:07:26.000000000 +0200
@@ -0,0 +1,37 @@
+From 637662d92865fbf5f3469d7754584f6d810fb902 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.i.k...@gmail.com>
+Date: Wed, 19 Apr 2023 08:46:17 +0100
+Subject: [PATCH] stress-pthread: use 64 bit tid_addr to fix stack clobbering
+ on 32 bit platforms
+
+Closes: https://github.com/ColinIanKing/stress-ng/issues/283
+
+Signed-off-by: Colin Ian King <colin.i.k...@gmail.com>
+Origin: upstream, 
https://github.com/ColinIanKing/stress-ng/commit/637662d92865fbf5f3469d7754584f6d810fb902
+---
+ stress-pthread.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/stress-pthread.c b/stress-pthread.c
+index 24431869b..a568f8167 100644
+--- a/stress-pthread.c
++++ b/stress-pthread.c
+@@ -163,7 +163,17 @@ static void OPTIMIZE3 stress_pthread_tid_address(const 
stress_args_t *args)
+     defined(__NR_set_tid_address) &&  \
+     defined(HAVE_KERNEL_ULONG_T) &&   \
+     defined(HAVE_SYSCALL)
+-      __kernel_ulong_t tid_addr = 0;
++      /*
++       *   prctl(2) states:
++       *    "Note that since the prctl() system call does not have a compat
++       *     implementation for the AMD64 x32 and MIPS n32 ABIs, and
++       *     the kernel writes out a pointer using the kernel's pointer
++       *     size, this operation expects a user-space buffer of 8 (not
++       *     4) bytes on these ABIs."
++       *
++       *   Use 64 bit tid_addr as default.
++       */
++      uint64_t tid_addr = 0;
+ 
+       if (LIKELY(prctl(PR_GET_TID_ADDRESS, &tid_addr, 0, 0, 0) == 0)) {
+               if (tid_addr) {

--- End Message ---
--- Begin Message ---
Version: 0.15.10-1

Hi,

On Sat, 20 May 2023 16:50:39 +0100 "Colin King (gmail)" <colin.i.k...@gmail.com> wrote:
Thanks for the update, I'm planning to make a stress-ng release that contains this fix before the end of next week to address this and several other issues.

At least the last upload doesn't fail its autopkgtest on 32 bit architectures anymore, so let's close this bug.

Paul

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


--- End Message ---

Reply via email to