4195 Commits

Author SHA1 Message Date
Azat Khuzhin
5df3037d10 Merge branch 'release-2.1.12-stable-pull' into patches-2.1
PR: https://github.com/libevent/libevent/pull/1045

* release-2.1.12-stable-pull:
  Update ChangeLog
  ci/linux: create dist artifact only if dist archive was built
  Merge branch 'fix-signal-leak'
  test: fix leak in dns/getaddrinfo_cancel_stress
  test: fix UB in evbuffer/empty_reference_prepend_buffer
  ci: set build type to debug with sanitizers
  test: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)
  test-closed: fix leak
  test-export: adjust libevent version
  cmake: set rpath for libraries on linux
  test-export: compatible with all versions of visual studio
  Bump version to 2.1.12-stable (w/o ABI breakage)
  ci: run ABI for release-*-pull branches too
  Purge travis-ci config
  Purge appveyor config
  Bump ChangeLog for 2.1.12
  Update AUTHORS for 2.1.12
  Backport github actions to 2.1
  test: add getaddrinfo(AI_ADDRCONFIG) test (off by default)
  build: remove duplicate -Wredundant-decls
  test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
  test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
  test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
  test: detect test failures if atexit handler calls _exit(!0) (sanitizers)
  Make all classes Entry, Struct, etc) new-style classes
  buffer: do not pass NULL to memcpy() from evbuffer_pullup()
  test: do not pass NULL to memcmp() in evbuffer_datacmp() helper
  http: fix undefined-shift in EVUTIL_IS*_ helpers
  Check error code of evhttp_add_header_internal() in evhttp_parse_query_impl()
  cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT
  test/regress_testutils: use inet_addr()
  remove FindGit.cmake, improve `git describe` command
  checkpatch.sh: fix clang-format-diff usage
  checkpatch.sh: fix usage
  Fix clang-format-diff usage
  variable redefinition in win32_dispatch
  test: http/autofree_connection cleanup
  http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)
  test: cleanup http/autofree_connection
  test: fix http/autofree_connection
  evdns: Add additional validation for values of dns options
  test: Fix test_simpleclose for Windows platform
  abi-check: abi-monitor 1.10 does not support -make -j8 (1.12 supports though)
  Add API/ABI checker (using LVC)
  Update list of cmake files for autotools dist archive
  Pass --quiet to the event_rcpgen.py (autotools already does this)
  There is typo in GetAdaptersAddresses windows library. It should be iphlpapi.dll
  Support EV_CLOSED on linux for poll(2)
  Fix EV_CLOSED detection/reporting (epoll only)
  Merge branch 'EV_CLOSED-and-EV_ET-fixes'
  bufferevent: allow setting priority on socket and openssl type
  cmake: set a default value for LIBEVENT_STATIC_LINK
  evutil_time: improve evutil_gettimeofday on Windows
  bench: Allow backend method selection
  cmake: missing test-closed binary
  Merge branch 'event_rpcgen.py-cleanup'
  cmake: replace CheckFunctionExists with CheckSymbolExists
  LibeventConfig.cmake: restore CMAKE_FIND_LIBRARY_SUFFIXES and LIBEVENT_STATIC_LINK default
  cmake: fix getaddrinfo checking error
  cmake: remove CheckFunctionExistsEx
  autoconf: fix getaddrinfo checking errors on mingw
  test-time: do not use deprecated API
  test-time: enable debug mode if EVENT_DEBUG_LOGGING_ALL env set
  increase segment refcnt only if evbuffer_add_file_segment() succeeds
  evdns: fix a crash when evdns_base with waiting requests is freed
  event_base_once: fix potential null pointer threat
  test-ratelim: add missing free
  Do not use shared global structures on CYGWIN
  test: move thread into realtime class even on EVENT__DISABLE_THREAD_SUPPORT
  test: fix compilation without thread support (EVENT__DISABLE_THREAD_SUPPORT=ON)
  test: fix bufferevent/bufferevent_connect_fail_eventcb* under osx/freebsd
  test: fix dst thread in move_pthread_to_realtime_scheduling_class (osx)
  test: fix compilation under win32 (rearrange thread_setup() code)
  test: use THREAD_* wrappers over pthread* in del_notify
  Merge branch 'osx-clock'
  cmake: do not print used method (EVENT_SHOW_METHOD) while running tests
  cmake: run regress test quietly like autotools (makes CI logs cleaner)
  Merge branch 'http-connect'
  http: do not assume body for CONNECT
  Added uninstall target check to cmakelists
  Fix compilation without OPENSSL_API_COMPAT
  evutil_time: Implements usleep() using wait funtion on Windows
  Initialize variable to 0 replace use memset function in sample/hello-world.c
  cmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined
  cmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink
  test-ratelim: calculate timers bias (for slow CPUs) to avoid false-positive
  mailmap: add name/email aliases for yuangongji (name and email)
  cmake: test for find_package()
  cmake: improve package config file
  Link with iphlpapi only on windows
  Parse IPv6 scope IDs.
  Relax bufferevent_connect_hostname_emfile
  autotools: fails build when need but can not find openssl
  cmake: eliminate duplicate installation of public headers
  append to CMAKE_MODULE_PATH
  Do not use sysctl.h on linux (it had been deprecated)
  sample/https-client: link crypt32 explicitly when build with mingw-w64
  Fix compat with NetBSD >= 10
  Avoid transforming base C_FLAGS set deliberately
  tinytest: support timeout on Windows
  Merge branch 'upstream/pr/899' (evbuffer_freeze testcase enhancements)
  evbuffer_add_file: fix freeing of segment in the error path
  evutil_time: detect and use _gmtime64_s()/_gmtime64()
  http: rename bind_socket_ai() to create_bind_socket_nonblock()
  https-client: load certificates from the system cert store on Windows
  Fix checking return value of the evdns_base_resolv_conf_parse()
  cmake: fix getrandom() detection
  arc4random: replace sysctl() with getrandom (on linux)
  Upgrade autoconf (after upgrading minimum required to 2.67)
  Revert "Warn if forked from the event loop during event_reinit()"
  eliminate some C4267 warnings in Windows
  autotools: attach doxygen target into all target
  cmake: attach doxygen target into all target
  Fix memory corruption in EV_CLOSURE_EVENT_FINALIZE with debug enabled
  test: prevent duplicate event_enable_debug_mode() for TT_ENABLE_DEBUG_MODE
  test: introduce TT_ENABLE_DEBUG_MODE flag
  sample/http-server: fix parameter parsing
  sample/signal-test: fix use of uninitialized variable
  Fix typos in comments (sample/test/event-internal.h)
  sample/signal-test: add NULL checks
  Change the minimum version of automake to 1.13 and autoconf to 2.67
  Add Uninstall.cmake.in into dist archive
release-2.1.12-stable
2020-07-05 15:02:46 +03:00
Azat Khuzhin
1324a03c12 Update ChangeLog 2020-07-05 15:00:12 +03:00
Azat Khuzhin
c660a578bf ci/linux: create dist artifact only if dist archive was built
Fixes: 512c88ce ("ci/linux: add dist check")
(cherry picked from commit e9a6b127696f75097dea01d197735596335865bb)
2020-07-05 15:00:12 +03:00
Azat Khuzhin
1c9cc07b32 Merge branch 'fix-signal-leak'
Fixes main/fork under ASAN (LSAN if to be precise)

* fix-signal-leak:
  select: requires reinit (otherwise it leaks signal handlers)
  poll: requires reinit (otherwise it leaks signal handlers)

(cherry picked from commit f6bfa8b3e35432992d9b580617c946dbbfa38bb3)
2020-07-05 13:46:38 +03:00
Azat Khuzhin
a03f0f8a54 test: fix leak in dns/getaddrinfo_cancel_stress
Some requests may get response (evutil_addrinfo) from gaic_server_cb,
in case of cancel_event (10000ms) will not be fast enough.

(cherry picked from commit 90bcf2d660b9b43cb8e747421d4938f08f935bd7)
2020-07-05 12:17:15 +03:00
Azat Khuzhin
777cc2b6b5 test: fix UB in evbuffer/empty_reference_prepend_buffer
UBSAN reports:
  test/regress_buffer.c:2360:2: runtime error: null pointer passed as argument 1, which is declared to never be null
  /usr/include/string.h:140:33: note: nonnull attribute specified here

