Page MenuHomePhabricator

Fix Linux lldb local and remote debugging to respect the flag to disable ASLR.
ClosedPublic

Authored by tfiala on Aug 16 2014, 4:25 PM.

Details

Reviewers
emaste
chandlerc
Summary

This change addresses the following bug:
http://llvm.org/bugs/show_bug.cgi?id=20658.

Ed Maste - please have a look at the (no-op) change to FreeBSD ProcessMonitor. I changed the interface that TOT local Linux and local FreeBSD debugging share in ProcessMonitor to pass in a const ref to the ProcessLaunchInfo structure when we launch a new process for debugging. (I did not build it on FreeBSD - my VM is not reachable on the weekend - but I did tweak the FreeBSD ProcessMonitor to accept the new arg).

I'll do a follow-up patch to add an --enable-aslr flag. Since everything does disable ASLR by default (the flag is always set), I'm not actually finding a way to enable ASLR with the current command setup. (--disable-aslr=False/false/0/no don't work as --disable-aslr isn't expected to take an argument). The net result is instead of always having ASLR stay in the default state, it will now always be disabled on Linux until I make that follow-up change AFAICT.

Diff Detail

Event Timeline

tfiala updated this revision to Diff 12584.Aug 16 2014, 4:25 PM
tfiala retitled this revision from to Fix Linux lldb local and remote debugging to respect the flag to disable ASLR..
tfiala updated this object.
tfiala edited the test plan for this revision. (Show Details)
tfiala added a reviewer: emaste.
tfiala added a subscriber: chandlerc.
tfiala added a subscriber: Unknown Object (MLST).Aug 16 2014, 4:26 PM

This change also adds the Plugins/Process/FreeBSD files to the Xcode project.

chandlerc accepted this revision.Aug 16 2014, 4:42 PM
chandlerc added a reviewer: chandlerc.

Looks good to me.

source/Plugins/Process/Linux/NativeProcessLinux.cpp
96–98

The comment here doesn't make much sense in a file which unconditionally #includes <linux/unistd.h> and <sys/personality.h>. This file can only be compiled on a Linux host or with a Linux SDK kicking around.

I think you can just use the enums from <sys/personality.h>. They aren't weird or surprising even if their documentation is limited.

This revision is now accepted and ready to land.Aug 16 2014, 4:42 PM

The defined flags were meant to prevent issues we've hit when
cross-compiling for ARM simulators where the cross-compilers occasionally
are missing some values. But I didn't actually hit that so fair enough, I
can remove it until we know it's an issue.

I just need a buddy build on FreeBSD (or I can watch their buildbot).

Personally, I would just watch the build bots. Their entire purpose is to
expose problems on other hosts.

emaste edited edge metadata.Aug 16 2014, 5:06 PM

Looks fine, and now that we have a FreeBSD bot on the official buildmaster it's easy to keep top of the results.

lldb.xcodeproj/project.pbxproj
955

Thanks Todd - I'm playing around with the Xcode build now and just noticed this today.

Ok cool, I'll get this in after removing the dupe of the system flag.

Thanks Todd - I'm playing around with the Xcode build now and just noticed this today.

My pleasure, Ed!

tfiala closed this revision.Aug 19 2014, 9:58 AM

Closed by this commit:

svn commit
Sending lldb.xcodeproj/project.pbxproj
Sending source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
Sending source/Plugins/Process/FreeBSD/ProcessMonitor.h
Sending source/Plugins/Process/Linux/NativeProcessLinux.cpp
Sending source/Plugins/Process/Linux/NativeProcessLinux.h
Sending source/Plugins/Process/Linux/ProcessMonitor.cpp
Sending source/Plugins/Process/Linux/ProcessMonitor.h
Sending source/Plugins/Process/POSIX/ProcessPOSIX.cpp
Transmitting file data ........
Committed revision 215822.