[DTrace-devel] [PATCH 2/2] link: no longer add utsname in USDT ELF notes
Elena Zannoni
elena.zannoni at oracle.com
Sat Oct 3 08:44:52 UTC 2026
Reviewed-by: Elena Zannoni <elena.zannoni at oracle.com>
On 9/28/26 2:53 PM, Kris Van Hees via DTrace-devel wrote:
> 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 at 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
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
>
More information about the DTrace-devel
mailing list