(cherry picked from commit ba19b356bf8a9be2a5bddfa264dee61ffc9573a7)
2020-07-05 11:48:31 +03:00
Azat Khuzhin
733201a4bb ci: set build type to debug with sanitizers
(cherry picked from commit 9da1743b41a6a1378f52e4127e162dcb44de87d7)
2020-07-05 11:36:30 +03:00
Azat Khuzhin
82ae28e1d7 test: really disable bufferevent_pair_release_lock under ASAN (and fix gcc)
(cherry picked from commit 7b9ba3b717af109abdf3fb5fc99c288dc8024ef5)
2020-07-05 11:36:30 +03:00
Azat Khuzhin
ff67e8c268 test-closed: fix leak
(cherry picked from commit e2f938c04f9a72f6fd6ca9b7a8219ca9cb409d69)
2020-07-05 11:36:30 +03:00
Azat Khuzhin
1acaa9a2cc test-export: adjust libevent version 2020-07-03 01:04:12 +03:00
yuangongji
813cc73925 cmake: set rpath for libraries on linux
(cherry picked from commit ce8be2385b5fee16859a630fca0c98ad290c8e21)
2020-07-03 01:03:30 +03:00
yuangongji
4e8e46135b test-export: compatible with all versions of visual studio
(cherry picked from commit 9adc9f149657212f65f05750b4f94ea3b1166aec)
2020-07-03 01:03:17 +03:00
Azat Khuzhin
2cfa7ff735 Bump version to 2.1.12-stable (w/o ABI breakage) 2020-06-28 22:33:52 +03:00
Azat Khuzhin
b2abc63ac7 ci: run ABI for release-*-pull branches too 2020-06-28 22:14:58 +03:00
Azat Khuzhin
afecaebf28 Purge travis-ci config 2020-06-28 22:13:50 +03:00
Azat Khuzhin
30bb66d7f3 Purge appveyor config 2020-06-28 22:13:44 +03:00
Azat Khuzhin
65539db063 Bump ChangeLog for 2.1.12 2020-06-28 22:11:50 +03:00
Azat Khuzhin
742bb5f5af Update AUTHORS for 2.1.12 2020-06-28 22:11:46 +03:00
Azat Khuzhin
be3acd7c08 Backport github actions to 2.1
With some modifications:
- drop coverage
- drop doxygen
- do not deploy ABI check, only artifacts
2020-06-28 21:44:41 +03:00
Azat Khuzhin
4d3ff29cac test: add getaddrinfo(AI_ADDRCONFIG) test (off by default)
(cherry picked from commit 0ac3cfc0b70edc2cfb429712d6aaf1b3a63d2d1a)
2020-06-28 21:38:40 +03:00
fanquake
cb4b87380d build: remove duplicate -Wredundant-decls
(cherry picked from commit ff4ec5fdb02d22c131e63b5a98e453da975a3cb1)
2020-06-28 21:38:40 +03:00
Azat Khuzhin
ccd6724300 test: fix memory leaks for https (add BEV_OPT_CLOSE_ON_FREE)
- http/https_filter_basic
- http/https_filter_chunk_out

