Skip to content

Conversation

@dottedmag
Copy link
Contributor

No description provided.

patuchov pushed a commit that referenced this pull request Feb 27, 2012
Fixes for broken packages testcases
@patuchov patuchov merged commit a7ea890 into cfengine:master Feb 27, 2012
olehermanse added a commit that referenced this pull request Nov 18, 2019
An empty rlist is represented as a NULL pointer, so all Rlist
functions should handle NULL pointers at runtime.

Fixes an issue on FreeBSD, where RlistContainsString is
called on a NULL pointer (before any elements are added):

    Core was generated by `/var/cfengine/bin/cf-key'.
    Program terminated with signal SIGABRT, Aborted.
    #0  0x00000008024219ba in thr_kill () from /lib/libc.so.7
    (gdb) bt
    #0  0x00000008024219ba in thr_kill () from /lib/libc.so.7
    #1  0x0000000802421984 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
    #2  0x00000008024218f9 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
    #3  0x000000080249d101 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>)
        at /usr/src/lib/libc/gen/assert.c:51
    #4  0x00000008008cc5b5 in RlistContainsString (list=0x0, string=0x8048af320 "0a:14:50:21:f0:44") at rlist.c:292
    #5  0x00000008009163e1 in FindV6InterfacesInfo (ctx=0x80481c0c0, interfaces=0x7ffffffed098, hardware=0x7ffffffed090, ips=0x7ffffffed080)
        at unix_iface.c:704
    #6  0x0000000800915f16 in GetInterfacesInfo (ctx=0x80481c0c0) at unix_iface.c:565
    #7  0x00000008009142eb in DetectEnvironment (ctx=0x80481c0c0) at sysinfo.c:3304
    #8  0x00000008008ab30f in GenericAgentDiscoverContext (ctx=0x80481c0c0, config=0x80481c000) at generic_agent.c:537
    #9  0x000000000040231b in main (argc=1, argv=0x7fffffffeaa8) at cf-key.c:148

This was introduced recently, and I don't believe it's been
in any released packages, so no changelog entry.

Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
olehermanse added a commit that referenced this pull request Nov 28, 2019
When compiling with explicit CFLAGS / LDFLAGS these are not handled in
the same way in different automake files.

The way we are mixing user-provided flags with configure generated ones
is not ideal, this change doesn't fix that, but it at least makes it
more consistent.

For example, compiling like this:

```
./autogen.sh --enable-debug && make CFLAGS="-fsanitize=address" LDFLAGS="-fsanitize=address"
```

Would cause the explicit flags to override flags from configure when
building cf-agent, but not in cf-promises. The end result is that debug
info (line numbers) is missing in some places.

**Before change:**

```
Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x7fc5c3640538 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x77538)
    #1 0x7fc5c31badc0 in xstrdup /home/vagrant/cfe/core/libntech/libutils/alloc.c:58
    #2 0x559ddf51b064 in VerifyNotInFstab (/var/cfengine/bin/cf-agent+0xa0064)
    #3 0x559ddf4d6bd1 in VerifyMountPromise (/var/cfengine/bin/cf-agent+0x5bbd1)
    #4 0x559ddf4d506c in VerifyStoragePromise (/var/cfengine/bin/cf-agent+0x5a06c)
    #5 0x559ddf529cd9 in LocateFilePromiserGroup (/var/cfengine/bin/cf-agent+0xaecd9)
    #6 0x559ddf4d4a83 in FindStoragePromiserObjects (/var/cfengine/bin/cf-agent+0x59a83)
    #7 0x559ddf4d4a2d in FindAndVerifyStoragePromises (/var/cfengine/bin/cf-agent+0x59a2d)
    #8 0x559ddf4b7239 in KeepAgentPromise (/var/cfengine/bin/cf-agent+0x3c239)
    #9 0x7fc5c3138372 in ExpandPromiseAndDo /home/vagrant/cfe/core/libpromises/expand.c:215
    #10 0x7fc5c3138713 in ExpandPromise /home/vagrant/cfe/core/libpromises/expand.c:283
    #11 0x559ddf4b5e43 in ScheduleAgentOperations (/var/cfengine/bin/cf-agent+0x3ae43)
    #12 0x559ddf4b5656 in KeepPromiseBundles (/var/cfengine/bin/cf-agent+0x3a656)
    #13 0x559ddf4b2870 in KeepPromises (/var/cfengine/bin/cf-agent+0x37870)
    #14 0x559ddf4b025b in main (/var/cfengine/bin/cf-agent+0x3525b)
    #15 0x7fc5c238cb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
```

**After change:**

```
Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x7fb282da4538 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x77538)
    #1 0x7fb28291edc0 in xstrdup /home/vagrant/cfe/core/libntech/libutils/alloc.c:58
    #2 0x55d8be8f6064 in VerifyNotInFstab /home/vagrant/cfe/core/cf-agent/nfs.c:541
    #3 0x55d8be8b1bd1 in VerifyMountPromise /home/vagrant/cfe/core/cf-agent/verify_storage.c:491
    #4 0x55d8be8b006c in VerifyStoragePromise /home/vagrant/cfe/core/cf-agent/verify_storage.c:146
    #5 0x55d8be904cd9 in LocateFilePromiserGroup /home/vagrant/cfe/core/cf-agent/promiser_regex_resolver.c:62
    #6 0x55d8be8afa83 in FindStoragePromiserObjects /home/vagrant/cfe/core/cf-agent/verify_storage.c:84
    #7 0x55d8be8afa2d in FindAndVerifyStoragePromises /home/vagrant/cfe/core/cf-agent/verify_storage.c:75
    #8 0x55d8be892239 in KeepAgentPromise /home/vagrant/cfe/core/cf-agent/cf-agent.c:1697
    #9 0x7fb28289c372 in ExpandPromiseAndDo /home/vagrant/cfe/core/libpromises/expand.c:215
    #10 0x7fb28289c713 in ExpandPromise /home/vagrant/cfe/core/libpromises/expand.c:283
    #11 0x55d8be890e43 in ScheduleAgentOperations /home/vagrant/cfe/core/cf-agent/cf-agent.c:1431
    #12 0x55d8be890656 in KeepPromiseBundles /home/vagrant/cfe/core/cf-agent/cf-agent.c:1344
    #13 0x55d8be88d870 in KeepPromises /home/vagrant/cfe/core/cf-agent/cf-agent.c:831
    #14 0x55d8be88b25b in main /home/vagrant/cfe/core/cf-agent/cf-agent.c:279
    #15 0x7fb281af0b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
```

Changelog: None
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
vpodzime pushed a commit to vpodzime/cfengine-core that referenced this pull request Feb 13, 2020
Also did a lot of refactoring, error checking, memory cleaning, et.c.

Squashed commits:
cf-keycrypt: license
cf-keycrypt: PR fixes #1
cf-keycrypt: Fixed copyright in cf-keycrypt.c
cf-keycrypt: CryptoInitialize()
cf-keycrypt: Implemented new syntax as discussed in PR
cf-keycrypt: Acceptance test for new arguments
cf-keycrypt: Print help message when no arguments are added
cf-keycrypt: PR fixes #2
cf-keycrypt: PR fixes cfengine#3
cf-keycrypt: PR fixes cfengine#4
cf-keycrypt: PR fixes #5
cf-keycrypt: Changed syntax to jimis' suggestion
cf-keycrypt: Moved and fixed acceptance tests

Changelog: Title

Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
oleorhagen pushed a commit to oleorhagen/core that referenced this pull request Feb 18, 2020
An empty rlist is represented as a NULL pointer, so all Rlist
functions should handle NULL pointers at runtime.

Fixes an issue on FreeBSD, where RlistContainsString is
called on a NULL pointer (before any elements are added):

    Core was generated by `/var/cfengine/bin/cf-key'.
    Program terminated with signal SIGABRT, Aborted.
    #0  0x00000008024219ba in thr_kill () from /lib/libc.so.7
    (gdb) bt
    #0  0x00000008024219ba in thr_kill () from /lib/libc.so.7
    cfengine#1  0x0000000802421984 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
    cfengine#2  0x00000008024218f9 in abort () at /usr/src/lib/libc/stdlib/abort.c:65
    cfengine#3  0x000000080249d101 in __assert (func=<optimized out>, file=<optimized out>, line=<optimized out>, failedexpr=<optimized out>)
        at /usr/src/lib/libc/gen/assert.c:51
    cfengine#4  0x00000008008cc5b5 in RlistContainsString (list=0x0, string=0x8048af320 "0a:14:50:21:f0:44") at rlist.c:292
    #5  0x00000008009163e1 in FindV6InterfacesInfo (ctx=0x80481c0c0, interfaces=0x7ffffffed098, hardware=0x7ffffffed090, ips=0x7ffffffed080)
        at unix_iface.c:704
    cfengine#6  0x0000000800915f16 in GetInterfacesInfo (ctx=0x80481c0c0) at unix_iface.c:565
    cfengine#7  0x00000008009142eb in DetectEnvironment (ctx=0x80481c0c0) at sysinfo.c:3304
    cfengine#8  0x00000008008ab30f in GenericAgentDiscoverContext (ctx=0x80481c0c0, config=0x80481c000) at generic_agent.c:537
    #9  0x000000000040231b in main (argc=1, argv=0x7fffffffeaa8) at cf-key.c:148

This was introduced recently, and I don't believe it's been
in any released packages, so no changelog entry.

Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
(cherry picked from commit 6ee912c)
vpodzime pushed a commit to vpodzime/cfengine-core that referenced this pull request Jun 5, 2020
Also did a lot of refactoring, error checking, memory cleaning, et.c.

