agora inbox for [email protected]
help / color / mirror / Atom feedRe: 7.4 feature freeze is here
264+ messages / 3 participants
[nested] [flat]
* Re: 7.4 feature freeze is here
@ 2003-07-04 06:03 Josh Berkus <[email protected]>
2003-07-04 06:15 ` Re: 7.4 feature freeze is here Philip Yarra <[email protected]>
0 siblings, 1 reply; 264+ messages in thread
From: Josh Berkus @ 2003-07-04 06:03 UTC (permalink / raw)
To: Christopher Kings-Lynne <[email protected]>; Philip Yarra <[email protected]>; Bruce Momjian <[email protected]>; +Cc: pgsql-hackers
Folks,
> > You might like to mention that (as far as I can tell) ECPG is now safe
> > for pthreads on Linux and FreeBSD. The recursive mutex locks are removed,
> > so
>
> even
>
> > platforms that implement the earlier version of pthreads ought to work as
> > well, once configure supports them (anyone care to actually test this
> > assertion?)
I don't quite understand this. This doesn't mean that *postgresql* is
threaded, does it?
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 264+ messages in thread
* Re: 7.4 feature freeze is here
2003-07-04 06:03 Re: 7.4 feature freeze is here Josh Berkus <[email protected]>
@ 2003-07-04 06:15 ` Philip Yarra <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Philip Yarra @ 2003-07-04 06:15 UTC (permalink / raw)
To: Josh Berkus <[email protected]>; Christopher Kings-Lynne <[email protected]>; Bruce Momjian <[email protected]>; +Cc: pgsql-hackers
On Fri, 4 Jul 2003 04:03 pm, Josh Berkus wrote:
> I don't quite understand this. This doesn't mean that *postgresql* is
> threaded, does it?
I was just referring to the client interfaces ECPG and libpq. AFAIK the
back-end is not threaded (and I'm beginning to understand why not).
So my app starts multiple threads of execution through the ECPG libs... the
ECPG libs (and libpq) start multiple sockets to the back-end - one for each
thread. No changes to the back-end.
That's my understanding - Lee did most of the work, so maybe he can confirm
that.
Regards, Philip Yarra.
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment;
filename="v6-0002-Provide-relfilenode-statistics.patch"
Content-Transfer-Encoding: 8bit
^ permalink raw reply [nested|flat] 264+ messages in thread
* [PATCH v6 1/2] Clear padding in PgStat_HashKey keys
@ 2024-11-02 14:21 Bertrand Drouvot <[email protected]>
0 siblings, 0 replies; 264+ messages in thread
From: Bertrand Drouvot @ 2024-11-02 14:21 UTC (permalink / raw)
PgStat_HashKey keys are currently initialized in a way that could result in random
data in the padding bytes (if there was padding in PgStat_HashKey which is not
the case currently).
We are using sizeof(PgStat_HashKey) in pgstat_cmp_hash_key() and we compute the
hash hash key in pgstat_hash_hash_key() using the PgStat_HashKey struct size as
input. So, we have to ensure that no random data can be stored in the padding
bytes (if any) of a PgStat_HashKey key.
---
src/backend/utils/activity/pgstat.c | 3 +++
src/backend/utils/activity/pgstat_shmem.c | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
100.0% src/backend/utils/activity/
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index be48432cc3..ea8c5691e8 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -938,6 +938,9 @@ pgstat_fetch_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
pgstat_prep_snapshot();
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
key.kind = kind;
key.dboid = dboid;
key.objid = objid;
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index a09c6fee05..c1b7ff76b1 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -432,11 +432,18 @@ PgStat_EntryRef *
pgstat_get_entry_ref(PgStat_Kind kind, Oid dboid, uint64 objid, bool create,
bool *created_entry)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shhashent;
PgStatShared_Common *shheader = NULL;
PgStat_EntryRef *entry_ref;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/*
* passing in created_entry only makes sense if we possibly could create
* entry.
@@ -908,10 +915,17 @@ pgstat_drop_database_and_contents(Oid dboid)
bool
pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid)
{
- PgStat_HashKey key = {.kind = kind,.dboid = dboid,.objid = objid};
+ PgStat_HashKey key;
PgStatShared_HashEntry *shent;
bool freed = true;
+ /* clear padding */
+ memset(&key, 0, sizeof(struct PgStat_HashKey));
+
+ key.kind = kind;
+ key.dboid = dboid;
+ key.objid = objid;
+
/* delete local reference */
if (pgStatEntryRefHash)
{
--
2.34.1
--gvmrl0mfoTEJEfPE
Content-Type: text/x-diff; charset=utf-8
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 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
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 --
2003-07-04 06:03 Re: 7.4 feature freeze is here Josh Berkus <[email protected]>
2003-07-04 06:15 ` Philip Yarra <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-11-02 14:21 [PATCH v6 1/2] Clear padding in PgStat_HashKey keys Bertrand Drouvot <[email protected]>
2024-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 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]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox