Offsets of `struct Port` are no longer constant

Started by Jacob Championover 1 year ago6 messageshackers
Jump to latest
#1Jacob Champion
jacob.champion@enterprisedb.com

Hi all,

A comment at the end of the Port struct says

/*
* OpenSSL structures. (Keep these last so that the locations of other
* fields are the same whether or not you build with SSL enabled.)
*/

but as part of the direct-SSL changes in d39a49c1e45 (cc'd Heikki),
some additional fields snuck in after it.

I assume it's too late to change this for 17, but should this be
addressed in HEAD? I've attached a draft patch (untested, beware)
which should no longer rely on field order.

Thanks,
--Jacob

Attachments:

port-offset.diffapplication/octet-stream; name=port-offset.diffDownload+5-2
#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Jacob Champion (#1)
Re: Offsets of `struct Port` are no longer constant

On 11/11/2024 18:34, Jacob Champion wrote:

Hi all,

A comment at the end of the Port struct says

/*
* OpenSSL structures. (Keep these last so that the locations of other
* fields are the same whether or not you build with SSL enabled.)
*/

but as part of the direct-SSL changes in d39a49c1e45 (cc'd Heikki),
some additional fields snuck in after it.

I assume it's too late to change this for 17, but should this be
addressed in HEAD? I've attached a draft patch (untested, beware)
which should no longer rely on field order.

Oops. Fortunately this is not likely to cause trouble in practice, I
can't imagine an extension peeking into 'raw_buf' and friends. But yeah,
we should do something at least on HEAD. +1 on your patch; I'll commit
that unless someone has better ideas.

On REL_17_STABLE, we should probably adjust the comment to warn that
'raw_buf' and friends can move depending on USE_OPENSSL.

--
Heikki Linnakangas
Neon (https://neon.tech)

#3Jacob Champion
jacob.champion@enterprisedb.com
In reply to: Heikki Linnakangas (#2)
Re: Offsets of `struct Port` are no longer constant

On Mon, Nov 11, 2024 at 11:13 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On REL_17_STABLE, we should probably adjust the comment to warn that
'raw_buf' and friends can move depending on USE_OPENSSL.

Yeah, makes sense.

--Jacob

#4Daniel Gustafsson
daniel@yesql.se
In reply to: Jacob Champion (#3)
Re: Offsets of `struct Port` are no longer constant

On 11 Nov 2024, at 20:17, Jacob Champion <jacob.champion@enterprisedb.com> wrote:

On Mon, Nov 11, 2024 at 11:13 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On REL_17_STABLE, we should probably adjust the comment to warn that
'raw_buf' and friends can move depending on USE_OPENSSL.

Yeah, makes sense.

+1

#5Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Daniel Gustafsson (#4)
Re: Offsets of `struct Port` are no longer constant

On 11/11/2024 21:43, Daniel Gustafsson wrote:

On 11 Nov 2024, at 20:17, Jacob Champion <jacob.champion@enterprisedb.com> wrote:

On Mon, Nov 11, 2024 at 11:13 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On REL_17_STABLE, we should probably adjust the comment to warn that
'raw_buf' and friends can move depending on USE_OPENSSL.

Yeah, makes sense.

+1

Ok, committed the "placeholder" fields to master, and just comment fixes
to REL_17_STABLE.

--
Heikki Linnakangas
Neon (https://neon.tech)

#6Jacob Champion
jacob.champion@enterprisedb.com
In reply to: Heikki Linnakangas (#5)
Re: Offsets of `struct Port` are no longer constant

On Fri, Nov 22, 2024 at 8:06 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:

Ok, committed the "placeholder" fields to master, and just comment fixes
to REL_17_STABLE.

Thanks!

--Jacob