Project

General

Profile

Actions

Bug #2063

closed

Core dump on AIX

Added by pedz (Perry Smith) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.1p243 (2009-07-16 revision 24175) [powerpc-aix5.3.0.0]
Backport:

Description

=begin
The aix_loaderror routine has many problems. First, if loadquery fails, messages has not been initialized. So the next if statement coredumps:

     for(i = 0; message[i] && *message[i]; i++) {

message[i] is set to trash and *message[i] can cause a SEGV.

Second, the messages returned are no long in the same format as the documentation. The easiest way to see this is to dump them out. They can optionally start with (xxx. Then there is the error code (as before), then what appears to be a count of parameters, followed by a list. The code below is valid for the case of a single undefined symbol.

The message text is placed inside the buffer which is passed as well as the pointers to the messages. So, it needs to be bigger than just the size of 8 pointers.

The code inside the for (j loop often uses i where it should use j.

All this just to get a message that is not printed out anyway which I feel should be changed but thats another matter.

I'm using ruby 1.9.1-p243, gcc 4.4.1, on AIX 5.3 gold.

diff is attached.
=end


Files

dln-diff (3.48 KB) dln-diff pedz (Perry Smith), 09/21/2009 12:32 AM
dln.diff (2.27 KB) dln.diff kanemoto (Yutaka Kanemoto), 04/29/2010 02:01 AM
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Open to Feedback

=begin
No diff is attached.
=end

Actions #2

Updated by pedz (Perry Smith) over 14 years ago

=begin
Try again... sorry

=end

Actions #3

Updated by naruse (Yui NARUSE) over 14 years ago

  • Status changed from Feedback to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
Assign this to nobu.
Anyway he'll say "Please make this patch as unified diff (diff -up)".
=end

Actions #4

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Assignee changed from nobu (Nobuyoshi Nakada) to kanemoto (Yutaka Kanemoto)

=begin

=end

Actions #5

Updated by kanemoto (Yutaka Kanemoto) almost 14 years ago

=begin
Sorry for this late response.

I found that there were 75 error types for load errors.

% fgrep -c L_ERROR_ /usr/include/sys/ldr.h
75

Some of them (in dln.c) are now obsolate in AIX 5.3. I think it is not a good idea for ruby to import messages from ldr.h. We are not able to follow them each time messages are changed.

I modified aix_loaderror to show a line for execerror command like this:

% ruby -v -I. -rhello -e 'p $:'
ruby 1.9.2dev (2010-04-28 trunk 27535) [powerpc-aix5.3.0.0]
ruby:0:in `require': load failed - /somewhere/hello.so. Please issue below command for detailed reasons: (LoadError)
/usr/sbin/execerror ruby "2 /somewhere/hello.so" "103 /somewhere/hello.so"

% /usr/sbin/execerror ruby "2 /somewhere/hello.so" "103 /somewhere/hello.so"
Could not load program ruby:
Could not load module /somewhere/hello.so.
The module has an invalid magic number.

In this case, hello.so is built as 64 bit module, though ruby is built as 32 bit process. Current implementation can not tell the reason because L_ERROR_CHECK_MAGIC is not imported.
I hesitated to call execerror directly to avoid other errors by opening another process.

Could someone please review the attached patch? If there are no suggestion, I would like to commit this soon.

execerror command is used to format return values of loadquery:
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=%2fcom.ibm.aix.basetechref%2fdoc%2fbasetrf1%2floadquery.htm
=end

Actions #6

Updated by mame (Yusuke Endoh) almost 14 years ago

=begin
Hi,

Your patch looks good to me.
At least, it is undoubtedly better than the current SEGV :-)

Two comments:

  • Macro `LOAD_ERRTAB_LEN' is not used.
  • The last newline (ERRBUF_APPEND("\n");) may be unnecessary.

--
Yusuke Endoh
=end

Actions #7

Updated by kanemoto (Yutaka Kanemoto) almost 14 years ago

=begin
Hi,

2010/5/4 Yusuke Endoh :

Issue #2063 has been updated by Yusuke Endoh.
...
Your patch looks good to me.
Thank you very much for spending your time for this issue. I really
appreciate it.

At least, it is undoubtedly better than the current SEGV :-)
Yes, that's the point. ;-)

Two comments:
Thanks. I will commit this soon.

--
Yutaka KANEMOTO
http://d.hatena.ne.jp/kinpoco/

=end

Actions #8

Updated by kanemoto (Yutaka Kanemoto) almost 14 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27631.
Perry, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0