| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_ring: Don't break strict-aliasing rules in APR_RING_SPLICE_{HEAD,TAIL}().
GCC-11 complains (see [1]) about apr_brigade_split_ex() seemingly issuing an
out of bounds access, the cause being that APR_RING_SPLICE_{HEAD,TAIL}() is
dereferencing an APR_RING_SENTINEL() and the cast there in not very aliasing
friendly (see [2] for a great explanation by Martin Sebor).
The APR (and user code) should never dereference APR_RING_SENTINEL(), it's fine
as a pointer only (i.e. for comparing pointers). So this commit modifies the
APR_RING_SPLICE_{HEAD,TAIL}() and APR_RING_{CONCAT,PREPEND}() macros to use the
passed in APR_RING_HEAD's prev/next pointers directly instead of passing the
APR_RING_SENTINEL() to APR_RING_SPLICE_{BEFORE,AFTER}().
Semantically, this also clarifies that APR_RING_{SPLICE,INSERT}_{BEFORE,AFTER}()
should be called for an APR_RING_ENTRY while APR_RING_SPLICE_{HEAD,TAIL}() and
APR_RING_{CONCAT,PREPEND}() are to be called with an APR_RING_HEAD.
[1]
In file included from ./include/apr_mmap.h:28,
from ./include/apr_buckets.h:32,
from buckets/apr_brigade.c:22:
buckets/apr_brigade.c: In function ‘apr_brigade_split’:
./include/apr_ring.h:177:43: error: array subscript ‘struct apr_bucket[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Werror=array-bounds]
177 | #define APR_RING_NEXT(ep, link) (ep)->link.next
| ~~~~~~~~~~^~~~~
./include/apr_ring.h:247:38: note: in expansion of macro ‘APR_RING_NEXT’
247 | APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \
| ^~~~~~~~~~~~~
./include/apr_ring.h:287:9: note: in expansion of macro ‘APR_RING_SPLICE_AFTER’
287 | APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((hp), elem, link), \
| ^~~~~~~~~~~~~~~~~~~~~
buckets/apr_brigade.c:118:9: note: in expansion of macro ‘APR_RING_SPLICE_HEAD’
118 | APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link);
| ^~~~~~~~~~~~~~~~~~~~
buckets/apr_brigade.c:90:9: note: referencing an object of size 32 allocated by ‘apr_palloc’
90 | b = apr_palloc(p, sizeof(*b));
| ^~~~~~~~~~~~~~~~~~~~~~~~~
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1957353#c2
(Note that the original comment from Martin Sebor talks about the struct
"_direntry" and the global variable "anchor" which relate to some httpd
code using an APR_RING in a similar way than apr_bucket_brigade does. So
below I allowed myself to edit the original comment to replace "_direntry"
by "apr_bucket" and "anchor" by "list" (the apr_bucket_brigade's member used
as the head of the ring) to make the link with the above commit message)
"
The message is a bit cryptic but it says that the code accesses an object
(list) of some anonymous type as it was struct apr_bucket. That's invalid
because objects can only be accessed by lvalues of compatible types (or char).
The APR_RING_ENTRY macro is defined like so:
#define APR_RING_ENTRY(elem) \
struct { \
struct elem * volatile next; \
struct elem * volatile prev; \
}
so given the definition:
APR_RING_ENTRY(apr_bucket) list;
list can only be accessed by lvalues of its (anonymous) type but the
APR_RING_SENTINEL() macro defined like so:
#define APR_RING_SENTINEL(hp, elem, link) \
(struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))
casts the address of list's next member minus some constant to a pointer to
struct apr_bucket and that pointer is then used to access the prev pointer.
The anonymous struct and struct apr_bucket are unrelated and cannot be used
each other's members even if the corresponding members have the same type and
are at the same offset within the bounds of the object.
"
apr_ring: Follow up to r1896535: Use APR_RING_{FIRST,LAST} macros.
hp->{next,prev} are APR_RING_{FIRST,LAST}(hp), so use them to make
APR_RING_SPLICE_{HEAD,TAIL}() read better.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896748 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
testatomic: Silence -Wmissing-prototypes warning.
Submitted by: brane
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896728 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
* test/proc_child.c (main): Avoid gcc -Wunused-result warning with
write() return value.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896718 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Add minimal Travis CI configuration (no notifications currently).
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896713 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix drain wakeup pipe issue when multiple threads call apr_pollset_wakeup/apr_pollcb_wakeup for the same pollset filling up drain pipe. Use atomics so that wakeup call is noop if some other thread allready done this
Follow up to r1895106: now we want blocking reads on unix too so revert r1894914.
Follow up to r1895106: Use less expensive atomics for wakeup.
If pipe writers (wakeup) put a single byte until it's consumed by the
reader (drain), it's enough to use an atomic cas for the writers (still) and
an atomic (re)set for the reader (no more cas here).
This requires that the reader never blocks on read though (e.g. spurious return
from poll), so make the read side on the pipe non-blocking again/finally.
Since synchronous non-blocking read is not a thing for Windows' Readfile(), add
a ->socket flag to this arch's apr_file_t (like the existing ->pipe one) which
file_socket_pipe_create() will set to make apr_file_read/write() handle
non-blocking (nor overlapped) socket pipes with WSARecv/Send().
Use enum instead multiple booleans
Fix remaining change when apr_filetype_e was added
Submitted by: mturk, ylavic, ylavic, mturk, mturk
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896510 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_atomic_read64(): Fix non-atomic read on 32-bit Windows.
* atomic/win32/apr_atomic64.c
(apr_atomic_read64): Use InterlockedCompareExchange64() instead of direct
memory read.
* test/testatomic.c
(test_atomics_threaded_setread64): New test.
(test_func_set64): Helepr for test_atomics_threaded_setread64 test.
* CHANGES: Add changelog entry.
* atomic/win32/apr_atomic64.c
(apr_atomic_read64): Use direct memory read when compiled for x86_x64, since
64-bit reads are atomic in 64-bit Windows [1].
Suggested by: Yann Ylavic
[1] https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-variable-access
Submitted by: ivan
Reviewed by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896068 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_atomic: Use __atomic builtins when available.
Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins
provide atomic load and store for weakly ordered architectures like ARM32 or
powerpc[64], so use them when available (gcc 4.6.3+).
Follow up to r1894621: restore apr_atomic_init::apr__atomic_generic64_init().
Even if apr__atomic_generic64_init() is currently a noop when !APR_HAS_THREADS,
it may change later without apr_atomic_init() noticing (thanks Rüdiger).
apr_atomic: Fix load/store for weak memory ordering architectures.
Volatile access prevents compiler reordering of load/store but it's not enough
for weakly ordered archs like ARM32 and PowerPC[64].
While __atomic builtins provide load and store, __sync builtins don't so let's
use an atomic add of zero for the former and atomic exchange for the latter.
The assembly code for PowerPC was not correct either, fix apr_atomic_read32()
and apr_atomic_set32() and add the necessary memory barriers for the others.
PR 50586.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1896067 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1895343 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1895342 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1895238 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1895237 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
See https://lists.apache.org/thread/dmlm6z38fpd9l7xccqkw9pzchv4rzvxv
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1895085 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Follow up to r1894914: non-blocking wakeup pipe reads on Windows too.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1894918 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
poll: Fix possible blocking when draining the wakeup pipe.
apr_poll_drain_wakeup_pipe() can block if exactly 512 bytes (or multiple
thereof) are available on the drained pipe, fix this by setting read end
of the pipe nonblocking (the write end is still blocking).
Submitted by: Mihaly Szjatinya <mihaly.szjatinya nxlog.org>
Reviewed by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1894916 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since runtime SCTP detection is dependent on kernel configuration, add
flags to make SCTP support reliable:
* build/apr_network.m4 (APR_CHECK_SCTP): Add --disable-sctp flag to
forcibly disable SCTP support, and --enable-sctp to fail configure
if is SCTP support is requested but not available.
Submitted by: Lubos Uhliarik <luhliari redhat.com>, jorton
Github: closes #28
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1894170 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
There is no cleanup with APR_FOPEN_NOCLEANUP, so apr_pool_cleanup_kill() can
go in the !(old_file->flags & APR_FOPEN_NOCLEANUP) block.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1893446 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Backports: r1860057
Submitted by: ivan
Reviewed by: wrowe
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1893388 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
poll: don't #include sys/poll.h if poll.h is available.
With musl libc, this fixes:
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1893277 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_tables: fix petential left shift of 31 on an int.
apr_tables.c:832:10: runtime error: left shift of 1 by 31 places cannot be
represented in type 'int'.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1893197 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
https://git.savannah.gnu.org/cgit/config.git.
Backport of r1892754 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1892755 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restore fix for CVE-2017-12613 which was missing in 1.7.x branch, though
was addressed in 1.6.x in 1.6.3 and later via r1807976.
The fix was merged back to 1.7.x in r1891198.
Since this was a regression in 1.7.0, a new CVE name has been assigned
to track this, CVE-2021-35940.
Thanks to Iveta Cesalova <icesalov redhat.com> for reporting this issue.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1892358 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
* locks/unix/thread_mutex.c,
include/arch/unix/apr_arch_thread_mutex.h: Completely drop the code
required imitate the mutex via a condition variable if
HAVE_PTHREAD_MUTEX_TIMEDLOCK is defined.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1891269 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* random/unix/sha2.c (apr__SHA256_Final, apr__SHA256_End): Fix parameter
buffer lengths to match declaration, avoiding GCC 11 warning.
(no functional change)
Bounds-check human-readable date fields (credit: Stefan Sperling)
Submitted by: jorton, niq
Reviewed by: jorton
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1891198 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* memory/unix/apr_pools.c (apr_pvsprintf): Fix a clang warning, the
'active' variable is never read/used before being set again to
pool->active on line 1436.
* file_io/unix/readwrite.c (apr_file_write, apr_file_writev): Fix
Coverity warnings from ignored lseek() return value in ->buffered
handling.
* test/teststr.c: Add trivial testcases for apr_pstrcat (though this
does not reproduce any problems from the bug).
Revert non-test part of r1878354, the Coverity warning was a
false -ve and there was no functional change nor bug.
* locks/unix/proc_mutex.c (apr_proc_mutex_defname): Fix clang warning,
remove unused local variable.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1891196 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r1861054, r1861061 from trunk:
* misc/win32/misc.c
(apr_get_oslevel): Fix condition to actually return APR_EGENERAL on
unsupported OS.
===
apr_socket_listen(): Allow larger backlog queue lengths on Windows 8+.
Starting with Windows 8, the socket listen() function accepts a special
SOMAXCONN_HINT(N) argument that allows making the backlog queue
length larger than the otherwise predefined limit of around 200:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms739168
https://blogs.msdn.microsoft.com/winsdk/2015/06/01/winsocks-listen-backlog-offers-more-flexibility-in-windows-8/
Having a larger listen backlog can be used for certain high performance
applications that need to handle lots of incoming connections. One
example would be the httpd server with it's "ListenBacklog" directive
where setting it to a larger value currently allows serving more concurrent
connections on Windows with mpm_winnt.
* include/arch/win32/apr_arch_misc.h
(enum apr_oslevel_e): Add APR_WIN_8.
* misc/win32/misc.c
(apr_get_oslevel): Determine whether we are running on Windows 7 or
on Windows 8+.
* network_io/win32/sockets.c
(SOMAXCONN_HINT): Define this macro in case we are building against
an older version of Windows SDK.
(apr_socket_listen): Use SOMAXCONN_HINT() for the backlog queue length
if it's supported by the Windows version we are running on.
Patch by: Evgeny Kotkov <evgeny.kotkov {at} visualsvn.com>
===
* misc/win32/misc.c
(apr_get_oslevel): Check return code from GetVersionEx().
===
* misc/win32/misc.c
(apr_get_oslevel): Do not use static variables to protect from potential
race condition.
===
* misc/win32/misc.c
(apr_get_oslevel): Use GetVersionExW() with OSVERSIONINFOEXW to version
information with service pack info.
===
* include/arch/win32/apr_arch_misc.h
(enum apr_oslevel_e): Add APR_WIN_8_1.
* misc/win32/misc.c
(apr_get_oslevel): Determine whether we are running on Windows 8 or
on Windows 8.1+.
===
Fix problem that apr_get_oslevel() was returning APR_WIN_XP on Windows 10.
* include/arch/win32/apr_arch_misc.h
(enum apr_oslevel_e): Add APR_WIN_10.
* misc/win32/misc.c
(apr_get_oslevel): Return APR_WIN_10 when dwMajorVersion is greater than 6.
===
* include/arch/win32/apr_arch_misc.h
(enum apr_oslevel_e): Add APR_WIN_7_SP1.
* misc/win32/misc.c
(apr_get_oslevel): Determine whether we are running on Windows 7 or on
Windows 7 SP1.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1890230 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
Use portable make variables
The usage of '$<' with BSD make results in an empty variable, therefore
compilation fails.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1890192 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1890173 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
testfnmatch: fix number of expected test/data/*.txt files.
Maybe there used to be 10 test/data/*.txt files, there are 3 only now.
testfile: don't generate .txt files since it distorts testfnmatch results.
Change to .dat files instead (also in svn:ignore).
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1888252 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow up to r1887279: fix new APR_TRY_COMPILE_NO_WARNING.
AC_LANG_PROGRAM generates an "int main()" prototype which some compilers warn
about. Restore AC_LANG_SOURCE to manually set the correct main() but do not
#include "confdefs.h" if it is inlined already by AC_LANG_SOURCE (i.e.
check whether PACKAGE_NAME is already defined).
Github: closes #25
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1888018 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow up to r1887060: fix compilation on BEOS.
poffset is undefined there, by inspection (no BEOS at hand..).
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887508 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
fdatasync() might return EINVAL for special files (i.e. terminal).
This is the case on latest Linux for instance, like 5.9.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887498 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Align apr_mmap()ing offset to a page boundary. PR 65158.
This is requirement for unix systems, and otherwise can cause failures or
undefined behaviour with some filesystems.
Add apr_mmap_t->poffset on unixes to track the offset to the previous page,
relative to the user requested/actual offset. This allows ->mm and ->size to
still point to the actual data, while munmap() now deletes the full range
from the start of the page.
Tests updated accordingly.
* Changes between r1887060 and this 1.7.x backport
Since the layout of struct apr_mmap_t cannot change (non opaque), the poffset
is over-allocated in mmap/unix/mmap.cmmap.c which uses this layout internally:
struct mm_layout {
apr_mmap_t mm;
apr_off_t poffset;
};
This works for all the apr_mmap_t created by apr_mmap_create() with which any
apr_mmap_*() function can then be called.
If a user creates an apr_mmap_t "by hand", with this change it cannot be passed
to apr_mmap_dup() without causing an out-of-bound read. This is hardly a new
limitation though, the refcounting which is the point of apr_mmap_dup() and
apr_mmap_delete() comes from the private function mmap_cleanup() anyway, so
there is no point in using these two functions with hand made apr_mmap_t (if
there ever was a point in the first place to create an hand made apr_mmap_t..).
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887497 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_skiplist: Handle ENOMEM from skiplisti_init(), fixing a compiler warning.
gcc-10 raises:
tables/apr_skiplist.c: In function ‘apr_skiplist_add_index’:
tables/apr_skiplist.c:284:16: error: ‘ni’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
284 | nsln = apr_skiplist_insert(ni, m->data);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
because above skiplisti_init() might return with ENOMEM, leaving ni uninitialized.
Since apr_skiplist_add_index returns void, the only option is to abort() in
this case.
For apr_skiplist_init(), we can forward the APR_ENOMEM to the caller.
Follow up to r1887481: fix skiplisti_init() returned pointer.
Submitted by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887486 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
build/apr_common.m4: avoid explicit inclusion of "confdefs.h"
The failure is observed on `autoconf-2.69d` (soon to be released
as `autoconf-2.70`). There `int64_t` detection fails as:
$ autoreconf && ./configure
checking whether int64_t and int use fmt %d... no
checking whether int64_t and long use fmt %ld... no
checking whether int64_t and long long use fmt %lld... no
configure: error: could not determine the string function for int64_t
```
This happens because `./configure` always stumbles on warning:
configure:3350: gcc -c -g -O2 -Werror conftest.c >&5
In file included from conftest.c:31:
confdefs.h:22: error: "__STDC_WANT_IEC_60559_ATTRIBS_EXT__" redefined [-Werror]
22 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
|
It's triggered by double inclusion of `"confdefs.h"` contents:
explicitly in `APR_TRY_COMPILE_NO_WARNING` macro and implicitly
via `AC_LANG_SOURCE` use.
To fix it and avoid having to define `main()` declaration the change
uses `AC_LANG_PROGRAM` instead.
Tested on both `autoconf-2.69` and `autoconf-2.69d`.
Github: closes #25
Submitted by: Sergei Trofimovich <slyfox gentoo.org>
Reviewed by: ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1887485 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OS/2: Clean up a thread's pool when it terminates.
<not backported in 1.7.x>
Add apr_pool_owner_set function to allow use of pool debugging with threads
Actually this function has been mentioned in the docs for over 10 years
but has never been implemented.
</not backported in 1.7.x>
Also consistently destroy the thread's pool when it exits normally, not only
on apr_thread_exit(). This was already done on OS2.
Other platforms than unix are untested.
apr_thread: destroy the thread's pool at _join() time, unless _detach()ed.
Destroying a joinable thread pool from apr_thread_exit() or when the thread
function returns, i.e. from inside the thread itself, is racy or deadlocky
with APR_POOL_DEBUG, with the parent pool being destroyed.
This commit adds a ->detached flag in each arch's apr_thread_t struct to track
whether a thread is detached (either at _create() or _detach() time). If
detached, the pool is destroyed when the thread exits, otherwise when the
thread is joined with apr_thread_join().
apr_thread: use unmanaged pools for detached threads.
A detached thread is by definition out of control, unjoinable, unmanaged,
and it can terminate/exit after its parent pool is detroyed.
To avoid use-after-free in this case, let's use an unmanaged pool for detached
threads, either by creating an unmanaged pool from the start if the thread
is created detached, or by "unmanaging" the pool if the thread is detached
later with apr_thread_detach().
To "umanage" the pool, provide a new internal helper, apr__pool_unmanage()
which takes care of removing the pool from its parent's list.
Submitted by: bjh, sf, ylavic, ylavic
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1884103 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Factor out common code in apr_pools.c. No function changes intended.
* memory/unix/apr_pools.c
(allocator_lock, allocator_unlock): New helpers.
(apr_allocator_max_free_set, allocator_alloc, allocator_free): Use
allocator_lock() and allocator_unlock().
apr_pools: two more uses of allocator_[un]lock() helpers to simplify the code.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1884101 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_pools: follow up to r1883750.
Make apr_pool_clear_debug() always lock the parent mutex, regardless of
whether its own mutex is the same (inherited), otherwise the race with
apr_pool_walk_tree() is still not addressed in any case.
There is no risk of the mutex being destroyed while locked since it's been
created on an ancestor pool, and the cleanups can still use the mutex since
it's APR_THREAD_MUTEX_NESTED.
Also, in apr_pool_create_ex_debug(), create/inherit the mutex before the pool
is registered in the parent, or it can be accessed by apr_pool_walk_tree()
with the a NULL mutex and thus breaking the rules.
For unmanaged pools, even though they have no parent pool, they can still
have children that can be cleared/destroyed so the synchronization with
apr_pool_walk_tree() still applies. And since the allocator plays no role in
APR_POOL_DEBUG mode, apr_pool_create_unmanaged_ex_debug() must always create
the mutex, regardless of whether an allocator is provided.
While doing this change in apr_pool_create_unmanaged_ex_debug(), this commit
also moves the corresponding code (creating the mutex) at the same place as
it's moved in apr_pool_create_ex_debug(), to ease reading/comparing the two
functions.
apr_pools: follow up to r1883750 and r1883800.
After r1883800, the mutex of a pool in APR_POOL_DEBUG can't be NULL, so
remove useless NULL checks around locking.
apr_pools: follow up to r1883750.
Don't release and re-acquire the lock in apr_pool_destroy_debug() between
pool_clear_debug() and the removal of the pool from the parent, so that
apr_pool_walk_tree() has no chance to find a pool being destroyed.
This is done like in apr_pool_clear_debug(), all the necessary locking goes
to apr_pool_destroy_debug() which then calls pool_destroy_debug() in the
critical section.
Note that pool_destroy_debug() when called from pool_clear_debug() is not
locking the parent mutex by itself anymore, thus the pool being cleared there
is not locked when its children are destroyed (just like before r1883750). This
is not an issue though because the parent mutex is supposed to protect against
concurrent access from apr_pool_walk_tree() on an ancestor, not an illegal
operation from another thread on a pool being cleared. That is always undefined
behaviour with debug and non-debug pools, though the latter might detect it
with apr_pool_check_owner(), not the pool being cleared's business anyway.
apr_pools: add and use pool_[un]lock() and parent_[un]lock() helpers.
To avoid #ifdef'ery in relevant code and thus help readers.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1884100 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
apr_decode_base{64,32,16}: stop reading before (not including) NUL byte.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883880 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
apr_encode_base32: fix advertised output *len when called with dst == NULL.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883879 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_sockaddr_ip_get[buf]: handle APR_UNIX family.
For unix sockets, return the path (sun_path).
Follow up to r1883728: uncomment the change, and fix apr_cpystrn() args orrder.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883753 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_pools: fix __attribute__((nonnull)) warning in [pre_]cleanup_register.
Since apr_[pre_]cleanup_register() functions are declared ((nonnull)) for
plain_cleanup_fn and child_cleanup_fn, the compiler (gcc-9 here) issues a
warning when we check them for !NULL is the code.
To preserve APR_POOL_DEBUG checks still with compilers that don't support
this __attribute__, let's work around this by checking NULL values afterward
for c, c->plain_cleanup_fn and c->child_cleanup_fn.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883752 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
apr_pools: lock parent pool in pool_destroy_debug().
By using apr_pool_clear_debug() instead of pool_clear_debug() in
pool_destroy_debug() we gain the locking provided by the former and thus
protection from concurrent access from apr_pool_walk_tree(), which is
undefined behaviour.
While pool_destroy_debug()=>apr_pool_clear_debug()=>pool_clear_debug() calls
pool_destroy_debug() for all the children pools, this does not cause a deadlock
because apr_pool_clear_debug() locks the parent pool only (not the pool itself)
and thus pool_destroy_debug(pool->child) locks the current pool with no issue.
This fixes use-after-free like the below in httpd (with -D APR_POOL_DEBUG):
=================================================================
==2026856==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600025acf0 at pc 0x7fe738f4c5be bp 0x7fe718598110 sp 0x7fe718598108
READ of size 8 at 0x60600025acf0 thread T51
#0 0x7fe738f4c5bd in apr_thread_mutex_lock locks/unix/thread_mutex.c:124
#1 0x7fe738f4e01c in apr_pool_walk_tree memory/unix/apr_pools.c:1505
#2 0x7fe738f4e066 in apr_pool_walk_tree memory/unix/apr_pools.c:1511
#3 0x7fe738f4e066 in apr_pool_walk_tree memory/unix/apr_pools.c:1511
#4 0x7fe738f4e066 in apr_pool_walk_tree memory/unix/apr_pools.c:1511
#5 0x7fe738f5027c in apr_pool_find memory/unix/apr_pools.c:2291
#6 0x7fe738f14aba in apr_table_mergen tables/apr_tables.c:746
#7 0x5578ad926a25 in ap_set_keepalive /home/ylavic/src/apache/httpd/trunk/modules/http/http_protocol.c:309
#8 0x5578ad93933f in ap_http_header_filter /home/ylavic/src/apache/httpd/trunk/modules/http/http_filters.c:1376
#9 0x5578ad98f7bd in ap_pass_brigade /home/ylavic/src/apache/httpd/trunk/server/util_filter.c:783
#10 0x5578ad9a67f3 in ap_content_length_filter /home/ylavic/src/apache/httpd/trunk/server/protocol.c:2046
#11 0x5578ad98f7bd in ap_pass_brigade /home/ylavic/src/apache/httpd/trunk/server/util_filter.c:783
#12 0x5578ad9405ae in ap_byterange_filter /home/ylavic/src/apache/httpd/trunk/modules/http/byterange_filter.c:463
#13 0x5578ad98f7bd in ap_pass_brigade /home/ylavic/src/apache/httpd/trunk/server/util_filter.c:783
#14 0x7fe7330e398b in ap_headers_output_filter /home/ylavic/src/apache/httpd/trunk/modules/metadata/mod_headers.c:891
#15 0x5578ad98f7bd in ap_pass_brigade /home/ylavic/src/apache/httpd/trunk/server/util_filter.c:783
#16 0x7fe732e32dba in session_output_filter /home/ylavic/src/apache/httpd/trunk/modules/session/mod_session.c:501
#17 0x5578ad98f7bd in ap_pass_brigade /home/ylavic/src/apache/httpd/trunk/server/util_filter.c:783
#18 0x5578ad9c8ee5 in default_handler /home/ylavic/src/apache/httpd/trunk/server/core.c:5188
#19 0x5578ad9431bb in ap_run_handler /home/ylavic/src/apache/httpd/trunk/server/config.c:170
#20 0x5578ad944941 in ap_invoke_handler /home/ylavic/src/apache/httpd/trunk/server/config.c:444
#21 0x5578ad92cc23 in ap_process_async_request /home/ylavic/src/apache/httpd/trunk/modules/http/http_request.c:463
#22 0x5578ad924d7c in ap_process_http_async_connection /home/ylavic/src/apache/httpd/trunk/modules/http/http_core.c:158
#23 0x5578ad925410 in ap_process_http_connection /home/ylavic/src/apache/httpd/trunk/modules/http/http_core.c:252
#24 0x5578ad97e04d in ap_run_process_connection /home/ylavic/src/apache/httpd/trunk/server/connection.c:42
#25 0x7fe735c7ef79 in process_socket /home/ylavic/src/apache/httpd/trunk/server/mpm/event/event.c:1097
#26 0x7fe735c856a0 in worker_thread /home/ylavic/src/apache/httpd/trunk/server/mpm/event/event.c:2386
#27 0x7fe738f7cef4 in dummy_worker threadproc/unix/thread.c:145
#28 0x7fe738e3eea6 in start_thread nptl/pthread_create.c:477
#29 0x7fe738d6ed4e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xfdd4e)
0x60600025acf0 is located 48 bytes inside of 64-byte region [0x60600025acc0,0x60600025ad00)
freed by thread T63 here:
#0 0x7fe7391ed277 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x107277)
#1 0x7fe738f4e9e5 in pool_clear_debug memory/unix/apr_pools.c:1893
#2 0x7fe738f4ecb2 in pool_destroy_debug memory/unix/apr_pools.c:1956
#3 0x7fe738f4eeeb in apr_pool_destroy_debug memory/unix/apr_pools.c:2002
#4 0x5578ada2534b in ap_queue_info_push_pool /home/ylavic/src/apache/httpd/trunk/server/mpm_fdqueue.c:230
#5 0x7fe735c81412 in process_lingering_close /home/ylavic/src/apache/httpd/trunk/server/mpm/event/event.c:1686
#6 0x7fe735c7f9bc in process_socket /home/ylavic/src/apache/httpd/trunk/server/mpm/event/event.c:1255
#7 0x7fe735c856a0 in worker_thread /home/ylavic/src/apache/httpd/trunk/server/mpm/event/event.c:2386
#8 0x7fe738f7cef4 in dummy_worker threadproc/unix/thread.c:145
#9 0x7fe738e3eea6 in start_thread nptl/pthread_create.c:477
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883751 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
Follow up to r1790200: fall back to fsync() if F_FULLFSYNC is not supported
by the file descriptor, filesystem or underlying device.
See, e.g.: https://github.com/vim/vim/pull/4025
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883341 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
@param should not be used inside description, or it will break the rendering
(r1883196 in trunk)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883197 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Remove a trailing '.' to be consistent.
(r1883194 in trunk)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883195 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
@param should not be used inside description, or it will break the rendering
(r1883192 in trunk)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1883193 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
#include <arpa/inet.h>
#endif
is required for inet_addr
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1882981 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
| |
-Werror,-Wimplicit-function-declaration
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1882980 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Update 1.7 win32 blocking in line with trunk and 1.6.x
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1882155 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1878356 13f79535-47bb-0310-9956-ffa450edef68
|