this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Yet another attempt at fixing PAGEZERO loading and Debian packages

+22 -5
+5
debian/darling.postinst
··· 1 1 #!/bin/sh 2 2 set -e 3 3 4 + echo ">>> Correcting permissions" 5 + setcap cap_sys_rawio,cap_sys_resource+ep /usr/bin/darlingserver 6 + setcap cap_sys_rawio,cap_sys_resource+ep /usr/libexec/darling/usr/libexec/darling/mldr 7 + setcap cap_sys_rawio,cap_sys_resource+ep /usr/libexec/darling/usr/libexec/darling/mldr32 8 + 4 9 echo ">>> Shutting down old instances of Darling" 5 10 bash /usr/lib/darling/shutdown-user.sh
+17 -5
src/startup/mldr/loader.c
··· 174 174 rv = mmap((void*)addr, seg->vmsize, useprot, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED_NOREPLACE, -1, 0); 175 175 if (rv == (void*)MAP_FAILED) 176 176 { 177 - if (addr == 0 && useprot == 0) { 177 + if (seg->vmaddr == 0 && useprot == 0) { 178 178 // this is the PAGEZERO segment; 179 179 // if we can't map it, assume everything is fine and the system has already made that area inaccessible 180 180 rv = 0; ··· 191 191 MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED_NOREPLACE, -1, 0); 192 192 if (rv == (void*)MAP_FAILED) 193 193 { 194 - fprintf(stderr, "Cannot mmap segment %s at %p: %s\n", seg->segname, (void*)(uintptr_t)seg->vmaddr, strerror(errno)); 195 - exit(1); 194 + if (seg->vmaddr == 0 && useprot == 0) { 195 + // this is the PAGEZERO segment; 196 + // if we can't map it, assume everything is fine and the system has already made that area inaccessible 197 + rv = 0; 198 + } else { 199 + fprintf(stderr, "Cannot mmap segment %s at %p: %s\n", seg->segname, (void*)(uintptr_t)seg->vmaddr, strerror(errno)); 200 + exit(1); 201 + } 196 202 } 197 203 } 198 204 } ··· 208 214 flag | MAP_PRIVATE, fd, seg->fileoff + fat_offset); 209 215 if (rv == (void*)MAP_FAILED) 210 216 { 211 - fprintf(stderr, "Cannot mmap segment %s at %p: %s\n", seg->segname, (void*)(uintptr_t)seg->vmaddr, strerror(errno)); 212 - exit(1); 217 + if (seg->vmaddr == 0 && useprot == 0) { 218 + // this is the PAGEZERO segment; 219 + // if we can't map it, assume everything is fine and the system has already made that area inaccessible 220 + rv = 0; 221 + } else { 222 + fprintf(stderr, "Cannot mmap segment %s at %p: %s\n", seg->segname, (void*)(uintptr_t)seg->vmaddr, strerror(errno)); 223 + exit(1); 224 + } 213 225 } 214 226 215 227 if (seg->fileoff == 0)