[CRIU] [PATCH 2/2] vdso: x86 -- Use dynamic symbols for parsing
Cyrill Gorcunov
gorcunov at gmail.com
Tue May 27 14:26:04 PDT 2014
On Wed, May 28, 2014 at 12:55:50AM +0400, Pavel Emelyanov wrote:
> On 05/26/2014 03:02 PM, Cyrill Gorcunov wrote:
> > New vDSO are in stripped format so use dynamic
> > symbols instead of sectioned ones.
>
> How about parasite-based vdso page detection? Has it changed?
Nope. Only symbols parsing is changed.
> > -#define DECLARE_VDSO(ident_name, symtab_name) \
>
> Do we need the macro itself?
Not anymore.
> > +static unsigned long elf_hash(const unsigned char *name)
> > +{
> > + unsigned long h = 0, g;
> > +
> > + while (*name) {
> > + h = (h << 4) + *name++;
> > + g = h & 0xf0000000ul;
> > + if (g)
> > + h ^= g >> 24;
> > + h &= ~g;
> > + }
> > + return h;
>
> Where did this come from?
This hash from elf specification.
> > + /*
> > + * See Elf specification.
>
> For what?
To decode the "magic" values if one is interested.
> > + */
> > + const char elf_ident[] = {
> > + 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00,
> > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > + };
> >
> > - DECLARE_VDSO(vdso_ident, vdso_symbols);
> > + const char *symtab_name[VDSO_SYMBOL_MAX] = {
> > + [VDSO_SYMBOL_CLOCK_GETTIME] = VDSO_SYMBOL_CLOCK_GETTIME_NAME,
> > + [VDSO_SYMBOL_GETCPU] = VDSO_SYMBOL_GETCPU_NAME,
> > + [VDSO_SYMBOL_GETTIMEOFDAY] = VDSO_SYMBOL_GETTIMEOFDAY_NAME,
> > + [VDSO_SYMBOL_TIME] = VDSO_SYMBOL_TIME_NAME,
> > + };
>
> These two are moves from header. Can we split the patch?
Could you please be more detailed here? What exactly you wanted me to split?
> > +
> > /*
> > - * Where the section names lays.
> > + * Dynamic section should provide us the rest of
>
> Dynamic _sections_? Or symbols?
This is a special section called "dynamic" -- it's section name, it consists
of dynamic names ;)
> > + if (d->d_tag == DT_NULL) {
> > + break;
> > + }else if (d->d_tag == DT_STRTAB) {
>
> Space
Ouch, thanks.
> > + dyn_hash = d;
> > + pr_debug("DT_HASH: %p\n", (void *)d->d_un.d_ptr);
> > }
>
> } else { ?
nope, anything else is simply ignored, we're not interested in other tags,
at least for now.
> > +
> > +#if 0
>
> Trash?
no no, I use it for debug -- I can't allow it in pie mode because compiler
does weird tricks and I may end up in segfault. so lets leave it here, I
might need it next time we need to modify this code.
Cyrill
More information about the CRIU
mailing list