link: no longer add utsname in USDT ELF notes
PATCH 2/2 link: no longer add utsname in USDT ELF notes
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 <[email protected]>
--- libdtrace/dt_link.c | 48 --------------------------------------------- 1 file changed, 48 deletions(-)
libdtrace/dt_link.c +0 -48
@@ -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);
Signature · 1 line
2.52.0
Reviewed-by Elena Zannoni <[email protected]>
Quoted 86 lines · Kris Van Hees via DTrace-devel
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 <[email protected]>--- libdtrace/dt_link.c | 48 --------------------------------------------- 1 file changed, 48 deletions(-)libdtrace/dt_link.c +0
-48@@ -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);Signature · 7 lines
2.52.0 _______________________________________________ DTrace-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/dtrace-devel