Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 2/2] link: no longer add utsname in USDT ELF notes
Date: Mon, 28 Sep 2026 20:53:33 +0000	[thread overview]
Message-ID: <065856951b0fa5e001b995773402efcc@oracle.com> (raw)

USDT ELF notes used to contain utsname information for debugging, but
this has proven to be troublesome for distributions that expect to be
able to regenerate build objects with identical data.  Since the
utsname data contains the system name, the USDT ELF notes were causing
comparisons between generates and regenerated objects to fail.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 libdtrace/dt_link.c | 48 ---------------------------------------------
 1 file changed, 48 deletions(-)

diff --git a/libdtrace/dt_link.c b/libdtrace/dt_link.c
index aa5eb735..d8188881 100644
--- a/libdtrace/dt_link.c
+++ b/libdtrace/dt_link.c
@@ -261,52 +261,6 @@ note_add_version(usdt_elf_t *usdt)
 	return 0;
 }
 
-static int
-note_add_utsname(usdt_elf_t *usdt)
-{
-	Elf_Data	*dbuf;
-	char		*buf, *p;
-	size_t		len, sz;
-
-#define UTSN_NOTE_HEADSZ \
-		((3 * sizeof(uint32_t)) +	/* namesz, descsz, type */ \
-		 ALIGN(5, 4))			/* "utsn\0" */
-
-	/* Ensure the note starts on a 4-byte alignment boundary. */
-	usdt->base = ALIGN(usdt->base + usdt->size, 4);
-	usdt->size = 0;
-
-	len = sizeof(struct utsname);
-	sz = UTSN_NOTE_HEADSZ + ALIGN(len, 4);
-
-	buf = malloc(sz);
-	if (buf == NULL)
-		return dt_set_errno(usdt->dtp, EDT_NOMEM);
-	memset(buf, 0, sz);
-
-	/* Construct the note header. */
-	*((uint32_t *)&buf[0]) = 5;
-	*((uint32_t *)&buf[4]) = sz - UTSN_NOTE_HEADSZ;
-	*((uint32_t *)&buf[8]) = 1;
-	memcpy(&buf[12], "utsn", 4);
-
-	/* Add the data. */
-	p = buf + UTSN_NOTE_HEADSZ;
-	memcpy(p, &usdt->dtp->dt_uts, sizeof(struct utsname));
-
-	/* Add the note header. */
-	dbuf = elf_newdata(usdt->note);
-	dbuf->d_align = sizeof(uint32_t);
-	dbuf->d_off = usdt->base;
-	dbuf->d_buf = buf;
-	dbuf->d_size = sz;
-	usdt->size = sz;
-
-	usdt->notes.next = NULL;
-
-	return 0;
-}
-
 static int
 create_elf64(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, int fd, uint_t flags)
 {
@@ -398,8 +352,6 @@ create_elf64(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, int fd, uint_t flags)
 	if (!(flags & DTRACE_D_STRIP)) {
 		if (note_add_version(usdt) == -1)
 			goto fail;
-		if (note_add_utsname(usdt) == -1)
-			goto fail;
 	}
 
 	dt_free(dtp, usdt);
-- 
2.52.0


             reply	other threads:[~2026-09-28 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 20:53 Kris Van Hees [this message]
2026-10-03  8:44 ` [DTrace-devel] [PATCH 2/2] link: no longer add utsname in USDT ELF notes Elena Zannoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=065856951b0fa5e001b995773402efcc@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox