Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: malloc() problems
@ 1997-07-14 12:20 Greg Lindahl
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Lindahl @ 1997-07-14 12:20 UTC (permalink / raw)


> I'm hoping someone out there has seen the following problem. I have a
> reasonably large C code I'm trying to get running on a PC164 system
> with RedHat 4.2 installed and kernel 2.0.30, also from the 4.2 CD.
> Some of the various binaries compile and run fine. Others, abort and
> in turn can cause gdb to abort when they attempt to issue malloc()'s.
> There are also some kernel messages indicating an unaligned access:
> 
> zm31mig(1382): unaligned trap at 0000000000000025: 000000012013b10c 29 1
> zm31mig(1382): unaligned trap at 0000000000000025: 000000012013b10c 29 3
> zm31mig(1382): unaligned trap at 0000000000000025: 007967669313b10c 29 2

This can be caused by an incorrect application -- if you over or
under-write your memory blocks, you can damage malloc()'s pointers
and cause it to dereference weird things before it dies.

-- g

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: malloc() problems
@ 1997-07-14 17:09 Michal Jaegermann
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Jaegermann @ 1997-07-14 17:09 UTC (permalink / raw)


> 
> zm31mig(1382): unaligned trap at 0000000000000025: 000000012013b10c 29 1

These may happen for binaries which do not follow alpha alignment
requirements.  For valid addresses you take an exception, machine
recovers but you get a substantial performance hit - so these are
warnings.

> What's odd is that sometimes, on the same binary, I get only the first
> error. Other times I get all three. From looking at the kernel source,
> the message is saying the program counter is at 0...25, the va?? is at
> 000000012013b10c, the instruction is 29 (load quadword) into register 1.
> I guess a quadword must align to a 16 byte boundary and that address is
> not on a 16 byte boundary so the message is valid. My main concern is
> understanding where that address of 0...25 came from. It doesn't seem
> like a normal address to me.

Your analysis is valid.  Screwed up addresses probably come from
an application which was compiled without paying attention to warnings
about converting pointers to integers and vice-versa (they are both
4-bytes wide for Intel and many other processors so no harm will be
done there).  Another possibility is of passing arguments of wrong
width to functions either because prototypes were not used or warnings
about faulty conversions forced by prototypes were not headed.  This
would mess up your stack and all bets are off.

It is not likely to be malloc() itself.  Probably a return value from
malloc was stored in int, or something like that.  But addresses
returned by malloc should be properly aligned for alpha in any case.

  Michal

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread
* malloc() problems
@ 1997-07-14  5:47 wsb
  0 siblings, 0 replies; 3+ messages in thread
From: wsb @ 1997-07-14  5:47 UTC (permalink / raw)


I'm hoping someone out there has seen the following problem. I have a
reasonably large C code I'm trying to get running on a PC164 system
with RedHat 4.2 installed and kernel 2.0.30, also from the 4.2 CD.
Some of the various binaries compile and run fine. Others, abort and
in turn can cause gdb to abort when they attempt to issue malloc()'s.
There are also some kernel messages indicating an unaligned access:

zm31mig(1382): unaligned trap at 0000000000000025: 000000012013b10c 29 1
zm31mig(1382): unaligned trap at 0000000000000025: 000000012013b10c 29 3
zm31mig(1382): unaligned trap at 0000000000000025: 007967669313b10c 29 2

What's odd is that sometimes, on the same binary, I get only the first
error. Other times I get all three. From looking at the kernel source,
the message is saying the program counter is at 0...25, the va?? is at
000000012013b10c, the instruction is 29 (load quadword) into register 1.
I guess a quadword must align to a 16 byte boundary and that address is
not on a 16 byte boundary so the message is valid. My main concern is
understanding where that address of 0...25 came from. It doesn't seem
like a normal address to me. That leads me to believe the address of
malloc() was somehow screwed up. How do I determine what happened to
the function address? If I step the program thru to just before the
error that takes gdb and my binary down, what should I try to look at?
I did try to ask 'whatis malloc' and that also crashes gdb so anything
that touches malloc() causes the problem.

Note this problem would seem to be similar to a previous one where a
programmer was attempting to malloc() several arrays and it kept crashing
on that code too. I saw that a couple weeks ago but do not remember anyone
posting an answer.

Any advice is appreciated.
Wes (wsb@vnet.ibm.com)

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-07-14 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-07-14 12:20 malloc() problems Greg Lindahl
  -- strict thread matches above, loose matches on Subject: below --
1997-07-14 17:09 Michal Jaegermann
1997-07-14  5:47 wsb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox