Forum: Cfengine Help
Subject: segfault using edit_line with 3.1.0b2
Author: babudro
Link to topic: https://cfengine.com/forum/read.php?3,18764,18764#msg-18764

I've run into an issue that perhaps is a bug.  I have compiled 3.1.0b2 on two 
64-bit machines and one 32-bit, all running RHEL5.  The 64-bit machines both 
segfault, the 32-bit gives a backtrace.  Version 3.0.5p1 worked on the 32-bit 
machine (I did not revert the 64-bit ones to check them).  The 32-bit machine 
is a physical server with 1GB of RAM and 512MB of swap, whereas the 64-bit 
machines are actually VMs under VMware with the reverse memory situation: 512MB 
of RAM and 1GB of swap.  I have verified that all machines have the same set of 
files in the working /inputs/ directory.

What I am doing is simply maintaining (editing) log-in configuration files.  If 
I edit /etc/login.defs to contain an incorrect value, I get a segfault 
following its correction.


$ sudo cf-agent -IKb auth_defaults -f ./promises.cf
 >> Using command line specified bundlesequence
 -> Setting field sub-value 90 in /etc/login.defs
 -> Edited field inside file object /etc/login.defs
Edited file /etc/login.defs
Segmentation fault


If I run it again it completes without segfault, but if I edit /etc/login.defs 
and again insert an invalid value, I get the same segfault.

The relevant tail-end of verbose output looks like this:


cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: ^(PASS_MAX_DAYS\t)([0-9]+)$
cf3
cf3     Comment:  Reset PASS_MAX_DAYS log-in value according to policy, if 
necessary.
cf3     .........................................................
cf3
cf3  - Matched line (PASS_MAX_DAYS      900)
cf3  -> Stopped at field 2
cf3  -> Setting field sub-value 90 in /etc/login.defs
cf3  -> Edited field inside file object /etc/login.defs
cf3
cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: ^(PASS_MIN_DAYS\t)([0-9]+)$
cf3
cf3     Comment:  Reset PASS_MIN_DAYS log-in value according to policy, if 
necessary.
cf3     .........................................................
cf3
cf3  - Matched line (PASS_MIN_DAYS      1)
cf3  -> Stopped at field 2
cf3  -> No need to edit field in /etc/login.defs
cf3 Edited file /etc/login.defs
cf3
cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: /etc/default/useradd
cf3
cf3     Comment:  Maintain new user defaults
cf3     .........................................................
cf3
cf3  -> Using literal pathtype for /etc/default/useradd
cf3  -> Handling file existence constraints on /etc/default/useradd
cf3  -> Handling file edits in edit_line bundle useradd_defaults
cf3
cf3       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3       BUNDLE useradd_defaults( {'21'} )
cf3       * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
cf3
cf3     ? Augment scope useradd_defaults with inactive
cf3      ??  Private class context
cf3
cf3
cf3       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3       field_edits in bundle useradd_defaults
cf3       = = = = = = = = = = = = = = = = = = = = = = = = = = = =
cf3
cf3
cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: ^(INACTIVE=)([0-9]+)$
cf3
cf3     Comment:  Reset INACTIVE value according to policy, if necessary.
cf3     .........................................................
cf3
cf3  - Matched line (INACTIVE=21)
cf3  -> Stopped at field 2
cf3  -> No need to edit field in /etc/default/useradd
Segmentation fault


It works exactly the same on both 64-bit machines.

The 32-bit machine behaves differently:  It gives a backtrace every time and 
does not update the login.defs file.  The tail of verbose output looks like 
this:


$  sudo cf-agent -vIKb auth_defaults -f ./promises.cf

(snip)

