public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: ananth@in.ibm.com, mahesh@linux.vnet.ibm.com,
	kexec@lists.infradead.org, LChouinard@s2sys.com,
	tachibana@mxm.nes.nec.co.jp, buendgen@de.ibm.com
Subject: Re: [PATCH v3 1/7] Initialize and setup eppic
Date: Thu, 27 Dec 2012 14:49:28 +0530	[thread overview]
Message-ID: <50DC12A0.1000005@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121220174525.fa881aafa4c3765172d2ec40@mxc.nes.nec.co.jp>

Hi Atsushi,

On 2012-12-20 14:15, Atsushi Kumagai wrote:

> Hello Aravinda,
> 
> Thank you for updating.
> I have two comments in this mail.
> 
> 
> On Fri, 14 Dec 2012 14:56:04 +0530
> Aravinda Prasad <aravinda@linux.vnet.ibm.com> wrote:
> 
>> This patch contains routines which initialize eppic and register call
>> back function which will be called whenever a new eppic macro is loaded
>> using eppic_load() API. The registered call back function executes the
>> eppic macro as soon as it is loaded.
>>
>> Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
>> ---
>>  Makefile          |    5 +++
>>  extension_eppic.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  extension_eppic.h |   23 +++++++++++++++
>>  3 files changed, 111 insertions(+), 1 deletions(-)
>>  create mode 100644 extension_eppic.c
>>  create mode 100644 extension_eppic.h
>>
>> diff --git a/Makefile b/Makefile
>> index e6c4e5d..f123a5f 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -69,7 +69,7 @@ $(OBJ_ARCH): $(SRC_ARCH)
>>  	$(CC) $(CFLAGS_ARCH) -c -o ./$@ ./$(@:.o=.c) 
>>  
>>  makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
>> -	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -o $@ $< $(LIBS)
>> +	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
>>  	echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.8
>>  	grep -v "^.TH MAKEDUMPFILE 8" makedumpfile.8 >> temp.8
>>  	mv temp.8 makedumpfile.8
>> @@ -79,6 +79,9 @@ makedumpfile: $(SRC) $(OBJ_PART) $(OBJ_ARCH)
>>  	mv temp.5 makedumpfile.conf.5
>>  	gzip -c ./makedumpfile.conf.5 > ./makedumpfile.conf.5.gz
>>  
>> +eppic_makedumpfile.so: extension_eppic.c
>> +	$(CC) $(CFLAGS) -nostartfiles -shared -rdynamic -o $@ extension_eppic.c -fPIC -leppic
>> +
> 
> First, I prepared eppic_makedumpfile.so with the code above, but I failed
> with the message below:
> 
>   $ makedumpfile -cd31 -x vmlinux --eppic eppic_macro/mod.c vmcore dumpfile.cd31
>   process_eppic_file: dlopen failed: /usr/lib64/eppic_makedumpfile.so: undefined symbol: setupterm
>   
>   makedumpfile Failed.
>   $
> 
> so I think '-lncurses' should be specified as gcc option, or did I mistake ?


-ltinfo was missing in the gcc option.

>

> 
> [...]
>> +/* Initialize eppic */
>> +int
>> +_init()
>> +{
>> +	if (eppic_open() >= 0) {
>> +
>> +		/* Register call back functions */
>> +		eppic_apiset(NULL, 3, sizeof(long), 0);
>> +
>> +		/* set the new function callback */
>> +		eppic_setcallback(reg_callback);
>> +
>> +		return 0;
>> +	}
>> +	return 1;
>> +}
> 
> Second, your code introduce _init() as constructor for dlopen().
> I'm not sure about dlopen(), but I found the description which recommend
> not to use _init() in man page:
> 
>    The obsolete symbols _init() and _fini()
>        The linker recognizes special symbols _init and _fini.  If a dynamic library exports a routine named _init(), then that  code  is  executed
>        after  the  loading,  before  dlopen()  returns.   If the dynamic library exports a routine named _fini(), then that routine is called just
>        before the library is unloaded.  In case you need to avoid linking against the system startup files, this can be done by using  the  gcc(1)
>        -nostartfiles command-line option.
> 
>        Using these routines, or the gcc -nostartfiles or -nostdlib options, is not recommended.  Their use may result in undesired behavior, since
>        the constructor/destructor routines will not be executed (unless special measures are taken).
> 
>        Instead, libraries should export routines using the __attribute__((constructor)) and __attribute__((destructor)) function attributes.   See
>        the  gcc  info pages for information on these.  Constructor routines are executed before dlopen() returns, and destructor routines are exe-
>        cuted before dlclose() returns.
> 
> So, is it OK to continue to use _init() ?


I am planning to change _init() to eppic_init() and then explicitly call
it after dlopen(), as using _init() is not recommended.

Apart from this I am facing some minor issues with dlopen(). With static
makedumpfile, dlopen is not able to resolve some symbols in dwarf_info.c
and is failing, while it is working when compiled with LINKTYPE=dynamic.
I am looking into it.

> 
> BTW, would you send the patch to add the description of this feature
> to README, man page and help message ?
> 
> 
> Thanks
> Atsushi Kumagai
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 


-- 
Regards,
Aravinda


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2012-12-27  9:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14  9:25 [PATCH v3 0/7] makedumpfile security key filtering with eppic Aravinda Prasad
2012-12-14  9:26 ` [PATCH v3 1/7] Initialize and setup eppic Aravinda Prasad
2012-12-20  8:45   ` Atsushi Kumagai
2012-12-27  9:19     ` Aravinda Prasad [this message]
2012-12-14  9:26 ` [PATCH v3 2/7] makedumpfile and eppic interface layer Aravinda Prasad
2012-12-14  9:26 ` [PATCH v3 3/7] Eppic call back functions to query a dump image Aravinda Prasad
2012-12-14  9:26 ` [PATCH v3 4/7] Implement apigetctype call back function Aravinda Prasad
2012-12-20  8:45   ` Atsushi Kumagai
2012-12-27  9:11     ` Aravinda Prasad
2012-12-14  9:26 ` [PATCH v3 5/7] Implement apimember and apigetrtype call back functions Aravinda Prasad
2012-12-14  9:26 ` [PATCH v3 6/7] Extend eppic built-in functions to include memset function Aravinda Prasad
2012-12-14  9:27 ` [PATCH v3 7/7] Support fully typed symbol access mode Aravinda Prasad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50DC12A0.1000005@linux.vnet.ibm.com \
    --to=aravinda@linux.vnet.ibm.com \
    --cc=LChouinard@s2sys.com \
    --cc=ananth@in.ibm.com \
    --cc=buendgen@de.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=tachibana@mxm.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox