[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xsplice: Use ld-embedded build-ids



>>> On 05.08.15 at 16:09, <mpohlack@xxxxxxxxx> wrote:
> Todo:
>   * Should be moved to sysctl to only allow Dom0 access

Because of?

>   * Maybe convert to binary transport to userland instead of printable form

Indeed.

> @@ -360,11 +366,30 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> arg)
>  
>      case XENVER_build_id:
>      {
> -        xen_build_id_t build_id;
> +        xen_build_id_t ascii_id;
> +        Elf_Note * n = (Elf_Note *)&__note_gnu_build_id_start;
> +        char * binary_id;
> +        int i;
> +
> +        memset(ascii_id, 0, sizeof(ascii_id));
> +
> +        /* check if we really have a build-id */
> +        if ( NT_GNU_BUILD_ID != n->type )
> +            return 0;

This needs to signal an error.

> +
> +        /* sanity check, name should be "GNU" for ld-generated build-id */
> +        if ( 0 != strncmp(ELFNOTE_NAME(n), "GNU", n->namesz))
> +            return 0;

Same here.

> +        binary_id = (char *)ELFNOTE_DESC(n);
> +
> +        /* convert to printable format */
> +        for (i = 0; i < n->descsz && (i + 1) * 2 < sizeof(xen_build_id_t); 
> i++)
> +        {
> +            snprintf(&ascii_id[i * 2], 3, "%02hhx", binary_id[i]);
> +        }

No need for the braces, and no need for the"hh" modifier.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.