-
Notifications
You must be signed in to change notification settings - Fork 29
Description
MIT uses Ubuntu on their machines, and on their athena machine, I compiled Elvis there and for some time it worked, until about a year ago. There must have been a hardware or distribution upgrade or something. THe current CPU is an Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz, running six cores. (40 gigs of RAM).
Elvis started dumping core after only moving around the file with navigation keys. My compilation flags are:
gcc -O2 -ansi
-ansi is used because getline() is confused with the one in stdio.h
This causes a flurry of warnings (this has always been my experience), so I added a -w flag. The warnings consisted of errors such as this random sampling out of the hundreds received:
osunix/osblock.c: In function ‘blkopen’:
osunix/osblock.c:201:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
(void)write(fd, (char *)buf, sizeof buf->super);
^
osunix/osprg.c: In function ‘prgopen’:
osunix/osprg.c:97:8: warning: ignoring return value of ‘dup’, declared with attribute warn_unused_result [-Wunused-result]
dup(r0w1[0]);
In file included from elvis.h:143:0,
from lowbuf.c:9:
lowbuf.c: In function ‘delblock’:
session.h:97:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
#define SES_MAXBLKLIST ((o_blksize - (int)(((BLK *)0)->blklist.blk)) / sizeof(((BLK *)0)->blklist.blk[0]))
lowbuf.c:445:28: note: in expansion of macro ‘SES_MAXSUPER’
for (i = 0; (unsigned)i < SES_MAXSUPER; i++)
^
osunix/tcaphelp.c: In function ‘ttywrite’:
osunix/tcaphelp.c:109:7: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(ttyscr, buf, (size_t)len);
^
guix11/guix11.c: In function ‘loadresources’:
guix11/guix11.c:399:25: warning: assignment makes pointer from integer without a cast [enabled by default]
resources[i].string = strdup(value.addr);
^
and so on.
Running Elvis causes a segfault as stated earlier after a few key movements, which I shall show here:
---
reading Makefile
*** buffer overflow detected ***: elvis terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7338f)[0x7f1be18ef38f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f1be1986c9c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109b60)[0x7f1be1985b60]
elvis[0x45482a]
elvis[0x42c889]
elvis[0x42f38c]
elvis[0x430949]
elvis[0x46246a]
elvis[0x404d17]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f1be189dec5]
elvis[0x405169]
======= Memory map: ========
00400000-0048d000 r-xp 00000000 00:1a 1851037812 /afs/athena.mit.edu/user/p/j/pjk/bin/elvis
0068c000-0068d000 r--p 0008c000 00:1a 1851037812 /afs/athena.mit.edu/user/p/j/pjk/bin/elvis
0068d000-00699000 rw-p 0008d000 00:1a 1851037812 /afs/athena.mit.edu/user/p/j/pjk/bin/elvis
00699000-006a1000 rw-p 00000000 00:00 0
00922000-01b90000 rw-p 00000000 00:00 0 [heap]
7f1be0613000-7f1be0629000 r-xp 00000000 fc:00 794601 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1be0629000-7f1be0828000 ---p 00016000 fc:00 794601 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1be0828000-7f1be0829000 rw-p 00015000 fc:00 794601 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f1be0829000-7f1be082e000 r-xp 00000000 fc:00 685095 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f1be082e000-7f1be0a2d000 ---p 00005000 fc:00 685095 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f1be0a2d000-7f1be0a2e000 r--p 00004000 fc:00 685095 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f1be0a2e000-7f1be0a2f000 rw-p 00005000 fc:00 685095 /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
7f1be0a2f000-7f1be0a38000 r-xp 00000000 fc:00 684890 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f1be0a38000-7f1be0c37000 ---p 00009000 fc:00 684890 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f1be0c37000-7f1be0c38000 r--p 00008000 fc:00 684890 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f1be0c38000-7f1be0c39000 rw-p 00009000 fc:00 684890 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f1be0c39000-7f1be0c42000 r-xp 00000000 fc:00 674276 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f1be0c42000-7f1be0e41000 ---p 00009000 fc:00 674276 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f1be0e41000-7f1be0e42000 r--p 00008000 fc:00 674276 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f1be0e42000-7f1be0e43000 rw-p 00009000 fc:00 674276 /usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
7f1be0e43000-7f1be0e4e000 r-xp 00000000 fc:00 913434 /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f1be0e4e000-7f1be104d000 ---p 0000b000 fc:00 913434 /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f1be104d000-7f1be104e000 r--p 0000a000 fc:00 913434 /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f1be104e000-7f1be104f000 rw-p 0000b000 fc:00 913434 /lib/x86_64-linux-gnu/libnss_files-2.19.so
7f1be104f000-7f1be1054000 r-xp 00000000 fc:00 662534 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1be1054000-7f1be1253000 ---p 00005000 fc:00 662534 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1be1253000-7f1be1254000 r--p 00004000 fc:00 662534 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1be1254000-7f1be1255000 rw-p 00005000 fc:00 662534 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1be1255000-7f1be1257000 r-xp 00000000 fc:00 662530 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1be1257000-7f1be1457000 ---p 00002000 fc:00 662530 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1be1457000-7f1be1458000 r--p 00002000 fc:00 662530 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1be1458000-7f1be1459000 rw-p 00003000 fc:00 662530 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1be1459000-7f1be145c000 r-xp 00000000 fc:00 913429 /lib/x86_64-linux-gnu/libdl-2.19.so
7f1be145c000-7f1be165b000 ---p 00003000 fc:00 913429 /lib/x86_64-linux-gnu/libdl-2.19.so
7f1be165b000-7f1be165c000 r--p 00002000 fc:00 913429 /lib/x86_64-linux-gnu/libdl-2.19.so
7f1be165c000-7f1be165d000 rw-p 00003000 fc:00 913429 /lib/x86_64-linux-gnu/libdl-2.19.so
7f1be165d000-7f1be167a000 r-xp 00000000 fc:00 662538 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1be167a000-7f1be187a000 ---p 0001d000 fc:00 662538 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1be187a000-7f1be187b000 r--p 0001d000 fc:00 662538 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1be187b000-7f1be187c000 rw-p 0001e000 fc:00 662538 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1be187c000-7f1be1a37000 r-xp 00000000 fc:00 847616 /lib/x86_64-linux-gnu/libc-2.19.so
7f1be1a37000-7f1be1c36000 ---p 001bb000 fc:00 847616 /lib/x86_64-linux-gnu/libc-2.19.so
7f1be1c36000-7f1be1c3a000 r--p 001ba000 fc:00 847616 /lib/x86_64-linux-gnu/libc-2.19.so
7f1be1c3a000-7f1be1c3c000 rw-p 001be000 fc:00 847616 /lib/x86_64-linux-gnu/libc-2.19.so
7f1be1c3c000-7f1be1c41000 rw-p 00000000 00:00 0
7f1be1c41000-7f1be1c66000 r-xp 00000000 fc:00 786554 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1be1c66000-7f1be1e65000 ---p 00025000 fc:00 786554 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1be1e65000-7f1be1e69000 r--p 00024000 fc:00 786554 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1be1e69000-7f1be1e6a000 rw-p 00028000 fc:00 786554 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1be1e6a000-7f1be1f9a000 r-xp 00000000 fc:00 662546 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1be1f9a000-7f1be219a000 ---p 00130000 fc:00 662546 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1be219a000-7f1be219b000 r--p 00130000 fc:00 662546 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1be219b000-7f1be219f000 rw-p 00131000 fc:00 662546 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1be219f000-7f1be21c2000 r-xp 00000000 fc:00 847695 /lib/x86_64-linux-gnu/ld-2.19.so
7f1be238d000-7f1be2392000 rw-p 00000000 00:00 0
7f1be23bc000-7f1be23c1000 rw-p 00000000 00:00 0
7f1be23c1000-7f1be23c2000 r--p 00022000 fc:00 847695 /lib/x86_64-linux-gnu/ld-2.19.so
7f1be23c2000-7f1be23c3000 rw-p 00023000 fc:00 847695 /lib/x86_64-linux-gnu/ld-2.19.so
7f1be23c3000-7f1be23c4000 rw-p 00000000 00:00 0
7ffdf2ab5000-7ffdf2ad6000 rw-p 00000000 00:00 0 [stack]
7ffdf2b07000-7ffdf2b09000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
Hope this helps.
Paul King