lkml.org 
[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: module: save load_info for livepatch modules
On Fri, 13 Nov 2015, Jessica Yu wrote:

> +++ Miroslav Benes [13/11/15 13:56 +0100]:
> > On Fri, 13 Nov 2015, Miroslav Benes wrote:
> >
> > > I agree this seems like the best approach. So if we preserve
> > > mod_arch_syminfo (in case of s390) we should free it not in
> > > module_finalize, but somewhere in free_module... where
> > > module_arch_cleanup() is called... and also module_arch_freeing_init() is
> > > called there too. And what you find there for s390 is
> > >
> > > vfree(mod->arch.syminfo);
> > > mod->arch.syminfo = NULL;
> > >
> > > Well, it does nothing here, because mod->arch.syminfo is already NULL. It
> > > was freed in module_finalize. So we can even remove this code from
> > > module_finalize and all should be fine. At least for s390.
> >
> > Which is not true because module_arch_freeing_init is also called from
> > do_init_module, called from load_module. So we should move it to
> > module_arch_cleanup.
> >
> > That code is like a maze without Ariadne's thread.
>
> Heh, I agree with that sentiment.
>
> I am slightly confused about the s390 code, and whether the authors
> originally intended for that double vfree() to happen in both
> module_finalize() and module_arch_freeing_init() (called from
> do_init_module). Seems like a mistake. If module load succeeds,
> do_init_module calls module_arch_freeing_init(). And if load_module
> fails halfway through, both module_deallocate() and free_module() will
> also call module_arch_freeing_init().

It seems like the authors are aware of this. At least the authors of
general module code :). See comment in free_module()

/* This may be NULL, but that's OK */

It is ok, because vfree checks if the pointer is NULL.

> I feel like that vfree should
> only happen once in module_arch_freeing_init() and not in
> module_finalize(). If we can remove the double vfree() code from
> module_finalize(), we can copy the mod_arch_specific safely before the
> call to do_init_module().

Yes, I think so.

Miroslav


\
 
 \ /
  Last update: 2015-11-16 13:41    [W:0.094 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site