(cherry picked from commit ec94a6bb3f9d950101d07b2a2e092b675d5aa3f0)
2020-06-28 21:38:36 +03:00
Azat Khuzhin
3c2c856de4 test: "fix" (with a quirk) leak in ssl/bufferevent_wm (w/o defer callbacks)
(cherry picked from commit cdbb2373f4d13f7a5eb69daaf0a172779ccc0040)
2020-06-28 21:38:05 +03:00
Azat Khuzhin
66341e84bc test: disable bufferevent/bufferevent_pair_release_lock under ASAN (too tricky)
And cannot be suppressed with suppressions due to setup routines.

(cherry picked from commit 3b13a64789b3942608f04c31455668bebe224a40)
2020-06-28 21:38:05 +03:00
Azat Khuzhin
19a68bd194 test: detect test failures if atexit handler calls _exit(!0) (sanitizers)
tinytest uses another way of detecting test failures, it uses pipe
between child and parent, and if the test function in child returns OK
it writes OK flag into pipe, and reads it in parent.

However sanitizers uses atexit handlers to detect leaks, and this will
not detect failures in case of exit() will be called from the atexit
handlers, fix this by checking status after waitpid().

(cherry picked from commit 6754740f15e8200a12605a2e707fc6d3e6754d6a)
2020-06-28 21:38:05 +03:00
Enji Cooper
48e04887f2 Make all classes Entry, Struct, etc) new-style classes
This allows the object methods to be properly inherited and called via
`super(..)`, addressing breakage with python 2.x, introduced in
cfcc093606e747a5d250787012bac0b149c60d6d.

Fixes #1042.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
(cherry picked from commit 46c9ead0ebbbb23c8f719c11c473dfec37c84fda)
2020-06-28 21:37:40 +03:00
Azat Khuzhin
5b063049cf buffer: do not pass NULL to memcpy() from evbuffer_pullup()
UBSAN reports:

  evbuffer/remove_buffer_with_empty3: ../buffer.c:1443:3: runtime error: null pointer passed as argument 2, which is declared to never be null
      #0 0x7ffff6cd0410 in evbuffer_pullup ../buffer.c:1443
      #1 0x5555556d68b9 in test_evbuffer_remove_buffer_with_empty3 ../test/regress_buffer.c:408
      #2 0x5555557b95ee in testcase_run_bare_ ../test/tinytest.c:173
      #3 0x5555557ba048 in testcase_run_one ../test/tinytest.c:333
      #4 0x5555557bc0f8 in tinytest_main ../test/tinytest.c:527
      #5 0x555555787702 in main ../test/regress_main.c:528
      #6 0x7ffff606c001 in __libc_start_main (/usr/lib/libc.so.6+0x27001)
      #7 0x55555569436d in _start (/src/le/libevent/.cmake-debug/bin/regress+0x14036d)

(cherry picked from commit a0c642ac04487d8cda809bd6e233b0fbd043806d)
2020-06-28 21:37:40 +03:00
Azat Khuzhin
a91abd0e8e test: do not pass NULL to memcmp() in evbuffer_datacmp() helper
Fixes:
  runtime error: null pointer passed as argument 2, which is declared to never be null
