This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix for PIE with both -e and --core in use


On Wed, 28 Nov 2012 17:03:04 +0100, Mark Wielaard wrote:
> I don't like a new field in struct Dwfl_Module that is only used for
> this single thing. So if we can store the state somewhere else that
> would be nice.

I had the same issue, this is was one of the reasons I used the USERDATA
before.


> I see what you are saying can happen theoretically, but have a little
> trouble imagining when this would every happen. If you are just using
> parse_argp for command line parsing I don't really see how that would
> happen. Are you thinking of some server program that would reuse
> dwfl_standard_argp () multiple times?

There are two issues:

Reusing of USERDATA instead of separate Dwfl_Module->executable_for_core:
The problem is that Dwfl_Module will remain without opening its Elf file
possibly very long from the parse_opt call till someone requests the Elf file.
So the USERDATA field is in fact used indefinitely/permanently.

Using dwfl_standard_argp () multiple times:
I agree this is very unlikely.  But I find good coding practice to never use
global variables.  And the field state->hook vs. field state->input and their
handling in ARGP_KEY_ERROR etc. is already so cryptic that if the original
author could use a global variable I am certain he would certainly do it.
He did not so I did not want to break this reentrancy validity of code.


Thanks,
Jan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]