Changes In Branch seccomp Excluding Merge-Ins
This is equivalent to a diff from 7ee2e833d2 to 64fcd6f371
2020-03-31
| ||
18:46 | Added AFL test script check-in: 05a7ef3fae user: rkeene tags: trunk | |
16:50 | More Makefile cleanup and build more precompiled builds Leaf check-in: 64fcd6f371 user: rkeene tags: seccomp | |
16:25 | Updated to not try to build seccomp dependencies unless seccomp is being used check-in: 0a04450d6f user: rkeene tags: seccomp | |
14:33 | Merged in trunk check-in: 2204669e3b user: rkeene tags: seccomp | |
14:30 | Integrated remove-c11-atomics changes check-in: 7ee2e833d2 user: rkeene tags: trunk | |
14:26 | Made socket idle timeout checks more frequent Closed-Leaf check-in: fe6d401e68 user: rkeene tags: remove-c11-atomics | |
2018-05-03
| ||
20:08 | Added support for not redirecting to index.html check-in: 879cdc86ce user: rkeene tags: trunk | |
Modified .fossil-settings/ignore-glob from [3d8734b3a3] to [dec4870937].
1 2 3 4 | 1 2 3 4 5 6 7 | + + + | filed filed.o filed-mime-types.h.new filed-mime-types.h filed.seccomp.h.new filed.seccomp.h compiled |
Modified Makefile from [8ce95f72a7] to [104b67b0fa].
|
Modified README from [dc3dfdd9b3] to [486e620538].
︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | + + + + + | argument to the "-r" or "--root" option prepended to them. 5. Differing "index.html" handling (CFLAGS, -DFILED_DONT_REDIRECT_DIRECTORIES=1) Normally "filed" redirects users who request a directory to the index.html file in that directory so that no memory allocations are required; This option lets the server generate the new path. 6. Enable seccomp (make FILED_DO_SECCOMP=1) Linux supports limiting the system calls that a process can make. This is called seccomp (SECure COMPuting). Currently not all platforms have been tested with this so it is disabled by default. 6. MIME Types (MIMETYPES) For single-file convenience "filed" compiles the mapping of file extensions (the string in the filename following its last dot (".")) into the executable. This mapping comes from a file in the format of type1 type1_extension1 type1_extension2... type2 type2_extension1 type2_extension2... ... |
︙ |
Modified build/build-precompiled from [46b4f35d88] to [e99d758cfd].
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + - + - - - - - - - + + - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + | # Compile everything, all at once idx=-1 for tryCompilerDir in "$(readlink -f ~/root/cross-compilers)" "$(readlink -f ~/devel/build-cc/TMP)"; do setup_cc="${tryCompilerDir}/setup-cc" platforms=( |
Modified filed.c from [7252b16239] to [94d290b0bc].
︙ | |||
602 603 604 605 606 607 608 | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | - + | pthread_create(&thread_id, NULL, filed_logging_thread, args); filed_log_msg("START"); return(0); } |
︙ | |||
723 724 725 726 727 728 729 730 731 732 733 734 735 736 | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | + + | pthread_t thread_id; long idx; int count; int valid; int time_interval = 30; int check_period = 90; filed_sockettimeout_time = time(NULL); while (1) { for (count = 0; count < (check_period / time_interval); count++) { sleep_time.tv_sec = time_interval; sleep_time.tv_nsec = 0; nanosleep(&sleep_time, NULL); pthread_mutex_lock(&filed_sockettimeout_mutex); |
︙ | |||
751 752 753 754 755 756 757 | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | - + | continue; } expiration_time = filed_sockettimeout_sockstatus[idx].expiration_time; thread_id = filed_sockettimeout_sockstatus[idx].thread_id; |
︙ | |||
804 805 806 807 808 809 810 | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | filed_sockettimeout_devnull_fd = open("/dev/null", O_RDWR); if (filed_sockettimeout_devnull_fd < 0) { return(-1); } return(0); } #endif /* FILED_DONT_TIMEOUT */ #ifndef FILED_DO_SECCOMP #define filed_init_seccomp() 0 #else #include <linux/seccomp.h> #include <linux/filter.h> #include <linux/audit.h> #include <sys/ptrace.h> #include <sys/prctl.h> #include <stddef.h> static int filed_init_seccomp(void) { struct sock_fprog filter; struct sock_filter rules[] = { #include "filed.seccomp.h" }; int prctl_ret; /* Do not allow any privilege changes beyond this point */ prctl_ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); if (prctl_ret != 0) { return(-1); } filter.len = sizeof(rules) / sizeof(*rules); filter.filter = rules; prctl_ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &filter); if (prctl_ret != 0) { return(-1); } return(0); } |
︙ | |||
1671 1672 1673 1674 1675 1676 1677 | 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 | - + | } return; } /* Add a getopt option */ static void filed_getopt_long_setopt(struct option *opt, const char *name, int has_arg, int val) { |
︙ | |||
1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 | + + + | int port = PORT, thread_count = THREAD_COUNT; int cache_size = CACHE_SIZE; int init_ret, chroot_ret, setuid_ret, lookup_ret, chdir_ret; int setuid_enabled = 0, daemon_enabled = 0; int ch; int fd; /* Set default value */ thread_options.fake_newroot = NULL; /* Process arguments */ filed_getopt_long_setopt(&options[0], "port", required_argument, 'p'); filed_getopt_long_setopt(&options[1], "threads", required_argument, 't'); filed_getopt_long_setopt(&options[2], "cache", required_argument, 'c'); filed_getopt_long_setopt(&options[3], "bind", required_argument, 'b'); filed_getopt_long_setopt(&options[4], "user", required_argument, 'u'); filed_getopt_long_setopt(&options[5], "root", required_argument, 'r'); |
︙ | |||
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | + + + + + + + + | /* Create socket termination thread */ init_ret = filed_sockettimeout_thread_init(); if (init_ret != 0) { perror("filed_sockettimeout_thread_init"); return(7); } /* Initialize seccomp */ init_ret = filed_init_seccomp(); if (init_ret != 0) { perror("filed_init_seccomp"); return(9); } /* Create worker threads */ init_ret = filed_worker_threads_init(fd, thread_count, &thread_options); if (init_ret != 0) { perror("filed_worker_threads_init"); return(5); |
︙ |
Added filed.seccomp version [4d1d628e0b].
|
Added generate-seccomp-filter version [d01690fff9].