|
From: Matthias A. <gu...@un...> - 2019-03-15 19:02:59
|
Hello,
While I'm often identifying the issue in our C source (compiled as 64bit on
Linux) I have here a case, which I do not understand and I'd like to ask
for some help. I have below the valgrind warnings and the C-code with
line numbers (from vim). It starts already with the 1st complaint about
"Invalid write of size 4" on line 2131. There is no code, just the start
of the function with a '{'.
Thanks for some explanations.
matthias
2128 PFSTAB FstabInit(
2129 FSTAB_SetId id /* Set-Id fuer die jeweilige FSTAB */
2130 )
2131 {
2132 /*-------------------------------------------------------------------------*/
2133 char *funk = "FstabInit()";
2134
2135 /* t_sik_fstab lesePuffer=SIK_FSTAB_EMPTY; */
2136 DB_ERR dbError;
2137 PFSTAB fstab = NULL;
2138
2139 int anzFstabElemente = 0, anzIndikatorfelder = 0;
2140 int anzRows = 0;
2141
2142 /* SRP-23121: we read the complete FSTAB into memory because we
2143 * have to pass twice through it for the logic of indicator fields
2144 *
2145 * maybe we should malloc() the space ...
2146 * the number MAX_FSTAB_ROWS is the limit for one set in FSTAB
2147 */
2148 t_sik_fstab myFSTABrows[MAX_FSTAB_ROWS];
2149
2150 /* check the SetId */
2151 if( id == FSTAB_Null || id >= FSTAB_Alle ) goto ABBRUCH;
2152
2153 /* init the buffer for read */
2154 memset( &myFSTABrows[anzRows], 0, sizeof( t_sik_fstab ));
2155
---------------------------
==9332== Invalid write of size 4
==9332== at 0x9DE90EF: FstabInit (BKFstab.c:2131)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed476bc is on thread 1's stack
==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
==9332==
==9332== Invalid read of size 4
==9332== at 0x9DE911D: FstabInit (BKFstab.c:2151)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed476bc is on thread 1's stack
==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
==9332==
==9332== Invalid read of size 4
==9332== at 0x9DE912A: FstabInit (BKFstab.c:2151)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed476bc is on thread 1's stack
==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
==9332==
==9332== Invalid write of size 8
==9332== at 0x9DE915A: FstabInit (BKFstab.c:2154)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed47688 is on thread 1's stack
==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
==9332==
==9332== Invalid write of size 8
==9332== at 0x4C305C7: memset (vg_replace_strmem.c:1224)
==9332== by 0x9DE915E: FstabInit (BKFstab.c:2154)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed476c0 is on thread 1's stack
==9332== in frame #1, created by FstabInit (BKFstab.c:2131)
==9332==
==9332== Invalid write of size 1
==9332== at 0x4C305E0: memset (vg_replace_strmem.c:1224)
==9332== by 0x9DE915E: FstabInit (BKFstab.c:2154)
==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==9332== by 0x413657: main (OPDaemon.c:272)
==9332== Address 0xffed47a70 is on thread 1's stack
--
Matthias Apitz, ✉ gu...@un..., http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
What is a good definition for Legacy Software? -- This is one which works.
|
|
From: John R. <jr...@bi...> - 2019-03-15 21:54:29
|
What is the version of valgrind? (run "valgrind --version")
What is the hardware architecture?
What is the value of MAX_FSTAB_ROWS ?
> ==9332== Address 0xffed476bc is on thread 1's stack
Note that the address of the Invalid write is 0xffed476bc which is 0xf_fed4_76bc or around 63 GiB.
That is very large, so large that it is very much more than the usual default maximum size
of a thread stack, which typically is 8 MiB or 16 MiB.
Try invoking valgrind with the parameter --main-stacksize=64000000000 which *might* work.
Otherwise: use malloc() instead of on-stack allocation for the myFSTABrows array.
> 2128 PFSTAB FstabInit(
> 2129 FSTAB_SetId id /* Set-Id fuer die jeweilige FSTAB */
> 2130 )
> 2131 {
> 2132 /*-------------------------------------------------------------------------*/
> 2133 char *funk = "FstabInit()";
> 2134
> 2135 /* t_sik_fstab lesePuffer=SIK_FSTAB_EMPTY; */
> 2136 DB_ERR dbError;
> 2137 PFSTAB fstab = NULL;
> 2138
> 2139 int anzFstabElemente = 0, anzIndikatorfelder = 0;
> 2140 int anzRows = 0;
> 2141
> 2142 /* SRP-23121: we read the complete FSTAB into memory because we
> 2143 * have to pass twice through it for the logic of indicator fields
> 2144 *
> 2145 * maybe we should malloc() the space ...
> 2146 * the number MAX_FSTAB_ROWS is the limit for one set in FSTAB
> 2147 */
> 2148 t_sik_fstab myFSTABrows[MAX_FSTAB_ROWS];
> 2149
> 2150 /* check the SetId */
> 2151 if( id == FSTAB_Null || id >= FSTAB_Alle ) goto ABBRUCH;
> 2152
> 2153 /* init the buffer for read */
> 2154 memset( &myFSTABrows[anzRows], 0, sizeof( t_sik_fstab ));
> 2155
>
>
> ---------------------------
>
> ==9332== Invalid write of size 4
> ==9332== at 0x9DE90EF: FstabInit (BKFstab.c:2131)
> ==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
> ==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
> ==9332== by 0x413657: main (OPDaemon.c:272)
> ==9332== Address 0xffed476bc is on thread 1's stack
> ==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
> ==9332==
> ==9332== Invalid read of size 4
> ==9332== at 0x9DE911D: FstabInit (BKFstab.c:2151)
> ==9332== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
> ==9332== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
> ==9332== by 0x413657: main (OPDaemon.c:272)
> ==9332== Address 0xffed476bc is on thread 1's stack
> ==9332== in frame #0, created by FstabInit (BKFstab.c:2131)
|
|
From: Matthias A. <gu...@un...> - 2019-03-16 08:23:20
|
Hello John,
Thanks for follow-up.
El día viernes, marzo 15, 2019 a las 02:54:11p. m. -0700, John Reiser escribió:
> What is the version of valgrind? (run "valgrind --version")
# /usr/local/sisis-pap/bin/valgrind --version
valgrind-3.11.0
(compiled by myself)
> What is the hardware architecture?
# uname -a
Linux srap18dxr1 4.12.14-95.3-default #1 SMP Wed Dec 5 06:00:48 UTC 2018 (63a8d29) x86_64 x86_64 x86_64 GNU/Linux
The process in question is:
# file /opt/lib/sisis/opserver/bin/OPServer
/opt/lib/sisis/opserver/bin/OPServer: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.0.0, BuildID[sha1]=ec9556bbcae06e85560d496b1755342aae9391d6, not stripped
I'm attaching below the output of 'pmap -x PID'.
> What is the value of MAX_FSTAB_ROWS ?
#define MAX_FSTAB_ROWS 3000
> > ==9332== Address 0xffed476bc is on thread 1's stack
> Note that the address of the Invalid write is 0xffed476bc which is 0xf_fed4_76bc or around 63 GiB.
> That is very large, so large that it is very much more than the usual default maximum size
> of a thread stack, which typically is 8 MiB or 16 MiB.
> Try invoking valgrind with the parameter --main-stacksize=64000000000 which *might* work.
> Otherwise: use malloc() instead of on-stack allocation for the myFSTABrows array.
I do not know exactly the sizeof(t_sik_fstab) but this will not exceed
10k and 3000 x 10k does not go so far. With '--main-stacksize=64000000000'
valgrind does not start anymore, but with '--main-stacksize=640000000'
and it says now the same with other addr values, but as I said BKFstab.c:2131
is the line of the function:
PFSTAB FstabInit(
FSTAB_SetId id /* Set-Id fuer die jeweilige FSTAB */
)
{ <----- line 2131
/*-------------------------------------------------------------------------*/
char *funk = "FstabInit()";
/* t_sik_fstab lesePuffer=SIK_FSTAB_EMPTY; */
DB_ERR dbError;
PFSTAB fstab = NULL;
int anzFstabElemente = 0, anzIndikatorfelder = 0;
int anzRows = 0;
...
==5868== Invalid write of size 4
==5868== at 0x9DE90EF: FstabInit (BKFstab.c:2131)
==5868== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==5868== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==5868== by 0x413657: main (OPDaemon.c:272)
==5868== Address 0xffed476bc is on thread 1's stack
==5868== in frame #0, created by FstabInit (BKFstab.c:2131)
==5868==
==5868== Invalid read of size 4
==5868== at 0x9DE911D: FstabInit (BKFstab.c:2151)
==5868== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299)
==5868== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738)
==5868== by 0x413657: main (OPDaemon.c:272)
==5868== Address 0xffed476bc is on thread 1's stack
==5868== in frame #0, created by FstabInit (BKFstab.c:2131)
==5868==
How valgrind can come to this large addr 0xffed476bc?
# pmap -x 2149
2149: OPServer
START SIZE RSS PSS DIRTY PERM MAPPING
0000000000400000 168K 168K 16K 0K r-xp /opt/lib/sisis/opserver/bin/OPServer
000000000062a000 4K 4K 0K 4K r--p /opt/lib/sisis/opserver/bin/OPServer
000000000062b000 32K 32K 6K 24K rw-p /opt/lib/sisis/opserver/bin/OPServer
0000000000633000 28K 8K 4K 8K rw-p [anon]
00000000025fc000 3448K 3408K 809K 3408K rw-p [heap]
00007fdfb68f6000 1216K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_COLLATE
00007fdfb6a26000 252K 248K 24K 248K rw-p [anon]
00007fdfb6a95000 272K 64K 1K 0K r--p /usr/lib/locale/de_DE.utf8/LC_CTYPE
00007fdfb6ad9000 128K 128K 12K 128K rw-p [anon]
00007fdfb6b36000 128K 128K 12K 128K rw-p [anon]
00007fdfb6b92000 356K 0K 0K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybunic64.so
00007fdfb6beb000 2044K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybunic64.so
00007fdfb6dea000 332K 196K 17K 172K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybunic64.so
00007fdfb6e3d000 96K 84K 1K 0K r-xp /lib64/libpthread-2.22.so
00007fdfb6e55000 2044K 0K 0K 0K ---p /lib64/libpthread-2.22.so
00007fdfb7054000 4K 4K 0K 4K r--p /lib64/libpthread-2.22.so
00007fdfb7055000 4K 4K 4K 4K rw-p /lib64/libpthread-2.22.so
00007fdfb7056000 16K 4K 4K 4K rw-p [anon]
00007fdfb705a000 32K 32K 0K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybintl64.so
00007fdfb7062000 2048K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybintl64.so
00007fdfb7262000 4K 4K 0K 4K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybintl64.so
00007fdfb7263000 684K 512K 12K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybcomn64.so
00007fdfb730e000 2044K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybcomn64.so
00007fdfb750d000 56K 56K 8K 52K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybcomn64.so
00007fdfb751b000 12K 12K 1K 12K rw-p [anon]
00007fdfb751e000 152K 128K 3K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybtcl64.so
00007fdfb7544000 2044K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybtcl64.so
00007fdfb7743000 4K 4K 0K 4K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybtcl64.so
00007fdfb7744000 8K 8K 4K 8K rw-p [anon]
00007fdfb7746000 76K 76K 1K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybcs64.so
00007fdfb7759000 2044K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybcs64.so
00007fdfb7958000 4K 4K 0K 4K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybcs64.so
00007fdfb7959000 572K 512K 12K 0K r-xp /opt/sybase157sp130/OCS-15_0/lib/libsybct64.so
00007fdfb79e8000 2044K 0K 0K 0K ---p /opt/sybase157sp130/OCS-15_0/lib/libsybct64.so
00007fdfb7be7000 72K 72K 7K 72K rw-p /opt/sybase157sp130/OCS-15_0/lib/libsybct64.so
00007fdfb7bf9000 1644K 1344K 18K 0K r-xp /lib64/libc-2.22.so
00007fdfb7d94000 2048K 0K 0K 0K ---p /lib64/libc-2.22.so
00007fdfb7f94000 16K 16K 1K 16K r--p /lib64/libc-2.22.so
00007fdfb7f98000 8K 8K 8K 8K rw-p /lib64/libc-2.22.so
00007fdfb7f9a000 16K 16K 12K 16K rw-p [anon]
00007fdfb7f9e000 940K 64K 1K 0K r-xp /usr/local/sisis-pap/lib/libiconv.so.2.5.0
00007fdfb8089000 2044K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libiconv.so.2.5.0
00007fdfb8288000 8K 8K 0K 8K r--p /usr/local/sisis-pap/lib/libiconv.so.2.5.0
00007fdfb828a000 4K 4K 0K 4K rw-p /usr/local/sisis-pap/lib/libiconv.so.2.5.0
00007fdfb828b000 2000K 1408K 115K 0K r-xp /usr/local/sisis-pap/lib/libcrypto.so.1.1
00007fdfb847f000 2044K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libcrypto.so.1.1
00007fdfb867e000 116K 116K 11K 116K r--p /usr/local/sisis-pap/lib/libcrypto.so.1.1
00007fdfb869b000 40K 40K 14K 40K rw-p /usr/local/sisis-pap/lib/libcrypto.so.1.1
00007fdfb86a5000 12K 12K 12K 12K rw-p [anon]
00007fdfb86a8000 404K 372K 27K 0K r-xp /usr/local/sisis-pap/lib/libssl.so.1.1
00007fdfb870d000 2044K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libssl.so.1.1
00007fdfb890c000 16K 16K 1K 16K r--p /usr/local/sisis-pap/lib/libssl.so.1.1
00007fdfb8910000 24K 24K 20K 24K rw-p /usr/local/sisis-pap/lib/libssl.so.1.1
00007fdfb8916000 1692K 64K 1K 0K r-xp /usr/local/sisis-pap/lib/libxml2.so.2.6.32
00007fdfb8abd000 2048K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libxml2.so.2.6.32
00007fdfb8cbd000 28K 28K 2K 28K r--p /usr/local/sisis-pap/lib/libxml2.so.2.6.32
00007fdfb8cc4000 12K 12K 1K 12K rw-p /usr/local/sisis-pap/lib/libxml2.so.2.6.32
00007fdfb8cc7000 4K 0K 0K 0K rw-p [anon]
00007fdfb8cc8000 44K 44K 0K 0K r-xp /lib64/libcrypt-2.22.so
00007fdfb8cd3000 2048K 0K 0K 0K ---p /lib64/libcrypt-2.22.so
00007fdfb8ed3000 4K 4K 0K 4K r--p /lib64/libcrypt-2.22.so
00007fdfb8ed4000 4K 4K 0K 4K rw-p /lib64/libcrypt-2.22.so
00007fdfb8ed5000 184K 0K 0K 0K rw-p [anon]
00007fdfb8f03000 8K 8K 0K 0K r-xp /lib64/libdl-2.22.so
00007fdfb8f05000 2048K 0K 0K 0K ---p /lib64/libdl-2.22.so
00007fdfb9105000 4K 4K 0K 4K r--p /lib64/libdl-2.22.so
00007fdfb9106000 4K 4K 4K 4K rw-p /lib64/libdl-2.22.so
00007fdfb9107000 1008K 128K 3K 0K r-xp /usr/local/sisis-pap/lib/libglib-2.0.so.0.2000.0
00007fdfb9203000 2048K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libglib-2.0.so.0.2000.0
00007fdfb9403000 4K 4K 0K 4K r--p /usr/local/sisis-pap/lib/libglib-2.0.so.0.2000.0
00007fdfb9404000 4K 4K 0K 4K rw-p /usr/local/sisis-pap/lib/libglib-2.0.so.0.2000.0
00007fdfb9405000 1004K 64K 1K 0K r-xp /lib64/libm-2.22.so
00007fdfb9500000 2048K 0K 0K 0K ---p /lib64/libm-2.22.so
00007fdfb9700000 4K 4K 0K 4K r--p /lib64/libm-2.22.so
00007fdfb9701000 4K 4K 0K 4K rw-p /lib64/libm-2.22.so
00007fdfb9702000 88K 64K 1K 0K r-xp /lib64/libnsl-2.22.so
00007fdfb9718000 2044K 0K 0K 0K ---p /lib64/libnsl-2.22.so
00007fdfb9917000 4K 4K 0K 4K r--p /lib64/libnsl-2.22.so
00007fdfb9918000 4K 4K 0K 4K rw-p /lib64/libnsl-2.22.so
00007fdfb9919000 8K 0K 0K 0K rw-p [anon]
00007fdfb991b000 108K 64K 1K 0K r-xp /usr/local/sisis-pap/lib/libz.so.1.2.8
00007fdfb9936000 2044K 0K 0K 0K ---p /usr/local/sisis-pap/lib/libz.so.1.2.8
00007fdfb9b35000 4K 4K 0K 4K r--p /usr/local/sisis-pap/lib/libz.so.1.2.8
00007fdfb9b36000 4K 4K 0K 4K rw-p /usr/local/sisis-pap/lib/libz.so.1.2.8
00007fdfb9b37000 24K 24K 1K 0K r-xp /opt/lib/sisis/lib/libIDServer.so
00007fdfb9b3d000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libIDServer.so
00007fdfb9d3c000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libIDServer.so
00007fdfb9d3d000 4K 4K 4K 4K rw-p /opt/lib/sisis/lib/libIDServer.so
00007fdfb9d3e000 12K 0K 0K 0K r-xp /opt/lib/sisis/opserver/lib/libpdservice.so
00007fdfb9d41000 2044K 0K 0K 0K ---p /opt/lib/sisis/opserver/lib/libpdservice.so
00007fdfb9f40000 4K 4K 0K 4K r--p /opt/lib/sisis/opserver/lib/libpdservice.so
00007fdfb9f41000 4K 4K 0K 4K rw-p /opt/lib/sisis/opserver/lib/libpdservice.so
00007fdfb9f42000 20832K 704K 28K 0K r-xp /opt/lib/sisis/lib/syb157/libdbcall.so
00007fdfbb39a000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/syb157/libdbcall.so
00007fdfbb599000 8K 8K 0K 8K r--p /opt/lib/sisis/lib/syb157/libdbcall.so
00007fdfbb59b000 52K 52K 9K 16K rw-p /opt/lib/sisis/lib/syb157/libdbcall.so
00007fdfbb5a8000 2884K 2068K 2064K 2068K rw-p [anon]
00007fdfbb879000 164K 128K 3K 0K r-xp /opt/lib/sisis/lib/libsbstring.so
00007fdfbb8a2000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libsbstring.so
00007fdfbbaa1000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsbstring.so
00007fdfbbaa2000 360K 360K 36K 360K rw-p /opt/lib/sisis/lib/libsbstring.so
00007fdfbbafc000 8K 4K 0K 4K rw-p [anon]
00007fdfbbafe000 320K 0K 0K 0K r-xp /opt/lib/sisis/lib/librech.so
00007fdfbbb4e000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/librech.so
00007fdfbbd4d000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/librech.so
00007fdfbbd4e000 8K 8K 1K 8K rw-p /opt/lib/sisis/lib/librech.so
00007fdfbbd50000 4512K 4K 0K 4K rw-p [anon]
00007fdfbc1b8000 288K 0K 0K 0K r-xp /opt/lib/sisis/lib/libsikisserver.so
00007fdfbc200000 2048K 0K 0K 0K ---p /opt/lib/sisis/lib/libsikisserver.so
00007fdfbc400000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsikisserver.so
00007fdfbc401000 8K 8K 0K 8K rw-p /opt/lib/sisis/lib/libsikisserver.so
00007fdfbc403000 164K 16K 1K 16K rw-p [anon]
00007fdfbc42c000 60K 0K 0K 0K r-xp /opt/lib/sisis/lib/libopacserver.so
00007fdfbc43b000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libopacserver.so
00007fdfbc63a000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libopacserver.so
00007fdfbc63b000 36K 36K 2K 16K rw-p /opt/lib/sisis/lib/libopacserver.so
00007fdfbc644000 8K 0K 0K 0K rw-p [anon]
00007fdfbc646000 4K 0K 0K 0K r-xp /opt/lib/sisis/lib/libBSA.so
00007fdfbc647000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libBSA.so
00007fdfbc846000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libBSA.so
00007fdfbc847000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libBSA.so
00007fdfbc848000 556K 0K 0K 0K r-xp /opt/lib/sisis/lib/libsiasbase.so
00007fdfbc8d3000 2048K 0K 0K 0K ---p /opt/lib/sisis/lib/libsiasbase.so
00007fdfbcad3000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsiasbase.so
00007fdfbcad4000 8K 8K 1K 8K rw-p /opt/lib/sisis/lib/libsiasbase.so
00007fdfbcad6000 176K 20K 2K 20K rw-p [anon]
00007fdfbcb02000 132K 0K 0K 0K r-xp /opt/lib/sisis/lib/libsicall.so
00007fdfbcb23000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libsicall.so
00007fdfbcd22000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsicall.so
00007fdfbcd23000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libsicall.so
00007fdfbcd24000 12K 0K 0K 0K rw-p [anon]
00007fdfbcd27000 860K 0K 0K 0K r-xp /opt/lib/sisis/lib/libsiasserver.so
00007fdfbcdfe000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libsiasserver.so
00007fdfbcffd000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsiasserver.so
00007fdfbcffe000 8K 8K 1K 8K rw-p /opt/lib/sisis/lib/libsiasserver.so
00007fdfbd000000 180K 0K 0K 0K rw-p [anon]
00007fdfbd02d000 16K 0K 0K 0K r-xp /opt/lib/sisis/lib/libInfo2ZFL.so
00007fdfbd031000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libInfo2ZFL.so
00007fdfbd230000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libInfo2ZFL.so
00007fdfbd231000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libInfo2ZFL.so
00007fdfbd232000 4K 0K 0K 0K rw-p [anon]
00007fdfbd233000 56K 0K 0K 0K r-xp /opt/lib/sisis/lib/libpfl.so
00007fdfbd241000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libpfl.so
00007fdfbd440000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libpfl.so
00007fdfbd441000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libpfl.so
00007fdfbd442000 24K 0K 0K 0K rw-p [anon]
00007fdfbd448000 428K 0K 0K 0K r-xp /opt/lib/sisis/lib/libcopz39.so
00007fdfbd4b3000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libcopz39.so
00007fdfbd6b2000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libcopz39.so
00007fdfbd6b3000 24K 24K 2K 20K rw-p /opt/lib/sisis/lib/libcopz39.so
00007fdfbd6b9000 84K 0K 0K 0K rw-p [anon]
00007fdfbd6ce000 148K 0K 0K 0K r-xp /opt/lib/sisis/lib/libslnpz39.so
00007fdfbd6f3000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libslnpz39.so
00007fdfbd8f2000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libslnpz39.so
00007fdfbd8f3000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libslnpz39.so
00007fdfbd8f4000 8K 0K 0K 0K rw-p [anon]
00007fdfbd8f6000 92K 0K 0K 0K r-xp /opt/lib/sisis/lib/libz39.so
00007fdfbd90d000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libz39.so
00007fdfbdb0c000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libz39.so
00007fdfbdb0d000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libz39.so
00007fdfbdb0e000 156K 148K 4K 0K r-xp /opt/lib/sisis/lib/libslnp.so
00007fdfbdb35000 2048K 0K 0K 0K ---p /opt/lib/sisis/lib/libslnp.so
00007fdfbdd35000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libslnp.so
00007fdfbdd36000 8K 8K 8K 8K rw-p /opt/lib/sisis/lib/libslnp.so
00007fdfbdd38000 16408K 20K 20K 20K rw-p [anon]
00007fdfbed3e000 28K 0K 0K 0K r-xp /opt/lib/sisis/lib/libslnpstd.so
00007fdfbed45000 2048K 0K 0K 0K ---p /opt/lib/sisis/lib/libslnpstd.so
00007fdfbef45000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libslnpstd.so
00007fdfbef46000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libslnpstd.so
00007fdfbef47000 72K 0K 0K 0K r-xp /opt/lib/sisis/opserver/lib/libcmdops.so
00007fdfbef59000 2044K 0K 0K 0K ---p /opt/lib/sisis/opserver/lib/libcmdops.so
00007fdfbf158000 4K 4K 0K 4K r--p /opt/lib/sisis/opserver/lib/libcmdops.so
00007fdfbf159000 24K 24K 2K 24K rw-p /opt/lib/sisis/opserver/lib/libcmdops.so
00007fdfbf15f000 220K 0K 0K 0K r-xp /opt/lib/sisis/opserver/lib/libslnpops.so
00007fdfbf196000 2044K 0K 0K 0K ---p /opt/lib/sisis/opserver/lib/libslnpops.so
00007fdfbf395000 4K 4K 0K 4K r--p /opt/lib/sisis/opserver/lib/libslnpops.so
00007fdfbf396000 4K 4K 0K 4K rw-p /opt/lib/sisis/opserver/lib/libslnpops.so
00007fdfbf397000 392K 128K 12K 0K r-xp /opt/lib/sisis/opserver/lib/libops.so
00007fdfbf3f9000 2044K 0K 0K 0K ---p /opt/lib/sisis/opserver/lib/libops.so
00007fdfbf5f8000 4K 4K 0K 4K r--p /opt/lib/sisis/opserver/lib/libops.so
00007fdfbf5f9000 112K 36K 4K 16K rw-p /opt/lib/sisis/opserver/lib/libops.so
00007fdfbf615000 148K 16K 5K 16K rw-p [anon]
00007fdfbf63a000 16K 16K 0K 0K r-xp /opt/lib/sisis/lib/libsrvtrace.so
00007fdfbf63e000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libsrvtrace.so
00007fdfbf83d000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libsrvtrace.so
00007fdfbf83e000 4K 4K 4K 4K rw-p /opt/lib/sisis/lib/libsrvtrace.so
00007fdfbf83f000 20480K 0K 0K 0K rw-p [anon]
00007fdfc0c3f000 688K 0K 0K 0K r-xp /opt/lib/sisis/lib/libslnpbts.so
00007fdfc0ceb000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libslnpbts.so
00007fdfc0eea000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libslnpbts.so
00007fdfc0eeb000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libslnpbts.so
00007fdfc0eec000 32K 0K 0K 0K r-xp /opt/lib/sisis/lib/libnahrot.so
00007fdfc0ef4000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libnahrot.so
00007fdfc10f3000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libnahrot.so
00007fdfc10f4000 4K 4K 0K 4K rw-p /opt/lib/sisis/lib/libnahrot.so
00007fdfc10f5000 12K 0K 0K 0K rw-p [anon]
00007fdfc10f8000 480K 0K 0K 0K r-xp /opt/lib/sisis/lib/libbts.so
00007fdfc1170000 2044K 0K 0K 0K ---p /opt/lib/sisis/lib/libbts.so
00007fdfc136f000 4K 4K 0K 4K r--p /opt/lib/sisis/lib/libbts.so
00007fdfc1370000 8K 8K 0K 8K rw-p /opt/lib/sisis/lib/libbts.so
00007fdfc1372000 320K 0K 0K 0K rw-p [anon]
00007fdfc13c2000 132K 132K 1K 0K r-xp /lib64/ld-2.22.so
00007fdfc1426000 252K 248K 24K 248K rw-p [anon]
00007fdfc147d000 128K 128K 12K 128K rw-p [anon]
00007fdfc14b3000 152K 152K 12K 0K r--p /usr/share/locale/de/LC_MESSAGES/libc.mo
00007fdfc14d9000 212K 64K 1K 64K r--s /run/nscd/dbWCJN5T
00007fdfc150e000 444K 0K 0K 0K r--p /opt/lib/nls/msg/de_DE.UTF-8/ops.cat.utf8
00007fdfc157d000 212K 64K 2K 64K r--s /run/nscd/passwd
00007fdfc15b2000 44K 44K 11K 44K rw-p [anon]
00007fdfc15c8000 4K 4K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_NUMERIC
00007fdfc15c9000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_TIME
00007fdfc15ca000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_MONETARY
00007fdfc15cb000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_MESSAGES/SYS_LC_MESSAGES
00007fdfc15cc000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_PAPER
00007fdfc15cd000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_NAME
00007fdfc15ce000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_ADDRESS
00007fdfc15cf000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_TELEPHONE
00007fdfc15d0000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_MEASUREMENT
00007fdfc15d1000 28K 28K 1K 0K r--s /usr/lib64/gconv/gconv-modules.cache
00007fdfc15d8000 4K 0K 0K 0K r--p /usr/lib/locale/de_DE.utf8/LC_IDENTIFICATION
00007fdfc15d9000 40K 40K 11K 40K rw-p [anon]
00007fdfc15e3000 4K 4K 0K 4K r--p /lib64/ld-2.22.so
00007fdfc15e4000 4K 4K 4K 4K rw-p /lib64/ld-2.22.so
00007fdfc15e5000 4K 4K 4K 4K rw-p [anon]
00007ffccdbf5000 2860K 992K 122K 992K rw-p [stack]
00007ffccdf0e000 12K 0K 0K 0K r--p [vvar]
00007ffccdf11000 8K 4K 0K 0K r-xp [vdso]
ffffffffff600000 4K 0K 0K 0K r-xp [vsyscall]
Total: 182480K 15816K 3631K 9032K
54336K writable-private, 127692K readonly-private, 452K shared, and 9964K referenced
--
Matthias Apitz, ✉ gu...@un..., http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
|
|
From: Matthias A. <gu...@un...> - 2019-03-16 11:42:35
|
El día sábado, marzo 16, 2019 a las 09:23:06a. m. +0100, Matthias Apitz escribió: > > What is the value of MAX_FSTAB_ROWS ? > > #define MAX_FSTAB_ROWS 3000 I set a gdb breakpoint at the entry of FstabInit(). The size of the array is: (gdb) p sizeof(t_sik_fstab) $4 = 950 (gdb) p sizeof(myFSTABrows) $5 = 2850000 and as well I can not see anything unusual while stepping through the init sequence of the function. matthias -- Matthias Apitz, ✉ gu...@un..., http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub |
|
From: Tom H. <to...@co...> - 2019-03-16 11:51:04
|
On 16/03/2019 11:42, Matthias Apitz wrote: > El día sábado, marzo 16, 2019 a las 09:23:06a. m. +0100, Matthias Apitz escribió: > >>> What is the value of MAX_FSTAB_ROWS ? >> >> #define MAX_FSTAB_ROWS 3000 > > I set a gdb breakpoint at the entry of FstabInit(). The size of the > array is: > > (gdb) p sizeof(t_sik_fstab) > $4 = 950 > (gdb) p sizeof(myFSTABrows) > $5 = 2850000 > > and as well I can not see anything unusual while stepping through the > init sequence of the function. That's nearly 3Mbytes that you are creating on the stack which is quite a lot... More importantly it is more than the default value that valgrind uses for --max-stackframe so it is likely to lead to confusion - do you get a warning about a stack switch being assumed before those other messages? Try using --max-stackframe=4000000 or something to specify a larger maximum stack frame size and see if that helps. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: Matthias A. <gu...@un...> - 2019-03-16 15:59:00
Attachments:
signature.asc
|
El día sábado, marzo 16, 2019 a las 11:50:48a. m. +0000, Tom Hughes escribió: > On 16/03/2019 11:42, Matthias Apitz wrote: > > El día sábado, marzo 16, 2019 a las 09:23:06a. m. +0100, Matthias Apitz escribió: > > > >>> What is the value of MAX_FSTAB_ROWS ? > >> > >> #define MAX_FSTAB_ROWS 3000 > > > > I set a gdb breakpoint at the entry of FstabInit(). The size of the > > array is: > > > > (gdb) p sizeof(t_sik_fstab) > > $4 = 950 > > (gdb) p sizeof(myFSTABrows) > > $5 = 2850000 > > > > and as well I can not see anything unusual while stepping through the > > init sequence of the function. > > That's nearly 3Mbytes that you are creating on the stack > which is quite a lot... > > More importantly it is more than the default value that > valgrind uses for --max-stackframe so it is likely to lead > to confusion - do you get a warning about a stack switch > being assumed before those other messages? > > Try using --max-stackframe=4000000 or something to specify > a larger maximum stack frame size and see if that helps. It says at the start when I set '--main-stacksize=640000000': ==5868== Memcheck, a memory error detector ==5868== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==5868== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==5868== Command: /opt/lib/sisis/opserver/bin/OPServer -p 4711 ==5868== 16.03.2019 09:17:15.772 OPServer <5868> : started at : 16.03.2019 09:17:15 ==5868== Warning: client switching stacks? SP change: 0xffefff3e8 --> 0xffed47690 ==5868== to suppress, use: --max-stackframe=2850136 or greater ==5868== Invalid write of size 4 ==5868== at 0x9DE90EF: FstabInit (BKFstab.c:2131) ==5868== by 0x6BFF1E8: OpsInitDatabase (SRVServerInit.c:1299) ==5868== by 0x413B48: SlnpInitDaemon (OPDaemon.c:738) ==5868== by 0x413657: main (OPDaemon.c:272) ==5868== Address 0xffed476bc is on thread 1's stack ==5868== in frame #0, created by FstabInit (BKFstab.c:2131) Ahh, it's requesting to higher '--max-stackframe'. The '--main-stacksize' is per default 8M and big enough, but '--max-stackframe' is per default only 2000000. I set it to 8000000 and with this the warning above and the false positive about bad reads in FstabInit() disappeared. Thanks for the hint and I will think in rewrite this using malloc(3C). Lesson learned. matthias -- Matthias Apitz, ✉ gu...@un..., http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub |