« first day (2020 days earlier)      last day (2931 days later) » 

9:00 PM
I super hated dealing with clients, they are literally the worst ...
 
@JoeWatkins I know what it is and why it is what I expect:
$server = stream_socket_server('tcp://127.0.0.1:12345');
stream_context_set_option($server, 'ssl', 'disable_compression');
$client = stream_socket_accept($server);
stream_socket_enable_crypto($client); // the ssl context options set on the server socket are used here
I expect, and there is a fair amount of code that relies on, options from the server having an effect on the accepted peer
 
it must also apply to the bound socket though, right ?
 
Wes
@bwoebi aren't them synonyms
i'm both tho
 
@Wes nah, the fool is intentionally crazy and the idiot is just stupid
 
@JoeWatkins The SSL context options are irrelevant to the bound socket, it never does any SSL related things, it's a TCP socket
It's a crappy API, but it is the expected behaviour in line with what we already have
 
Wes
9:03 PM
@bwoebi i'm somewhere between them :B
 
that seems like precedent then
 
Wes
so union & intersections are going to be proposed together?
 
You wouldn't set the option itself on the underlying server socket, the effect of setting a peer-only option on a PHP server stream is to set it on the accepted peers
 
@Wes doesn't look like it, levi done a separate rfc for intersections ...
@DaveRandom yeah got that ...
 
Somewhere in the transcript in the run up to 5.6 there will be a log of me and @rdlowrey discussing this literally to death
 
9:06 PM
but wait ...
every server socket with a context is going to get perf hit on accept, that seems pretty bad ?
maybe I can offset that by removing the pointless branch, a little ... might it still be too bad ?
 
@JoeWatkins how come?
 
hash lookup, possibly two
	if (clisock >= 0) {
		php_netstream_data_t *clisockdata;

		clisockdata = emalloc(sizeof(*clisockdata));

		if (clisockdata == NULL) {
			close(clisock);
			/* technically a fatal error */
		} else {
			memcpy(clisockdata, sock, sizeof(*clisockdata));
			clisockdata->socket = clisock;

			xparam->outputs.client = php_stream_alloc_rel(stream->ops, clisockdata, NULL, "r+");
			if (xparam->outputs.client) {
				xparam->outputs.client->ctx = stream->ctx;
				if (stream->ctx) {
					GC_REFCOUNT(stream->ctx)++;
 
> /* technically a fatal error */
 
that can never happen
 
@JoeWatkins why not drop it then?
 
9:10 PM
I know, it's a weird check, at that point no behaviour is surprising
 
the innermost branch is where we need to fetch option ... which may result in two lookups, even if it doesn't, you may feel it ...
@NikiC can you believe I'm still trying to set a single option on a socket ?
yeah it should be dropped ... will remove it ...
 
@JoeWatkins There is also precedent (if you want me to find it you will have to wait until tomorrow but I am 100% certain it is there) for changing the value of a context option after the stream has been initialised having no effect. So if there is any way you can attach it to the server socket (?) then you could just precompute a int sockopts during server socket creation and blindly set it on every peer
 
please, don't show me that ...
 
/me sleeps
nn @all
 
Wes
9:17 PM
gn
 
@Sara Do I remember correctly that HHVM in repo-auth mode is able to determine the types of properties and takes that into account for object layout?
 
@JoeWatkins how about this: a second signature for stream_socket_accept() where the 3rd arg is a callable, which receives the peer_name as an argument. The callable returns a stream context to attach to the peer socket. If the third arg is null or the callback returns nothing then you can skip the hash lookups entirely.
(I haven't thought this through and am going to bed now, but something for you to think on until tomorrow)
or a different function name if that second signature doesn't float your boat
 
invoking the function is much more expensive than the lookups :)
 
@NikiC I know that typing info is used to some extent, especially in the emitter, but I don't /think/ it affects layout any.
@NikiC ISTR discussing using type info to store some props as just the Value (64bit) and not the whole TypedValue (128bit).
 
9:32 PM
@Sara ISTR?
 
Wes
"quite" is my new favorite english word. it means both "absolutely/totally" and "relatively/reasonably" etc. your language is so strange
 
I Seem To Recal
*Recall
 
@Sara Even if used only in the emitter, how does it deal with things like setting a value through reflection?
 
o.O Not sure how that's affected...
Or are you thinking Reflection can violate type hinting?
 
@Sara There is no property type hinting ^^
It's just not clear to me how it's possible to establish types for properties
Unless it's only speculative
Is it speculative?
 
9:37 PM
@Wes quite :)
 
I honestly don't recall where the runtime is at wrt typed properties
It may actually be (all but) thrown out at compile time.
That's where it was 1+ years ago last time I looked at it
 
Wes
@PaulCrovella quite quite :B
 
@Sara hum, okay
thx
Why do we show the title of security bugs in the tracker?
 
@NikiC we don't?
or do you meant upon direct access?
I don't see any title
where did you see the title?
 
@bwoebi in the list view
 
9:51 PM
@NikiC list view? there must be some functionality I don't know yet … link?
or do you mean search?
I don't see it in search?!
 
@bwoebi yes
 
with what search query did you find it?
 
Not everyone's cup of tea, but of interest to many here, or friends of those here (relink where appropriate) Cheap books on hacking/infosec/stuff /cc @ScottArciszewski @ircmaxell (I own bug hunter's diary, and art of exploitation in hard copy, both pretty good)
 
@NikiC I can't find private bugs with serach
 
bugs.php.net/… #72098 is private
or is there a difference between sec & private?
 
9:54 PM
@NikiC seems so
@NikiC I think only bugs which were initially private are hidden
 
why is it when openssl is loaded, it's accept function is invoked for tcp streams ?
 
@JoeWatkins to check whether it needs openssl handling?
 
can that happen ?
 
dunno, I'm just guessing
 
I don't like having to change openssl ...
I'm sure that can't happen ...
 
10:02 PM
not sure
 
@Leigh can you ever need to accept a secure connection from a plain tcp socket, without crypto, not created with openssl ?
 
"secure" ... "without crypto" ...
 
the bound socket is normal tcp socket
but php invoke the openssl accept routine
why is that ?
 
are you referring to the enable_?_crypto php commands?
 
php_openssl_tcp_sockop_accept
this is invoked for stream_socket_accept on a tcp socket ...
 
10:04 PM
I'm going to have to work purely on assumptions... openssl accept performs a handshake on your behalf before handing over the accepted connection?
 
yeah
 
http://git.php.net/?p=web/bugs.git;a=blob;f=include/query.php;h=5f8d4358e45cf4c8f42e1c8d06790cbf643b7494;hb=HEAD#l255

hahahahah
 
I'm actually confused, you're saying a regular tcp socket, with openssl ext, without any ssl in the context, and without enable_crypto, is calling openssl fns?
 
yes
 
I say madness
 
10:06 PM
exactly
we need a person that knows for sure ...
 
was just typing.... I also wouldn't touch openssl ext with a barge pole
 
@JoeWatkins You make that sound like such a person exists
 
aww, really ?
 
it's one of those kettle of monkeys inside a barrel of fish thingies that I don't want to let the worms out of
 
@JoeWatkins I guess everyone will need to read that code up again
 
10:08 PM
sounds like it's hooking because it can, is there any kind of early exit from the openssl func if it isn't required?
 
ffs, I just want to set a single flag ...
how has this turned into needing to read openssl ...
code which I've never looked at ... and probably won't understand ...
 
because streams.
 
# --with-openssl=...
 
will scott know, or anthony ?
 
I still don't understand the question, my guess is they'll have to read the same as the rest of us
 
10:12 PM
the question is what's supposed to happen if you try to negotiate a secure connection with an insecure server, I guess ...
 
as far as I'm away, a tcp stream is either indicated as requiring a secure negotiation via stream wrapper, or has stream crypto enabled post facto. A vanilla tcp stream (obviously) has no dependency on openssl
back to confusion, you've opened a vanilla tcp connection, and then from your end you're trying to negotiate a secure connection when the server doesn't support it?
server should abort
 
no I'm not trying to do that, but that seems to be what the code is preparing for by invoking the openssl accept routine on a plain tcp stream
<?php

$ctxt = stream_context_create([
	"socket" => [
		"tcp_nodelay" => true
	]
]);

$server = stream_socket_server(
	"tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt);

if (!is_resource($server)) {
	die("no server");
}

$pid = pcntl_fork();

if ($pid == -1) {
	die("no fork");
} else if ($pid) {
	$client = stream_socket_accept($server);

	var_dump(socket_get_option(
				socket_import_stream($client),
					STREAM_IPPROTO_TCP, TCP_NODELAY));

	fclose($client);
this
no ssl involved, ssl stuff still invoked ... is the problem ...
omg I'm checking that I haven't accidentally used ssl ...
this is infuriating, I'd rather work on something difficult than something shit ...
 
well I say that is fundamentally wrong (pending argument from someone who knows openssl better)...

the only place I can think of with an automatic upgrade without user intervention, would be curl with hsts or something. otherwise you should be indicating the protocol is secure, or, the protocol is inherently secure and the upgrade is part and parcel
think of a simple protocol, tcp connection, send stuff, receive stuff, die on invalid data... an openssl instigated negotiation should kill the connection
@JoeWatkins are you sure a negotiation is actually happening, or is it just a hook that's aborting early?
 
no negotiation
if (xparam->outputs.client && sock->enable_on_connect)
maybe it looks on purpose ...
 
so it's a just-in-case call, but aborts before work is done, leaving you with your vanilla tcp stream
 
10:21 PM
enable_on_connect is a really really confusing thing isn't it ?
 
it makes sense it has to analyse the context to see if it should do work
(if that's what it's doing)
 
openssl overrides everything
not just accept
this must mean that ipv6-only and reuseport don't work on secure connections
I've had enough of today, I'm off to bed ... nn all
 
Wes
10:40 PM
\o
 
o/
 
 
1 hour later…
11:52 PM
Moin
 
Wes
mornin
 

« first day (2020 days earlier)      last day (2931 days later) »