Opened 5 years ago

Closed 5 years ago

#13478 closed enhancement (implemented)

Semantic changes to tor_calloc

Reported by: cypherpunks Owned by:
Priority: Low Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi,

I noticed the improvements to tor_malloc_zero with tor_calloc, and I added a bit to that.

The tor_calloc function overflow check is a bit faster; the semantic patch changes the argument order to be like calloc; and some other small details.

The branch is "calloc" at: https://bitbucket.org/eliteraspberries/tor/branch/calloc

Everything seems to work fine on the stable release.

Child Tickets

Change History (3)

comment:1 Changed 5 years ago by nickm

Milestone: Tor: unspecifiedTor: 0.2.6.x-final
Status: newneeds_review

Hmmm. Looks plausibly correct. I wonder, are we actually using whole-program optimization? It seems that without cross-module optimization, optimizing for a constant second argument won't actually help. (Then again, I'm not sure that we actually calloc in any critical path.)

comment:2 Changed 5 years ago by cypherpunks

I don't think there was really a need for optimization, but it might come in handy. It's mainly the ordering of the arguments that Coccinelle output that looked strange.

To verify important functions like this I've been working on some ACSL specifications that Frama-C could check. (But it would be simpler with a few changes upstream, so I'm trying to get their help on that first.) If I can figure it out, I'll add an update here.

comment:3 Changed 5 years ago by nickm

Resolution: implemented
Status: needs_reviewclosed

I've tweaked this a little to use a potentially more efficient patch, and re-applied the coccinelle patch to the latest master. Now it's merged. Thanks!

Note: See TracTickets for help on using tickets.