vendor bump
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> containerd: linux -> runtime/linux Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> fix utils to properly format vendor repo Signed-off-by: Evan Hazlett <ejhazlett@gmail.com> test fixup Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
4
vendor/github.com/docker/docker/contrib/README.md
generated
vendored
Normal file
4
vendor/github.com/docker/docker/contrib/README.md
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
The `contrib` directory contains scripts, images, and other helpful things
|
||||
which are not part of the core docker distribution. Please note that they
|
||||
could be out of date, since they do not receive the same attention as the
|
||||
rest of the repository.
|
10
vendor/github.com/docker/docker/contrib/nnp-test/nnp-test.c
generated
vendored
Normal file
10
vendor/github.com/docker/docker/contrib/nnp-test/nnp-test.c
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("EUID=%d\n", geteuid());
|
||||
return 0;
|
||||
}
|
||||
|
16
vendor/github.com/docker/docker/contrib/syscall-test/acct.c
generated
vendored
Normal file
16
vendor/github.com/docker/docker/contrib/syscall-test/acct.c
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err = acct("/tmp/t");
|
||||
if (err == -1) {
|
||||
fprintf(stderr, "acct failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
7
vendor/github.com/docker/docker/contrib/syscall-test/exit32.s
generated
vendored
Normal file
7
vendor/github.com/docker/docker/contrib/syscall-test/exit32.s
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.globl _start
|
||||
.text
|
||||
_start:
|
||||
xorl %eax, %eax
|
||||
incl %eax
|
||||
movb $0, %bl
|
||||
int $0x80
|
63
vendor/github.com/docker/docker/contrib/syscall-test/ns.c
generated
vendored
Normal file
63
vendor/github.com/docker/docker/contrib/syscall-test/ns.c
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define STACK_SIZE (1024 * 1024) /* Stack size for cloned child */
|
||||
|
||||
struct clone_args {
|
||||
char **argv;
|
||||
};
|
||||
|
||||
// child_exec is the func that will be executed as the result of clone
|
||||
static int child_exec(void *stuff)
|
||||
{
|
||||
struct clone_args *args = (struct clone_args *)stuff;
|
||||
if (execvp(args->argv[0], args->argv) != 0) {
|
||||
fprintf(stderr, "failed to execvp arguments %s\n",
|
||||
strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
// we should never reach here!
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct clone_args args;
|
||||
args.argv = &argv[1];
|
||||
|
||||
int clone_flags = CLONE_NEWNS | CLONE_NEWPID | SIGCHLD;
|
||||
|
||||
// allocate stack for child
|
||||
char *stack; /* Start of stack buffer */
|
||||
char *child_stack; /* End of stack buffer */
|
||||
stack =
|
||||
mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANON | MAP_STACK, -1, 0);
|
||||
if (stack == MAP_FAILED) {
|
||||
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
||||
|
||||
// the result of this call is that our child_exec will be run in another
|
||||
// process returning its pid
|
||||
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
||||
if (pid < 0) {
|
||||
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// lets wait on our child process here before we, the parent, exits
|
||||
if (waitpid(pid, NULL, 0) == -1) {
|
||||
fprintf(stderr, "failed to wait pid %d\n", pid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
14
vendor/github.com/docker/docker/contrib/syscall-test/raw.c
generated
vendored
Normal file
14
vendor/github.com/docker/docker/contrib/syscall-test/raw.c
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/udp.h>
|
||||
|
||||
int main() {
|
||||
if (socket(PF_INET, SOCK_RAW, IPPROTO_UDP) == -1) {
|
||||
perror("socket");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
11
vendor/github.com/docker/docker/contrib/syscall-test/setgid.c
generated
vendored
Normal file
11
vendor/github.com/docker/docker/contrib/syscall-test/setgid.c
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
if (setgid(1) == -1) {
|
||||
perror("setgid");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
11
vendor/github.com/docker/docker/contrib/syscall-test/setuid.c
generated
vendored
Normal file
11
vendor/github.com/docker/docker/contrib/syscall-test/setuid.c
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
if (setuid(1) == -1) {
|
||||
perror("setuid");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
30
vendor/github.com/docker/docker/contrib/syscall-test/socket.c
generated
vendored
Normal file
30
vendor/github.com/docker/docker/contrib/syscall-test/socket.c
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
int main() {
|
||||
int s;
|
||||
struct sockaddr_in sin;
|
||||
|
||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s == -1) {
|
||||
perror("socket");
|
||||
return 1;
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = INADDR_ANY;
|
||||
sin.sin_port = htons(80);
|
||||
|
||||
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
|
||||
perror("bind");
|
||||
return 1;
|
||||
}
|
||||
|
||||
close(s);
|
||||
|
||||
return 0;
|
||||
}
|
63
vendor/github.com/docker/docker/contrib/syscall-test/userns.c
generated
vendored
Normal file
63
vendor/github.com/docker/docker/contrib/syscall-test/userns.c
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define STACK_SIZE (1024 * 1024) /* Stack size for cloned child */
|
||||
|
||||
struct clone_args {
|
||||
char **argv;
|
||||
};
|
||||
|
||||
// child_exec is the func that will be executed as the result of clone
|
||||
static int child_exec(void *stuff)
|
||||
{
|
||||
struct clone_args *args = (struct clone_args *)stuff;
|
||||
if (execvp(args->argv[0], args->argv) != 0) {
|
||||
fprintf(stderr, "failed to execvp arguments %s\n",
|
||||
strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
// we should never reach here!
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct clone_args args;
|
||||
args.argv = &argv[1];
|
||||
|
||||
int clone_flags = CLONE_NEWUSER | SIGCHLD;
|
||||
|
||||
// allocate stack for child
|
||||
char *stack; /* Start of stack buffer */
|
||||
char *child_stack; /* End of stack buffer */
|
||||
stack =
|
||||
mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANON | MAP_STACK, -1, 0);
|
||||
if (stack == MAP_FAILED) {
|
||||
fprintf(stderr, "mmap failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
child_stack = stack + STACK_SIZE; /* Assume stack grows downward */
|
||||
|
||||
// the result of this call is that our child_exec will be run in another
|
||||
// process returning its pid
|
||||
pid_t pid = clone(child_exec, child_stack, clone_flags, &args);
|
||||
if (pid < 0) {
|
||||
fprintf(stderr, "clone failed: %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
// lets wait on our child process here before we, the parent, exits
|
||||
if (waitpid(pid, NULL, 0) == -1) {
|
||||
fprintf(stderr, "failed to wait pid %d\n", pid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
Reference in New Issue
Block a user