(cherry picked from commit 6f152befb4523fd2e57c1a937e590f8ff87b7f15)
2020-06-28 21:37:40 +03:00
Azat Khuzhin
6b8d02a755 http: fix undefined-shift in EVUTIL_IS*_ helpers
evutil.c:2559:1: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
    #0 0x4f2be0 in EVUTIL_ISXDIGIT_ libevent/evutil.c:2559:1
    #1 0x4bd689 in regname_ok libevent/http.c:4838:7
    #2 0x4bc16b in parse_authority libevent/http.c:4958:9
    #3 0x4bb8b5 in evhttp_uri_parse_with_flags libevent/http.c:5103:7
    #4 0x4bb762 in evhttp_uri_parse libevent/http.c:5050:9
    #5 0x4b8f41 in evhttp_parse_query_impl libevent/http.c:3505:9
    #6 0x4b8ed7 in evhttp_parse_query libevent/http.c:3569:9

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23291
Report: https://oss-fuzz.com/testcase-detail/5670743106125824
(cherry picked from commit 37dbb3508099d49748453166c1ee9ef1603fcf3a)
2020-06-28 21:37:40 +03:00
Azat Khuzhin
97e28f09ed Check error code of evhttp_add_header_internal() in evhttp_parse_query_impl()
(cherry picked from commit 4528d8e98781be794cbce13394f8442dd466684b)
2020-06-28 21:37:35 +03:00
Paul Osborne
a62ec76561 cmake: avoid problems from use of CMAKE_USE_PTHREADS_INIT
In some CMake integrations, portions of the toolchain may end up
defining CMAKE_USE_PTHREADS_INIT even when EVENT__DISABLE_THREAD_SUPPORT
is set for libevent.  Modify the build to not rely on this side effect
of find_package(Threads, ...) [which could be done elsewhere] but instead
to use EVENT__HAVE_PTHREADS which is defined only on the desired codepath.

Without this change, affected builds fail as a result of event_pthreads source
files being built but with build defines which cause the build to fail.

Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
(cherry picked from commit 26d5ff457c9e6cf9b84ec9d8fb83d87caf083d96)
2020-06-28 21:36:58 +03:00
Azat Khuzhin
fb5fa12ac0 test/regress_testutils: use inet_addr()
(cherry picked from commit 8b5a4d61f6eb7180c0800f38549c20776c6d1cd9)
2020-06-28 21:36:02 +03:00
yuangongji
9a94cd9b49 remove FindGit.cmake, improve git describe command
(cherry picked from commit a9aa2b3607c8adf9846aa6a01e070130f4d6dcb9)
2020-06-28 21:35:11 +03:00
Azat Khuzhin
da11fcc881 checkpatch.sh: fix clang-format-diff usage
- strip 1 path component
- it does not accept file name anymore, only stdin

Refs: #1029
(cherry picked from commit 89d313b14dffed7271f41f4e2d68ccfe6b6475ed)
2020-06-28 21:35:11 +03:00
Azat Khuzhin
9c2b49c772 checkpatch.sh: fix usage
Refs: #1029
(cherry picked from commit 8209a623addf6688243eeb6ebb9ece6a20206437)
2020-06-28 21:35:11 +03:00
Wataru Ashihara
b0e9577f36 Fix clang-format-diff usage
"--style" is invalid:

$ ./checkpatch.sh -r HEAD
usage: clang-format-diff [-h] [-i] [-p NUM] [-regex PATTERN] [-iregex PATTERN]
                         [-sort-includes] [-v] [-style STYLE] [-binary BINARY]
clang-format-diff: error: unrecognized arguments: --style={ Language:... }

(cherry picked from commit 866fbb54570c74f215208b237ddce48fb79d2cd6)
2020-06-28 21:35:11 +03:00
mohuang
0970e25c23 variable redefinition in win32_dispatch
(cherry picked from commit f10aaea37433b60ed3e0b7adcc7b1764c8b0b518)
2020-06-28 21:35:11 +03:00
Azat Khuzhin
65a002a8e5 test: http/autofree_connection cleanup
(cherry picked from commit e8c8951029a0a084dd73b27e6dc3b637a7c914db)
2020-06-28 21:35:11 +03:00
Azat Khuzhin
1be25938b0 http: fix EVHTTP_CON_AUTOFREE in case of timeout (and some else)
Refs: #182
(cherry picked from commit eee26deed38fc7a6b6780b54628b007a2810efcd)
2020-06-28 21:35:11 +03:00
Azat Khuzhin
8dc6468e7e test: cleanup http/autofree_connection
(cherry picked from commit 70f69194eb3b19b5e41b52b17a820e1e91512560)
2020-06-28 21:34:56 +03:00
Azat Khuzhin
ab13087526 test: fix http/autofree_connection
Refs: #182
(cherry picked from commit 1cc94feab81e7387041edc32be9843f66847072d)
2020-06-28 21:33:12 +03:00
ayuseleznev
c297245377 evdns: Add additional validation for values of dns options
(cherry picked from commit 8fe35c7614802fa13d144cceea9b079d5a131891)
2020-06-28 21:33:12 +03:00
Nick Grifka
141e37c804 test: Fix test_simpleclose for Windows platform
Replace close with evutil_closesocket
Caught with PR #1006