cf3     .........................................................
cf3
cf3  - Matched line (PASS_MAX_DAYS      900)
cf3  -> Stopped at field 2
cf3  -> Setting field sub-value 90 in /etc/login.defs
cf3  -> Edited field inside file object /etc/login.defs
cf3
cf3     .........................................................
cf3     Promise handle:
cf3     Promise made by: ^(PASS_MIN_DAYS\t)([0-9]+)$
cf3
cf3     Comment:  Reset PASS_MIN_DAYS log-in value according to policy, if 
necessary.
cf3     .........................................................
cf3
cf3  - Matched line (PASS_MIN_DAYS      1)
cf3  -> Stopped at field 2
cf3  -> No need to edit field in /etc/login.defs
*** glibc detected *** cf-agent: double free or corruption (fasttop): 
0x09a97588 ***
======= Backtrace: =========
/lib/libc.so.6[0x1c50f1]
/lib/libc.so.6(cfree+0x90)[0x1c8bc0]
cf-agent[0x80a8634]
cf-agent[0x80a85fe]
cf-agent[0x80a86ad]
cf-agent[0x80718a4]
cf-agent[0x8072f2f]
cf-agent[0x80733ff]
cf-agent[0x809dda7]
cf-agent[0x809e5a3]
cf-agent[0x807356e]
cf-agent[0x806e68d]
cf-agent[0x80681cc]
cf-agent[0x8078150]
cf-agent[0x804d66f]
cf-agent[0x804d69a]
cf-agent[0x804bc2e]
cf-agent[0x809dda7]
cf-agent[0x809e5a3]
cf-agent[0x804bef4]
cf-agent[0x804c163]
cf-agent[0x804cf25]
cf-agent[0x804d5a4]
/lib/libc.so.6(__libc_start_main+0xdc)[0x171e8c]
cf-agent[0x804b2a1]
======= Memory map: ========
00110000-00117000 r-xp 00000000 fd:00 854267     /lib/librt-2.5.so
00117000-00118000 r-xp 00006000 fd:00 854267     /lib/librt-2.5.so
00118000-00119000 rwxp 00007000 fd:00 854267     /lib/librt-2.5.so
00119000-00122000 r-xp 00000000 fd:00 852008     /lib/libnss_files-2.5.so
00122000-00123000 r-xp 00008000 fd:00 852008     /lib/libnss_files-2.5.so
00123000-00124000 rwxp 00009000 fd:00 852008     /lib/libnss_files-2.5.so
00124000-00131000 r-xp 00000000 fd:00 84320      /usr/lib/liblber-2.3.so.0.2.31
00131000-00132000 rwxp 0000c000 fd:00 84320      /usr/lib/liblber-2.3.so.0.2.31
00132000-00134000 r-xp 00000000 fd:00 73874      /usr/lib/libXau.so.6.0.0
00134000-00135000 rwxp 00001000 fd:00 73874      /usr/lib/libXau.so.6.0.0
00135000-0013d000 r-xp 00000000 fd:00 78482      /usr/lib/libkrb5support.so.0.1
0013d000-0013e000 rwxp 00007000 fd:00 78482      /usr/lib/libkrb5support.so.0.1
0013e000-00158000 r-xp 00000000 fd:00 854262     /lib/ld-2.5.so
00158000-00159000 r-xp 00019000 fd:00 854262     /lib/ld-2.5.so
00159000-0015a000 rwxp 0001a000 fd:00 854262     /lib/ld-2.5.so
0015c000-0029a000 r-xp 00000000 fd:00 854263     /lib/libc-2.5.so
0029a000-0029c000 r-xp 0013e000 fd:00 854263     /lib/libc-2.5.so
0029c000-0029d000 rwxp 00140000 fd:00 854263     /lib/libc-2.5.so
0029d000-002a0000 rwxp 0029d000 00:00 0
002a2000-002a4000 r-xp 00000000 fd:00 852180     /lib/libdl-2.5.so
002a4000-002a5000 r-xp 00001000 fd:00 852180     /lib/libdl-2.5.so
002a5000-002a6000 rwxp 00002000 fd:00 852180     /lib/libdl-2.5.so
002a8000-002cd000 r-xp 00000000 fd:00 854273     /lib/libm-2.5.so
002cd000-002ce000 r-xp 00024000 fd:00 854273     /lib/libm-2.5.so
002ce000-002cf000 rwxp 00025000 fd:00 854273     /lib/libm-2.5.so
002d1000-002e4000 r-xp 00000000 fd:00 854266     /lib/libpthread-2.5.so
002e4000-002e5000 r-xp 00012000 fd:00 854266     /lib/libpthread-2.5.so
002e5000-002e6000 rwxp 00013000 fd:00 854266     /lib/libpthread-2.5.so
002e6000-002e8000 rwxp 002e6000 00:00 0
002ea000-002fc000 r-xp 00000000 fd:00 72313      /usr/lib/libz.so.1.2.3
002fc000-002fd000 rwxp 00011000 fd:00 72313      /usr/lib/libz.so.1.2.3
002ff000-0031e000 r-xp 00000000 fd:00 87190      /usr/lib/libgd.so.2.0.0
0031e000-0033e000 rwxp 0001e000 fd:00 87190      /usr/lib/libgd.so.2.0.0
0033e000-00352000 rwxp 0033e000 00:00 0
00352000-0036a000 r-xp 00000000 fd:00 84321      /usr/lib/libsasl2.so.2.0.22
0036a000-0036b000 rwxp 00017000 fd:00 84321      /usr/lib/libsasl2.so.2.0.22
0036c000-003a5000 r-xp 00000000 fd:00 82390      /usr/lib/libldap-2.3.so.0.2.31
003a5000-003a6000 rwxp 00039000 fd:00 82390      /usr/lib/libldap-2.3.so.0.2.31
003a6000-003af000 r-xp 00000000 fd:00 852036     /lib/libcrypt-2.5.so
003af000-003b0000 r-xp 00008000 fd:00 852036     /lib/libcrypt-2.5.so
003b0000-003b1000 rwxp 00009000 fd:00 852036     /lib/libcrypt-2.5.so
003b1000-003d8000 rwxp 003b1000 00:00 0
003da000-003fd000 r-xp 00000000 fd:00 305500     /usr/lib/libpq.so.5.2
003fd000-003ff000 rwxp 00022000 fd:00 305500     /usr/lib/libpq.so.5.2
003ff000-0047c000 r-xp 00000000 fd:00 75544      /usr/lib/libfreetype.so.6.3.10
0047c000-0047f000 rwxp 0007d000 fd:00 75544      /usr/lib/libfreetype.so.6.3.10
0047f000-004bd000 r-xp 00000000 fd:00 84322      
/usr/lib/libldap_r-2.3.so.0.2.31
004bd000-004bf000 rwxp 0003d000 fd:00 84322      
/usr/lib/libldap_r-2.3.so.0.2.31
004bf000Aborted


The machines have all the latest software from RHN as of three days ago.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to