Source: sysprof
Version: 3.46.0-2
Severity: normal
Tags: ftbfs patch

Dear Maintainer,

The test test-mapped-ring-buffer fails on hppa:

==================================== 2/4 =====================================
test:         test-mapped-ring-buffer
start time:   14:55:16
duration:     0.40s
result:       killed by signal 6 SIGABRT
command:      GSETTINGS_BACKEND=memory G_DEBUG=gc-friendly MALLOC_PERTURB_=142 
NO_AT_BRIDGE=1 MALLOC_CHECK_=2 G_TEST_SRCDIR=/<<PKGBUILDDIR>>/src/tests 
G_TEST_BUILDDIR=/<<PKGBUILDDIR>>/obj-hppa-linux-gnu/src/tests 
/<<PKGBUILDDIR>>/obj-hppa-linux-gnu/src/tests/test-mapped-ring-buffer
----------------------------------- stdout -----------------------------------
# random seed: R02Sb35445e48e2cfa93f89f3c5793901662
1..3
# Start of MappedRingBuffer tests
Bail out! ERROR:../src/tests/test-mapped-ring-buffer.c:43:test_basic_movements: 
'reader' should not be NULL
----------------------------------- stderr -----------------------------------
**
ERROR:../src/tests/test-mapped-ring-buffer.c:43:test_basic_movements: 'reader' 
should not be NULL
==============================================================================

Full build log is here:
https://buildd.debian.org/status/fetch.php?pkg=sysprof&arch=hppa&ver=3.46.0-3&stamp=1665759904&raw=0

In map_head_and_body_twice(), the second mmap call fails:

mmap2(NULL, 135168, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xf64a2000
mmap2(0xf64b3000, 65536, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, 3, 0x1000) 
= -1 EINVAL (Invalid argument)

Due to cache issues, all shared mapping of a page must be equivalently
mapped.  This requires page mappings to be at the same virtual address
modulo 4 MB.  Due to a kernel limitation, all mappings to a file must
be equivalent.

The test can be fixed by rounding the buffer_size used in the mapped
ring buffer to 4 MB on hppa.  This makes the two mmap mappings equivalent.

Please send the fix upstream and install if okay.

Regards,
Dave Anglin

-- System Information:
Debian Release: bookworm/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)

Kernel: Linux 5.19.15+ (SMP w/4 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Index: sysprof-3.46.0/src/libsysprof-capture/mapped-ring-buffer.c
===================================================================
--- sysprof-3.46.0.orig/src/libsysprof-capture/mapped-ring-buffer.c
+++ sysprof-3.46.0/src/libsysprof-capture/mapped-ring-buffer.c
@@ -35,6 +35,7 @@
 
 #define DEFAULT_N_PAGES 32
 #define BUFFER_MAX_SIZE ((UINT32_MAX/2)-_sysprof_getpagesize())
+#define SHM_COLOUR 0x00400000
 
 enum {
   MODE_READER    = 1,
@@ -172,9 +173,16 @@ mapped_ring_buffer_new_reader (size_t bu
 
   page_size = _sysprof_getpagesize ();
 
-  /* Add 1 page for coordination header */
   if (buffer_size == 0)
     buffer_size = page_size * DEFAULT_N_PAGES;
+
+#ifdef __hppa__
+  /* Round buffer_size up to the shared memory colour boundary */
+  buffer_size += SHM_COLOUR - 1;
+  buffer_size &= ~(SHM_COLOUR - 1);
+#endif
+
+  /* Add 1 page for coordination header */
   buffer_size += page_size;
 
   /* Create our memfd (or tmpfs) for writing */

Reply via email to