agora inbox for [email protected]
help / color / mirror / Atom feedRe: Re: unanswered: Schema Issue
264+ messages / 3 participants
[nested] [flat]
* Re: Re: unanswered: Schema Issue
@ 2001-04-26 19:24 V. M. <[email protected]>
2001-04-26 19:32 ` Re: [HACKERS] Re: unanswered: Schema Issue Joel Burton <[email protected]>
0 siblings, 1 reply; 264+ messages in thread
From: V. M. @ 2001-04-26 19:24 UTC (permalink / raw)
To: pgsql-hackers; +Cc: [email protected]
perhaps adding t.tgargs to your view enable me to extract parameters
that are the related fields
---------------------------------------
CREATE VIEW dev_ri
AS
SELECT ***** t.tgargs **** , t.oid as trigoid,
c.relname as trig_tbl,
t.tgfoid,
f.proname as trigfunc,
t.tgenabled,
t.tgconstrname,
c2.relname as const_tbl,
t.tgdeferrable,
t.tginitdeferred
FROM pg_trigger t,
pg_class c,
pg_class c2,
pg_proc f
WHERE t.tgrelid=c.oid
AND t.tgconstrrelid=c2.oid
AND tgfoid=f.oid
AND tgname ~ '^RI_'
ORDER BY t.oid;
a tgargs example is:
fk_provincie_id_paesi_id_provin\000paesi\000province\000UNSPECIFIED\000id_provincia\000id\000
first field (fk_provincie_id_paesi_id_provin) is constraint name, and i can
understand that: paesi(id_provincia) references provincia(id).
valter
>From: Joel Burton <[email protected]>
>To: "V. M." <[email protected]>
>CC: [email protected]
>Subject: [HACKERS] Re: unanswered: Schema Issue
>Date: Thu, 26 Apr 2001 14:42:31 -0400 (EDT)
>
>On Thu, 26 Apr 2001, V. M. wrote:
>
> > ok for serials, now i can extract from psql (\d tablename).
> >
> > But i'm not able to extract foreign keys from the schema.
>
>Yes you can. Read my tutorial on Referential Integrity in the top section
>at techdocs.postgresql.org.
>
>--
>Joel Burton <[email protected]>
>Director of Information Systems, Support Center of Washington
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
^ permalink raw reply [nested|flat] 264+ messages in thread
* Re: [HACKERS] Re: unanswered: Schema Issue
2001-04-26 19:24 Re: Re: unanswered: Schema Issue V. M. <[email protected]>
@ 2001-04-26 19:32 ` Joel Burton <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Joel Burton @ 2001-04-26 19:32 UTC (permalink / raw)
To: V. M. <[email protected]>; +Cc: [email protected]; pgsql-hackers
On Thu, 26 Apr 2001, V. M. wrote:
(moving this conversation back to pgsql-general, followups to there)
> perhaps adding t.tgargs to your view enable me to extract parameters
> that are the related fields
At SCW, we use a naming convention for RI triggers, to allow
us to easily extract that, and deal with error messages.
We use:
CREATE TABLE p (id INT);
CREATE TABLE c (id INT CONSTRAINT c__ref_id REFERENCES p);
This allows us at a glance to see in error messages what field of what
table we were referencing. In an Access front end, we can trap this
error message to a nice statement like "You're trying to change a value in
the table "c", using information in table "p", "id", but...")
If you don't have this, yes, you can look at in
the tgargs, but, given that its a bytea field, it's hard to
programmatically dig anything out of it.
HTH,
--
Joel Burton <[email protected]>
Director of Information Systems, Support Center of Washington
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v1] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--Dqk2D9QbcLZswiIf--
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v1] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--Dqk2D9QbcLZswiIf--
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
end of thread, other threads:[~2024-11-02 14:21 UTC | newest]
Thread overview: 264+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-26 19:24 Re: Re: unanswered: Schema Issue V. M. <[email protected]>
2001-04-26 19:32 ` Joel Burton <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v1] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v1] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox