[Bug general/28263] New: 0.185: test suite fails with sigsegv

2021-08-25 Thread kloczko.tomasz at gmail dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28263

Bug ID: 28263
   Summary: 0.185: test suite fails with sigsegv
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: general
  Assignee: unassigned at sourceware dot org
  Reporter: kloczko.tomasz at gmail dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

elfutils compiled with LTO.

==
   elfutils 0.185: tests/test-suite.log
==

# TOTAL: 227
# PASS:  222
# SKIP:  1
# XFAIL: 0
# FAIL:  4
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: run-backtrace-native.sh
=

backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp
(symname, "raise") == 0' failed.
./test-subr.sh: line 84: 2583792 Aborted (core dumped)
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
$VALGRIND_CMD "$@"
backtrace-child: no main
FAIL run-backtrace-native.sh (exit status: 1)

FAIL: run-backtrace-native-biarch.sh


backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp
(symname, "raise") == 0' failed.
./test-subr.sh: line 84: 2583882 Aborted (core dumped)
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
$VALGRIND_CMD "$@"
backtrace-child-biarch: no main
FAIL run-backtrace-native-biarch.sh (exit status: 1)

FAIL: run-backtrace-native-core.sh
==

/usr/bin/coredumpctl
   PID: 2583912 (backtrace-child)
   UID: 1000 (tkloczko)
   GID: 1000 (tkloczko)
Signal: 6 (ABRT)
 Timestamp: Wed 2021-08-25 09:15:04 BST (1s ago)
  Command Line:
/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child --gencore
Executable:
/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child
 Control Group: /user.slice/user-1000.slice/session-2594.scope
  Unit: session-2594.scope
 Slice: user-1000.slice
   Session: 2594
 Owner UID: 1000 (tkloczko)
   Boot ID: dacb7fefc2824304bb9d4576770821a4
Machine ID: d033f66b249a4ec09acfa81ac205554f
  Hostname: barrel
   Storage:
/var/lib/systemd/coredump/core.backtrace-child.1000.dacb7fefc2824304bb9d4576770821a4.2583912.162987930400.zst
   Message: Process 2583912 (backtrace-child) of user 1000 dumped core.

Stack trace of thread 2583929:
#0  0x7f986c886783 pthread_kill@GLIBC_2.2.5 (libc.so.6 +
0x8f783)
#1  0x7f986c8396b6 raise (libc.so.6 + 0x426b6)
#2  0x56208bd93521 n/a
(/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child + 0x1521)
backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp
(symname, "raise") == 0' failed.
./test-subr.sh: line 84: 2587340 Aborted (core dumped)
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
$VALGRIND_CMD "$@"
backtrace-child-core.2583912: no main
rmdir: failed to remove 'test-2583798': Directory not empty
FAIL run-backtrace-native-core.sh (exit status: 1)

FAIL: run-backtrace-native-core-biarch.sh
=

/usr/bin/coredumpctl
   PID: 2587430 (backtrace-child)
   UID: 1000 (tkloczko)
   GID: 1000 (tkloczko)
Signal: 6 (ABRT)
 Timestamp: Wed 2021-08-25 09:15:05 BST (2s ago)
  Command Line:
/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child-biarch
--gencore
Executable:
/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child-biarch
 Control Group: /user.slice/user-1000.slice/session-2594.scope
  Unit: session-2594.scope
 Slice: user-1000.slice
   Session: 2594
 Owner UID: 1000 (tkloczko)
   Boot ID: dacb7fefc2824304bb9d4576770821a4
Machine ID: d033f66b249a4ec09acfa81ac205554f
  Hostname: barrel
   Storage:
/var/lib/systemd/coredump/core.backtrace-child.1000.dacb7fefc2824304bb9d4576770821a4.2587430.162987930500.zst
   Message: Process 2587430 (backtrace-child) of user 1000 dumped core.

Stack trace of thread 2587431:
#0  0x7f19ac3ca783 pthread_kill@GLIBC_2.2.5 (libc.so.6 +
0x8f783)
#1  0x7f19ac37d6b6 raise (libc.so.6 + 0x426b6)
#2  0x55a8a232d521 n/a
(/home/tkloczko/rpmbuild/BUILD/elfutils-0.185/tests/backtrace-child-biarch +
0x1521)
backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp
(symname, "raise") == 0' failed.
./test-subr.sh: line 84: 2587720 Aborted (core dumped)
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
$VALGRIND_CMD "$@"
backtrace-child-biarch-core.2587430: no main
rmdir: failed to remove 'test-2583832': Directory no

[Bug general/28263] 0.185: test suite fails with sigsegv

2021-08-25 Thread kloczko.tomasz at gmail dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28263

--- Comment #1 from kloczek  ---
Correction. I'm building elfutils with disabled LTO.

gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug general/28263] 0.185: test suite fails with sigsegv

2021-08-25 Thread fweimer at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28263

Florian Weimer  changed:

   What|Removed |Added

 CC||fweimer at redhat dot com
 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Florian Weimer  ---
I believe this was already fixed as:

commit 9aee0992d6e6ec4cce2c015d8da4b61022c6f6dd
Author: Mark Wielaard 
Date:   Wed Aug 4 21:01:27 2021 +0200

tests: Allow an extra pthread_kill frame in backtrace tests

glibc 2.34 calls pthread_kill from the raise function. Before raise
directly called the (tg)kill syscall. So allow pthread_kill to be the
first frame in a backtrace where raise is expected. Also change some
asserts to fprintf plus abort to make it more clear why the testcase
fails.

https://sourceware.org/bugzilla/show_bug.cgi?id=28190

Signed-off-by: Mark Wielaard 

*** This bug has been marked as a duplicate of bug 28190 ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug libelf/28190] FAIL: run-backtrace-native.sh with glibc 2.34

2021-08-25 Thread fweimer at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28190

Florian Weimer  changed:

   What|Removed |Added

 CC||kloczko.tomasz at gmail dot com

--- Comment #8 from Florian Weimer  ---
*** Bug 28263 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28034] debuginfod server: preserve + etc. elements in incoming webapi url

2021-08-25 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28034

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #4 from Mark Wielaard  ---
commit 9ab0c139eebf4ba40ac721224a673e4b66d29cd9
Author: Noah Sanci 
Date:   Fri Jul 16 15:16:20 2021 -0400

debuginfod: PR28034 - client-side %-escape url characters

When requesting some source files, some URL-inconvenient chars
sometimes pop up.  Example from f33 libstdc++:
/buildid/44d8485cb75512c2ca5c8f70afbd475cae30af4f/source/usr/src/debug/
gcc-10.3.1-1.fc33.x86_64/obj-x86_64-redhat-linux/x86_64-redhat-linux/
libstdc++-v3/src/c++11/../../../../../libstdc++-v3/src/c++11/
condition_variable.cc
As this URL is passed into debuginfod's handler_cb, it appears that the
+ signs are helpfully unescaped to spaces by libmicrohttpd, which
'course breaks everything.
In order to ensure the server properly parses urls such as this one,
%-escape characters on the client side so that the correct url
is preserved and properly processed on the server side.

https://sourceware.org/bugzilla/show_bug.cgi?id=28034

Signed-off-by: Noah Sanci 

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28034] debuginfod server: preserve + etc. elements in incoming webapi url

2021-08-25 Thread fche at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28034

--- Comment #5 from Frank Ch. Eigler  ---
We should probably tweak this to avoid %-escaping the '/' characters, which
default apache httpd mod_proxy configurations treat as sus.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28034] debuginfod server: preserve + etc. elements in incoming webapi url

2021-08-25 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28034

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Status|RESOLVED|REOPENED

--- Comment #6 from Mark Wielaard  ---
(In reply to Frank Ch. Eigler from comment #5)
> We should probably tweak this to avoid %-escaping the '/' characters, which
> default apache httpd mod_proxy configurations treat as sus.

Ah, OK, yes. Reopened for now to get that fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/27277] Describe retrieved files when verbose

2021-08-25 Thread Noah Sanci via Elfutils-devel
Hello,

There appear to exist use cases that intend to simply check for the
existence of content in a debuginfod server, without actually
downloading it.  In HTTP land, the HEAD operation is the natural
expression of this.
Instead of implementing a HEAD/describe option, allow users, with enough
verbosity, to print the HTTP response headers upon retrieving a file.
E.g output:

HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 2428240
Cache-Control: public
Last-Modified: Sat, 15 May 2021 20:49:51 GMT
Content-Type: application/octet-stream
Date: Tue, 03 Aug 2021 18:50:36 GMT

Note: the new test is mostly compatible with the nsanci/test-fix
commit. When nsanci/test-fix merges with master I can resubmit the
patch with the test properly rebased and adjusted for maximum
efficiency.

The HEAD functionality will (likely) be put into a new PR for existing checking.

-Noah Sanci
From 6351258d707337b69563d4be8effbb30fc42f784 Mon Sep 17 00:00:00 2001
From: Noah Sanci 
Date: Wed, 28 Jul 2021 14:46:05 -0400
Subject: [PATCH] debuginfod: PR27277 - Describe retrieved files when verbose

There appear to exist use cases that intend to simply check for the
existence of content in a debuginfod server, without actually
downloading it.  In HTTP land, the HEAD operation is the natural
expression of this.
Instead of implementing a HEAD/describe option, allow users, with enough
verbosity, to print the HTTP response headers upon retrieving a file.
E.g output:

HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 2428240
Cache-Control: public
Last-Modified: Sat, 15 May 2021 20:49:51 GMT
Content-Type: application/octet-stream
Date: Tue, 03 Aug 2021 18:50:36 GMT

https://sourceware.org/bugzilla/show_bug.cgi?id=27277

Signed-off-by: Noah Sanci 
---
 debuginfod/ChangeLog |  11 ++
 debuginfod/debuginfod-client.c   |  58 ++-
 doc/ChangeLog|   6 +
 doc/debuginfod-find.1|   3 +-
 tests/ChangeLog  |   7 +
 tests/Makefile.am|   3 +-
 tests/run-debuginfod-response-headers.sh | 186 +++
 7 files changed, 268 insertions(+), 6 deletions(-)
 create mode 100755 tests/run-debuginfod-response-headers.sh

diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 530f7dc7..cb9e50c7 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -4,6 +4,17 @@
 	* debuginfod.cxx (handler_cb): Fix after_you unique_set key
 	to the entire incoming URL.
 
+2021-08-02  Noah Sanci  
+
+	PR27277
+	* debuginfod-client.c (struct debuginfod_client): New field 
+	winning_headers.
+	(struct handle_data): New field response_data.
+	(header_callback): Store received headers in response_data.
+	(debuginfod_query_server): Activate CURLOPT_HEADERFUNCTION.
+	Save winning response_data.
+	(debuginfod_end): free client winning headers.
+
 2021-07-26  Noah Sanci  
 
 	PR27982
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 7d4b220f..985a17c5 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -127,6 +127,7 @@ struct debuginfod_client
  timeout or other info gotten from environment variables, the
  handle data, etc. So those don't have to be reparsed and
  recreated on each request.  */
+  char * winning_headers;
 };
 
 /* The cache_clean_interval_s file within the debuginfod cache specifies
@@ -183,6 +184,8 @@ struct handle_data
  to the cache. Used to ensure that a file is not downloaded from
  multiple servers unnecessarily.  */
   CURL **target_handle;
+  /* Response http headers for this client handle, sent from the server */
+  char *response_data;
 };
 
 static size_t
@@ -499,6 +502,33 @@ default_progressfn (debuginfod_client *c, long a, long b)
 }
 
 
+static size_t
+header_callback (char * buffer, size_t size, size_t numitems, void * userdata)
+{
+  if (size != 1)
+return 0;
+  /* Temporary buffer for realloc */
+  char *temp = NULL;
+  size_t userlen = 0;
+  if (*(char**)userdata == NULL)
+{
+  temp = malloc(numitems+1);
+  if (temp == NULL)
+return 0;
+  memset(temp, '\0', numitems+1);
+}
+  else
+{
+  userlen = strlen(*(char**)userdata);
+  temp = realloc(*(char**)userdata, userlen + numitems + 1);
+  if (temp == NULL)
+   return 0;
+}
+  strncat(temp, buffer, numitems);
+  *(char**)userdata = temp;
+  return numitems;
+}
+
 /* Query each of the server URLs found in $DEBUGINFOD_URLS for the file
with the specified build-id, type (debuginfo, executable or source)
and filename. filename may be NULL. If found, return a file
@@ -936,10 +966,13 @@ debuginfod_query_server (debuginfod_client *c,
 	  curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
 			100 * 1024L);
 	}
+  data[i].response_data = NULL;
   curl_easy_setopt(data[i].handle, CURLOPT_FILETIME, (long) 1);
   curl_easy_setopt(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
   

[Bug debuginfod/27917] protect against federation loops

2021-08-25 Thread dichen at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27917

--- Comment #2 from Di Chen  ---
Created attachment 13623
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13623&action=edit
Submit a Patch for Bug 27917

-- 
You are receiving this mail because:
You are on the CC list for the bug.