Commit e67e1fb
committed
Improve ReadRemoteMemory error handling on macOS
Improve the return value check to be able to raise a ProcessLookupError
when the remote process is not available.
Mach uses composite error values where higher error values indicate
specific subsystems. We can use the err_get_code function to mask the
higher bits to make our error checking more robust in case the subsystem
bits are set. For example, in some situations if the process is in zombie
state, we can get KERN_NO_SPACE (0x3) but the actual return value is
0x10000003 which indicates a specific subsystem, thus we need to
use err_get_code to extract the error value.
This also improves how KERN_INVALID_ARGUMENT is handled to check whether
we got a generic invalid argument error, or if the process is no longer
accessible.1 parent dc9aad3 commit e67e1fb
2 files changed
+27
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1723 | 1723 | | |
1724 | 1724 | | |
1725 | 1725 | | |
1726 | | - | |
1727 | | - | |
| 1726 | + | |
1728 | 1727 | | |
1729 | 1728 | | |
1730 | 1729 | | |
1731 | | - | |
| 1730 | + | |
1732 | 1731 | | |
1733 | 1732 | | |
1734 | 1733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
1053 | 1054 | | |
1054 | 1055 | | |
1055 | 1056 | | |
1056 | | - | |
| 1057 | + | |
1057 | 1058 | | |
1058 | 1059 | | |
1059 | 1060 | | |
1060 | 1061 | | |
1061 | 1062 | | |
1062 | 1063 | | |
1063 | 1064 | | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1068 | 1088 | | |
1069 | 1089 | | |
1070 | 1090 | | |
| |||
0 commit comments