|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 5/5] xsplice: Use ld-embedded build-ids
>>> On 16.09.15 at 23:01, <konrad.wilk@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -108,11 +108,11 @@ $(TARGET)-syms: prelink.o xen.lds
> $(BASEDIR)/common/symbols-dummy.o
> $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
> $(NM) -n $(@D)/.$(@F).0 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).0.S
> $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
> - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
> + $(LD) $(LDFLAGS) -T xen.lds -N prelink.o --build-id=sha1 \
> $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
> $(NM) -n $(@D)/.$(@F).1 | $(BASEDIR)/tools/symbols >$(@D)/.$(@F).1.S
> $(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
> - $(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
> + $(LD) $(LDFLAGS) -T xen.lds -N prelink.o --build-id=sha1 \
> $(@D)/.$(@F).1.o -o $@
> rm -f $(@D)/.$(@F).[0-9]*
Which raises the question: What about xen.efi?
> @@ -44,6 +46,36 @@ struct payload {
> struct tasklet tasklet;
> };
>
> +#ifdef CONFIG_ARM
> +static int build_id(char **p, unsigned int *len)
> +{
> + return 0;
> +}
> +#else
Any reason not to make the build logic common, in order to avoid such
#ifdef-ery?
> +extern char * __note_gnu_build_id_start; /* defined in linker script */
const, and I think you mean the type to be Elf_Note[].
> @@ -68,9 +100,31 @@ static const char *status2str(int64_t status)
> return names[status];
> }
>
> +#define LEN 128
Because of?
> void xsplice_printall(unsigned char key)
> {
> struct payload *data;
> + char *binary_id = NULL;
> + unsigned int len = 0;
> + int rc;
> +
> + rc = build_id(&binary_id, &len);
> + printk("build-id: ");
> + if ( !rc )
> + {
> + unsigned int i;
> +
> + if ( len > LEN )
> + len = LEN;
> +
> + for ( i = 0; i < len; i++ )
> + {
> + uint8_t c = binary_id[i];
> + printk("%02x", c);
Hard tabs.
> + }
> + printk("\n");
> + } else if ( rc < 0 )
Coding style.
> @@ -415,6 +470,34 @@ static int xsplice_action(xen_sysctl_xsplice_action_t
> *action)
> return rc;
> }
>
> +static int xsplice_info(xen_sysctl_xsplice_info_t *info)
> +{
> + int rc;
> + unsigned int len = 0;
> + char *p = NULL;
> +
> + if ( info->cmd != XEN_SYSCTL_XSPLICE_INFO_BUILD_ID )
> + return -EINVAL;
> +
> + if ( info->size == 0 )
> + return -EINVAL;
> +
> + if ( !guest_handle_okay(info->u.info, info->size) )
> + return -EFAULT;
> +
> + rc = build_id(&p, &len);
> + if ( rc )
> + return rc;
> +
> + if ( len > info->size )
> + return -ENOMEM;
> +
> + if ( copy_to_guest(info->u.info, p, len) )
> + return -EFAULT;
So how does the caller know how much data got copied?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |