Adam Langley [Thu, 7 Jul 2011 22:06:50 +0000 (18:06 -0400)]
crypto/x509: prevent chain cycles in Verify
It's possible to include a self-signed root certificate as an
intermediate and push Verify into a loop.
I already had a test for this so I thought that it was ok, but it
turns out that the test was void because the Verisign root certificate
doesn't contain the "IsCA" flag and so it wasn't an acceptable
intermediate certificate for that reason.
crypto/openpgp: fixed dangerous use of for loop variable
In function readSignedMessage a pointer to for loop variable 'key' was incorrectly being assigned
to md.SignedBy. Changed so that md.SignedBy is pointing to the 'more correct' memory position.
Rob Pike [Wed, 6 Jul 2011 05:35:23 +0000 (15:35 +1000)]
maketables: update debugging data.
This is unused in the generation of the tables, but was incorrect if we ever needed it.
Also update the reference to the document.
Rob Pike [Wed, 6 Jul 2011 04:46:41 +0000 (14:46 +1000)]
exp/template: fixes and updates.
- fix line numbers - forgot to update state.line during execution
- add a comment convention {{/* comment */}}
- set.Template returns the named template in the set
- set.Execute executes the named template in the set
- use a local methodByName so this package can be used with earlier release of reflect.
- use initial cap to detect exported names
Rob Pike [Tue, 5 Jul 2011 04:23:51 +0000 (14:23 +1000)]
exp/template: functions
Add the ability to attach functions to template and template sets.
Make variadic functions and methods work.
Still to come: static checking of function names during parse.
Rob Pike [Mon, 4 Jul 2011 06:15:14 +0000 (16:15 +1000)]
docs: fold the prog.sh scripting from makehtml into htmlgen itself.
This allows us to drop some crufty scripting and provides a firmer
footing for building better tools for preparing documents with source
code inside.
Also eliminate line numbers from the examples and text.
Adam Langley [Fri, 1 Jul 2011 17:53:12 +0000 (13:53 -0400)]
crypto/openpgp: add ability to reserialize keys.
This changes Signature so that parsed signatures can be reserialized
exactly. With this ability we can add Serialize to Entity and also the
ability to sign other public keys.
Dmitriy Vyukov [Thu, 30 Jun 2011 15:13:29 +0000 (11:13 -0400)]
sync: improve Mutex to allow successive acquisitions
This implementation allows a goroutine to do successive acquisitions
of a mutex even if there are blocked goroutines.
Moreover, it allows a newcomer goroutine to acquire a mutex ahead of
blocked goroutines (that is, it does not enforce FIFO).
On implementation level it's achieved by separating waiter count and
locked flag.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows (with 4631059 "replace Semacquire/Semrelease implementation"
patch applied):
benchmark old ns/op new ns/op delta
sync_test.BenchmarkMutexUncontended 24.10 25.40 +5.39%
sync_test.BenchmarkMutexUncontended-2 12.00 13.00 +8.33%
sync_test.BenchmarkMutexUncontended-4 6.06 6.83 +12.71%
sync_test.BenchmarkMutexUncontended-8 3.63 3.60 -0.83%
sync_test.BenchmarkMutexUncontended-16 2.38 2.49 +4.62%
Julian Phillips [Thu, 30 Jun 2011 08:54:53 +0000 (18:54 +1000)]
goinstall: Add support for generic hosts using special import form
This change extends goinstall to support "magic" package names of the
form:
<host>/<repo>.<vcs>/<path>
Where <host> is the hostname, <repo> the path to the repository, <vcs>
the type of vcs (git, hg, bzr or svn), and <path> is the path inside the
repository that contains the source code for the package.
For example: "example.com/pub/foo.hg/src" means download the Mercurial
repository at either pub/foo.hg or pub/foo from example.com and then
build and install the source files from src inside the repository
checkout.
Repositories on the built-in hostings sites (github, bitbucket,
launchpad and googlecode) must still use the old form (i.e.
github.com/xxx/yyy.git/src will be rejected).
Russ Cox [Wed, 29 Jun 2011 13:52:34 +0000 (09:52 -0400)]
reflect: support for struct tag use by multiple packages
Each package using struct field tags assumes that
it is the only package storing data in the tag.
This CL adds support in package reflect for sharing
tags between multiple packages. In this scheme, the
tags must be of the form
key:"value" key2:"value2"
(raw strings help when writing that tag in Go source).
reflect.StructField's Tag field now has type StructTag
(a string type), which has method Get(key string) string
that returns the associated value.
Clients of json and xml will need to be updated.
Code that says
type T struct {
X int "name"
}
should become
type T struct {
X int `json:"name"` // or `xml:"name"`
}
Use govet to identify struct tags that need to be changed
to use the new syntax.
Russ Cox [Wed, 29 Jun 2011 03:58:35 +0000 (23:58 -0400)]
gc: fix package quoting logic
The decision for when to say "hash/crc32".New instead of
crc32.New in an error was double-counting imports
from different packages or indirect imports, so it was
quoting even when there was no ambiguity.
Gustavo Niemeyer [Tue, 28 Jun 2011 21:28:30 +0000 (22:28 +0100)]
ld: fix ELF strip by removing overlap of sections
The gosymtab and gopclntab sections were pointing to the proper
data, but that data was already owned by the rodata section.
Some ELF references explicitly prohibit multiple sections from
owning the same data, and strip behaves accordingly.
The data for these sections was moved to after rodata, and the
gosymtab and gopclntab sections now own their respective ranges.
This change makes strip happy both with and without -s being
provided at link time. Note that it won't remove these sections
because they are still allocated, and that's by design since
they are necessary at runtime for generating proper backtraces
and similar introspection operations.
Unlike the previous behavior, -s will now maintain zero-sized
gosymtab and gopclntab sections. This makes the implementation
slightly cleaner.
Dmitriy Vyukov [Tue, 28 Jun 2011 19:09:53 +0000 (15:09 -0400)]
runtime: replace Semacquire/Semrelease implementation
1. The implementation uses distributed hash table of waitlists instead of a centralized one.
It significantly improves scalability for uncontended semaphores.
2. The implementation provides wait-free fast-path for signalers.
3. The implementation uses less locks (1 lock/unlock instead of 5 for Semacquire).
4. runtime·ready() call is moved out of critical section.
5. Semacquire() does not call semwake().
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark old ns/op new ns/op delta
runtime_test.BenchmarkSemaUncontended 58.20 36.30 -37.63%
runtime_test.BenchmarkSemaUncontended-2 199.00 18.30 -90.80%
runtime_test.BenchmarkSemaUncontended-4 327.00 9.20 -97.19%
runtime_test.BenchmarkSemaUncontended-8 491.00 5.32 -98.92%
runtime_test.BenchmarkSemaUncontended-16 946.00 4.18 -99.56%
Dmitriy Vyukov [Tue, 28 Jun 2011 13:43:01 +0000 (09:43 -0400)]
sync: add fast path to Once
The implementation does not grab the lock,
if Once is already initalized.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark old ns/op new ns/op delta
sync_test.BenchmarkOnce 187.00 14.00 -92.51%
sync_test.BenchmarkOnce-2 909.00 21.40 -97.65%
sync_test.BenchmarkOnce-4 3684.00 20.90 -99.43%
sync_test.BenchmarkOnce-8 5987.00 23.00 -99.62%
sync_test.BenchmarkOnce-16 5051.00 21.60 -99.57%