Squashed commits:
cf-keycrypt: license
cf-keycrypt: PR fixes #1
cf-keycrypt: Fixed copyright in cf-keycrypt.c
cf-keycrypt: CryptoInitialize()
cf-keycrypt: Implemented new syntax as discussed in PR
cf-keycrypt: Acceptance test for new arguments
cf-keycrypt: Print help message when no arguments are added
cf-keycrypt: PR fixes #2
cf-keycrypt: PR fixes cfengine#3
cf-keycrypt: PR fixes cfengine#4
cf-keycrypt: PR fixes #5
cf-keycrypt: Changed syntax to jimis' suggestion
cf-keycrypt: Moved and fixed acceptance tests

Changelog: Title

Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
(cherry picked from commit 53d7769)
larsewi added a commit to larsewi/core that referenced this pull request Jun 26, 2025
Now that we link with libpromises we no longer have to declare this
here.

```
==45622==ERROR: AddressSanitizer: odr-violation (0x55c3e03d9d40):
  [1] size=1024 'VFQNAME' logging_test.c:11:6 in /home/runner/work/core/core/tests/unit/.libs/logging_test
  [2] size=1024 'VFQNAME' cf3globals.c:64:6 in /home/runner/work/core/core/libpromises/.libs/libpromises.so.3
These globals were registered at these points:
  [1]:
    #0 0x7f770c85306f in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:350
    #1 0x55c3e03c776f in _sub_I_00099_1 (/home/runner/work/core/core/tests/unit/.libs/logging_test+0x676f) (BuildId: 7031c26309619108a56e4f80219ce2a3f7dc0d53)
    #2 0x7f770b02a303 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a303) (BuildId: 42c84c92e6f98126b3e2230ebfdead22c235b667)
    cfengine#3 0x55c3e03c67a4 in _start (/home/runner/work/core/core/tests/unit/.libs/logging_test+0x57a4) (BuildId: 7031c26309619108a56e4f80219ce2a3f7dc0d53)

  [2]:
    #0 0x7f770c85306f in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:350
    #1 0x7f770c32b055 in _sub_I_00099_1 (/home/runner/work/core/core/libpromises/.libs/libpromises.so.3+0x12b055) (BuildId: e23104812e7f54cae9a78b25a00d6f00861edf79)
    #2 0x7f770cfe471e  (/lib64/ld-linux-x86-64.so.2+0x571e) (BuildId: 1c8db5f83bba514f8fd5f1fb6d7be975be1bb855)
    cfengine#3 0x7f770cfe4823  (/lib64/ld-linux-x86-64.so.2+0x5823) (BuildId: 1c8db5f83bba514f8fd5f1fb6d7be975be1bb855)
    cfengine#4 0x7f770cffe59f  (/lib64/ld-linux-x86-64.so.2+0x1f59f) (BuildId: 1c8db5f83bba514f8fd5f1fb6d7be975be1bb855)

==45622==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'VFQNAME' at logging_test.c:11:6 in /home/runner/work/core/core/tests/unit/.libs/logging_test
==45622==ABORTING
FAIL: logging_test
```

Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
larsewi added a commit to larsewi/core that referenced this pull request Dec 11, 2025
```
==25903==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50200004460f at pc 0x7fa23c10ec86 bp 0x7ffef7339c60 sp 0x7ffef7339408
READ of size 1 at 0x50200004460f thread T0
    #0 0x7fa23c10ec85 in __interceptor_strncmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:497
    #1 0x7fa23be8d09b in StringSafeCompareN /tmp/matchpolicy_poc_3369/cfengine-core/libntech/libutils/string_lib.c:254
    #2 0x7fa23be8d10f in StringEqualN /tmp/matchpolicy_poc_3369/cfengine-core/libntech/libutils/string_lib.c:268
    cfengine#3 0x560644d90e30 in MatchPolicy /tmp/matchpolicy_poc_3369/cfengine-core/cf-agent/files_editline.c:1749
 ---snip---
0x50200004460f is located 1 bytes to the left of 4-byte region [0x502000044610,0x502000044614)
allocated by thread T0 here:
 ---snip---
```

Ticket: ENT-13590
Changelog: Title
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
larsewi added a commit to larsewi/core that referenced this pull request Dec 15, 2025
```
==25903==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50200004460f at pc 0x7fa23c10ec86 bp 0x7ffef7339c60 sp 0x7ffef7339408
READ of size 1 at 0x50200004460f thread T0
    #0 0x7fa23c10ec85 in __interceptor_strncmp ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:497
    #1 0x7fa23be8d09b in StringSafeCompareN /tmp/matchpolicy_poc_3369/cfengine-core/libntech/libutils/string_lib.c:254
    #2 0x7fa23be8d10f in StringEqualN /tmp/matchpolicy_poc_3369/cfengine-core/libntech/libutils/string_lib.c:268
    cfengine#3 0x560644d90e30 in MatchPolicy /tmp/matchpolicy_poc_3369/cfengine-core/cf-agent/files_editline.c:1749
 ---snip---
0x50200004460f is located 1 bytes to the left of 4-byte region [0x502000044610,0x502000044614)
allocated by thread T0 here:
 ---snip---
```

Ticket: ENT-13590
Changelog: Title
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
(cherry picked from commit 3da06b4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants