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

Issue 318920043: i#2091: Implement execve of a "#!" script with early injection. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 4 months ago by Edmund.Grimley.Evans
Modified:
7 years, 4 months ago
Reviewers:
zhaoqin, bruening
CC:
dynamorio-devs_googlegroups.com
Visibility:
Public.

Description

Commit log for first patchset: --------------- i#2091: Implement execve of a "#!" script with early injection. The implementation carefully imitates what a recent Linux kernel was observed to do with levels of recursion and long lines, but there are some race conditions and transparency limitations: see the comment in the code. Fixes #2091 ---------------

Patch Set 1 #

Patch Set 2 : Fixed #

Patch Set 3 : dr_helper #

Total comments: 52

Patch Set 4 : set_failure_return_val #

Total comments: 4

Patch Set 5 : MacOS #

Patch Set 6 : Committed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+275 lines, -6 lines) Patch
M core/lib/dr_helper.h View 1 2 3 4 5 1 chunk +40 lines, -1 line 0 comments Download
M core/lib/dr_helper.c View 1 2 3 4 1 chunk +114 lines, -0 lines 0 comments Download
M core/unix/os.c View 1 2 3 4 5 6 chunks +121 lines, -5 lines 0 comments Download

Messages

Total messages: 41
Edmund.Grimley.Evans
7 years, 4 months ago (2016-12-06 11:53:25 UTC) #1
Edmund.Grimley.Evans
There's a serious problem with this. Don't review yet...
7 years, 4 months ago (2016-12-06 13:40:22 UTC) #2
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#2091: Implement execve of a "#!" script with early ...
7 years, 4 months ago (2016-12-07 11:05:15 UTC) #3
bruening
On 2016/12/07 11:05:15, Edmund.Grimley.Evans wrote: > Fixes #2091 It looks like this will not handle ...
7 years, 4 months ago (2016-12-07 15:42:22 UTC) #4
Edmund.Grimley.Evans
On 2016/12/07 15:42:22, bruening wrote: > On 2016/12/07 11:05:15, Edmund.Grimley.Evans wrote: > > Fixes #2091 ...
7 years, 4 months ago (2016-12-07 15:56:02 UTC) #5
bruening
I wonder if a different design would better handle both initial and from-app execve: moving ...
7 years, 4 months ago (2016-12-07 16:04:11 UTC) #6
Edmund.Grimley.Evans
On 2016/12/07 16:04:11, bruening wrote: > I wonder if a different design would better handle ...
7 years, 4 months ago (2016-12-07 16:30:10 UTC) #7
Edmund.Grimley.Evans
I don't mind using "bin64/drrun -- sh -c the_script" or "bin64/drrun -- env the_script", by ...
7 years, 4 months ago (2016-12-07 16:59:50 UTC) #8
bruening
On 2016/12/07 16:59:50, Edmund.Grimley.Evans wrote: > I don't mind using "bin64/drrun -- sh -c the_script" ...
7 years, 4 months ago (2016-12-07 17:07:00 UTC) #9
Edmund.Grimley.Evans
On 2016/12/07 17:07:00, bruening wrote: > Typical usage is to take some command line and ...
7 years, 4 months ago (2016-12-07 17:26:52 UTC) #10
bruening
Maybe the best thing is for the parent to always resolve down to an ELF, ...
7 years, 4 months ago (2016-12-07 17:29:26 UTC) #11
bruening
On 2016/12/07 17:26:52, Edmund.Grimley.Evans wrote: > On 2016/12/07 17:07:00, bruening wrote: > > Typical usage ...
7 years, 4 months ago (2016-12-07 17:34:19 UTC) #12
Edmund.Grimley.Evans
On 2016/12/07 17:34:19, bruening wrote: > On 2016/12/07 17:26:52, Edmund.Grimley.Evans wrote: > > On 2016/12/07 ...
7 years, 4 months ago (2016-12-07 18:11:03 UTC) #13
bruening
On 2016/12/07 18:11:03, Edmund.Grimley.Evans wrote: > On 2016/12/07 17:34:19, bruening wrote: > > On 2016/12/07 ...
7 years, 4 months ago (2016-12-07 18:53:45 UTC) #14
Edmund.Grimley.Evans
On 2016/12/07 18:53:45, bruening wrote: > Sounds like a separate, unrelated bug in how drdeploy.c ...
7 years, 4 months ago (2016-12-08 10:09:58 UTC) #15
Edmund.Grimley.Evans
There are three kinds of recursion potentially involved in executing a file: script interpreters, ELF ...
7 years, 4 months ago (2016-12-08 10:26:39 UTC) #16
bruening
We should make sure the code is in a place that can be shared with ...
7 years, 4 months ago (2016-12-10 20:42:39 UTC) #17
Edmund.Grimley.Evans
On 2016/12/10 20:42:39, bruening wrote: > We should make sure the code is in a ...
7 years, 4 months ago (2016-12-10 22:04:56 UTC) #18
bruening
On 2016/12/10 22:04:56, Edmund.Grimley.Evans wrote: > On 2016/12/10 20:42:39, bruening wrote: > > We should ...
7 years, 4 months ago (2016-12-11 02:32:47 UTC) #19
Edmund.Grimley.Evans
On 2016/12/11 02:32:47, bruening wrote: > On 2016/12/10 22:04:56, Edmund.Grimley.Evans wrote: > > On 2016/12/10 ...
7 years, 4 months ago (2016-12-11 08:17:09 UTC) #20
bruening
On 2016/12/11 08:17:09, Edmund.Grimley.Evans wrote: > On 2016/12/11 02:32:47, bruening wrote: > > On 2016/12/10 ...
7 years, 4 months ago (2016-12-11 21:59:19 UTC) #21
Edmund.Grimley.Evans
On 2016/12/11 21:59:19, bruening wrote: > > So the new functions take the allocator function ...
7 years, 4 months ago (2016-12-12 12:55:42 UTC) #22
Edmund.Grimley.Evans
The different contexts don't just require different memory allocation; they also, I presume, require different ...
7 years, 4 months ago (2016-12-13 09:48:10 UTC) #23
bruening
tl;dr -- yes. If drhelper is the right place (as opposed to a 2nd lib). ...
7 years, 4 months ago (2016-12-13 16:31:06 UTC) #24
Edmund.Grimley.Evans
On 2016/12/13 16:31:06, bruening wrote: > I don't know where the hardcoded [11] and [512] ...
7 years, 4 months ago (2016-12-13 18:19:06 UTC) #25
bruening
On Tue, Dec 13, 2016 at 1:19 PM, <Edmund.Grimley.Evans@gmail.com> wrote: > On 2016/12/13 16:31:06, bruening ...
7 years, 4 months ago (2016-12-13 21:38:00 UTC) #26
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#2091: Implement execve of a "#!" script with early ...
7 years, 4 months ago (2016-12-15 13:10:17 UTC) #27
bruening
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c File core/lib/dr_helper.c (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c#newcode99 core/lib/dr_helper.c:99: is_shebang(IN char *str, OUT char **interp, OUT char **arg) ...
7 years, 4 months ago (2016-12-16 05:03:17 UTC) #28
bruening
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c File core/lib/dr_helper.c (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c#newcode119 core/lib/dr_helper.c:119: *p++ = 0; On 2016/12/16 05:03:16, bruening wrote: > ...
7 years, 4 months ago (2016-12-16 05:09:58 UTC) #29
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c File core/lib/dr_helper.c (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c#newcode99 core/lib/dr_helper.c:99: is_shebang(IN char *str, OUT char **interp, OUT char **arg) ...
7 years, 4 months ago (2016-12-16 09:56:54 UTC) #30
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c File core/lib/dr_helper.c (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c#newcode108 core/lib/dr_helper.c:108: if (*p == '\n' || *p == 0) If ...
7 years, 4 months ago (2016-12-16 10:57:36 UTC) #31
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/unix/os.c File core/unix/os.c (right): https://codereview.appspot.com/318920043/diff/40001/core/unix/os.c#newcode5545 core/unix/os.c:5545: * do a (non-failing) execve and therefore not to ...
7 years, 4 months ago (2016-12-16 12:00:21 UTC) #32
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#2091: Implement execve of a "#!" script with early ...
7 years, 4 months ago (2016-12-16 12:09:15 UTC) #33
bruening
Could we add a test? https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c File core/lib/dr_helper.c (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.c#newcode108 core/lib/dr_helper.c:108: if (*p == '\n' ...
7 years, 4 months ago (2016-12-16 19:07:11 UTC) #34
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h File core/lib/dr_helper.h (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h#newcode79 core/lib/dr_helper.h:79: /* Linux allows five levels of script interpreter, and ...
7 years, 4 months ago (2016-12-16 21:22:17 UTC) #35
bruening
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h File core/lib/dr_helper.h (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h#newcode79 core/lib/dr_helper.h:79: /* Linux allows five levels of script interpreter, and ...
7 years, 4 months ago (2016-12-16 21:40:17 UTC) #36
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h File core/lib/dr_helper.h (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h#newcode84 core/lib/dr_helper.h:84: char *argv[11]; /* null terminated list of arguments */ ...
7 years, 4 months ago (2016-12-19 15:17:04 UTC) #37
Edmund.Grimley.Evans
https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h File core/lib/dr_helper.h (right): https://codereview.appspot.com/318920043/diff/40001/core/lib/dr_helper.h#newcode84 core/lib/dr_helper.h:84: char *argv[11]; /* null terminated list of arguments */ ...
7 years, 4 months ago (2016-12-20 17:14:31 UTC) #38
Edmund.Grimley.Evans
Commit log for latest patchset: --------------- i#2091: Implement execve of a "#!" script with early ...
7 years, 4 months ago (2016-12-21 09:19:53 UTC) #39
bruening
If a fixme comment about the known leak is added then LGTM https://codereview.appspot.com/318920043/diff/60001/core/unix/os.c File core/unix/os.c ...
7 years, 4 months ago (2016-12-21 16:20:19 UTC) #40
Edmund.Grimley.Evans
7 years, 4 months ago (2016-12-22 10:39:25 UTC) #41
Committed as
https://github.com/DynamoRIO/dynamorio/commit/1b763ba775b8f43fff347ff90eaa628...

Final commit log: 
---------------
i#2091: Implement execve of a "#!" script with early injection.

The implementation carefully imitates what a recent Linux kernel was
observed to do with levels of recursion and long lines, but there are
some race conditions and transparency limitations: see the comment
in the code.

Still to do: Handle script interpreters that are not followed, and
add a test.

Review-URL: https://codereview.appspot.com/318920043
---------------
Sign in to reply to this message.

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