3510 Commits

Author SHA1 Message Date
Nick Mathewson
4472ec68e6 Merge pull request #212 from xbao/master
changed strtotimeval signature to avoid conflict with Android NDK sys/time.h header (#211)
2015-02-03 15:57:31 -05:00
Nick Mathewson
1cae3ae167 Merge remote-tracking branch 'public/master' 2015-02-02 13:57:50 -05:00
Nick Mathewson
537177d315 New function to get address for nameserver. 2015-02-02 13:57:22 -05:00
Xiao Bao Clark
bdbc823f7e changed strtotimeval signature as per #211 2015-01-28 17:17:02 +11:00
Nick Mathewson
62eaa889cc Merge pull request #210 from mc-server/master
Added cmake-generated files to ignore list.
2015-01-27 10:07:22 -05:00
Matyas Dolak
6c12bfec1d Added cmake-generated files to ignore list.
These are generated by cmake on Windows with MSVC.
2015-01-27 15:30:52 +01:00
Azat Khuzhin
a558fcdb43 be_pair/regress: cover use of shared lock (lock/unlock/free)
For more info look at 92a359ee3adf4636db508e6c6d7179d4d59eaafc
("be_pair: release shared lock with the latest of bufferevent_pair")
2015-01-26 00:40:09 +03:00
Azat Khuzhin
e5c87d18b0 event_free_debug_globals_locks(): disable lock debugging
This will allow to use library event after
event_free_debug_globals_locks()/libevent_global_shutdown() without
invalid read/write's.
2015-01-26 00:40:09 +03:00
Azat Khuzhin
ccc55937cf evthread: evthreadimpl_disable_lock_debugging_() for libevent_global_shutdown() 2015-01-26 00:40:09 +03:00
Azat Khuzhin
c0b34f6fd5 evthread: add evthread_get_{lock,condition}_callbacks() helpers 2015-01-26 00:40:09 +03:00
Azat Khuzhin
92a359ee3a be_pair: release shared lock with the latest of bufferevent_pair
Then next code sample will use free'd lock:
  evthread_use_pthreads();
  ...
  assert(!bufferevent_pair_new(base, BEV_OPT_THREADSAFE, pair));
  ...
  bufferevent_free(pair[0]); # refcnt == 0 -> unlink
  bufferevent_free(pair[1]); # refcnt == 0 -> unlink
  ...
  event_base_free() -> finalizers -> EVTHREAD_FREE_LOCK(bev1->lock)
                                  -> BEV_LOCK(bev2->lock) <-- *already freed*

While if you will reverse the order:
  bufferevent_free(pair[1]); # refcnt == 0 -> unlink
  bufferevent_free(pair[0]); # refcnt == 0 -> unlink
  ...
  event_base_free() -> finalizers -> BEV_LOCK(bev2->lock)/!own_lock/BEV_UNLOCK(bev2->lock)
                                  -> EVTHREAD_FREE_LOCK(bev1->lock) (own_lock)

It is ok now, but I guess that it will be better to relax order of
freeing pairs.
2015-01-26 00:40:02 +03:00
Nick Mathewson
4d66552a47 Merge pull request #115 from jer-gentoo/master
EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD
2015-01-22 12:15:01 -05:00
jer-gentoo
8674e4fb0a EVBUFFER_PTR_SET -> EVBUFFER_PTR_ADD
Looks like EVBUFFER_PTR_ADD should have been used instead of EVBUFFER_PTR_SET.
2015-01-21 11:24:23 +01:00
Azat Khuzhin
3540a193b5 regress_dns: drop hack for event_debug_map_HT_GROW in leak tests 2015-01-08 04:51:27 +03:00
Azat Khuzhin
941faaed39 event: call event_disable_debug_mode() in libevent_global_shutdown()
This will avoid leaking of event_debug_map_HT_GROW

I buildin it into libevent_glboal_shutdown() because
event_disable_debug_mode() -> event_free_debug_globals() ->
event_free_debug_globals_locks() will clean event_debug_map_lock_ that
used in event_disable_debug_mode().
2015-01-08 04:49:28 +03:00
Azat Khuzhin
597c7b259b ht-internal: don't reset hth_table_length explicitly in name_##HT_CLEAR
name_##HT_CLEAR calls name_##HT_INIT that reset hth_table_length to 0.
2015-01-08 04:43:37 +03:00
Nick Mathewson
0b49ae3459 Update changelog release-2.1.5-beta 2015-01-05 09:33:48 -05:00
Nick Mathewson
2c827e76e7 Merge branch '21_cve_2014_6272_v2' 2015-01-05 09:33:02 -05:00
Nick Mathewson
841ecbd961 Fix CVE-2014-6272 in Libevent 2.1
For this fix, we need to make sure that passing too-large inputs to
the evbuffer functions can't make us do bad things with the heap.

Also, lower the maximum chunk size to the lower of off_t, size_t maximum.

This is necessary since otherwise we could get into an infinite loop
if we make a chunk that 'misalign' cannot index into.
2015-01-05 09:32:53 -05:00
Nick Mathewson
683f5568ab Increment version to 2.1.5-beta 2015-01-05 09:16:12 -05:00
Nick Mathewson
0eb391941b work on changelog for 2.1.5-alpah 2015-01-05 08:50:30 -05:00
Nick Mathewson
8a29f3b3ae Merge pull request #201 from nsuke/cmake-shared-build
Fix CMake shared library build
2015-01-04 10:27:02 -05:00
Nobuaki Sukegawa
e69d910948 Fix CMake shared library build
This fixes following problems in shared library build:
* visibility=hidden was not enabled for gcc because of incorrect variable name
* test programs that need internal APIs caused link errors
2015-01-03 02:28:08 +09:00
Nick Mathewson
f05a0d53a6 Merge pull request #197 from JohnOhl/fix-clang-compile-warnings
Fix warnings when compiling with clang 3.5
2014-12-23 09:35:40 -05:00
John Ohl
f5b476570d Fix warnings when compiling with clang 3.5 2014-12-22 00:46:56 -05:00
Nick Mathewson
cb737041e2 Fix annoying heisenbug in test-time.c 2014-12-15 12:51:01 -05:00
Nick Mathewson
37df827a01 Merge pull request #192 from miniupnp/master
Fix mixed declarations and code (forbidden by ISO C90)
2014-12-08 10:26:01 -05:00
Thomas Bernard
8afbdbc470 Fix mixed declarations and code (forbidden by ISO C90) 2014-12-08 10:21:00 +01:00
Andrea Shepard
f2645f80c1 Implement new/free for struct evutil_monotonic_timer and export monotonic time functions 2014-12-04 09:30:20 -05:00
Nick Mathewson
6ae44b5da9 Merge remote-tracking branch 'origin/patches-2.0' 2014-12-01 08:32:23 -05:00
Nick Mathewson
fb7e76aec5 Fix evbuffer_peek() with len==-1 and start_at non-NULL. 2014-12-01 08:32:05 -05:00
Nick Mathewson
37145c5659 Merge remote-tracking branch 'public/patches-2.0'
Conflicts:
	ChangeLog
	event.c
2014-11-30 21:07:55 -05:00
Nick Mathewson
1da2f42bdb Merge branch 'patches-2.0' of github.com:libevent/libevent into patches-2.0 2014-11-30 21:02:25 -05:00
Nick Mathewson
d9469d396f Start on 2.1.5-alpha/beta changelog 2014-11-30 21:02:06 -05:00
Nick Mathewson
5ae5287214 Work on the changelog for 2.0.22 2014-11-30 19:38:23 -05:00
Nick Mathewson
7fd4941465 Merge remote-tracking branch 'origin/pr/182' 2014-11-30 19:26:20 -05:00
Nick Mathewson
23133cacc8 Merge remote-tracking branch 'origin/pr/180' 2014-11-30 19:25:21 -05:00
vjpai
3c7d6fcaff Fix race caused by event_active
There is a race between manual event_active and natural event activation. If both happen at the same time on the same FD, they would both be protected by the same event base lock except for 1 LoC where the fields of struct event are read without any kind of lock. This commit does those reads into local variables inside the lock and then invokes the callback with those local arguments outside the lock. In 2.0-stable, none of this is inside the lock; in HEAD, only the callback is read inside the lock. This gets the callback and all 3 arguments inside the lock before calling it outside the lock.
2014-11-30 19:24:15 -05:00
Nick Mathewson
c51c85d397 Merge remote-tracking branch 'origin/pr/175' 2014-11-30 11:11:33 -05:00
Nick Mathewson
a5d43cf4c6 Merge branch 'evbufer_peek_fix_v3' 2014-11-30 11:09:50 -05:00
Nick Mathewson
154006ad36 More evbuffer_peek() test cases 2014-11-30 11:09:28 -05:00
Azat Khuzhin
e2d139dd7e test/evbuffer_peek: add regress in case we have first buffer greater 2014-11-30 11:06:08 -05:00
Nick Mathewson
ba59923ab8 Fix evbuffer_peek() with len==-1 and start_at non-NULL. 2014-11-30 11:05:40 -05:00
Nick Mathewson
4f360f89ca Merge remote-tracking branch 'origin/pr/186' 2014-11-30 10:23:39 -05:00
Acer Yang
befbd13071 Fix cmake error when the Module path has more than one entry.
CMAKE_MODULE_PATH is usually a list instead of single entry. Especially
for projects contain sub cmake projects. My patch replace the
CMAKE_MODULE_PATH with fixed path, to locate the `.in` file.
2014-11-30 10:19:35 -05:00
John Ohl
24eea0da97 evhttp: Fix failure to send all output data for POST/PUT requests 2014-11-24 02:32:23 -05:00
Nick Mathewson
5ebad45e2d Merge pull request #189 from azat/be_async-avoid-doule-close
be async: avoid double close()
2014-11-24 01:09:13 -05:00
Azat Khuzhin
f133b8693e be async: avoid double close()
In case when between this two close (close(F), close(F)) some open()
will be executed, than we will close newly opened fd.

Reported-by: xujiezhige@163.com
2014-11-21 09:00:12 +03:00
John Ohl
10fe4ef300 Prevent duplicate event_del on fd 2014-11-16 23:40:16 -05:00
Azat Khuzhin
61262a0f08 evdns: avoid read-after-free in evdns_request_timeout_callback()
In evdns_request_timeout_callback() in case we a giving up, we call
request_finished() which will free() req structure, however we ns from
it to fail it, so save pointer to ns to call nameserver_failed() on
them.

Founded with valgrind:
$ valgrind regress dns/retry
==10497== Memcheck, a memory error detector
==10497== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10497== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==10497== Command: regress dns/retry
==10497==
dns/retry: [forking] ==10498== Invalid read of size 8
==10498==    at 0x4C309D: evdns_request_timeout_callback (evdns.c:2179)
==10498==    by 0x49EA95: event_process_active_single_queue (event.c:1576)
==10498==    by 0x49EFDD: event_process_active (event.c:1668)
==10498==    by 0x49F6DD: event_base_loop (event.c:1891)
==10498==    by 0x49F063: event_base_dispatch (event.c:1702)
==10498==    by 0x44C7F1: dns_retry_test_impl (regress_dns.c:724)
==10498==    by 0x44CF60: dns_retry_test (regress_dns.c:749)
==10498==    by 0x48A8A1: testcase_run_bare_ (tinytest.c:105)
==10498==    by 0x48A94E: testcase_run_forked_ (tinytest.c:189)
==10498==    by 0x48AB73: testcase_run_one (tinytest.c:247)
==10498==    by 0x48B4C2: tinytest_main (tinytest.c:434)
==10498==    by 0x477FC7: main (regress_main.c:459)
==10498==  Address 0x6176ef8 is 40 bytes inside a block of size 342 free'd
==10498==    at 0x4C29E90: free (vg_replace_malloc.c:473)
==10498==    by 0x4A4411: event_mm_free_ (event.c:3443)
==10498==    by 0x4BE8C5: request_finished (evdns.c:702)
==10498==    by 0x4C3098: evdns_request_timeout_callback (evdns.c:2178)
==10498==    by 0x49EA95: event_process_active_single_queue (event.c:1576)
==10498==    by 0x49EFDD: event_process_active (event.c:1668)
==10498==    by 0x49F6DD: event_base_loop (event.c:1891)
==10498==    by 0x49F063: event_base_dispatch (event.c:1702)
==10498==    by 0x44C7F1: dns_retry_test_impl (regress_dns.c:724)
==10498==    by 0x44CF60: dns_retry_test (regress_dns.c:749)
==10498==    by 0x48A8A1: testcase_run_bare_ (tinytest.c:105)
==10498==    by 0x48A94E: testcase_run_forked_ (tinytest.c:189)
==10498==
==10498==
==10498== HEAP SUMMARY:
==10498==     in use at exit: 0 bytes in 0 blocks
==10498==   total heap usage: 83 allocs, 83 frees, 10,020 bytes allocated
==10498==
==10498== All heap blocks were freed -- no leaks are possible
==10498==
==10498== For counts of detected and suppressed errors, rerun with: -v
==10498== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
OK
1 tests ok.  (0 skipped)
==10497==
==10497== HEAP SUMMARY:
==10497==     in use at exit: 0 bytes in 0 blocks
==10497==   total heap usage: 3 allocs, 3 frees, 96 bytes allocated
==10497==
==10497== All heap blocks were freed -- no leaks are possible
==10497==
==10497== For counts of detected and suppressed errors, rerun with: -v
==10497== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Bug was introduced in 97c750d6602517f22a1100f16592b421c38f2a45 ("evdns:
fail ns after we are failing/retrasmitting request").
2014-11-12 20:20:11 +03:00