Open Bug 1548356 Opened 6 years ago Updated 2 years ago

Hash the XDR transcode buffer

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

People

(Reporter: tcampbell, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(3 obsolete files)

Since the XDR data integrity of startup caches is important to avoid crashes, we should add a hash check on decode.

One concern would be disk read, but the hash is per transcode operation which are done as a chunk and would quickly hit the same disk latency anyways. The startup caches perform several transcode operations so the hash does not span the whole file. The worst case I see is the activity-stream bundle which is a 750kB buffer.

This also lumps the first-access of the data in one place which might be useful if we wanted to have a signal handling to catch mmap errors. See Bug 1444442.

Depends on D29551

Compute and verify the SHA1 hash of each XDR transcode operation. This
is to detect data corruption issues that will otherwise lead to serious
crashes.

Depends on D29552

Stupid question, any reason to use SHA1, and not a cheaper / faster-to-compute hashing / check-sum algorithm?

The silly reason was that it was available in MFBT. There are several CRC implementations in tree but not in JS so SHA1 was the easiest to get. Several of the CRC implementations are not very efficient either. A number of those CRC implementations are byte-based and naive as well. It is probably worth replacing the SHA1 before landing so no reviewers have been assigned yet.

Attachment #9061991 - Attachment is obsolete: true
Attachment #9061989 - Attachment is obsolete: true
Attachment #9061990 - Attachment is obsolete: true
Assignee: tcampbell → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: