1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00
Commit Graph

292 Commits

Author SHA1 Message Date
David Carlier
8cbc0c57b7 Fix GH-17921 socket_read/socket_recv overflows on buffer size.
update the existing checks to be more straightforward instead of
counting on undefined behavior.

close GH-17923
2025-02-25 21:54:24 +00:00
David Carlier
8a649a8343 ext/sockets: socket_set_option switch from convert_to_long to zval_get_long.
to be explicit when the expected type is not met. Check SO_LINGER values
for possible overflow.

close GH-17135
2024-12-16 22:55:23 +00:00
David Carlier
3bea6a2ddb ext/sockets: socket_strerror follow-up on GH-16267 fix.
boundaries should be INT_MIN <= val < INT_MAX in fact.

close GH-16891
2024-12-09 13:16:32 +00:00
David Carlier
f12e496cba Merge branch 'PHP-8.2' into PHP-8.3 2024-10-12 15:23:35 +01:00
David Carlier
e583890af0 Fix socket_recvfrom overflow on buffer size.
when passing PHP_INT_MAX for the $length param we get this (with ubsan)

`ext/sockets/sockets.c:1409:36: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'`

close GH-16382
2024-10-12 15:23:03 +01:00
David Carlier
2af32659b3 Merge branch 'PHP-8.2' into PHP-8.3 2024-10-06 19:25:59 +01:00
David Carlier
8537aa687e Fix GH-16267 socket_strerror overflow on argument value.
only socket_strerror provides user-supplied value to sockets_strerror
handler.

close GH-16270
2024-10-06 19:25:38 +01:00
David Carlier
93d89cb80d Merge branch 'PHP-8.2' into PHP-8.3 2024-03-06 11:39:37 +00:00
David Carlier
e3f0d03452 Fix GH-13603 ext/sockets: properly initialised address info data.
Led to random characters visible on socket id on macOs.

