Lines Matching +full:addr +full:- +full:mode
2 // available in capability mode. The goal is not to see if they work, just
27 #include "capsicum-test.h"
61 unsigned int mode = -1;
62 EXPECT_OK(cap_getmode(&mode));
63 EXPECT_EQ(0, (int)mode);
64 EXPECT_OK(cap_enter()); // Enter capability mode.
65 EXPECT_OK(cap_getmode(&mode));
66 EXPECT_EQ(1, (int)mode);
68 // System calls that are not permitted in capability mode.
76 EXPECT_CAPMODE(chown(TmpFile("cap_capmode_chown"), -1, -1));
102 EXPECT_OK(cap_enter()); // Enter capability mode.
104 // System calls that are not permitted in capability mode.
105 struct sockaddr_in addr;
106 addr.sin_family = AF_INET;
107 addr.sin_port = 0;
108 addr.sin_addr.s_addr = htonl(INADDR_ANY);
109 EXPECT_CAPMODE(bind_(fd_socket_, (sockaddr*)&addr, sizeof(addr)));
110 addr.sin_family = AF_INET;
111 addr.sin_port = 53;
112 addr.sin_addr.s_addr = htonl(0x08080808);
113 EXPECT_CAPMODE(connect_(fd_tcp_socket_, (sockaddr*)&addr, sizeof(addr)));
118 EXPECT_OK(cap_enter()); // Enter capability mode.
121 fd_close_ = -1;
156 // TODO(drysdale): reinstate these tests for 32-bit runs when possible
178 EXPECT_OK(cap_enter()); // Enter capability mode.
180 // recvfrom() either returns -1 with EAGAIN, or 0.
189 // but they are allowed in capability mode, so errno != ECAPMODE.
204 int fd_pair[2] = {-1, -1};
213 EXPECT_OK(cap_enter()); // Enter capability mode.
215 // Creation of raw sockets is not permitted in capability mode.
229 // mode.
252 struct sockaddr_in addr;
253 addr.sin_family = AF_INET;
254 addr.sin_port = htons(0);
255 addr.sin_addr.s_addr = htonl(INADDR_ANY);
256 EXPECT_OK(bind(fd_socket, (sockaddr*)&addr, sizeof(addr)));
258 EXPECT_OK(cap_enter()); // Enter capability mode.
285 EXPECT_OK(cap_enter()); // Enter capability mode.
325 EXPECT_OK(cap_enter()); // Enter capability mode.
343 EXPECT_OK(cap_enter()); // Enter capability mode.
360 EXPECT_OK(cap_enter()); // Enter capability mode.
367 EXPECT_OK(cap_enter()); // Enter capability mode.
382 void *mem = mmap(NULL, mem_size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
384 EXPECT_OK(cap_enter()); // Enter capability mode.
397 // mlockall may well fail with ENOMEM for non-root users, as the
408 EXPECT_OK(cap_enter()); // Enter capability mode
449 // Child: enter cap mode and run tests
450 EXPECT_OK(cap_enter()); // Enter capability mode
473 // Check that invalid requests get a non-Capsicum errno.
475 rc = readlinkat(-1, "symlink", buffer, sizeof(buffer));
485 rc = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
510 // Child: move into temp dir, enter cap mode and run tests
512 EXPECT_OK(cap_enter()); // Enter capability mode
542 rc = WIFEXITED(status) ? WEXITSTATUS(status) : -1;
555 // Check that abort(3) works even in capability mode.
558 // Child: enter capability mode and call abort(3).
560 cap_enter(); // Enter capability mode.
575 EXPECT_OK(cap_enter()); // Enter capability mode.
578 EXPECT_NE(-ECAPMODE, (int)um);
609 // sysarch() is, by definition, architecture-dependent
633 // Fire off a new thread before entering capability mode
646 // Fire off a new process before entering capability mode.
647 if (verbose) fprintf(stderr, " starting second child (non-capability mode)\n");
653 // Child: wait and then confirm this process is unaffected by capability mode in the parent.
665 EXPECT_OK(cap_enter()); // Enter capability mode.
667 // child thread that were created before entering capability mode.
668 // - The child process is unaffected by capability mode.
669 // - The child thread is affected by capability mode.
679 << "Cannot continue test with pre-existing failures.";
680 // Now that we're in capability mode, if we create a second child process
681 // it will be affected by capability mode.
682 if (verbose) fprintf(stderr, " starting second child (in capability mode)\n");
698 // be affected by capability mode since it's per-process not per-thread.
701 // of the gtest-internal mutexes, so the child process deadlocks.
703 // Wait for the early-started thread.
710 // Fire off a new (second) child thread, which is also affected by capability mode.
712 << "Cannot continue test with pre-existing failures.";
722 << "Cannot continue test with pre-existing failures.";
723 if (verbose) fprintf(stderr, " starting third child (in capability mode)\n");
763 EXPECT_OK(cap_enter()); // Enter capability mode.