gcc (/dev/zero problems & Segmentation fault)

gcc (/dev/zero problems & Segmentation fault)

Post by Henry Cros » Sun, 28 Jan 1996 04:00:00



Hi, again. If you've seen my other post I just found out using xwpe
and stepping thru the program that the segmentation fault occurs when
I use the strlen() function it recieves the SIGSEGV signal.

 What gives?

TIA,
H.Cross

 
 
 

gcc (/dev/zero problems & Segmentation fault)

Post by Henry Cros » Sun, 28 Jan 1996 04:00:00


Hi, I'm just learning NIX, coming from DOS/OS2 world. I'm playing around with
gcc using a snippet of a C program I'm writing in the DOS world. My problem is
when I attempt to run this small program I get a segmentation fault and a core
dump. "less'ing " thru the core I find the following:

/lib/ld-linux.so.1  dl_boot:mmap of /dev/zero failed!

 Any knowledgeable programmers out there got an answer for a newbie?

TIA,
H.Cross


 
 
 

gcc (/dev/zero problems & Segmentation fault)

Post by na8570600-Schoonov » Wed, 31 Jan 1996 04:00:00


There are 3 causes I've seen for this behavior of strlen.
        1.  Passing a NULL pointer to strlen.
        2.  Passing an uninitialized pointer to strlen.
        3.  Passing a pointer to a character array that's not nul terminated.

In particular, I saw case 1 several times in code I ported from HP-UX
to Solaris.  HP-UX evidently puts something at address 0, whereas
Solaris makes sure 0 is an invalid address.  This lead to code that
seemed to work right for HP-UX that broke when ported to Solaris.
In reality, it was also broken for HP-UX, relying on what the ANSI C
standard says is "undefined behavior".

                                J. P. Schoonover


>Hi, again. If you've seen my other post I just found out using xwpe
>and stepping thru the program that the segmentation fault occurs when
>I use the strlen() function it recieves the SIGSEGV signal.

> What gives?

>TIA,
>H.Cross

--
 
 
 

1. divide by zero / segmentation fault

Software: Slackware 3.1
Hardware: AMD K5 75 MHz, Triton motherboard, NE 2000 clone, IDE

Problem: Networking works fine for everything from ping to httpd server;
however, after a period of inactivity of somewhere from 1 hour to
several
days every networking function stops working, even ping, and produces a
divide by zero / segmentation fault error.  Killing inetd and restarting
it does not solve the problem.

Here is the entry the kernel writes to syslog after an error:

divide error: 0000
CPU:    0
IP:    0010:[get_cpuinfo+190/440]
EFLAGS: 00010046
eax: 00000000   ebx: 0f6bdee9   ecx: 00001e5a   edx: 000026f8
esi: 9728c179   edi: 00000000   ebp: 00000604   esp: 001ac61c
ds: 0018   es: 0018   fs: 002b   gs: 0018   ss: 0018
Process swapper (pid: 0, process nr: 0, stackpage=001aa79c)
Stack: 001ac660 00000246 00252e30 0010ed56 01b0dc00 00252e14
0014378e                      001ac660 001af128 00252e00 00252e30
00000000 00252df2 00002e34        00196552 b3bafdcc 00250018 32a200ff
000927d9 0013ce77 00252e30        001b9260 00000000 b3bafdcc
Call Trace: [get_cpuinfo+434/440] [tcp_connect+742/1072]
            [SHATransform+1050/6796] [rt_del+103/396]
            [sys_getsockopt+84/112] [sys_adjtimex+863/868]
            [do_signal+95/612] [init+416/828] [do_signal+214/612]
            [do_shell+116/196] [start_kernel+323/416]
            [sys_getitimer+32/100]
Code: f7 f1 a3 bc a0 1a 00 89 c3 0f 31 31 d2 29 f0 f7 e3 81 fa f7
Aiee, killing interrupt handler
kfree of non-kmalloced memory: 001ac7e4, next=00000000, order=0
kfree of non-kmalloced memory: 001ac7d4, next=00000000, order=0
kfree of non-kmalloced memory: 001acc08, next=00000000, order=0
idle task may not sleep

The segmentation fault message does not appear in the syslog but does
appear on the screen.

I turned off all power management features in the BIOS and used
setterm -blank 0 to turn off screen saving, however that did not solve
the problem.

Another poster experienced a similar problem, and the only apparent
similarities are Slackware and AMD K5 CPU.

Any of you gurus have any suggestions for fixes or even further
diagnosis?  I'm stuck.

                                                Greg Martin

2. Screen blanking under RedHat 8.0

3. wu-ftpd 2.4, /dev/zero,/dev/tcp problem

4. Creative Ensoniq AudioPCI sound card

5. segmentation faults with large static arrays using gcc under RedHat 5.1

6. Netscape Problems

7. Segmentation Fault (gcc SparcSolaris)

8. IP Masquerade Problem

9. gcc and segmentation faults

10. Reg. segmentation fault on sparc with gcc-3.0 (ld)

11. gcc, malloc, segmentation fault

12. "Segmentation fault" by running gcc

13. Help: GCC 2.7.2 no sr bug Segmentation Fault