<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Raymond Toy pushed to branch rtoy-mmap-anon-control-and-binding-stacks at <a href="https://gitlab.common-lisp.net/cmucl/cmucl">cmucl / cmucl</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/1869d0938e6e09c1a02f0f6f0a8764ee43e2c56e">1869d093</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-10-03T07:55:34Z</i>
</div>
<pre class='commit-message'>Updates to handle random stack locations better.
* Print out some better messages from os_protect
* Add make_hole to actually make a hole
* make_holes only does the read-only and static spaces.
* make_stack_holes handles the binding and control stacks.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/4b838e3f56bbfb80f9d7eee847644cffdf69a7e4">4b838e3f</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-10-03T07:56:07Z</i>
</div>
<pre class='commit-message'>Make holes in the stacks, as before.</pre>
</li>
</ul>
<h4>2 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/lisp/solaris-os.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/lisp/validate.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/586ca74df2c5289c9154e688e092e1b4a3f7d4cf...4b838e3f56bbfb80f9d7eee847644cffdf69a7e4#diff-0'>
<strong>
src/lisp/solaris-os.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/solaris-os.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/solaris-os.c
</span><span style="color: #aaaaaa">@@ -169,8 +169,14 @@ os_flush_icache(os_vm_address_t address, os_vm_size_t length)
</span> void
os_protect(os_vm_address_t address, os_vm_size_t length, os_vm_prot_t prot)
{
<span style="color: #000000;background-color: #ffdddd">- if (mprotect((void *) address, length, prot) == -1)
- perror("mprotect");
</span><span style="color: #000000;background-color: #ddffdd">+ if (mprotect((void *) address, length, prot) == -1) {
+ char msg[1000];
+
+ snprintf(msg, sizeof(msg), "mprotect: os_protect(0x%p, %u, 0x%x): ",
+ address, length, prot);
+
+ perror(msg);
+ }
</span> }
static boolean
<span style="color: #aaaaaa">@@ -430,27 +436,37 @@ static unsigned long *space_size[] = {
</span> #define HOLE_SIZE 0x2000
void
<span style="color: #000000;background-color: #ffdddd">-make_holes(void)
</span><span style="color: #000000;background-color: #ddffdd">+make_hole(int index)
</span> {
<span style="color: #000000;background-color: #ffdddd">- int k;
</span> os_vm_address_t hole;
/* Make holes of the appropriate size for desired spaces */
<span style="color: #000000;background-color: #ffdddd">- for (k = 0; k < sizeof(spaces) / sizeof(spaces[0]); ++k) {
-
- hole = spaces[k] + *space_size[k];
</span><span style="color: #000000;background-color: #ddffdd">+ hole = spaces[k] + *space_size[k];
</span>
<span style="color: #000000;background-color: #ffdddd">- if (os_validate(hole, HOLE_SIZE) == NULL) {
- fprintf(stderr,
- "ensure_space: Failed to validate hole of %d bytes at 0x%08lX\n",
- HOLE_SIZE, (unsigned long) hole);
- exit(1);
- }
- /* Make it inaccessible */
- os_protect(hole, HOLE_SIZE, 0);
</span><span style="color: #000000;background-color: #ddffdd">+ if (os_validate(hole, HOLE_SIZE) == NULL) {
+ fprintf(stderr,
+ "ensure_space: Failed to validate hole of %d bytes at 0x%08lX\n",
+ HOLE_SIZE, (unsigned long) hole);
+ exit(1);
</span> }
<span style="color: #000000;background-color: #ddffdd">+ /* Make it inaccessible */
+ os_protect(hole, HOLE_SIZE, 0);
+}
+
+void
+make_holes(void)
+{
+ os_vm_address_t hole;
+
+ /*
+ * Make holes of the appropriate size for desired spaces. The
+ * stacks are handled in make_stack_holes.
+ */
</span>
<span style="color: #000000;background-color: #ddffdd">+ make_hole(0); /* Read-only space */
+ make_hole(1); /* Static space */
+
</span> /* Round up the dynamic_space_size to the nearest SPARSE_BLOCK_SIZE */
dynamic_space_size = round_up_sparse_size(dynamic_space_size);
<span style="color: #aaaaaa">@@ -477,6 +493,13 @@ make_holes(void)
</span> #endif
}
<span style="color: #000000;background-color: #ddffdd">+void
+make_stack_holes(void)
+{
+ make_hole(2);
+ make_hole(3);
+}
+
</span> void *
os_dlsym(const char *sym_name, lispobj lib_list)
{
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/586ca74df2c5289c9154e688e092e1b4a3f7d4cf...4b838e3f56bbfb80f9d7eee847644cffdf69a7e4#diff-1'>
<strong>
src/lisp/validate.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/validate.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/validate.c
</span><span style="color: #aaaaaa">@@ -18,6 +18,7 @@
</span>
#ifdef sparc
extern void make_holes(void);
<span style="color: #000000;background-color: #ddffdd">+extern void make_stack_holes(void);
</span> #endif
static void
<span style="color: #aaaaaa">@@ -124,6 +125,10 @@ validate_stacks()
</span> /* Binding Stack */
binding_stack = os_validate(NULL, binding_stack_size);
<span style="color: #000000;background-color: #ddffdd">+#ifdef sparc
+ make_stack_holes();
+#endif
+
</span> #ifdef RED_ZONE_HIT
os_guard_control_stack(0, 1);
#endif
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/compare/586ca74df2c5289c9154e688e092e1b4a3f7d4cf...4b838e3f56bbfb80f9d7eee847644cffdf69a7e4">View it on GitLab</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":["merge_requests","issues","commit"],"url":"https://gitlab.common-lisp.net/cmucl/cmucl/compare/586ca74df2c5289c9154e688e092e1b4a3f7d4cf...4b838e3f56bbfb80f9d7eee847644cffdf69a7e4"}}</script>
</p>
</div>
</body>
</html>