#
bdb56518 |
| 11-Nov-2015 |
David van Moolenbroek <david@minix3.org> |
passes: updates for LLVM 3.6.1
This patch also takes the first step to remove backward compatibility code from the passes. We only support the in-tree LLVM version.
Change-Id: I7836e524404afba151d
passes: updates for LLVM 3.6.1
This patch also takes the first step to remove backward compatibility code from the passes. We only support the in-tree LLVM version.
Change-Id: I7836e524404afba151d1a8bfa539b505e1dbdb8e
show more ...
|
#
3a3478dc |
| 24-Aug-2015 |
David van Moolenbroek <david@minix3.org> |
magic pass: register additional compatible types
This patch is a first step towards working around the larger problem of LLVM 3.x's use of bitcasting between structures and their elements to deal wi
magic pass: register additional compatible types
This patch is a first step towards working around the larger problem of LLVM 3.x's use of bitcasting between structures and their elements to deal with opaque types, replacing LLVM 2.x's actual unification. The patch allows the pass to register a larger number of compatible types, in particular for structure pointers passed through function calls. A skeleton is provided for dealing with structure elements as well, but that part requires much more work. It remains to be seen whether a more structural approach to dealing with this problem may be warranted.
For now, this change is necessary to allow instrumented state transfer of various "minix_timer" structures and pointers in PM and VFS.
Change-Id: Ib717d86ccfced53387e72a92750d22ae980c3466
show more ...
|
#
c07c198b |
| 06-Sep-2015 |
David van Moolenbroek <david@minix3.org> |
Disable malloc instrumentation for VM (#2)
When the malloc code is instrumented, the global _brksize variable should not be transferred. However, when the malloc code is not instrumented, failing t
Disable malloc instrumentation for VM (#2)
When the malloc code is instrumented, the global _brksize variable should not be transferred. However, when the malloc code is not instrumented, failing to transfer _brksize would reset the heap upon state transfer. In this patch, the magic pass stores the flag indicating whether memory function instrumentation is disabled, in the target process. This allows libmagic to check this flag during state transfer, to see whether it should transfer _brksize or not.
Change-Id: Ia004651e21e08b0ed3f5305865c53c6659e18f38
show more ...
|
#
76b68f9f |
| 01-Sep-2015 |
David van Moolenbroek <david@minix3.org> |
Disable malloc instrumentation for VM (#1)
This patch changes the VM makefile to specify that the magic pass is to skip memory function instrumentation, and to transfer the data variables of the mal
Disable malloc instrumentation for VM (#1)
This patch changes the VM makefile to specify that the magic pass is to skip memory function instrumentation, and to transfer the data variables of the malloc code (thus overriding the exception we made for all other system services). We add two magic pass flags to achieve this. Since the magic pass is a big bowl of spaghetti code, ignoring whitespace changes while viewing this patch is recommended.
Change-Id: I5ab83b23d8437b37c44dea99537bc202469c9df6
show more ...
|
#
b7725c85 |
| 26-Aug-2015 |
David van Moolenbroek <david@minix3.org> |
Fix mmap leak in malloc code upon state transfer
The NetBSD libc malloc implementation uses a memory-mapped area for its page directory. Since the process heap is reconstructed upon state transfer
Fix mmap leak in malloc code upon state transfer
The NetBSD libc malloc implementation uses a memory-mapped area for its page directory. Since the process heap is reconstructed upon state transfer for live update, this memory-mapped area must not be transferred to the new process. However, as the new instance of the process being updated inherits all memory-mapped areas of the old instance, it also automatically inherits the malloc implementation's page directory. Thus, we must explicitly free this area in order to avoid a memory leak.
The magic pass already detects (de)allocation functions called from within other (de)allocation functions, which is why the mmap(2) and munmap(2) calls of the malloc code are not instrumented as it is. This patch changes that particular case to allow a different hook function to be called for such "nested" allocation calls, for a particular set of nested calls. In particular, the malloc(3) code's mmap(2) and munmap(2) calls are replaced with magic_nested_mmap and magic_nested_munmap calls, respectively. The magic library then tracks memory mapping allocations of the malloc code by providing an implementation for these two wrappers, and frees the allocations upon state transfer.
This approach was chosen over various alternatives:
- While it appears that nesting could be established by setting a flag while the malloc(3) wrapper is active, and testing the flag in the mmap(2)/munmap(2) wrappers, this approach would fail to detect memory-mapped allocations made from uninstrumented malloc(3) calls, and therefore not a viable option. - It would be possible to obtain the value of the variables that store the information about the memory-mapped area in the malloc code. However, this is rather difficult in practice due to the way the libc malloc implementation stores the size of the are, and it would make the solution more dependent on the specific libc malloc implementation. - It would be possible to use the special "nested" instrumentation for allocations made from certain marked sections. Since we mark the data section of the malloc code already, this would not be hard to do. Switching to this alternative would change very little, and if for any reason this approach yields more advantages in the future, we can still choose to do so.
Change-Id: Id977405da86a72458dd10f18e076d8460fd2fb75
show more ...
|
#
9b9bea92 |
| 26-Aug-2015 |
David van Moolenbroek <david@minix3.org> |
Do not instrument malloc implementation variables
Since the heap is reconstructed upon state transfer, the old malloc state is discarded. In order to avoid state transfer errors, we can and in fact
Do not instrument malloc implementation variables
Since the heap is reconstructed upon state transfer, the old malloc state is discarded. In order to avoid state transfer errors, we can and in fact must discard the internal state of the malloc implementation. This patch achieves this by using the sectionify pass to mark the variables in the libminc malloc object as state that must be skipped during state transfer.
Change-Id: Ie330f582c8bd45f37a878ea41fa0f9d4a18045e1
show more ...
|
#
3e457fe3 |
| 29-Jun-2015 |
David van Moolenbroek <david@minix3.org> |
Import magic pass from llvm-apps
Change-Id: I19535b913b50f2ff24aeb80ddefc92e305c31fe8
|