From f17ef04fd95dd38c51dab346e929d4c9b11bbdfa Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Wed, 5 Aug 2026 12:51:31 -0400 Subject: [PATCH] import UBI ruby-4.0.6-34.module+el9.8.0+24564+e55418dc --- .gitignore | 2 +- .ruby.metadata | 2 +- ...0-Enable-configuration-of-archlibdir.patch | 2 +- ...ed-paths-when-empty-version-string-i.patch | 2 +- SOURCES/ruby-2.1.0-always-use-i386.patch | 2 +- .../ruby-2.1.0-custom-rubygems-location.patch | 4 +- SOURCES/ruby-2.3.0-ruby_version.patch | 10 +- SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch | 4 +- ...mizable-rustc_flags-for-rustc-builds.patch | 6 +- ...-quadratic-complexity-CVE-2026-42245.patch | 343 ------------------ ...ripping-vulnerability-CVE-2026-42246.patch | 125 ------- ...lag-symbol-validation-CVE-2026-42258.patch | 98 ----- SPECS/ruby.spec | 56 +-- 13 files changed, 30 insertions(+), 626 deletions(-) delete mode 100644 SOURCES/rubygem-net-imap-0.6.2-ResponseReader-quadratic-complexity-CVE-2026-42245.patch delete mode 100644 SOURCES/rubygem-net-imap-0.6.2-STARTTLS-stripping-vulnerability-CVE-2026-42246.patch delete mode 100644 SOURCES/rubygem-net-imap-0.6.2-flag-symbol-validation-CVE-2026-42258.patch diff --git a/.gitignore b/.gitignore index c6a1ef0..9b20e0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/ruby-4.0.3.tar.xz +SOURCES/ruby-4.0.6.tar.xz diff --git a/.ruby.metadata b/.ruby.metadata index 3dc1e0a..917742e 100644 --- a/.ruby.metadata +++ b/.ruby.metadata @@ -1 +1 @@ -faf1f3df171d2160116d190ca32b6b00e0338bfa SOURCES/ruby-4.0.3.tar.xz +1b55f5159fec2bfa08147fc91d23643ab176c009 SOURCES/ruby-4.0.6.tar.xz diff --git a/SOURCES/ruby-2.1.0-Enable-configuration-of-archlibdir.patch b/SOURCES/ruby-2.1.0-Enable-configuration-of-archlibdir.patch index 8551d79..a54faff 100644 --- a/SOURCES/ruby-2.1.0-Enable-configuration-of-archlibdir.patch +++ b/SOURCES/ruby-2.1.0-Enable-configuration-of-archlibdir.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index a64358fada..b3bdfad1eb 100644 --- a/configure.ac +++ b/configure.ac -@@ -3556,6 +3556,11 @@ AS_IF([test ${multiarch+set}], [ +@@ -3553,6 +3553,11 @@ AS_IF([test ${multiarch+set}], [ ]) archlibdir='${libdir}/${arch}' diff --git a/SOURCES/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch b/SOURCES/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch index 045d6ae..b5d506c 100644 --- a/SOURCES/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch +++ b/SOURCES/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch @@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac index 2bc5153141..a64358fada 100644 --- a/configure.ac +++ b/configure.ac -@@ -4472,7 +4472,8 @@ AS_CASE(["$ruby_version_dir_name"], +@@ -4469,7 +4469,8 @@ AS_CASE(["$ruby_version_dir_name"], ruby_version_dir=/'${ruby_version_dir_name}' if test -z "${ruby_version_dir_name}"; then diff --git a/SOURCES/ruby-2.1.0-always-use-i386.patch b/SOURCES/ruby-2.1.0-always-use-i386.patch index 6ecfb2e..190108e 100644 --- a/SOURCES/ruby-2.1.0-always-use-i386.patch +++ b/SOURCES/ruby-2.1.0-always-use-i386.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index b3bdfad1eb..411322a27f 100644 --- a/configure.ac +++ b/configure.ac -@@ -4536,6 +4536,8 @@ AC_SUBST(vendorarchdir)dnl +@@ -4533,6 +4533,8 @@ AC_SUBST(vendorarchdir)dnl AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl diff --git a/SOURCES/ruby-2.1.0-custom-rubygems-location.patch b/SOURCES/ruby-2.1.0-custom-rubygems-location.patch index 969fefa..aae55fc 100644 --- a/SOURCES/ruby-2.1.0-custom-rubygems-location.patch +++ b/SOURCES/ruby-2.1.0-custom-rubygems-location.patch @@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac index 411322a27f..b5f842a512 100644 --- a/configure.ac +++ b/configure.ac -@@ -4508,6 +4508,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -4505,6 +4505,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) @@ -26,7 +26,7 @@ index 411322a27f..b5f842a512 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -4532,6 +4536,7 @@ AC_SUBST(sitearchdir)dnl +@@ -4529,6 +4533,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl diff --git a/SOURCES/ruby-2.3.0-ruby_version.patch b/SOURCES/ruby-2.3.0-ruby_version.patch index 2eb5d00..e3e49ea 100644 --- a/SOURCES/ruby-2.3.0-ruby_version.patch +++ b/SOURCES/ruby-2.3.0-ruby_version.patch @@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac index 2bbce78fd0..9d8662369c 100644 --- a/configure.ac +++ b/configure.ac -@@ -4422,9 +4422,6 @@ AS_CASE(["$target_os"], +@@ -4419,9 +4419,6 @@ AS_CASE(["$target_os"], rubyw_install_name='$(RUBYW_INSTALL_NAME)' ]) @@ -30,7 +30,7 @@ index 2bbce78fd0..9d8662369c 100644 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix, AS_HELP_STRING([--with-rubyarchprefix=DIR], -@@ -4447,57 +4444,63 @@ AC_ARG_WITH(ridir, +@@ -4444,57 +4441,63 @@ AC_ARG_WITH(ridir, AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME) @@ -122,7 +122,7 @@ index 2bbce78fd0..9d8662369c 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) -@@ -4514,6 +4517,7 @@ AC_SUBST(sitearchincludedir)dnl +@@ -4511,6 +4514,7 @@ AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl @@ -212,7 +212,7 @@ diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 74c8953904..1f3bd91d51 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb -@@ -1339,7 +1339,8 @@ def test_self_use_paths +@@ -1365,7 +1365,8 @@ def test_self_use_paths def test_self_user_dir parts = [@userhome, ".gem", Gem.ruby_engine] @@ -222,7 +222,7 @@ index 74c8953904..1f3bd91d51 100644 FileUtils.mkdir_p File.join(parts) -@@ -1415,7 +1416,7 @@ def test_self_vendor_dir +@@ -1441,7 +1442,7 @@ def test_self_vendor_dir vendordir(File.join(@tempdir, "vendor")) do expected = File.join RbConfig::CONFIG["vendordir"], "gems", diff --git a/SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch b/SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch index 86d97fc..d328ebc 100644 --- a/SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch +++ b/SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch @@ -56,8 +56,8 @@ diff --git a/ruby.c b/ruby.c index b00fc1502d..32b88f7496 100644 --- a/ruby.c +++ b/ruby.c -@@ -1773,10 +1773,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) - +@@ -1793,10 +1793,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt) + VALUE rb_define_gem_modules(VALUE, VALUE); void Init_builtin_features(void); +/* abrt.c */ diff --git a/SOURCES/ruby-4.0.1-Support-customizable-rustc_flags-for-rustc-builds.patch b/SOURCES/ruby-4.0.1-Support-customizable-rustc_flags-for-rustc-builds.patch index 8238b58..3d16ff2 100644 --- a/SOURCES/ruby-4.0.1-Support-customizable-rustc_flags-for-rustc-builds.patch +++ b/SOURCES/ruby-4.0.1-Support-customizable-rustc_flags-for-rustc-builds.patch @@ -55,7 +55,7 @@ index 2bbce78fd0..a3aa6dc383 100644 [begin]_group "environment section" && { HAVE_BASERUBY=yes -@@ -4054,6 +4055,11 @@ AS_CASE(["${ZJIT_SUPPORT}"], +@@ -4051,6 +4054,11 @@ AS_CASE(["${ZJIT_SUPPORT}"], AC_DEFINE(USE_ZJIT, 0) ]) @@ -67,7 +67,7 @@ index 2bbce78fd0..a3aa6dc383 100644 JIT_RUST_FLAGS='--crate-type=staticlib --cfg feature=\"stats_allocator\"' RLIB_DIR= AS_CASE(["$JIT_CARGO_SUPPORT:$YJIT_SUPPORT:$ZJIT_SUPPORT"], -@@ -4111,6 +4117,7 @@ AS_IF([test -n "$RUST_LIB"], [ +@@ -4108,6 +4114,7 @@ AS_IF([test -n "$RUST_LIB"], [ dnl These variables end up in ::RbConfig::CONFIG AC_SUBST(RUSTC)dnl Rust compiler command AC_SUBST(JIT_RUST_FLAGS)dnl the common rustc flags for JIT crates such as zjit @@ -75,7 +75,7 @@ index 2bbce78fd0..a3aa6dc383 100644 AC_SUBST(CARGO)dnl Cargo command for Rust builds AC_SUBST(CARGO_BUILD_ARGS)dnl for selecting Rust build profiles AC_SUBST(YJIT_SUPPORT)dnl what flavor of YJIT the Ruby build includes -@@ -4855,6 +4862,7 @@ config_summary "strip command" "$STRIP" +@@ -4852,6 +4859,7 @@ config_summary "strip command" "$STRIP" config_summary "install doc" "$DOCTARGETS" config_summary "YJIT support" "$YJIT_SUPPORT" config_summary "ZJIT support" "$ZJIT_SUPPORT" diff --git a/SOURCES/rubygem-net-imap-0.6.2-ResponseReader-quadratic-complexity-CVE-2026-42245.patch b/SOURCES/rubygem-net-imap-0.6.2-ResponseReader-quadratic-complexity-CVE-2026-42245.patch deleted file mode 100644 index 71a9ce2..0000000 --- a/SOURCES/rubygem-net-imap-0.6.2-ResponseReader-quadratic-complexity-CVE-2026-42245.patch +++ /dev/null @@ -1,343 +0,0 @@ -From 341ab628167da41f33db69e5c240918aa65b60cd Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Tue, 31 Mar 2026 19:28:20 -0400 -Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8D=92=20pick=20341ab6281:=20?= - =?UTF-8?q?=E2=9A=A1=EF=B8=8F=F0=9F=94=92=EF=B8=8F=20Fix=20non-linear=20pe?= - =?UTF-8?q?rformance=20in=20ResponseReader?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A very large response with many small repeated literals can trigger -super-linear time. This happens because the regular expression that -checks for literal continuation matches from the beginning of the buffer -every time. - -This could be mitigated by searching from an offset, based on what has -already been processed, or only searching the most recent line (before -merging it with the buffer), but that is still `O(n)` on line length. - -The regexp is anchored to the end of the string, so searching in reverse -from the end of the string should be `O(1)`. This is accomplished by -converting `=~` to `rindex`. - -Note that this _does_ slow down the "no literals" scenario. - -``` -$ benchmark-driver benchmarks/response_reader.yml --filter KiB -Warming up -------------------------------------- - 1KiB with no literals 143.564k i/s - 153.197k times in 1.067099s (6.97μs/i) - 10KiB with no literals 27.394k i/s - 28.864k times in 1.053670s (36.50μs/i) -100KiB with no literals 2.926k i/s - 3.157k times in 1.079109s (341.81μs/i) - 1KiB of 25B literals 2.786k i/s - 2.970k times in 1.066159s (358.98μs/i) - 10KiB of 25B literals 263.498 i/s - 286.000 times in 1.085396s (3.80ms/i) -100KiB of 25B literals 19.470 i/s - 20.000 times in 1.027203s (51.36ms/i) - 1KiB of 0B literals 530.014 i/s - 530.000 times in 0.999974s (1.89ms/i) - 10KiB of 0B literals 45.239 i/s - 50.000 times in 1.105233s (22.10ms/i) -100KiB of 0B literals 3.075 i/s - 4.000 times in 1.300721s (325.18ms/i) -Calculating ------------------------------------- - local YJIT - 1KiB with no literals 137.049k 159.971k i/s - 430.691k times in 3.142607s 2.692304s - 10KiB with no literals 27.272k 28.101k i/s - 82.181k times in 3.013413s 2.924470s -100KiB with no literals 2.941k 2.937k i/s - 8.776k times in 2.984095s 2.988129s - 1KiB of 25B literals 2.803k 4.136k i/s - 8.357k times in 2.981249s 2.020772s - 10KiB of 25B literals 262.978 385.394 i/s - 790.000 times in 3.004055s 2.049850s -100KiB of 25B literals 18.355 22.549 i/s - 58.000 times in 3.159962s 2.572152s - 1KiB of 0B literals 505.733 759.572 i/s - 1.590k times in 3.143953s 2.093285s - 10KiB of 0B literals 45.414 67.569 i/s - 135.000 times in 2.972648s 1.997962s -100KiB of 0B literals 2.722 3.510 i/s - 9.000 times in 3.306786s 2.564007s - -Comparison: - 1KiB with no literals - YJIT: 159971.1 i/s - local: 137049.0 i/s - 1.17x slower - - 10KiB with no literals - YJIT: 28101.2 i/s - local: 27271.7 i/s - 1.03x slower - - 100KiB with no literals - local: 2940.9 i/s - YJIT: 2937.0 i/s - 1.00x slower - - 1KiB of 25B literals - YJIT: 4135.5 i/s - local: 2803.2 i/s - 1.48x slower - - 10KiB of 25B literals - YJIT: 385.4 i/s - local: 263.0 i/s - 1.47x slower - - 100KiB of 25B literals - YJIT: 22.5 i/s - local: 18.4 i/s - 1.23x slower - - 1KiB of 0B literals - YJIT: 759.6 i/s - local: 505.7 i/s - 1.50x slower - - 10KiB of 0B literals - YJIT: 67.6 i/s - local: 45.4 i/s - 1.49x slower - - 100KiB of 0B literals - YJIT: 3.5 i/s - local: 2.7 i/s - 1.29x slower -``` - -For responses that are larger than 10KiB, the benchmarks do take another -dip. Despite that, I believe the algorithm _is_ still linear, and that -the performance hit on large responses is probably due to the large -strings inducing memory locality (paging/caching) bottlenecks. ---- - lib/net/imap/response_reader.rb | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/net/imap/response_reader.rb b/lib/net/imap/response_reader.rb -index d3e819c..71f1980 100644 ---- a/lib/net/imap/response_reader.rb -+++ b/lib/net/imap/response_reader.rb -@@ -32,7 +32,7 @@ module Net - def empty? = buff.empty? - def done? = line_done? && !get_literal_size - def line_done? = buff.end_with?(CRLF) -- def get_literal_size = /\{(\d+)\}\r\n\z/n =~ buff && $1.to_i -+ def get_literal_size = buff.rindex(/\{(\d+)\}\r\n\z/n) && $1.to_i - - def read_line - buff << (@sock.gets(CRLF, read_limit) or throw :eof) - - -From 49c516d621bbffeaf4472e8ff23b85703fc83034 Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Wed, 15 Apr 2026 10:00:24 -0400 -Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8D=92=20pick=2049c516d62:=20?= - =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Faster=20ResponseParser:=20short-circuit?= - =?UTF-8?q?=20no=20literal?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -I was suprised at how much slower `buff.rindex` is (vs `=~`) when it -doesn't match. This speeds up that case significantly (it's now faster -than it was prior to the `rindex` change), with only a small impact in -the case when it does match. - -``` -$ benchmark-driver benchmarks/response_reader.yml --filter KiB -Warming up -------------------------------------- - 1KiB with no literals 202.754k i/s - 210.144k times in 1.036449s (4.93μs/i) - 10KiB with no literals 55.683k i/s - 57.541k times in 1.033362s (17.96μs/i) -100KiB with no literals 6.654k i/s - 7.176k times in 1.078491s (150.29μs/i) - 1KiB of 25B literals 2.780k i/s - 2.959k times in 1.064363s (359.70μs/i) - 10KiB of 25B literals 260.357 i/s - 286.000 times in 1.098491s (3.84ms/i) -100KiB of 25B literals 19.485 i/s - 20.000 times in 1.026445s (51.32ms/i) - 1KiB of 0B literals 506.675 i/s - 550.000 times in 1.085508s (1.97ms/i) - 10KiB of 0B literals 44.384 i/s - 45.000 times in 1.013872s (22.53ms/i) -100KiB of 0B literals 3.063 i/s - 4.000 times in 1.305939s (326.48ms/i) -Calculating ------------------------------------- - local YJIT - 1KiB with no literals 194.355k 247.756k i/s - 608.261k times in 3.129645s 2.455086s - 10KiB with no literals 55.733k 58.585k i/s - 167.049k times in 2.997311s 2.851414s -100KiB with no literals 6.553k 6.453k i/s - 19.961k times in 3.045870s 3.093461s - 1KiB of 25B literals 2.732k 4.061k i/s - 8.340k times in 3.052737s 2.053682s - 10KiB of 25B literals 256.552 379.524 i/s - 781.000 times in 3.044220s 2.057840s -100KiB of 25B literals 17.804 23.286 i/s - 58.000 times in 3.257733s 2.490779s - 1KiB of 0B literals 467.714 703.446 i/s - 1.520k times in 3.249846s 2.160791s - 10KiB of 0B literals 45.376 65.876 i/s - 133.000 times in 2.931045s 2.018955s -100KiB of 0B literals 3.072 3.840 i/s - 9.000 times in 2.929458s 2.343586s - -Comparison: - 1KiB with no literals - YJIT: 247755.5 i/s - local: 194354.7 i/s - 1.27x slower - - 10KiB with no literals - YJIT: 58584.6 i/s - local: 55733.0 i/s - 1.05x slower - - 100KiB with no literals - local: 6553.5 i/s - YJIT: 6452.6 i/s - 1.02x slower - - 1KiB of 25B literals - YJIT: 4061.0 i/s - local: 2732.0 i/s - 1.49x slower - - 10KiB of 25B literals - YJIT: 379.5 i/s - local: 256.6 i/s - 1.48x slower - - 100KiB of 25B literals - YJIT: 23.3 i/s - local: 17.8 i/s - 1.31x slower - - 1KiB of 0B literals - YJIT: 703.4 i/s - local: 467.7 i/s - 1.50x slower - - 10KiB of 0B literals - YJIT: 65.9 i/s - local: 45.4 i/s - 1.45x slower - - 100KiB of 0B literals - YJIT: 3.8 i/s - local: 3.1 i/s - 1.25x slower -``` ---- - lib/net/imap/response_reader.rb | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/lib/net/imap/response_reader.rb b/lib/net/imap/response_reader.rb -index 71f1980..09d9a79 100644 ---- a/lib/net/imap/response_reader.rb -+++ b/lib/net/imap/response_reader.rb -@@ -32,7 +32,10 @@ module Net - def empty? = buff.empty? - def done? = line_done? && !get_literal_size - def line_done? = buff.end_with?(CRLF) -- def get_literal_size = buff.rindex(/\{(\d+)\}\r\n\z/n) && $1.to_i -+ -+ def get_literal_size -+ buff.end_with?("}\r\n") && buff.rindex(/\{(\d+)\}\r\n\z/n) && $1.to_i -+ end - - def read_line - buff << (@sock.gets(CRLF, read_limit) or throw :eof) - - -From 6f82e28f714ecced2396144bce0155e2cdb0256e Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Tue, 14 Apr 2026 14:40:48 -0400 -Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=8D=92=20pick=206f82e28f7:=20?= - =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Faster=20ResponseReader:=20parse=20literal?= - =?UTF-8?q?=20from=20line?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Unfortunately, neither `#rindex` nor even `#end_with?` appear to be -truly `O(1)` for very large strings (100K+). I'm guessing that this is -due to memory locality and caching issues. But, by parsing the literal -from the latest `line` (rather than the full buffer), we mostly avoid -that problem. - -Also, by explicitly parsing literal_size immediately after reading the -line, we don't need to parse it again in `#done?`. - -``` -$ benchmark-driver benchmarks/response_reader.yml --filter KiB -Warming up -------------------------------------- - 1KiB with no literals 202.846k i/s - 214.181k times in 1.055878s (4.93μs/i) - 10KiB with no literals 55.699k i/s - 57.354k times in 1.029717s (17.95μs/i) -100KiB with no literals 6.622k i/s - 6.688k times in 1.009943s (151.01μs/i) - 1KiB of 25B literals 3.428k i/s - 3.751k times in 1.094065s (291.67μs/i) - 10KiB of 25B literals 342.733 i/s - 350.000 times in 1.021202s (2.92ms/i) -100KiB of 25B literals 34.343 i/s - 36.000 times in 1.048234s (29.12ms/i) - 1KiB of 0B literals 683.800 i/s - 690.000 times in 1.009066s (1.46ms/i) - 10KiB of 0B literals 69.186 i/s - 70.000 times in 1.011759s (14.45ms/i) -100KiB of 0B literals 6.914 i/s - 7.000 times in 1.012449s (144.64ms/i) -Calculating ------------------------------------- - local YJIT - 1KiB with no literals 193.622k 250.330k i/s - 608.539k times in 3.142929s 2.430944s - 10KiB with no literals 55.944k 58.881k i/s - 167.096k times in 2.986849s 2.837843s -100KiB with no literals 6.550k 6.480k i/s - 19.866k times in 3.033041s 3.065821s - 1KiB of 25B literals 3.445k 5.520k i/s - 10.285k times in 2.985693s 1.863057s - 10KiB of 25B literals 338.578 548.670 i/s - 1.028k times in 3.036224s 1.873620s -100KiB of 25B literals 33.829 55.860 i/s - 103.000 times in 3.044728s 1.843900s - 1KiB of 0B literals 626.970 1.103k i/s - 2.051k times in 3.271287s 1.860275s - 10KiB of 0B literals 66.065 108.347 i/s - 207.000 times in 3.133301s 1.910523s -100KiB of 0B literals 6.720 8.159 i/s - 20.000 times in 2.976273s 2.451265s - -Comparison: - 1KiB with no literals - YJIT: 250330.3 i/s - local: 193621.6 i/s - 1.29x slower - - 10KiB with no literals - YJIT: 58881.3 i/s - local: 55943.9 i/s - 1.05x slower - - 100KiB with no literals - local: 6549.9 i/s - YJIT: 6479.8 i/s - 1.01x slower - - 1KiB of 25B literals - YJIT: 5520.5 i/s - local: 3444.8 i/s - 1.60x slower - - 10KiB of 25B literals - YJIT: 548.7 i/s - local: 338.6 i/s - 1.62x slower - - 100KiB of 25B literals - YJIT: 55.9 i/s - local: 33.8 i/s - 1.65x slower - - 1KiB of 0B literals - YJIT: 1102.5 i/s - local: 627.0 i/s - 1.76x slower - - 10KiB of 0B literals - YJIT: 108.3 i/s - local: 66.1 i/s - 1.64x slower - - 100KiB of 0B literals - YJIT: 8.2 i/s - local: 6.7 i/s - 1.21x slower -``` ---- - lib/net/imap/response_reader.rb | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/lib/net/imap/response_reader.rb b/lib/net/imap/response_reader.rb -index 09d9a79..dd19d98 100644 ---- a/lib/net/imap/response_reader.rb -+++ b/lib/net/imap/response_reader.rb -@@ -8,6 +8,7 @@ module Net - - def initialize(client, sock) - @client, @sock = client, sock -+ @buff = @literal_size = nil - end - - def read_response_buffer -@@ -15,13 +16,13 @@ module Net - catch :eof do - while true - read_line -- break unless (@literal_size = get_literal_size) -+ break unless literal_size - read_literal - end - end - buff - ensure -- @buff = nil -+ @buff = @literal_size = nil - end - - private -@@ -30,16 +31,18 @@ module Net - - def bytes_read = buff.bytesize - def empty? = buff.empty? -- def done? = line_done? && !get_literal_size -+ def done? = line_done? && !literal_size - def line_done? = buff.end_with?(CRLF) - -- def get_literal_size -+ def get_literal_size(buff) - buff.end_with?("}\r\n") && buff.rindex(/\{(\d+)\}\r\n\z/n) && $1.to_i - end - - def read_line -- buff << (@sock.gets(CRLF, read_limit) or throw :eof) -+ line = (@sock.gets(CRLF, read_limit) or throw :eof) -+ buff << line - max_response_remaining! unless line_done? -+ @literal_size = get_literal_size(line) - end - - def read_literal - diff --git a/SOURCES/rubygem-net-imap-0.6.2-STARTTLS-stripping-vulnerability-CVE-2026-42246.patch b/SOURCES/rubygem-net-imap-0.6.2-STARTTLS-stripping-vulnerability-CVE-2026-42246.patch deleted file mode 100644 index 35941ba..0000000 --- a/SOURCES/rubygem-net-imap-0.6.2-STARTTLS-stripping-vulnerability-CVE-2026-42246.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 62eea6ffe1e390060065169474f97edbc42bd2b2 Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Fri, 27 Mar 2026 17:31:11 -0400 -Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=92=F0=9F=A5=85=20Ensure=20STARTTL?= - =?UTF-8?q?S=20tagged=20response=20was=20handled?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taking a "belt-and-suspenders" approach to a STARTTLS stripping attack: - -This handles `STARTTLS` as a special-case: if the `STARTTLS` handler -did not run, for _whatever_ reason, an exception _must_ be raised and -the connection dropped. - -_No_ command should ever receive a tagged `OK` prior to completely -sending the command. But `STARTTLS` is security-sensitive enough to -warrant this special-case handler. ---- - lib/net/imap.rb | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/lib/net/imap.rb b/lib/net/imap.rb -index 00f1588..e2cbc5a 100644 ---- a/lib/net/imap.rb -+++ b/lib/net/imap.rb -@@ -1390,9 +1390,11 @@ module Net - # - def starttls(**options) - @ssl_ctx_params, @ssl_ctx = build_ssl_ctx(options) -+ handled = false - error = nil - ok = send_command("STARTTLS") do |resp| - if resp.kind_of?(TaggedResponse) && resp.name == "OK" -+ handled = true - clear_cached_capabilities - clear_responses - start_tls_session -@@ -1404,6 +1406,13 @@ module Net - disconnect - raise error - end -+ unless handled -+ disconnect -+ raise InvalidResponseError, -+ "STARTTLS handler was bypassed, although server responded %p" % [ -+ ok.raw_data.chomp -+ ] -+ end - ok - end - - - -From 24d5c773d1bb76ca1cd0a26b2218195011c16969 Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Fri, 27 Mar 2026 18:00:09 -0400 -Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=92=F0=9F=A5=85=20Handle=20tagged?= - =?UTF-8?q?=20"OK"=20to=20incomplete=20command?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Taking a "belt-and-suspenders" approach: - -This is a potential problem for any command which registers a response -handler: a malicious server can easily guess what the next tag will be, -and send an `OK` response _before_ the client the response handler is -attached. - -`STARTTLS` is an extreme example of this issue: if the `STARTTLS` -handler does not run, then `#starttls` will not start the TLS session, -and the connection is not secured, _but no error is raised._ - -We should _also_ attach the response handler before sending the `CRLF`, -but that is neither necessary (the response handler will added before -the `synchronize` mutex is unlocked) nor sufficient (the fake `OK` can -be sent _much_ earlier). - -On the other hand, it _is_ okay for the server to send an error tagged -response (`NO` or `BAD`), before sending the command has completed. ---- - lib/net/imap.rb | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/lib/net/imap.rb b/lib/net/imap.rb -index e2cbc5a..6af1ca5 100644 ---- a/lib/net/imap.rb -+++ b/lib/net/imap.rb -@@ -3086,6 +3086,7 @@ module Net - - synchronize do - tag = Thread.current[:net_imap_tag] = generate_tag -+ guard_against_tagged_response_skipping_handler!(tag, "IDLE") - put_string("#{tag} IDLE#{CRLF}") - - begin -@@ -3550,6 +3551,7 @@ module Net - put_string(" ") - send_data(i, tag) - end -+ guard_against_tagged_response_skipping_handler!(tag, cmd) - put_string(CRLF) - if cmd == "LOGOUT" - @logout_command_tag = tag -@@ -3565,6 +3567,19 @@ module Net - end - end - end -+ rescue InvalidResponseError -+ disconnect -+ raise -+ end -+ -+ def guard_against_tagged_response_skipping_handler!(tag, cmd) -+ return unless (resp = @tagged_responses[tag])&.name&.upcase == "OK" -+ raise InvalidResponseError, format( -+ "Received tagged 'OK' to incomplete %s command (tag=%s). " \ -+ "This could indicate a malicious server, a man-in-the-middle, or " \ -+ "client-side command injection. Disconnecting.", -+ cmd, tag -+ ) - end - - def generate_tag diff --git a/SOURCES/rubygem-net-imap-0.6.2-flag-symbol-validation-CVE-2026-42258.patch b/SOURCES/rubygem-net-imap-0.6.2-flag-symbol-validation-CVE-2026-42258.patch deleted file mode 100644 index bc61d61..0000000 --- a/SOURCES/rubygem-net-imap-0.6.2-flag-symbol-validation-CVE-2026-42258.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 9db3e9d Mon Sep 17 00:00:00 2001 -From: nick evans -Date: Thu, 19 Feb 2026 15:06:08 -0500 -Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20Strictly=20validate=20symbol=20(?= - =?UTF-8?q?\flag)=20arguments?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Flags should not allow `atom-specials`. - -Previously, no validation was done on symbol data. Sending atom or flag -args which contain atom specials could lead to various errors. - -Although this could theoretically include injection attacks, this is not -considered to be a critical vulnerability in `net-imap`, for the -following reason: Valid "system flag" inputs are restricted to an -enumerated set of RFC-defined flag types. User-defined "keyword" flags -are sent as atoms, not flags, which use string inputs (strings which -can't be sent as an atom will be quoted or sent as a literal). `\Seen` -as a flag (symbol argument) is semantically different from `Seen` as a -keyword (string argument). So there is no scenario where it is -appropriate to call `#to_sym` on unvetted user input. Any code which -calls `#to_sym` indiscriminately on user-input is already buggy. - -Nevertheless, users should reasonably be able to rely on `net-imap` to -do very basic input validation on its basic input types. ---- - lib/net/imap/command_data.rb | 33 +++++++++++++++++++++++++++------ - 1 file changed, 27 insertions(+), 6 deletions(-) - -diff --git a/lib/net/imap/command_data.rb b/lib/net/imap/command_data.rb -index 02b9a61..2671d5d 100644 ---- a/lib/net/imap/command_data.rb -+++ b/lib/net/imap/command_data.rb -@@ -25,6 +25,7 @@ module Net - end - when Time, Date, DateTime - when Symbol -+ Flag.validate(data) - else - data.validate - end -@@ -45,7 +46,7 @@ module Net - when Date - send_date_data(data) - when Symbol -- send_symbol_data(data) -+ Flag[data].send_data(self, tag) - else - data.send_data(self, tag) - end -@@ -115,11 +116,13 @@ module Net - def send_date_data(date) put_string Net::IMAP.encode_date(date) end - def send_time_data(time) put_string Net::IMAP.encode_time(time) end - -- def send_symbol_data(symbol) -- put_string("\\" + symbol.to_s) -- end -- - CommandData = Data.define(:data) do # :nodoc: -+ def self.validate(...) -+ data = new(...) -+ data.validate -+ data -+ end -+ - def send_data(imap, tag) - raise NoMethodError, "#{self.class} must implement #{__method__}" - end -@@ -135,8 +138,26 @@ module Net - end - - class Atom < CommandData # :nodoc: -+ def initialize(**) -+ super -+ validate -+ end -+ -+ def validate -+ data.to_s.ascii_only? \ -+ or raise DataFormatError, "#{self.class} must be ASCII only" -+ data.match?(ResponseParser::Patterns::ATOM_SPECIALS) \ -+ and raise DataFormatError, "#{self.class} must not contain atom-specials" -+ end -+ - def send_data(imap, tag) -- imap.__send__(:put_string, data) -+ imap.__send__(:put_string, data.to_s) -+ end -+ end -+ -+ class Flag < Atom # :nodoc: -+ def send_data(imap, tag) -+ imap.__send__(:put_string, "\\#{data}") - end - end - diff --git a/SPECS/ruby.spec b/SPECS/ruby.spec index ab72d81..49fb292 100644 --- a/SPECS/ruby.spec +++ b/SPECS/ruby.spec @@ -1,6 +1,6 @@ %global major_version 4 %global minor_version 0 -%global teeny_version 3 +%global teeny_version 6 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -36,7 +36,7 @@ ## BUNDLED_GEMS_VERSIONS # Bundled libraries versions -%global rubygems_version 4.0.6 +%global rubygems_version 4.0.16 %global rubygems_molinillo_version 0.8.0 %global rubygems_net_http_version 0.7.0 %global rubygems_net_protocol_version 0.2.2 @@ -48,14 +48,13 @@ %global rubygems_uri_version 1.1.1 # Default gems. -%global bundler_version 4.0.6 +%global bundler_version 4.0.16 %global bundler_connection_pool_version 2.5.4 %global bundler_fileutils_version 1.8.0 %global bundler_net_http_persistent_version 4.0.6 %global bundler_pub_grub_version 0.5.0 %global bundler_securerandom_version 0.4.1 %global bundler_thor_version 1.4.0 -%global bundler_tsort_version 0.2.0 %global bundler_uri_version 1.1.1 %global date_version 3.5.1 @@ -64,7 +63,7 @@ %global digest_version 3.2.1 %global english_version 0.8.1 %global erb_version 6.0.1.1 -%global error_highlight_version 0.7.1 +%global error_highlight_version 0.7.2 %global etc_version 1.4.6 %global fcntl_version 1.3.0 %global fileutils_version 1.8.0 @@ -79,7 +78,7 @@ %global net_protocol_version 0.2.2 %global open_uri_version 0.5.0 %global open3_version 0.2.1 -%global openssl_version 4.0.0 +%global openssl_version 4.0.2 %global optparse_version 0.8.1 %global pp_version 0.6.3 %global prettyprint_version 0.2.0 @@ -121,7 +120,7 @@ %global minitest_version 6.0.0 %global mutex_m_version 0.3.0 %global net_ftp_version 0.3.9 -%global net_imap_version 0.6.2 +%global net_imap_version 0.6.4.1 %global net_pop_version 0.1.2 %global net_smtp_version 0.5.1 %global nkf_version 0.2.0 @@ -133,7 +132,7 @@ %global racc_version 1.8.1 %global rake_version 13.3.1 %global rbs_version 3.10.0 -%global rdoc_version 7.0.3 +%global rdoc_version 7.0.4 %global readline_version 0.0.4 %global reline_version 0.6.3 %global repl_type_completor_version 0.1.12 @@ -186,7 +185,7 @@ Summary: An interpreter of object-oriented scripting language Name: ruby Version: %{ruby_version}%{?development_release} -Release: 33%{?dist} +Release: 34%{?dist} # Licenses, which are likely not included in binary RPMs: # Apache-2.0: # benchmark/gc/redblack.rb @@ -299,24 +298,6 @@ Patch9: rdoc-pr1531-fix-mutilple-document-installation.patch # in Ruby JSON # https://github.com/ruby/json/commit/393b41c3e5f87491e1e34fa59fa78ff6fa179a74 Patch10: ruby-4.0.3-Fix-a-format-string-injection-vulnerability.patch -# CVE-2026-42245 -# Net::IMAP ResponseReader quadratic complexity vulnerability -# Sourced from: -# - https://github.com/ruby/net-imap/commit/341ab628 -# - https://github.com/ruby/net-imap/commit/49c516d6 -# - https://github.com/ruby/net-imap/commit/6f82e28f -Patch11: rubygem-net-imap-0.6.2-ResponseReader-quadratic-complexity-CVE-2026-42245.patch -# CVE-2026-42246 -# Net::IMAP STARTTLS stripping vulnerability -# Sourced from: -# - https://github.com/ruby/net-imap/commit/62eea6ff -# - https://github.com/ruby/net-imap/commit/24d5c773 -Patch12: rubygem-net-imap-0.6.2-STARTTLS-stripping-vulnerability-CVE-2026-42246.patch -# CVE-2026-42258 -# Net::IMAP command injection vulnerability via unvalidated Symbol arguments -# Sourced from: -# - https://github.com/ruby/net-imap/commit/9db3e9d -Patch13: rubygem-net-imap-0.6.2-flag-symbol-validation-CVE-2026-42258.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{?with_rubypick:Suggests: rubypick} @@ -626,7 +607,6 @@ Provides: bundled(rubygem-net-http-persistent) = %{bundler_net_http_persistent Provides: bundled(rubygem-pub_grub) = %{bundler_pub_grub_version} Provides: bundled(rubygem-securerandom) = %{bundler_securerandom_version} Provides: bundled(rubygem-thor) = %{bundler_thor_version} -Provides: bundled(rubygem-tsort) = %{bundler_tsort_version} Provides: bundled(rubygem-uri) = %{bundler_uri_version} BuildArch: noarch @@ -835,12 +815,6 @@ popd %patch -P 8 -p1 %patch -P 10 -p1 -pushd .bundle/gems/net-imap-%{net_imap_version} -%patch -P 11 -p1 -%patch -P 12 -p1 -%patch -P 13 -p1 -popd - # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1187,15 +1161,6 @@ make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \ exit 1 if Bundler::Thor::VERSION != '%{bundler_thor_version}'; \ \"" -# TSort -make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \ - module Bundler; end; \ - require 'bundler/vendor/tsort/lib/tsort'; \ - puts '%%{bundler_tsort_version}: %{bundler_tsort_version}'; \ - puts %Q[Bundler::TSort::VERSION: #{Bundler::TSort::VERSION}]; \ - exit 1 if Bundler::TSort::VERSION != '%{bundler_tsort_version}'; \ -\"" - # URI. make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \ module Bundler; end; \ @@ -1999,6 +1964,11 @@ make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \ %changelog +* Thu Jul 23 2026 Jarek Prokop - 4.0.6-34 +- Upgrade to Ruby 4.0.6. + Resolves: RHEL-211301 + Resolves: RHEL-193663 + * Wed Jun 10 2026 Tomas Juhasz - 4.0.3-33 - Fix Net::IMAP ResponseReader quadratic complexity vulnerability. (CVE-2026-42245) Resolves: RHEL-181690