Fix build rule for pushing cosmo nightlies

This commit is contained in:
Justine Tunney 2022-08-13 15:06:00 -07:00
parent e62d7b8789
commit b212f49ef4
2 changed files with 161 additions and 149 deletions

View file

@ -1,17 +1,16 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
o/$(MODE)/test/libc/release/cosmopolitan.zip: .UNSANDBOXED = 1
o/$(MODE)/test/libc/release/cosmopolitan.zip: \
o/cosmopolitan.h \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/zip/zip.com
@$(COMPILE) -wAZIP -T$@ \
o/$(MODE)/third_party/zip/zip.com \
-qj $@ \
o/$(MODE)/cosmopolitan.a
mkdir -p $(@D)
zip -qj $@ \
o/cosmopolitan.h \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \

View file

@ -68,6 +68,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "libc/log/rop.h"
#include "libc/intrin/kprintf.h"
#include "libc/sock/sock.h"
#include "libc/intrin/kprintf.h"
#include "third_party/make/dep.h"
#define GOTO_SLOW \
@ -1719,6 +1720,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
{
const int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
struct dep *d;
bool sandboxed;
struct child *c;
char pathbuf[PATH_MAX];
char outpathbuf[PATH_MAX];
@ -1759,8 +1761,22 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
g_strict = Vartoi (lookup_variable (STRING_SIZE_TUPLE(".STRICT")));
intptr_t loc = (intptr_t)child; /* we can cast if it's on the heap ;_; */
if (!(GetStackAddr() < loc && loc < GetStackAddr() + GetStackSize())) {
c = (struct child *)child;
} else {
c = 0;
}
sandboxed = (
!Vartoi (lookup_variable
(STRING_SIZE_TUPLE(".UNSANDBOXED"))) &&
(!c || !Vartoi (lookup_variable_in_set
(STRING_SIZE_TUPLE(".UNSANDBOXED"),
c->file->variables->set))));
/* resolve command into executable path */
if (!g_strict)
if (!g_strict || !sandboxed)
{
if ((s = commandv (argv[0], pathbuf, sizeof (pathbuf))))
argv[0] = s;
@ -1773,13 +1789,10 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
}
/* [jart] sandbox command based on prerequisites */
intptr_t loc = (intptr_t)child; /* we can cast if it's on the heap ;_; */
if (!(GetStackAddr() < loc && loc < GetStackAddr() + GetStackSize())) {
c = (struct child *)child;
if (c)
{
errno = 0;
if (!Vartoi (lookup_variable (STRING_SIZE_TUPLE(".UNSANDBOXED"))) &&
!Vartoi (lookup_variable_in_set (STRING_SIZE_TUPLE(".UNSANDBOXED"),
c->file->variables->set)))
if (sandboxed)
{
if (!g_strict && argv[0][0] == '/' && IsDynamicExecutable (argv[0]))
{