https://bugs.openldap.org/show_bug.cgi?id=9935
Issue ID: 9935
Summary: buffer overflow in UTF8StringValidate
Product: OpenLDAP
Version: 2.6.3
Hardware: x86_64
OS: Linux
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: slapd
Assignee: bugs(a)openldap.org
Reporter: kimjuhi96(a)snu.ac.kr
Target Milestone: ---
I get a heap buffer overflow running this on the latest openldap on git.
Built with CFLAGS="-fsanitize=address" using clang 15.
./servers/slapd/slapd $(python2 -c 'print("-Td \x4c\x3d\xc2\x8c\xf0\xf0")')
SUMMARY: AddressSanitizer: heap-buffer-overflow
(/home/juhee/project/foxfuzz/programs/network/openldap-ori/servers/slapd/slapd
+0x3961ac)
Shadow bytes around the buggy address:
0x0c047fffcb00: fa fa 00 06 fa fa 00 00 fa fa 00 07 fa fa 00 00
0x0c047fffcb10: fa fa 00 07 fa fa 00 00 fa fa 03 fa fa fa 00 05
0x0c047fffcb20: fa fa 02 fa fa fa 02 fa fa fa 03 fa fa fa 07 fa
0x0c047fffcb30: fa fa 02 fa fa fa 03 fa fa fa 06 fa fa fa 00 03
0x0c047fffcb40: fa fa 00 06 fa fa 00 02 fa fa 00 01 fa fa 00 04
=>0x0c047fffcb50: fa fa 00 00 fa fa 00 fa fa fa 00 02 fa fa[05]fa
0x0c047fffcb60: fa fa 00 00 fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffcb70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffcb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffcb90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffcba0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==2202218==ABORTING
Stopped reason: SIGABRT
__GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
gdb-peda$ bt
#0 __GI_raise (sig=sig@entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff78ca859 in __GI_abort () at abort.c:79
#2 0x00005555556eb04f in __sanitizer::Abort ()
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:143
#3 0x00005555556e8aac in __sanitizer::Die ()
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_termination.cpp:58
#4 0x00005555556c5dda in __asan::ScopedInErrorReport::~ScopedInErrorReport
(this=0x7fffffffc4d6, __in_chrg=<optimized out>)
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/asan/asan_report.cpp:192
#5 0x00005555556c6461 in __asan::ReportGenericError (pc=<optimized out>,
bp=0x7fffffffd140, sp=0x7fffffffd138,
addr=0x602000025af5, is_write=is_write@entry=0x0, access_size=0x1,
fatal=0x1, exp=<optimized out>)
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/asan/asan_report.cpp:199
#6 0x00005555556c99d6 in __asan::ReportGenericError (pc=<optimized out>,
bp=bp@entry=0x7fffffffd140,
sp=sp@entry=0x7fffffffd138, addr=<optimized out>,
is_write=is_write@entry=0x0, access_size=access_size@entry=0x1,
exp=<optimized out>, fatal=0x1)
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_atomic_clang.h:74
#7 0x00005555556ca34c in __asan::__asan_report_load1 (addr=<optimized out>)
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/asan/asan_rtl.cpp:118
#8 0x00005555558ea1ad in UTF8StringValidate ()
#9 0x000055555581e5a7 in LDAPRDN_rewrite ()
#10 0x000055555581d059 in LDAPDN_rewrite ()
#11 0x0000555555820f7f in dnPrettyNormal ()
#12 0x0000555555a37d1d in slapdn ()
#13 0x000055555570901f in main ()
#14 0x00007ffff78cc083 in __libc_start_main (main=0x555555706ef0 <main>,
argc=0x3, argv=0x7fffffffdfd8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffdfc8)
at ../csu/libc-start.c:308
#15 0x000055555561011e in _start ()
at
/home/juhee/project/foxfuzz/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:397
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9930
Issue ID: 9930
Summary: test050 deadlock on BSD OSes
Product: OpenLDAP
Version: 2.5.13
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: slapd
Assignee: bugs(a)openldap.org
Reporter: quanah(a)openldap.org
Target Milestone: ---
Initially reported to me directly as an issue with NetBSD 9.1, I was able to
reproduce this with FreeBSD 13.1 as well. Investigation ongoing.
Running test050 in a loop eventually results in a deadlock in one of the 4
slapd provider processes.
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9898
Issue ID: 9898
Summary: slapd-addel.c contains invalid struct initialization
which does not compile on HP-UX aCC
Product: OpenLDAP
Version: 2.6.3
Hardware: All
OS: Other
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: slapd
Assignee: bugs(a)openldap.org
Reporter: michael.osipov(a)siemens.com
Target Milestone: ---
My compiler (cc: HP C/aC++ B3910B A.06.29 [Oct 18 2016]) gives me:
/opt/aCC/bin/aCC -Ae -g -I../../include -I../../include -I/opt/ports/include
-I/opt/ports/include -c -o slapd-addel.o slapd-addel.c
"slapd-addel.c", line 68: error #2029: expected an expression
LDIFRecord record = {};
^
"slapd-addel.c", line 70: error #2029: expected an expression
struct berval bv = {};
^
This is invalid C code, it can be easily solved by using "{0}" and the code
does compile.
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9892
Issue ID: 9892
Summary: LDAP_TXN_SPECIFY assumes cleanup responsibility for
writes but never performs it
Product: OpenLDAP
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: slapd
Assignee: bugs(a)openldap.org
Reporter: ondra(a)mistotebe.net
Target Milestone: ---
When TXN extop is accepted and the client sends some write ops, the cleanup
path is skipped within do_modify/do_add/... however the data is never actually
freed when the transaction is being settled (regardless of whether it was
committed successfully or aborted).
Confirmed to happen with do_modify by tests/scripts/lloadd/test007-coherence,
for others it's my assumption based on reading the code.
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9880
Issue ID: 9880
Summary: reqStart filter with trailing zeros is truncated,
which breaks certain searches
Product: OpenLDAP
Version: 2.5.12
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: slapd
Assignee: bugs(a)openldap.org
Reporter: subbarao(a)computer.org
Target Milestone: ---
Note: ITS#9358 seems to address this very issue, but it doesn't seem to help
this particular case.
Certain range searches with reqStart on the changelog don't work as expected.
For example:
(!(reqStart<=20220707123456.000000Z))
The idea here is to grab all entries strictly greater than the timestamp. But
slapd truncates zeros in this filter, rewriting it to:
(!(reqStart<=20220707123456Z))
As a result, the reqStart=20220707123456.000000Z entry is the first match since
it is greater than 20220707123456Z, which is not the desired behavior.
I was able to reproduce this issue on 2.5.12 as follows:
1) Start the test043-delta-syncrepl test, let it run almost to the end so that
it makes many changes, and then hit ^Z to suspend the script. I waited until
one of the last occurrences of "Waiting 7 seconds for syncrepl to receive
changes".
2) pkill -CONT -f slapd to restart slapd (but not the test script)
3) ldapsearch -x -h localhost:9011 -b cn=log objectclass=top | grep
'^dn:.*.000000Z'
Look for a change with all trailing zeros. It's not as rare as one might think,
I saw at least one trailing-zeros change in two consecutive runs of the test
script. I suppose you could also just create an entry with all trailing zeros
in the accesslog :-)
4) Run a range search to only return changes after that change (I used -z 1 and
-s one so that it would only give me one result):
ldapsearch -x -z 1 -h localhost:9011 -b cn=log -s one
'(!(reqStart<=20220708012121.000000Z))'
If you see the same entry, then the problem is present.
5) Even if you can't have an accesslog entry with all trailing zeros, you can
still do the above search verbatim and look at the slapd log file
testrun/slapd.1.log:
62c7873f.145b4396 0x7fabf14c9700 conn=1011 op=1 SRCH base="cn=log" scope=1
deref
=0 filter="(!(reqStart<=20220708012121Z))"
The filter being rewritten in the server log seems to indicate that trailing
zeros are being truncated somewhere.
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9966
Issue ID: 9966
Summary: slapd crashes in pcache consistency_check()
Product: OpenLDAP
Version: 2.5.13
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: overlays
Assignee: bugs(a)openldap.org
Reporter: aweits(a)rit.edu
Target Milestone: ---
The pcache overlay (when run with multiple templates) crashes in the
consistency checker. Cause appears to be that "expires" is not reset for the
next iteration of the template loop. I can provide more details if necessary.
Server does not crash with this in place:
diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c
index 423c19641e72..7b9e2061f927 100644
--- a/servers/slapd/overlays/pcache.c
+++ b/servers/slapd/overlays/pcache.c
@@ -3628,6 +3628,8 @@ consistency_check(
if ( rem ) free_query(query);
}
+ expires = NULL;
+
/* handle refreshes that we skipped earlier */
if ( templ->ttr ) {
ldap_pvt_thread_rdwr_rlock(&templ->t_rwlock);
valgrind says:
==217138== Thread 13:
==217138== Invalid read of size 8
==217138== at 0x63949EE: consistency_check (pcache.c:3604)
==217138== by 0x48A5DB9: ldap_int_thread_pool_wrapper (tpool.c:1053)
==217138== by 0x5016801: start_thread (in /usr/lib64/libc.so.6)
==217138== by 0x4FB6313: clone (in /usr/lib64/libc.so.6)
==217138== Address 0x6d14c60 is 160 bytes inside a block of size 240 free'd
==217138== at 0x48470E4: free (vg_replace_malloc.c:872)
==217138== by 0x63949DE: UnknownInlinedFun (pcache.c:1548)
==217138== by 0x63949DE: consistency_check (pcache.c:3628)
==217138== by 0x48A5DB9: ldap_int_thread_pool_wrapper (tpool.c:1053)
==217138== by 0x5016801: start_thread (in /usr/lib64/libc.so.6)
==217138== by 0x4FB6313: clone (in /usr/lib64/libc.so.6)
==217138== Block was alloc'd at
==217138== at 0x484486F: malloc (vg_replace_malloc.c:381)
==217138== by 0x48C8804: ber_memalloc_x (memory.c:228)
==217138== by 0x4598C2: ch_malloc (in /usr/local/libexec/slapd)
==217138== by 0x6391276: add_query (pcache.c:1562)
==217138== by 0x639ADEF: pcache_op_cleanup (pcache.c:2376)
==217138== by 0x52498D: ??? (in /usr/local/libexec/slapd)
==217138== by 0x452C32: ??? (in /usr/local/libexec/slapd)
==217138== by 0x4536BC: slap_send_ldap_result (in /usr/local/libexec/slapd)
==217138== by 0x4CF9EA: ldap_back_search (in /usr/local/libexec/slapd)
==217138== by 0x4BD022: overlay_op_walk (in /usr/local/libexec/slapd)
==217138== by 0x4BD1A0: ??? (in /usr/local/libexec/slapd)
==217138== by 0x4415D8: fe_op_search (in /usr/local/libexec/slapd)
==217138==
Happy Holidays!
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9929
Issue ID: 9929
Summary: slapo-dynlist unnecessary search for dynamic lists
Product: OpenLDAP
Version: 2.5.12
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: overlays
Assignee: bugs(a)openldap.org
Reporter: hyc(a)openldap.org
Target Milestone: ---
An extra initial search is performed by slapo-dynlist to make dynamic groups
filterable. This search is not needed for dynamic lists, but is still
occurring.
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9924
Issue ID: 9924
Summary: Increased/RunAway memory usage slapo-deref
Product: OpenLDAP
Version: 2.5.13
Hardware: x86_64
OS: Linux
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: overlays
Assignee: bugs(a)openldap.org
Reporter: erikdewaard(a)gmail.com
Target Milestone: ---
Created attachment 916
--> https://bugs.openldap.org/attachment.cgi?id=916&action=edit
slapd.conf
Increased/RunAway memory usage slapo-deref
Running: 2.5.13
After enabling slapo-deref slapd memory usage increased and growing.
I can reproduce this on every consumer with deref enabled.
From:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
173229 ldap 20 0 26.6g 1.0g 941996 S 4.0 0.8 3674:19 slapd
To:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2745810 ldap 20 0 141.5g 115.8g 468940 S 3.0 92.5 312:42.93 slapd
How best to debug this?
I should probably recompile to get all symbols for slapd available.
#valgrind.sh
valgrind --leak-check=full \
--show-leak-kinds=all \
--extra-debuginfo-path=/usr/lib/debug/usr/lib64/openldap \
--allow-mismatched-debuginfo=yes \
--track-origins=yes \
--error-limit=no \
--verbose \
--log-file=valgrind-out.txt \
/usr/sbin/slapd -F /etc/openldap/slapd.d -u ldap -h "ldap:///
ldaps:/// ldapi:///"
#mleak.sh
LD_PRELOAD=/tmp/mleak/mleak.so \
/usr/sbin/slapd -F /etc/openldap/slapd.d -u ldap -h "ldap:/// ldaps:///
ldapi:///"
sent kill -2
#mleak_report.sh
./mdump /usr/sbin/slapd ml.*
./report.sh | more
fncdump: Cant open linux-vdso.so.1
Memory leaks (14480 total):
--
You are receiving this mail because:
You are on the CC list for the issue.
https://bugs.openldap.org/show_bug.cgi?id=9915
Issue ID: 9915
Summary: Changing slapo-unique to use serialize causes
cn=config replication to fail
Product: OpenLDAP
Version: 2.6.3
Hardware: All
OS: All
Status: UNCONFIRMED
Keywords: needs_review
Severity: normal
Priority: ---
Component: overlays
Assignee: bugs(a)openldap.org
Reporter: quanah(a)openldap.org
Target Milestone: ---
I updated my slapo-unique configuration from:
olcUniqueURI: ldap:///?uid?sub?
to
olcUniqueURI: "serialize ldap:///?uid?sub?"
and replication of the config database fails with the following error:
syncrepl_null_callback: error code 0x50
syncrepl_entry: rid=001 be_modify
olcOverlay={2}unique,olcDatabase={2}mdb,cn=config (80)
syncrepl_entry: rid=001 be_modify failed (80)
--
You are receiving this mail because:
You are on the CC list for the issue.