Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(36)

Issue 2333045: code review 2333045: Make.pkg: remove .so before installing new one (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by rsc
Modified:
14 years, 5 months ago
Reviewers:
CC:
iant, golang-dev, msolo
Visibility:
Public.

Description

Make.pkg: remove .so before installing new one On Linux, overwriting an mmap'ed file causes all the MAP_PRIVATE pages to get refreshed with the new content, even ones that have been modified by the process that did the mmap. One specific instance of this is that after the dynamic linker has relocated a page from a .so, overwriting the .so will un-relocate it, making the next use of one of the no-longer-relocated addresses incorrect and probably crash the program. Linux must go out of its way to break programs in this way: the pages have already been copied on write, so they're not shared with the file system cache, and it trashes them anyway. The manual says the behavior when the file gets overwritten is "undefined". Removing before copy avoids the undefined behavior.

Patch Set 1 #

Patch Set 2 : code review 2333045: Make.pkg: remove .so before installing new one #

Patch Set 3 : code review 2333045: Make.pkg: remove .so before installing new one #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -0 lines) Patch
M src/Make.pkg View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3
rsc
Hello iant (cc: golang-dev@googlegroups.com, msolo@gmail.com), I'd like you to review this change.
14 years, 5 months ago (2010-10-01 19:55:30 UTC) #1
iant
LGTM
14 years, 5 months ago (2010-10-01 20:00:13 UTC) #2
rsc
14 years, 5 months ago (2010-10-01 20:02:25 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=dc1fa88536cf ***

Make.pkg: remove .so before installing new one

On Linux, overwriting an mmap'ed file causes
all the MAP_PRIVATE pages to get refreshed
with the new content, even ones that have been
modified by the process that did the mmap.

One specific instance of this is that after the
dynamic linker has relocated a page from a .so,
overwriting the .so will un-relocate it, making
the next use of one of the no-longer-relocated
addresses incorrect and probably crash the
program.

Linux must go out of its way to break programs
in this way: the pages have already been copied
on write, so they're not shared with the file system
cache, and it trashes them anyway.  The manual
says the behavior when the file gets overwritten
is "undefined".  Removing before copy avoids the
undefined behavior.

R=iant
CC=golang-dev, msolo
http://codereview.appspot.com/2333045
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b