| Age | Commit message (Collapse) | Author |
|
c26057ebafb23b063190d31d5b4d19a0e0a1306c: [Backport #21779]
[PATCH] [Bug #21779] Uniquify `InitVM` functions as well as `Init`
Avoid possible name conflict when `--with-static-linked-ext`.
[PATCH] [Bug #21779] Do not export InitVM functions
Fix ruby/io-console#105.
|
|
[PATCH] [Bug #21705] Fix segfaults on Windows
It should check the type of the argument and coercion before
converting the encoding.
|
|
When calling getnameinfo we spawn a thread because it may do a slow,
blocking reverse-DNS lookup. Spawning a thread is relatively fast (~20µs
on my Linux machine) but still an order of magnitude slower than when
getnameinfo is simply translating to a numeric IP or port, which, at
least in my tests on Linux, doesn't even make a syscall.
This commit adds a fast path for when reverse DNS isn't required: either
host isn't being fetched or NI_NUMERICHOST is set AND either the
service name isn't required or NI_NUMERICSERV is set. The service name
should only need to read /etc/services, which should be fast-ish, but
is still I/O so I kept the existing behaviour (it could be on a network
fs I guess).
I tested with:
s = TCPSocket.open("www.ruby-lang.org", 80)
500_000.times { Socket.unpack_sockaddr_in(s.getpeername) }
Before: 12.935s
After: 0.338s
|
|
Backport of https://github.com/ruby/ruby/pull/15142
[Bug #21679]
|
|
|
|
Update openssl gem to 3.3.1
[Backport #21631]
|
|
[PATCH] [Bug #21629] Initialize `struct RString`
which appears to be missed in the previous commit for some reason.
|
|
declarations
https://github.com/ruby/json/commit/95fb084027
https://github.com/ruby/json/commit/9d080765cc
|
|
https://github.com/ruby/strscan/commit/18c0a59b65
|
|
(https://github.com/ruby/strscan/pull/158)
- `have_func` includes "ruby.h" by default.
- include "ruby/re.h" where `rb_reg_onig_match` is declared.
https://github.com/ruby/strscan/commit/1ac96f47e9
|
|
declarations
https://github.com/ruby/openssl/commit/b6f56c4540
https://github.com/ruby/openssl/commit/5277ca1431
|
|
|
|
|
|
|
|
|
|
[Bug #21497] [ruby/socket]: add full prototype
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
otherwise, gcc 15 will complain:
> init.c:573:19: error: too many arguments to function ‘Rconnect’; expected 0, have 3
> 573 | return (VALUE)Rconnect(arg->fd, arg->sockaddr, arg->len);
> | ^~~~~~~~ ~~~~~~~
> In file included from init.c:11:
> rubysocket.h:294:5: note: declared here
> 294 | int Rconnect();
> | ^~~~~~~~
> sockssocket.c:33:9: error: too many arguments to function ‘SOCKSinit’; expected 0, have 1
> 33 | SOCKSinit("ruby");
> | ^~~~~~~~~ ~~~~~~
> In file included from sockssocket.c:11:
> rubysocket.h:293:6: note: declared here
> 293 | void SOCKSinit();
> | ^~~~~~~~~
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
|
|
[ruby/date] [Bug #21437] Date#hash for large years
Addresses https://bugs.ruby-lang.org/issues/21437
Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com>
https://github.com/ruby/date/commit/31f07bc576
|
|
|
|
This change addresses the following ASAN error:
```
==36597==ERROR: AddressSanitizer: heap-use-after-free on address 0x512000396ba8 at pc 0x7fcad5cbad9f bp 0x7fff19739af0 sp 0x7fff19739ae8
WRITE of size 8 at 0x512000396ba8 thread T0
[643/756] 36600=optparse/test_summary
#0 0x7fcad5cbad9e in free_fast_fallback_getaddrinfo_entry /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/raddrinfo.c:3046:22
#1 0x7fcad5c9fb48 in fast_fallback_inetsock_cleanup /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/ipsocket.c:1179:17
#2 0x7fcadf3b611a in rb_ensure /home/runner/work/ruby-dev-builder/ruby-dev-builder/eval.c:1081:5
#3 0x7fcad5c9b44b in rsock_init_inetsock /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/ipsocket.c:1289:20
#4 0x7fcad5ca22b8 in tcp_init /home/runner/work/ruby-dev-builder/ruby-dev-builder/ext/socket/tcpsocket.c:76:12
#5 0x7fcadf83ba70 in vm_call0_cfunc_with_frame /home/runner/work/ruby-dev-builder/ruby-dev-builder/./vm_eval.c:164:15
...
```
A `struct fast_fallback_getaddrinfo_shared` is shared between the main thread and two child threads.
This struct contains an array of `fast_fallback_getaddrinfo_entry`.
`fast_fallback_getaddrinfo_entry` and `fast_fallback_getaddrinfo_shared` were freed separately, and if `fast_fallback_getaddrinfo_shared` was freed first and then an attempt was made to free a `fast_fallback_getaddrinfo_entry`, a `heap-use-after-free` could occur.
This change avoids that possibility by separating the deallocation of the addrinfo memory held by `fast_fallback_getaddrinfo_entry` from the access and lifecycle of the `fast_fallback_getaddrinfo_entry` itself.
|
|
`free_fast_fallback_getaddrinfo_*` (#12661)
Ensure that `getaddrinfo_entry` and `getaddrinfo_shared` exist before free them in the main thread.
|
|
Fix segfault crash observable with TCPSocket.open(nil, nil)
|
|
[Bug #21211]
Socket errors raised from background threads are hard to track down because
their backtrace starts from the spawned thread.
To solve this we can raise a new error with the old one as `cause`.
|
|
[Bug #21179]
```
socket.rb:1046:in 'Socket::HostnameResolutionStore#get_addrinfo': can not access non-shareable objects in constant
Socket::HostnameResolutionStore::PRIORITY_ON_V6 by non-main ractor. (Ractor::IsolationError)
from socket.rb:724:in 'block in Socket.tcp_with_fast_fallback'
from socket.rb:720:in 'Socket.tcp_with_fast_fallback'
```
|
|
Do not save ResolutionError if resolution succeeds for any address family (#12678)
* Do not save ResolutionError if resolution succeeds for any address family
Socket with Happy Eyeballs Version 2 performs connection attempts and name resolution in parallel.
In the existing implementation, if a connection attempt failed for one address family while name resolution was still in progress for the other, and that name resolution later failed, the method would terminate with a name resolution error.
This behavior was intended to ensure that the final error reflected the most recent failure, potentially overriding an earlier error.
However, [Bug #21088](https://bugs.ruby-lang.org/issues/21088) made me realize that terminating with a name resolution error is unnatural when name resolution succeeded for at least one address family.
This PR modifies the behavior so that if name resolution succeeds for one address family, any name resolution error from the other is not saved.
This PR includes the following changes:
* Do not display select(2) as the system call that caused the raised error, as it is for internal processing
* Fix bug: Get errno with Socket::SO_ERROR in Windows environment with a workaround for tests not passing
|
|
[Bug #21092] Fallback variables after execonf has done
When reading from a dummy makefile, the global variables initialized
in `init_mkmf` may not be overridden.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12467
|
|
`:nodoc:` seems not working for inner classes.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12460
|
|
write(2) failure (#12457)
Rarely, there are cases where a write(2) call from a child thread
to notify the main thread of the completion of name resolution fails.
If this happens while the main thread is waiting in `rb_thread_fd_select`,
rb_thread_fd_select may not notice that the name resolution has completed and end up hanging.
This issue becomes a problem when there are no sockets currently being connected,
no addresses ready for immediate connection attempts,
and name resolution has already completed for one address family
while the main thread is waiting for the name resolution of the other address family.
(If name resolution is not completed for either address family,
the chances of write(2) failing in both child threads are likely low.)
To avoid this issue, a timeout is introduced to rb_thread_fd_select under the above conditions.
This way, even if the issue occurs,
the completion of name resolution should still be detected
in the subsequent `if (!resolution_store.is_all_finished) ...` block.
Notes:
Merged-By: shioimm <shioi.mm@gmail.com>
|
|
Also, a topic about Socket::ResolutionError is added to NEWS
Notes:
Merged-By: shioimm <shioi.mm@gmail.com>
|
|
to prevent the following scenario:
1. `delete_unique_str()` can be called while GC (sweeping)
2. it calls `st_insert()` to decrement the counter
3. `st_insert()` can try to extend the table even if the key exists
4. `xmalloc` while GC and cause BUG
Notes:
Merged: https://github.com/ruby/ruby/pull/12407
|
|
https://github.com/ruby/openssl/commit/e5153dbbb4
Notes:
Merged: https://github.com/ruby/ruby/pull/12421
|
|
OpenSSL::Digest#finish overrides Digest::Instance#finish and is called
from the Digest::Class framework in the digest library. This method is
not supposed to take any arguments, as suggested by the RDoc comment for
Digest::Instance#finish.
It is a private method and not exposed to users. Let's remove it.
This optional parameter exists since r15602 in Ruby trunk, the commit
which converted OpenSSL::Digest to a subclass of Digest::Class.
https://github.com/ruby/openssl/commit/dcb2a4f30b
Notes:
Merged: https://github.com/ruby/ruby/pull/12421
|
|
Likewise, OpenSSL::Digest#finish needs to make the output buffer
independent before writing to it.
https://github.com/ruby/openssl/commit/9cc8a83466
Notes:
Merged: https://github.com/ruby/ruby/pull/12421
|
|
OpenSSL::Cipher#update accepts a String as the second argument to be
used as the output buffer. The buffer must be directly writable, in
other words, it must not be frozen and not a shared string.
rb_str_resize() does not make the String independent if the String
already has the intended length. Use the rb_str_modify() family instead
to check it.
Fixes: https://bugs.ruby-lang.org/issues/20937
https://github.com/ruby/openssl/commit/1de3b80a46
Notes:
Merged: https://github.com/ruby/ruby/pull/12421
|
|
Add a binding for PKCS12_set_mac() to set MAC parameters and
(re-)calculate MAC for the content.
This allows generating PKCS #12 with consistent MAC parameters with
different OpenSSL versions. OpenSSL 3.0 changed the default hash
function used for HMAC and the KDF from SHA-1 to SHA-256.
Fixes: https://github.com/ruby/openssl/issues/772
https://github.com/ruby/openssl/commit/f5ed2a74b6
Notes:
Merged: https://github.com/ruby/ruby/pull/12421
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12385
|
|
https://github.com/ruby/json/commit/f745ec145e
Notes:
Merged: https://github.com/ruby/ruby/pull/12394
|
|
Check for existence of strnlen() and use alternative code if it is missing.
https://github.com/ruby/json/commit/48d4bbc3a0
Notes:
Merged: https://github.com/ruby/ruby/pull/12394
|
|
https://github.com/ruby/psych/commit/746e1ad24d
|
|
Wrap `do_fast_fallback_getaddrinfo` with `rb_thread_prevent_fork`
Referencing PR #10864,
wrap `do_fast_fallback_getaddrinfo` with `rb_thread_prevent_fork`
to avoid fork safety issues.
`do_fast_fallback_getaddrinfo` internally uses getaddrinfo(3),
leading to fork safety issues, as described in PR #10864.
This change ensures that `do_fast_fallback_getaddrinfo`
is guarded by `rb_thread_prevent_fork`,
preventing fork during its execution and avoiding related issues.
Notes:
Merged-By: shioimm <shioi.mm@gmail.com>
|
|
https://github.com/ruby/win32ole/commit/3e9b3b02e9
|
|
When reference updating ObjectSpace.trace_object_allocations, we need to
check whether the object is valid or not because it does not mark the
object so the object may be dead. This can cause a segmentation fault
if the object is on a free heap page.
For example, the following script crashes:
require "objspace"
objs = []
ObjectSpace.trace_object_allocations do
1_000_000.times do
objs << Object.new
end
end
objs = nil
# Free pages that the objs were on
GC.start
# Run compaction and check that it doesn't crash
GC.compact
Notes:
Merged: https://github.com/ruby/ruby/pull/12360
|
|
We need to reinsert into the ST table when an object moves because it is
a numtable that hashes on the object address, so when an object moves we
need to reinsert it rather than just updating the key.
Notes:
Merged: https://github.com/ruby/ruby/pull/12339
|
|
We should be checking for key for moved objects rather than the value
because the key is a Ruby object and the value is malloc'd memory.
Notes:
Merged: https://github.com/ruby/ruby/pull/12339
|
|
https://docs.ruby-lang.org/en/master/Psych.html#module-Psych-label-Exception+handling
https://github.com/ruby/psych/commit/c53c298222
|
|
https://github.com/ruby/digest/commit/26c757fe9a
|
|
|
|
(https://github.com/ruby/fiddle/pull/162)
This allows for passing integers as pointer arguments to functions when
using the FFI backend. This is a workaround until we can get JRuby's FFI
implementation to allow for it directly (see also
https://github.com/jruby/jruby/pull/8423)
---------
https://github.com/ruby/fiddle/commit/e2f0952e9b
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
|
|
(https://github.com/ruby/strscan/pull/126)
Split off from https://github.com/ruby/ruby/pull/12322
https://github.com/ruby/strscan/commit/9bee37e0f5
|