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

Re: [Xen-devel] [PATCH v3 2/3] XENVER_build_id: Provide ld-embedded build-ids (v8)



>>> On 12.01.16 at 17:43, <konrad.wilk@xxxxxxxxxx> wrote:
> On Tue, Jan 12, 2016 at 09:25:27AM -0700, Jan Beulich wrote:
>> >>> On 08.01.16 at 03:25, <konrad.wilk@xxxxxxxxxx> wrote:
>> > The mechanism to get this is via the XENVER hypercall and
>> > we add a new sub-command to retrieve the binary build-id
>> > called XENVER_build_id. The sub-hypercall parameter
>> > allows an arbitrary size (the buffer and len is provided
>> > to the hypervisor). A NULL parameter will probe the hypervisor
>> > for the length of the build-id.
>> > 
>> > One can also retrieve the value of the build-id by doing
>> > 'readelf -h xen-syms'.
>> 
>> Does this or something similar also work on xen.gz and xen.efi?
> 
> Sadly no.
>> I ask because xen-syms isn't present on the boot partition, and
>> may not be present anywhere on an otherwise functioning
>> system.
> 
> Right. Some later patches (xsplice related) hook the build-id printing
> to a keyboard handler. Would that work ?

Key handlers are strictly a debugging facility.

> Or are you suggesting that perhaps the kernel should at boot time
> print the build-id (like it does the changset)?

Perhaps, albeit to me that's a bit orthogonal to being able to find out
the build ID for a given binary.

>> > +        if ( rc )
>> > +            return rc;
>> > +
>> > +        if ( guest_handle_is_null(arg) )
>> > +            return sz;
>> > +
>> > +        if ( sz > build_id.len )
>> > +            return -ENOBUFS;
>> 
>> And how will the caller know how much is needed?
> 
> Duh. I shall update the build_id.len with the appropiate value.

Ah, actually I now see you have Andrew's beloved NULL handle
check up a few lines - that may suffice. Albeit I'm not generally in
favor of this model; I prefer a first attempt to succeed if possible,
and a second one only to be needed if the caller estimated size in
fact didn't suffice (and then no 3rd one being necessary in order
to obtain the needed size).

>> > +        if ( copy_to_guest_offset(arg, offsetof(xen_build_id_t, buf), p, 
>> > sz) )
>> > +            return -EFAULT;
>> > +
>> > +        return sz;
>> > +    }
>> 
>> Or how much got copied?
> 
> That one is easy - we do return 'sz' which tells us how much got copied.

Ah, right. Perhaps I shouldn't be reviewing patches a few minutes
before heading home...

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®.