Loading changes/ticket12541 0 → 100644 +23 −0 Original line number Diff line number Diff line o Major feature (scheduler, channel): - Introducing the KIST scheduler which stands for Kernel Informed Socket Transport. It is only available on Linux systems. This comes from a researched and published paper you can find here: http://www.robgjansen.com/publications/kist-sec2014.pdf https://arxiv.org/abs/1709.01044 This is also a major refactoring of the entire scheduler subsystem in order for it to be more modular and thus much more easier to add more scheduler type later. The current scheduler has been named "Vanilla" but we favor KIST if available in this version. A new torrc option has been added and named "Schedulers type1,type2,..." which allows a user to select which scheduler type it wants tor to use. It is also possible to change it at runtime. It is an ordered list by priority. KIST might not be available on all platforms so there is a fallback to "KISTLite" that uses the same mechanisms but without the kernel support. The current default values are: Schedulers KIST,KISTLite,Vanilla. Closes ticket 12541. configure.ac +28 −0 Original line number Diff line number Diff line Loading @@ -792,6 +792,34 @@ AC_CHECK_MEMBERS([SSL.state], , , [#include <openssl/ssl.h> ]) dnl Define the set of checks for KIST scheduler support. AC_DEFUN([CHECK_KIST_SUPPORT],[ dnl KIST needs struct tcp_info and for certain members to exist. AC_CHECK_MEMBERS( [struct tcp_info.tcpi_unacked, struct tcp_info.tcpi_snd_mss], , ,[[#include <netinet/tcp.h>]]) dnl KIST needs SIOCOUTQNSD to exist for an ioctl call. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ #include <linux/sockios.h> #ifndef SIOCOUTQNSD #error #endif ])], have_siocoutqnsd=yes, have_siocoutqnsd=no) if test "x$have_siocoutqnsd" = "xyes"; then if test "x$ac_cv_member_struct_tcp_info_tcpi_unacked" = "xyes"; then if test "x$ac_cv_member_struct_tcp_info_tcpi_snd_mss" = "xyes"; then have_kist_support=yes fi fi fi ]) dnl Now, trigger the check. CHECK_KIST_SUPPORT AS_IF([test "x$have_kist_support" = "xyes"], [AC_DEFINE(HAVE_KIST_SUPPORT, 1, [Defined if KIST scheduler is supported on this system])], [AC_MSG_NOTICE([KIST scheduler can't be used. Missing support.])]) LIBS="$save_LIBS" LDFLAGS="$save_LDFLAGS" CPPFLAGS="$save_CPPFLAGS" Loading doc/tor.1.txt +30 −0 Original line number Diff line number Diff line Loading @@ -782,6 +782,36 @@ GENERAL OPTIONS option has been set to 1, it cannot be set back to 0 without restarting Tor. (Default: 0) [[Schedulers]] **Schedulers** **KIST**|**KISTLite**|**Vanilla**:: Specify the scheduler type that tor should use to handle outbound data on channels. This is an ordered list by priority which means that the first value will be tried first and if unavailable, the second one is tried and so on. It is possible to change thse values at runtime. (Default: KIST,KISTLite,Vanilla) + The possible scheduler types are: + KIST: Kernel Informed Socket Transport. Tor will use the kernel tcp information stack per-socket to make an informed decision on if it should send or not the data. (Only available on Linux) + KISTLite: Same as KIST but without kernel support which means that tor will use all the same mecanics as KIST but without the TCP information the kernel can provide. + Vanilla: The scheduler that tor has always used that is do as much as possible or AMAP. [[KISTSchedRunInterval]] **KISTSchedRunInterval** __NUM__ **msec**:: If KIST or KISTLite is used in Schedulers option, this control at which interval the scheduler tick is. If the value is 0 msec, the value is taken from the consensus if possible else it will fallback to the default 10 msec. Maximum possible value is 100 msec. (Default: 0 msec) [[KISTSockBufSizeFactor]] **KISTSockBufSizeFactor** __NUM__:: If KIST is used in Schedulers, this is a multiplier of the per-socket limit calculation of the KIST algorithm. (Default: 1.0) CLIENT OPTIONS -------------- Loading src/common/sandbox.c +33 −1 Original line number Diff line number Diff line Loading @@ -653,6 +653,25 @@ sb_socketpair(scmp_filter_ctx ctx, sandbox_cfg_t *filter) return 0; } #ifdef HAVE_KIST_SUPPORT #include <linux/sockios.h> static int sb_ioctl(scmp_filter_ctx ctx, sandbox_cfg_t *filter) { int rc; (void) filter; rc = seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(ioctl), SCMP_CMP(1, SCMP_CMP_EQ, SIOCOUTQNSD)); if (rc) return rc; return 0; } #endif /* HAVE_KIST_SUPPORT */ /** * Function responsible for setting up the setsockopt syscall for * the seccomp filter sandbox. Loading Loading @@ -760,6 +779,15 @@ sb_getsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter) return rc; #endif #ifdef HAVE_KIST_SUPPORT #include <netinet/tcp.h> rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), SCMP_CMP(1, SCMP_CMP_EQ, SOL_TCP), SCMP_CMP(2, SCMP_CMP_EQ, TCP_INFO)); if (rc) return rc; #endif return 0; } Loading Loading @@ -1060,7 +1088,11 @@ static sandbox_filter_func_t filter_func[] = { sb_socket, sb_setsockopt, sb_getsockopt, sb_socketpair sb_socketpair, #ifdef HAVE_KIST_SUPPORT sb_ioctl, #endif }; const char * Loading src/ext/ht.h +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ #define HT_CLEAR(name, head) name##_HT_CLEAR(head) #define HT_INIT(name, head) name##_HT_INIT(head) #define HT_REP_IS_BAD_(name, head) name##_HT_REP_IS_BAD_(head) #define HT_FOREACH_FN(name, head, fn, data) \ name##_HT_FOREACH_FN((head), (fn), (data)) /* Helper: */ static inline unsigned ht_improve_hash(unsigned h) Loading Loading
changes/ticket12541 0 → 100644 +23 −0 Original line number Diff line number Diff line o Major feature (scheduler, channel): - Introducing the KIST scheduler which stands for Kernel Informed Socket Transport. It is only available on Linux systems. This comes from a researched and published paper you can find here: http://www.robgjansen.com/publications/kist-sec2014.pdf https://arxiv.org/abs/1709.01044 This is also a major refactoring of the entire scheduler subsystem in order for it to be more modular and thus much more easier to add more scheduler type later. The current scheduler has been named "Vanilla" but we favor KIST if available in this version. A new torrc option has been added and named "Schedulers type1,type2,..." which allows a user to select which scheduler type it wants tor to use. It is also possible to change it at runtime. It is an ordered list by priority. KIST might not be available on all platforms so there is a fallback to "KISTLite" that uses the same mechanisms but without the kernel support. The current default values are: Schedulers KIST,KISTLite,Vanilla. Closes ticket 12541.
configure.ac +28 −0 Original line number Diff line number Diff line Loading @@ -792,6 +792,34 @@ AC_CHECK_MEMBERS([SSL.state], , , [#include <openssl/ssl.h> ]) dnl Define the set of checks for KIST scheduler support. AC_DEFUN([CHECK_KIST_SUPPORT],[ dnl KIST needs struct tcp_info and for certain members to exist. AC_CHECK_MEMBERS( [struct tcp_info.tcpi_unacked, struct tcp_info.tcpi_snd_mss], , ,[[#include <netinet/tcp.h>]]) dnl KIST needs SIOCOUTQNSD to exist for an ioctl call. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ #include <linux/sockios.h> #ifndef SIOCOUTQNSD #error #endif ])], have_siocoutqnsd=yes, have_siocoutqnsd=no) if test "x$have_siocoutqnsd" = "xyes"; then if test "x$ac_cv_member_struct_tcp_info_tcpi_unacked" = "xyes"; then if test "x$ac_cv_member_struct_tcp_info_tcpi_snd_mss" = "xyes"; then have_kist_support=yes fi fi fi ]) dnl Now, trigger the check. CHECK_KIST_SUPPORT AS_IF([test "x$have_kist_support" = "xyes"], [AC_DEFINE(HAVE_KIST_SUPPORT, 1, [Defined if KIST scheduler is supported on this system])], [AC_MSG_NOTICE([KIST scheduler can't be used. Missing support.])]) LIBS="$save_LIBS" LDFLAGS="$save_LDFLAGS" CPPFLAGS="$save_CPPFLAGS" Loading
doc/tor.1.txt +30 −0 Original line number Diff line number Diff line Loading @@ -782,6 +782,36 @@ GENERAL OPTIONS option has been set to 1, it cannot be set back to 0 without restarting Tor. (Default: 0) [[Schedulers]] **Schedulers** **KIST**|**KISTLite**|**Vanilla**:: Specify the scheduler type that tor should use to handle outbound data on channels. This is an ordered list by priority which means that the first value will be tried first and if unavailable, the second one is tried and so on. It is possible to change thse values at runtime. (Default: KIST,KISTLite,Vanilla) + The possible scheduler types are: + KIST: Kernel Informed Socket Transport. Tor will use the kernel tcp information stack per-socket to make an informed decision on if it should send or not the data. (Only available on Linux) + KISTLite: Same as KIST but without kernel support which means that tor will use all the same mecanics as KIST but without the TCP information the kernel can provide. + Vanilla: The scheduler that tor has always used that is do as much as possible or AMAP. [[KISTSchedRunInterval]] **KISTSchedRunInterval** __NUM__ **msec**:: If KIST or KISTLite is used in Schedulers option, this control at which interval the scheduler tick is. If the value is 0 msec, the value is taken from the consensus if possible else it will fallback to the default 10 msec. Maximum possible value is 100 msec. (Default: 0 msec) [[KISTSockBufSizeFactor]] **KISTSockBufSizeFactor** __NUM__:: If KIST is used in Schedulers, this is a multiplier of the per-socket limit calculation of the KIST algorithm. (Default: 1.0) CLIENT OPTIONS -------------- Loading
src/common/sandbox.c +33 −1 Original line number Diff line number Diff line Loading @@ -653,6 +653,25 @@ sb_socketpair(scmp_filter_ctx ctx, sandbox_cfg_t *filter) return 0; } #ifdef HAVE_KIST_SUPPORT #include <linux/sockios.h> static int sb_ioctl(scmp_filter_ctx ctx, sandbox_cfg_t *filter) { int rc; (void) filter; rc = seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(ioctl), SCMP_CMP(1, SCMP_CMP_EQ, SIOCOUTQNSD)); if (rc) return rc; return 0; } #endif /* HAVE_KIST_SUPPORT */ /** * Function responsible for setting up the setsockopt syscall for * the seccomp filter sandbox. Loading Loading @@ -760,6 +779,15 @@ sb_getsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter) return rc; #endif #ifdef HAVE_KIST_SUPPORT #include <netinet/tcp.h> rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), SCMP_CMP(1, SCMP_CMP_EQ, SOL_TCP), SCMP_CMP(2, SCMP_CMP_EQ, TCP_INFO)); if (rc) return rc; #endif return 0; } Loading Loading @@ -1060,7 +1088,11 @@ static sandbox_filter_func_t filter_func[] = { sb_socket, sb_setsockopt, sb_getsockopt, sb_socketpair sb_socketpair, #ifdef HAVE_KIST_SUPPORT sb_ioctl, #endif }; const char * Loading
src/ext/ht.h +2 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ #define HT_CLEAR(name, head) name##_HT_CLEAR(head) #define HT_INIT(name, head) name##_HT_INIT(head) #define HT_REP_IS_BAD_(name, head) name##_HT_REP_IS_BAD_(head) #define HT_FOREACH_FN(name, head, fn, data) \ name##_HT_FOREACH_FN((head), (fn), (data)) /* Helper: */ static inline unsigned ht_improve_hash(unsigned h) Loading