[tor-bugs] #17183 [Tor]: Add exit-policy/reject-private so stem can discover ExitPolicyRejectPrivate rules

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Nov 26 19:12:39 UTC 2015


#17183: Add exit-policy/reject-private so stem can discover ExitPolicyRejectPrivate
rules
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:
     Type:  enhancement                          |         Status:
 Priority:  Medium                               |  reopened
Component:  Tor                                  |      Milestone:  Tor:
 Severity:  Normal                               |  0.2.8.x-final
 Keywords:  stem, 028-triaged,                   |        Version:  Tor:
  TorCoreTeam201511                              |  unspecified
Parent ID:                                       |     Resolution:
  Sponsor:                                       |  Actual Points:
                                                 |         Points:  small
-------------------------------------------------+-------------------------
Changes (by cypherpunks):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Sorry to reopen this ticket again, but i found two other issues after
 running it through Valgrind.

 The first issue is a memory leak in the `getinfo_helper_policies` test.
 The attached patch solves this.

 The second issue are uninitialized value warnings such as;
 {{{
 Conditional jump or move depends on uninitialised value(s)
    tor_addr_is_null (address.c:869)
    tor_addr_is_public_for_reject (policies.c:910)
    addr_policy_append_reject_addr_filter (policies.c:928)
    addr_policy_append_reject_addr_list_filter (policies.c:964)
    policies_parse_exit_policy_reject_private (policies.c:1081)
    getinfo_helper_policies (policies.c:2163)
    test_policies_getinfo_helper_policies (test_policy.c:1001)
    testcase_run_bare_ (tinytest.c:105)
    testcase_run_one (tinytest.c:252)
    tinytest_main (tinytest.c:434)
    main (testing_common.c:293)

 Conditional jump or move depends on uninitialised value(s)
    tor_addr_is_internal_ (address.c:364)
    tor_addr_is_public_for_reject (policies.c:910)
    addr_policy_append_reject_addr_filter (policies.c:928)
    addr_policy_append_reject_addr_list_filter (policies.c:964)
    policies_parse_exit_policy_reject_private (policies.c:1081)
    getinfo_helper_policies (policies.c:2163)
    test_policies_getinfo_helper_policies (test_policy.c:1001)
    testcase_run_bare_ (tinytest.c:105)
    testcase_run_one (tinytest.c:252)
    tinytest_main (tinytest.c:434)
    main (testing_common.c:293)
 }}}

 Research into these warnings lead me to the
 `policies_add_ipv4h_to_smartlist` function. The function allocates the
 `ipv4_tor_addr` on the stack and adds a pointer to it to `addr_list`. This
 means that memory held by `ipv4_tor_addr` is freed once the function
 returns and the pointer is then pointing to uninitialized memory. I do not
 have a patch for this issue because i am unsure how to allocate the
 `ipv4_tor_addr` variable on the heap without creating a memory leak.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17183#comment:27>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list