Commit Graph

12 Commits

Author SHA1 Message Date
Eric Miotto
a10313ec51 Reduce surface for command injection in some Python scripts
Namely, in scripts that alter the search paths for dylibs, ensure to
invoke `/usr/bin/xcrun` directly to run `dyld_info` and
`install_name_tool`, and validate that each argument is a valid path.

Addresses rdar://160463033
2025-09-16 07:18:32 -07:00
Mike Ash
4341102c92 [Tools] Add a library to build specialized generic metadata out of process.
This library uses GenericMetadataBuilder with a ReaderWriter that can read data and resolve pointers from MachO files, and emit a JSON representation of a dylib containing the built metadata.

We use LLVM's binary file readers to parse the MachO files and resolve fixups so we can follow pointers. This code is somewhat MachO specific, but could be generalized to other formats that LLVM supports.

rdar://116592577
2024-01-24 20:45:50 -05:00
Alastair Houghton
f28cf1368a [Backtracing] Please the Python linter.
For some reason it wants two blank lines instead of one here.

rdar://107362003
2023-04-13 09:00:28 +01:00
Alastair Houghton
c275939c9e [Backtracing] Don't use the hardened runtime for tests.
Using the hardened runtime for tests doesn't work.

rdar://107362003
2023-04-12 13:47:08 +01:00
Alastair Houghton
e5680de071 [Backtracing] Security improvements.
Use `task_read_for_pid()` rather than having the crashing program pass its
own task port through.  This opts us in to additional OS security measures
surrounding the use of this call.

rdar://107362003
2023-04-12 12:48:33 +01:00
Kavon Farvardin
e9ba998723 emit a message when falling-back to xcrun dyldinfo 2022-09-15 15:36:30 -07:00
Dario Rexin
de91842938 [Build] Update scripts to use dyld_info (#60532)
* [Build] Update scripts to use dyld_info

dyldinfo has been deprecated and will no longer be available on newer Xcode releases. It has been replaced with dyld_info. To stay compatible with older releases, we are still falling back to dyldinfo, if dyld_info is not available.

rdar://98570807

* Apply suggestions from code review

Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>
2022-08-12 17:48:05 -07:00
Karoy Lorentey
d0e377e737 [utils] Use Python 2 compatible name for text=True 2022-03-08 12:03:56 -08:00
Karoy Lorentey
bcddc9b7b9 [utils] Force subprocess output to be read in text mode
In Python 3, subprocess output is read as binary data by default, which isn’t what we want.

Instead of reading process output as byte strings, then manually decoding them into strings, simply pass `text=True` to functions in the `subprocess` module, so that we get properly decoded strings right out the box.

This fixes places that forget to do the decoding step — most especially, the `update-checkout` script. That script prints Git output as byte strings, which leads to unreadable results.

Additionally, in shell.run, use the same pipe for capturing both stdout and stderr. The distinction is pretty pointless in this use case; however, keeping the two channels separate means that we lose the original ordering of printed messages, which does matter.
2022-03-07 16:59:36 -08:00
Mishal Shah
d492b1a14e Fix the python lint issue with swift-darwin-postprocess.py 2021-06-08 14:00:44 -07:00
Mishal Shah
38faa8ce38 Fix the permission issue with utils/swift-darwin-postprocess.py 2021-06-07 21:29:28 -07:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00