Close GH-13606
2024-03-06 11:37:48 +00:00
twosee
d9b0bdbaa4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix socket_export_stream() with wrong protocol
2023-09-29 18:58:05 +08:00
twosee
90707f33e1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix socket_export_stream() with wrong protocol
2023-09-29 18:33:59 +08:00
twosee
b5da98b972 Fix socket_export_stream() with wrong protocol
Closes GH-12310.
2023-09-29 18:33:12 +08:00
Michael Orlitzky
ce8c07e942 ext/sockets/tests/mcast_ipv6_*.phpt: suppress no-ipv6 warning (#11651)
These three tests try to create an ipv6 socket with socket_create() to
determine if they should be skipped. On certain systems lacking ipv6
support, however, the call to socket_create() itself raises a warning:

  BORK Warning: socket_create(): Unable to create socket [97]: Address
  family not supported by protocol in ...

The output is "borked" because the return value (false) is expected
but the text of the warning is not. This commit uses the error control
operator (@) to hide the warning. Afterwards the tests are skipped
normally on such a system.
2023-07-10 16:19:12 +02:00
Ilija Tovilo
45ffa773c8 Merge branch 'PHP-8.2'
* PHP-8.2:
  xfail socket zerocopy test on Cirrus + arm
2023-06-29 08:49:07 +02:00
Ilija Tovilo
838f6bffff xfail socket zerocopy test on Cirrus + arm
Closes GH-11553
2023-06-29 08:48:48 +02:00
divinity76
4918765d54 SKIP_(SLOW|ONLINE)_TESTS (#11479)
it was missing the SKIP_ONLINE_TESTS check for windows.
2023-06-19 19:44:03 +01:00
David Carlier
9198e8894b socket DF flag on UDP socket via IP_MTU_DISCOVER on Linux and IP_DONTFRAGMENT on FreeBSD for path MTU discovery purpose.
idea proposal via ml :
https://marc.info/?l=php-internals&m=167329288509393&w=2

Close GH-10282
2023-01-12 22:22:30 +00:00
Jakub Zelenka
ac7d812fb7 Merge branch 'PHP-8.2' 2022-09-30 17:10:15 +01:00
Jakub Zelenka
d2b7d67dac Merge branch 'PHP-8.1' into PHP-8.2 2022-09-30 17:08:55 +01:00
Jakub Zelenka
ee8f2c75e0 Merge branch 'PHP-8.0' into PHP-8.1 2022-09-30 17:08:17 +01:00
Andy Postnikov
c58241a003 Make socket path shorter for ext/sockets/tests/socket_cmsg_{rights|credentials}.phpt
When running in CI it fails when path/address is longer 108
2022-09-30 17:07:40 +01:00
David Carlier
615b8006c4 socket module add SO_ATTACH_REUSEPORT_CPBF for Linux.
to be used in conjunction with SO_REUSPORT, giving a greater control
over how we bind a socket instead of the round robin workflow, we do
 instead attach to the processor id as :
- we assign the processor_id to A in the BPF filter.
- then returns A.

in other words, a more modern version of SO_INCOMING_CPU (ie can have a per
 worker notion we do not use here).
Closes #8062
2022-09-29 23:32:39 +01:00
David Carlier
067a3022f8 Sockets disable zerocopy test on ppc based arch.
Failure reported by alpine maintainers.
Closes #9081.
2022-07-21 13:36:49 +01:00
David Carlier
dedad408fe sockets introduces socket_set_option SO_ZEROCOPY and MSG_ZEROCOPY for the socket_send* functions. it avoids copy b/w userland and kernel for both TCP and UDP protocols. 2022-07-10 20:06:52 +01:00
David Carlier
a193427333 Adds TCP_CONGESTION socket option for Linux/FreeBSD.
Closes #8824.
2022-06-30 19:43:09 +01:00
David Carlier
d677cc13ce Add SO_BPF_EXTENSIONS flag to socket.
Returns the supported bpf extensions from the kernel. Linux only.
Closes GH-8713.
2022-06-08 05:14:57 +01:00
David CARLIER
f813520b50 Implements socket ancillary data on FreeBSD. (#7708)
using LOCAL_CREDS_PERSISTENT/SCM_CREDS2 instead so we also get the send process id.
2022-06-02 14:08:03 +01:00
Christoph M. Becker
57add48777 Revert "Make socket path shorter for ext/sockets/tests/socket_cmsg_{rights|credentials}.phpt"
This reverts commit b0c1773686, since
this causes CI failures, apparently related to ZTS builds.
2022-05-31 11:22:04 +02:00
Andy Postnikov
b0c1773686 Make socket path shorter for ext/sockets/tests/socket_cmsg_{rights|credentials}.phpt
When running in CI it fails when path/address is longer 108

Closes GH-8617.
2022-05-31 10:37:35 +02:00
David Carlier
2410e378c1 Add SO_MEMINFO socket option for gathering socket related info 2022-05-20 22:06:53 +01:00
Joe Watkins
0b5d371a9c Merge branch 'PHP-8.1'
* PHP-8.1:
  socket cmsg credential test fixes, "backporting" from the FreeBSD PR.
2021-12-21 07:28:19 +01:00
Joe Watkins
938a81cf01 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  socket cmsg credential test fixes, "backporting" from the FreeBSD PR.
2021-12-21 07:28:09 +01:00
David Carlier
80b02275bb socket cmsg credential test fixes, "backporting" from the FreeBSD PR. 2021-12-21 07:27:59 +01:00
Nikita Popov
d032b85762 Merge branch 'PHP-8.1'
* PHP-8.1:
  Use ephemeral port in test
2021-10-05 16:01:00 +02:00
Nikita Popov
e91a751e3d Use ephemeral port in test 2021-10-05 16:00:50 +02:00
Kamil Tekiela
c3dda473cc Fix 'can not' in test data and in code comments 2021-10-05 09:51:58 +01:00
Nikita Popov
bc19186c7f Merge branch 'PHP-8.1'
* PHP-8.1:
  Use ephemeral ports in socket test
2021-09-20 10:20:10 +02:00
Nikita Popov
624848f118 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Use ephemeral ports in socket test
2021-09-20 10:20:03 +02:00
Nikita Popov
07f6c61c8e Use ephemeral ports in socket test 2021-09-20 10:19:48 +02:00
Nikita Popov
768265cd22 Fix some more CLEAN sections 2021-09-06 17:03:35 +02:00
Nikita Popov
2ab4482d34 Fix some broken or unnecessary CLEAN sections 2021-09-03 10:52:30 +02:00
Nikita Popov
e539cb9ca0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix port clash in socket tests
2021-08-12 12:02:37 +02:00
Nikita Popov
77c1c42c66 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix port clash in socket tests
2021-08-12 12:02:27 +02:00
Nikita Popov
78cbe56e68 Fix port clash in socket tests
Use ephemeral port instead.
2021-08-12 12:02:05 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Nikita Popov
892421c9a8 Make some zend_test dependencies explicit
Rather than checking that specific functions exist.
2021-06-14 15:40:34 +02:00
Nikita Popov
6600ad6067 Add some missing EXTENSIONS sections to misc tests 2021-06-14 14:52:44 +02:00
David CARLIER
ff23a34757 define SO_ACCEPTFILTER separately where supported (#7146) 2021-06-14 07:24:55 +02:00
Nikita Popov
7485978339 Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
David Carlier
fc147ed8db sockets exposing TC_DEFER_ACCEPT to optimise tcp exchanges. 2021-06-09 06:54:02 +02:00