(cherry picked from commit 06a11929511bebaaf40c52aaf91de397b1782ba2)
2020-06-28 21:33:12 +03:00
Azat Khuzhin
2af1f6cc2d abi-check: abi-monitor 1.10 does not support -make -j8 (1.12 supports though)
An error for 1.10 on ci:
  https://github.com/azat/libevent/runs/647860649?check_suite_focus=true#step:4:219

(cherry picked from commit 448a478a98ae7797c1d1a5f1463c02f1b09982f2)
2020-06-28 21:33:11 +03:00
yuangongji
709210d457 Add API/ABI checker (using LVC)
v2 (by azat):
- drop package installations
- use local .abi-check over $HOME/abi-check for build dir
- drop regex check, simply use default values (too complex otherwise)
- use sub-shell to avoid cd back
- add missing quotes
- make the style uniq across the whole file (no tabs for indent, copy-paste?)
- drop `set -x`, use `bash -x abi-check.sh` over
- drop EVENT_ABI_CHECK
- use /usr/bin/env bash as shebang
- use `find | xargs` over `cp $(grep -v)`
- adjust markdown syntax in abi-check/README.md
- adjust link to the publicly available documentation

v3 (by azat):
- docker image
- git check-ignore
- make -j8
- allow to change defaults

Refs: #887
(cherry picked from commit 735c891e71dc7de737dc09cdef26683eea394e66)
2020-06-28 21:33:11 +03:00
Azat Khuzhin
2016f017b3 Update list of cmake files for autotools dist archive
Fixes: #976
(cherry picked from commit f3bc532735c4ac91c5be31ed5f0ca58241a0e983)
2020-06-28 21:33:11 +03:00
Azat Khuzhin
9ea60ab2c1 Pass --quiet to the event_rcpgen.py (autotools already does this)
(cherry picked from commit 7a465268b29c57958e55dceda77ad8322e247454)
2020-06-28 21:33:11 +03:00
Aleksandr-Melnikov
891adda9f1 There is typo in GetAdaptersAddresses windows library. It should be iphlpapi.dll
(cherry picked from commit 61fc2bf2e9719eb7ca9c56b6e186df2f79f05de7)
2020-06-28 21:33:11 +03:00
Azat Khuzhin
2530e7c630 Support EV_CLOSED on linux for poll(2)
Refs: #984
(cherry picked from commit 4c13afaeec2d35df2580dfbc49391d0524101248)
2020-06-28 21:33:11 +03:00
Azat Khuzhin
1df324d4c4 Fix EV_CLOSED detection/reporting (epoll only)
- EV_CLOSED is EPOLLRDHUP in epoll
- EPOLLRDHUP reported w/o EPOLLHUP if the socket closed with shutdown(SHUT_WR)
- EPOLLRDHUP reported w/  EPOLLHUP if the socket closed with close()
  so in this case epoll backend will detect this event as error
  (EV_READ|EV_WRITE), since the epoll_ctl() will return EPOLLRDHUP with
  EPOLLHUP set, but this is not correct, let's fix this.

Fixes: #984
(cherry picked from commit 972b456bf60e9a2f550ec45a14921c06e252c793)
2020-06-28 21:33:11 +03:00