summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-Add-support-for-RISC-V.patch10
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-Improve-reproducibility.patch6
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-Properly-NULL-terminate-GSS-receive-buffer-on-error-.patch50
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-config_info.c-not-expose-build-info.patch18
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-configure.ac-bypass-autoconf-2.69-version-check.patch6
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/0001-postgresql-fix-ptest-failure-of-sysviews.patch11
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/CVE-2023-2454.patch235
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/CVE-2023-2455.patch118
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/not-check-libperl.patch10
-rw-r--r--meta-oe/recipes-dbs/postgresql/files/remove_duplicate.patch38
-rw-r--r--meta-oe/recipes-dbs/postgresql/postgresql_14.9.bb (renamed from meta-oe/recipes-dbs/postgresql/postgresql_14.5.bb)8
11 files changed, 31 insertions, 479 deletions
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-Add-support-for-RISC-V.patch b/meta-oe/recipes-dbs/postgresql/files/0001-Add-support-for-RISC-V.patch
index 90b7419495..46343674fc 100644
--- a/meta-oe/recipes-dbs/postgresql/files/0001-Add-support-for-RISC-V.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/0001-Add-support-for-RISC-V.patch
@@ -1,16 +1,17 @@
1From 780fd27ea6f7f2c446c46a7a5e26d94106c67efd Mon Sep 17 00:00:00 2001 1From 0801befde991250b4502954fdec61bec8c33da3b Mon Sep 17 00:00:00 2001
2From: "Richard W.M. Jones" <rjones@redhat.com> 2From: "Richard W.M. Jones" <rjones@redhat.com>
3Date: Sun, 20 Nov 2016 15:04:52 +0000 3Date: Sun, 20 Nov 2016 15:04:52 +0000
4Subject: [PATCH] Add support for RISC-V. 4Subject: [PATCH] Add support for RISC-V.
5 5
6The architecture is sufficiently similar to aarch64 that simply 6The architecture is sufficiently similar to aarch64 that simply
7extending the existing aarch64 macro works. 7extending the existing aarch64 macro works.
8
8--- 9---
9 src/include/storage/s_lock.h | 5 +++-- 10 src/include/storage/s_lock.h | 5 +++--
10 1 file changed, 3 insertions(+), 2 deletions(-) 11 1 file changed, 3 insertions(+), 2 deletions(-)
11 12
12diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h 13diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
13index dccbd29..ad60429 100644 14index 95049f0..e08c963 100644
14--- a/src/include/storage/s_lock.h 15--- a/src/include/storage/s_lock.h
15+++ b/src/include/storage/s_lock.h 16+++ b/src/include/storage/s_lock.h
16@@ -317,11 +317,12 @@ tas(volatile slock_t *lock) 17@@ -317,11 +317,12 @@ tas(volatile slock_t *lock)
@@ -35,7 +36,4 @@ index dccbd29..ad60429 100644
35+#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */ 36+#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */
36 37
37 38
38 /* 39 /* S/390 and S/390x Linux (32- and 64-bit zSeries) */
39--
402.34.1
41
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-Improve-reproducibility.patch b/meta-oe/recipes-dbs/postgresql/files/0001-Improve-reproducibility.patch
index 02f4c9e513..eeffe6bcb1 100644
--- a/meta-oe/recipes-dbs/postgresql/files/0001-Improve-reproducibility.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/0001-Improve-reproducibility.patch
@@ -1,4 +1,4 @@
1From bbba8a5261a99e79c9cd4693ef56021014a9856b Mon Sep 17 00:00:00 2001 1From e167d58d6be1b1ee4d49571650444700ab97ed7c Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com> 2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 28 Dec 2020 16:38:21 +0800 3Date: Mon, 28 Dec 2020 16:38:21 +0800
4Subject: [PATCH] Improve reproducibility, 4Subject: [PATCH] Improve reproducibility,
@@ -18,6 +18,7 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
18 18
19update patch for v13.1 19update patch for v13.1
20Signed-off-by: Changqing Li <changqing.li@windriver.com> 20Signed-off-by: Changqing Li <changqing.li@windriver.com>
21
21--- 22---
22 src/common/Makefile | 3 --- 23 src/common/Makefile | 3 ---
23 1 file changed, 3 deletions(-) 24 1 file changed, 3 deletions(-)
@@ -36,6 +37,3 @@ index 880722f..7a9b9d4 100644
36 override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\"" 37 override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
37 override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\"" 38 override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
38 override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\"" 39 override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
39--
402.34.1
41
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-Properly-NULL-terminate-GSS-receive-buffer-on-error-.patch b/meta-oe/recipes-dbs/postgresql/files/0001-Properly-NULL-terminate-GSS-receive-buffer-on-error-.patch
deleted file mode 100644
index 2d11b18883..0000000000
--- a/meta-oe/recipes-dbs/postgresql/files/0001-Properly-NULL-terminate-GSS-receive-buffer-on-error-.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 586b074026d703c29057b04b1318e984701fe195 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 2 Mar 2023 19:10:47 +0800
4Subject: [PATCH] Properly NULL-terminate GSS receive buffer on error packet
5 reception
6
7pqsecure_open_gss() includes a code path handling error messages with
8v2-style protocol messages coming from the server. The client-side
9buffer holding the error message does not force a NULL-termination, with
10the data of the server getting copied to the errorMessage of the
11connection. Hence, it would be possible for a server to send an
12unterminated string and copy arbitrary bytes in the buffer receiving the
13error message in the client, opening the door to a crash or even data
14exposure.
15
16As at this stage of the authentication process the exchange has not been
17completed yet, this could be abused by an attacker without Kerberos
18credentials. Clients that have a valid kerberos cache are vulnerable as
19libpq opportunistically requests for it except if gssencmode is
20disabled.
21
22Author: Jacob Champion
23Backpatch-through: 12
24Security: CVE-2022-41862
25
26Upstream-Status: Backport [https://github.com/postgres/postgres/commit/71c37797d7bd78266146a5829ab62b3687c47295]
27CVE: CVE-2022-41862
28
29Signed-off-by: Changqing Li <changqing.li@windriver.com>
30---
31 src/interfaces/libpq/fe-secure-gssapi.c | 3 ++-
32 1 file changed, 2 insertions(+), 1 deletion(-)
33
34diff --git a/src/interfaces/libpq/fe-secure-gssapi.c b/src/interfaces/libpq/fe-secure-gssapi.c
35index c783a53..a42ebc0 100644
36--- a/src/interfaces/libpq/fe-secure-gssapi.c
37+++ b/src/interfaces/libpq/fe-secure-gssapi.c
38@@ -577,7 +577,8 @@ pqsecure_open_gss(PGconn *conn)
39 return result;
40
41 PqGSSRecvLength += ret;
42-
43+ Assert(PqGSSRecvLength < PQ_GSS_RECV_BUFFER_SIZE);
44+ PqGSSRecvBuffer[PqGSSRecvLength] = '\0';
45 appendPQExpBuffer(&conn->errorMessage, "%s\n", PqGSSRecvBuffer + 1);
46
47 return PGRES_POLLING_FAILED;
48--
492.25.1
50
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-config_info.c-not-expose-build-info.patch b/meta-oe/recipes-dbs/postgresql/files/0001-config_info.c-not-expose-build-info.patch
index 52ca276da6..eff69140f7 100644
--- a/meta-oe/recipes-dbs/postgresql/files/0001-config_info.c-not-expose-build-info.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/0001-config_info.c-not-expose-build-info.patch
@@ -1,4 +1,4 @@
1From b92eebe8b0760fee7bd55c6c22318620c2c07579 Mon Sep 17 00:00:00 2001 1From 805f03529c7fc33685979651562112bab524e5a5 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com> 2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Mon, 1 Aug 2022 15:44:38 +0800 3Date: Mon, 1 Aug 2022 15:44:38 +0800
4Subject: [PATCH] config_info.c: not expose build info 4Subject: [PATCH] config_info.c: not expose build info
@@ -8,13 +8,14 @@ Don't collect the build information to fix the buildpaths issue.
8Upstream-Status: Inappropriate [oe specific] 8Upstream-Status: Inappropriate [oe specific]
9 9
10Signed-off-by: Mingli Yu <mingli.yu@windriver.com> 10Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
11
11--- 12---
12 configure.ac | 2 +- 13 configure.ac | 2 +-
13 src/common/config_info.c | 68 ---------------------------------------- 14 src/common/config_info.c | 70 +---------------------------------------
14 2 files changed, 1 insertion(+), 69 deletions(-) 15 2 files changed, 2 insertions(+), 70 deletions(-)
15 16
16diff --git a/configure.ac b/configure.ac 17diff --git a/configure.ac b/configure.ac
17index 0eb595b..508487b 100644 18index 54a539e..c6edc0a 100644
18--- a/configure.ac 19--- a/configure.ac
19+++ b/configure.ac 20+++ b/configure.ac
20@@ -23,7 +23,7 @@ AC_COPYRIGHT([Copyright (c) 1996-2021, PostgreSQL Global Development Group]) 21@@ -23,7 +23,7 @@ AC_COPYRIGHT([Copyright (c) 1996-2021, PostgreSQL Global Development Group])
@@ -27,10 +28,10 @@ index 0eb595b..508487b 100644
27 [PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`] 28 [PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`]
28 [PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`] 29 [PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`]
29diff --git a/src/common/config_info.c b/src/common/config_info.c 30diff --git a/src/common/config_info.c b/src/common/config_info.c
30index e72e729..b482c20 100644 31index e72e729..a020236 100644
31--- a/src/common/config_info.c 32--- a/src/common/config_info.c
32+++ b/src/common/config_info.c 33+++ b/src/common/config_info.c
33@@ -38,7 +38,7 @@ 34@@ -38,7 +38,7 @@ get_configdata(const char *my_exec_path, size_t *configdata_len)
34 int i = 0; 35 int i = 0;
35 36
36 /* Adjust this to match the number of items filled below */ 37 /* Adjust this to match the number of items filled below */
@@ -39,7 +40,7 @@ index e72e729..b482c20 100644
39 configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData)); 40 configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
40 41
41 configdata[i].name = pstrdup("BINDIR"); 42 configdata[i].name = pstrdup("BINDIR");
42@@ -123,74 +123,6 @@ 43@@ -123,74 +123,6 @@ get_configdata(const char *my_exec_path, size_t *configdata_len)
43 configdata[i].setting = pstrdup(path); 44 configdata[i].setting = pstrdup(path);
44 i++; 45 i++;
45 46
@@ -114,6 +115,3 @@ index e72e729..b482c20 100644
114 configdata[i].name = pstrdup("VERSION"); 115 configdata[i].name = pstrdup("VERSION");
115 configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION); 116 configdata[i].setting = pstrdup("PostgreSQL " PG_VERSION);
116 i++; 117 i++;
117--
1182.25.1
119
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-configure.ac-bypass-autoconf-2.69-version-check.patch b/meta-oe/recipes-dbs/postgresql/files/0001-configure.ac-bypass-autoconf-2.69-version-check.patch
index 4a576d7172..8ffefbe341 100644
--- a/meta-oe/recipes-dbs/postgresql/files/0001-configure.ac-bypass-autoconf-2.69-version-check.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/0001-configure.ac-bypass-autoconf-2.69-version-check.patch
@@ -1,4 +1,4 @@
1From 258c6bd2ad96f2c42f1cb5f4c84e4ca5865059f0 Mon Sep 17 00:00:00 2001 1From 2d3ac7b2eab1bba53c1729e8edb9f8a86700b60f Mon Sep 17 00:00:00 2001
2From: Yi Fan Yu <yifan.yu@windriver.com> 2From: Yi Fan Yu <yifan.yu@windriver.com>
3Date: Fri, 5 Feb 2021 17:15:42 -0500 3Date: Fri, 5 Feb 2021 17:15:42 -0500
4Subject: [PATCH] configure.ac: bypass autoconf 2.69 version check 4Subject: [PATCH] configure.ac: bypass autoconf 2.69 version check
@@ -14,12 +14,12 @@ Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
14 1 file changed, 4 deletions(-) 14 1 file changed, 4 deletions(-)
15 15
16diff --git a/configure.ac b/configure.ac 16diff --git a/configure.ac b/configure.ac
17index ffe878e..c39799b 100644 17index d0f0b14..54a539e 100644
18--- a/configure.ac 18--- a/configure.ac
19+++ b/configure.ac 19+++ b/configure.ac
20@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros 20@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
21 21
22 AC_INIT([PostgreSQL], [14.5], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/]) 22 AC_INIT([PostgreSQL], [14.9], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
23 23
24-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required. 24-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
25-Untested combinations of 'autoconf' and PostgreSQL versions are not 25-Untested combinations of 'autoconf' and PostgreSQL versions are not
diff --git a/meta-oe/recipes-dbs/postgresql/files/0001-postgresql-fix-ptest-failure-of-sysviews.patch b/meta-oe/recipes-dbs/postgresql/files/0001-postgresql-fix-ptest-failure-of-sysviews.patch
index 4db36d26fd..555fd7f1fc 100644
--- a/meta-oe/recipes-dbs/postgresql/files/0001-postgresql-fix-ptest-failure-of-sysviews.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/0001-postgresql-fix-ptest-failure-of-sysviews.patch
@@ -1,4 +1,4 @@
1From 9f81377dddfe32d950844d7053020a36b40fce08 Mon Sep 17 00:00:00 2001 1From 5a17b7b88776cbbe5b37838baff71726b8a6e7dd Mon Sep 17 00:00:00 2001
2From: Manoj Saun <manojsingh.saun@windriver.com> 2From: Manoj Saun <manojsingh.saun@windriver.com>
3Date: Wed, 22 Mar 2023 08:07:26 +0000 3Date: Wed, 22 Mar 2023 08:07:26 +0000
4Subject: [PATCH] postgresql: fix ptest failure of sysviews 4Subject: [PATCH] postgresql: fix ptest failure of sysviews
@@ -13,14 +13,17 @@ to make the test output shown as pass.
13Upstream-Status: Inappropriate [oe specific] 13Upstream-Status: Inappropriate [oe specific]
14 14
15Signed-off-by: Manoj Saun <manojsingh.saun@windriver.com> 15Signed-off-by: Manoj Saun <manojsingh.saun@windriver.com>
16
16--- 17---
17 src/test/regress/expected/sysviews.out | 2 +- 18 src/test/regress/expected/sysviews.out | 2 +-
18 src/test/regress/sql/sysviews.sql | 2 +- 19 src/test/regress/sql/sysviews.sql | 2 +-
19 2 files changed, 2 insertions(+), 2 deletions(-) 20 2 files changed, 2 insertions(+), 2 deletions(-)
20 21
22diff --git a/src/test/regress/expected/sysviews.out b/src/test/regress/expected/sysviews.out
23index 2088857..96a15cc 100644
21--- a/src/test/regress/expected/sysviews.out 24--- a/src/test/regress/expected/sysviews.out
22+++ b/src/test/regress/expected/sysviews.out 25+++ b/src/test/regress/expected/sysviews.out
23@@ -29,7 +29,7 @@ select name, ident, parent, level, total 26@@ -29,7 +29,7 @@ select name, ident, parent, level, total_bytes >= free_bytes
24 (1 row) 27 (1 row)
25 28
26 -- At introduction, pg_config had 23 entries; it may grow 29 -- At introduction, pg_config had 23 entries; it may grow
@@ -29,9 +32,11 @@ Signed-off-by: Manoj Saun <manojsingh.saun@windriver.com>
29 ok 32 ok
30 ---- 33 ----
31 t 34 t
35diff --git a/src/test/regress/sql/sysviews.sql b/src/test/regress/sql/sysviews.sql
36index b24816e..72ff887 100644
32--- a/src/test/regress/sql/sysviews.sql 37--- a/src/test/regress/sql/sysviews.sql
33+++ b/src/test/regress/sql/sysviews.sql 38+++ b/src/test/regress/sql/sysviews.sql
34@@ -18,7 +18,7 @@ select name, ident, parent, level, total 39@@ -18,7 +18,7 @@ select name, ident, parent, level, total_bytes >= free_bytes
35 from pg_backend_memory_contexts where level = 0; 40 from pg_backend_memory_contexts where level = 0;
36 41
37 -- At introduction, pg_config had 23 entries; it may grow 42 -- At introduction, pg_config had 23 entries; it may grow
diff --git a/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2454.patch b/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2454.patch
deleted file mode 100644
index a2f6927e30..0000000000
--- a/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2454.patch
+++ /dev/null
@@ -1,235 +0,0 @@
1From 23cb8eaeb97df350273cb8902e55842a955339c8 Mon Sep 17 00:00:00 2001
2From: Noah Misch <noah@leadboat.com>
3Date: Mon, 8 May 2023 06:14:07 -0700
4Subject: [PATCH] Replace last PushOverrideSearchPath() call with
5 set_config_option().
6
7The two methods don't cooperate, so set_config_option("search_path",
8...) has been ineffective under non-empty overrideStack. This defect
9enabled an attacker having database-level CREATE privilege to execute
10arbitrary code as the bootstrap superuser. While that particular attack
11requires v13+ for the trusted extension attribute, other attacks are
12feasible in all supported versions.
13
14Standardize on the combination of NewGUCNestLevel() and
15set_config_option("search_path", ...). It is newer than
16PushOverrideSearchPath(), more-prevalent, and has no known
17disadvantages. The "override" mechanism remains for now, for
18compatibility with out-of-tree code. Users should update such code,
19which likely suffers from the same sort of vulnerability closed here.
20Back-patch to v11 (all supported versions).
21
22Alexander Lakhin. Reported by Alexander Lakhin.
23
24Security: CVE-2023-2454
25
26Upstream-Status: Backport [https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=23cb8eaeb97df350273cb8902e55842a955339c8]
27CVE: CVE-2023-2454
28Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
29---
30 src/backend/catalog/namespace.c | 4 +++
31 src/backend/commands/schemacmds.c | 37 ++++++++++++++------
32 src/test/regress/expected/namespace.out | 45 +++++++++++++++++++++++++
33 src/test/regress/sql/namespace.sql | 24 +++++++++++++
34 4 files changed, 100 insertions(+), 10 deletions(-)
35
36diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
37index 81b6472..0175a91 100644
38--- a/src/backend/catalog/namespace.c
39+++ b/src/backend/catalog/namespace.c
40@@ -3518,6 +3518,10 @@ OverrideSearchPathMatchesCurrent(OverrideSearchPath *path)
41 /*
42 * PushOverrideSearchPath - temporarily override the search path
43 *
44+ * Do not use this function; almost any usage introduces a security
45+ * vulnerability. It exists for the benefit of legacy code running in
46+ * non-security-sensitive environments.
47+ *
48 * We allow nested overrides, hence the push/pop terminology. The GUC
49 * search_path variable is ignored while an override is active.
50 *
51diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
52index 66306d1..ecd0cbb 100644
53--- a/src/backend/commands/schemacmds.c
54+++ b/src/backend/commands/schemacmds.c
55@@ -29,6 +29,7 @@
56 #include "commands/schemacmds.h"
57 #include "miscadmin.h"
58 #include "parser/parse_utilcmd.h"
59+#include "parser/scansup.h"
60 #include "tcop/utility.h"
61 #include "utils/acl.h"
62 #include "utils/builtins.h"
63@@ -52,14 +53,16 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
64 {
65 const char *schemaName = stmt->schemaname;
66 Oid namespaceId;
67- OverrideSearchPath *overridePath;
68 List *parsetree_list;
69 ListCell *parsetree_item;
70 Oid owner_uid;
71 Oid saved_uid;
72 int save_sec_context;
73+ int save_nestlevel;
74+ char *nsp = namespace_search_path;
75 AclResult aclresult;
76 ObjectAddress address;
77+ StringInfoData pathbuf;
78
79 GetUserIdAndSecContext(&saved_uid, &save_sec_context);
80
81@@ -152,14 +155,26 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
82 CommandCounterIncrement();
83
84 /*
85- * Temporarily make the new namespace be the front of the search path, as
86- * well as the default creation target namespace. This will be undone at
87- * the end of this routine, or upon error.
88+ * Prepend the new schema to the current search path.
89+ *
90+ * We use the equivalent of a function SET option to allow the setting to
91+ * persist for exactly the duration of the schema creation. guc.c also
92+ * takes care of undoing the setting on error.
93 */
94- overridePath = GetOverrideSearchPath(CurrentMemoryContext);
95- overridePath->schemas = lcons_oid(namespaceId, overridePath->schemas);
96- /* XXX should we clear overridePath->useTemp? */
97- PushOverrideSearchPath(overridePath);
98+ save_nestlevel = NewGUCNestLevel();
99+
100+ initStringInfo(&pathbuf);
101+ appendStringInfoString(&pathbuf, quote_identifier(schemaName));
102+
103+ while (scanner_isspace(*nsp))
104+ nsp++;
105+
106+ if (*nsp != '\0')
107+ appendStringInfo(&pathbuf, ", %s", nsp);
108+
109+ (void) set_config_option("search_path", pathbuf.data,
110+ PGC_USERSET, PGC_S_SESSION,
111+ GUC_ACTION_SAVE, true, 0, false);
112
113 /*
114 * Report the new schema to possibly interested event triggers. Note we
115@@ -213,8 +228,10 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
116 CommandCounterIncrement();
117 }
118
119- /* Reset search path to normal state */
120- PopOverrideSearchPath();
121+ /*
122+ * Restore the GUC variable search_path we set above.
123+ */
124+ AtEOXact_GUC(true, save_nestlevel);
125
126 /* Reset current user and security context */
127 SetUserIdAndSecContext(saved_uid, save_sec_context);
128diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out
129index 2564d1b..a62fd8d 100644
130--- a/src/test/regress/expected/namespace.out
131+++ b/src/test/regress/expected/namespace.out
132@@ -1,6 +1,14 @@
133 --
134 -- Regression tests for schemas (namespaces)
135 --
136+-- set the whitespace-only search_path to test that the
137+-- GUC list syntax is preserved during a schema creation
138+SELECT pg_catalog.set_config('search_path', ' ', false);
139+ set_config
140+------------
141+
142+(1 row)
143+
144 CREATE SCHEMA test_ns_schema_1
145 CREATE UNIQUE INDEX abc_a_idx ON abc (a)
146 CREATE VIEW abc_view AS
147@@ -9,6 +17,43 @@ CREATE SCHEMA test_ns_schema_1
148 a serial,
149 b int UNIQUE
150 );
151+-- verify that the correct search_path restored on abort
152+SET search_path to public;
153+BEGIN;
154+SET search_path to public, test_ns_schema_1;
155+CREATE SCHEMA test_ns_schema_2
156+ CREATE VIEW abc_view AS SELECT c FROM abc;
157+ERROR: column "c" does not exist
158+LINE 2: CREATE VIEW abc_view AS SELECT c FROM abc;
159+ ^
160+COMMIT;
161+SHOW search_path;
162+ search_path
163+-------------
164+ public
165+(1 row)
166+
167+-- verify that the correct search_path preserved
168+-- after creating the schema and on commit
169+BEGIN;
170+SET search_path to public, test_ns_schema_1;
171+CREATE SCHEMA test_ns_schema_2
172+ CREATE VIEW abc_view AS SELECT a FROM abc;
173+SHOW search_path;
174+ search_path
175+--------------------------
176+ public, test_ns_schema_1
177+(1 row)
178+
179+COMMIT;
180+SHOW search_path;
181+ search_path
182+--------------------------
183+ public, test_ns_schema_1
184+(1 row)
185+
186+DROP SCHEMA test_ns_schema_2 CASCADE;
187+NOTICE: drop cascades to view test_ns_schema_2.abc_view
188 -- verify that the objects were created
189 SELECT COUNT(*) FROM pg_class WHERE relnamespace =
190 (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
191diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql
192index 6b12c96..3474f5e 100644
193--- a/src/test/regress/sql/namespace.sql
194+++ b/src/test/regress/sql/namespace.sql
195@@ -2,6 +2,10 @@
196 -- Regression tests for schemas (namespaces)
197 --
198
199+-- set the whitespace-only search_path to test that the
200+-- GUC list syntax is preserved during a schema creation
201+SELECT pg_catalog.set_config('search_path', ' ', false);
202+
203 CREATE SCHEMA test_ns_schema_1
204 CREATE UNIQUE INDEX abc_a_idx ON abc (a)
205
206@@ -13,6 +17,26 @@ CREATE SCHEMA test_ns_schema_1
207 b int UNIQUE
208 );
209
210+-- verify that the correct search_path restored on abort
211+SET search_path to public;
212+BEGIN;
213+SET search_path to public, test_ns_schema_1;
214+CREATE SCHEMA test_ns_schema_2
215+ CREATE VIEW abc_view AS SELECT c FROM abc;
216+COMMIT;
217+SHOW search_path;
218+
219+-- verify that the correct search_path preserved
220+-- after creating the schema and on commit
221+BEGIN;
222+SET search_path to public, test_ns_schema_1;
223+CREATE SCHEMA test_ns_schema_2
224+ CREATE VIEW abc_view AS SELECT a FROM abc;
225+SHOW search_path;
226+COMMIT;
227+SHOW search_path;
228+DROP SCHEMA test_ns_schema_2 CASCADE;
229+
230 -- verify that the objects were created
231 SELECT COUNT(*) FROM pg_class WHERE relnamespace =
232 (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
233--
2342.25.1
235
diff --git a/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2455.patch b/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2455.patch
deleted file mode 100644
index a94c65cc0c..0000000000
--- a/meta-oe/recipes-dbs/postgresql/files/CVE-2023-2455.patch
+++ /dev/null
@@ -1,118 +0,0 @@
1From 473626cf00babd829eb15c36b51dfb358d32bc95 Mon Sep 17 00:00:00 2001
2From: Tom Lane <tgl@sss.pgh.pa.us>
3Date: Mon, 8 May 2023 10:12:45 -0400
4Subject: [PATCH] Handle RLS dependencies in inlined set-returning functions
5 properly.
6
7If an SRF in the FROM clause references a table having row-level
8security policies, and we inline that SRF into the calling query,
9we neglected to mark the plan as potentially dependent on which
10role is executing it. This could lead to later executions in the
11same session returning or hiding rows that should have been hidden
12or returned instead.
13
14Our thanks to Wolfgang Walther for reporting this problem.
15
16Stephen Frost and Tom Lane
17
18Security: CVE-2023-2455
19
20Upstream-Status: Backport [https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=473626cf00babd829eb15c36b51dfb358d32bc95]
21CVE: CVE-2023-2455
22Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
23---
24 src/backend/optimizer/util/clauses.c | 7 ++++++
25 src/test/regress/expected/rowsecurity.out | 27 +++++++++++++++++++++++
26 src/test/regress/sql/rowsecurity.sql | 20 +++++++++++++++++
27 3 files changed, 54 insertions(+)
28
29diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
30index 9d7aa8b..da50bef 100644
31--- a/src/backend/optimizer/util/clauses.c
32+++ b/src/backend/optimizer/util/clauses.c
33@@ -5095,6 +5095,13 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
34 */
35 record_plan_function_dependency(root, func_oid);
36
37+ /*
38+ * We must also notice if the inserted query adds a dependency on the
39+ * calling role due to RLS quals.
40+ */
41+ if (querytree->hasRowSecurity)
42+ root->glob->dependsOnRole = true;
43+
44 return querytree;
45
46 /* Here if func is not inlinable: release temp memory and return NULL */
47diff --git a/src/test/regress/expected/rowsecurity.out b/src/test/regress/expected/rowsecurity.out
48index 89397e4..379f988 100644
49--- a/src/test/regress/expected/rowsecurity.out
50+++ b/src/test/regress/expected/rowsecurity.out
51@@ -3982,6 +3982,33 @@ SELECT * FROM rls_tbl;
52
53 DROP TABLE rls_tbl;
54 RESET SESSION AUTHORIZATION;
55+-- CVE-2023-2455: inlining an SRF may introduce an RLS dependency
56+create table rls_t (c text);
57+insert into rls_t values ('invisible to bob');
58+alter table rls_t enable row level security;
59+grant select on rls_t to regress_rls_alice, regress_rls_bob;
60+create policy p1 on rls_t for select to regress_rls_alice using (true);
61+create policy p2 on rls_t for select to regress_rls_bob using (false);
62+create function rls_f () returns setof rls_t
63+ stable language sql
64+ as $$ select * from rls_t $$;
65+prepare q as select current_user, * from rls_f();
66+set role regress_rls_alice;
67+execute q;
68+ current_user | c
69+-------------------+------------------
70+ regress_rls_alice | invisible to bob
71+(1 row)
72+
73+set role regress_rls_bob;
74+execute q;
75+ current_user | c
76+--------------+---
77+(0 rows)
78+
79+RESET ROLE;
80+DROP FUNCTION rls_f();
81+DROP TABLE rls_t;
82 --
83 -- Clean up objects
84 --
85diff --git a/src/test/regress/sql/rowsecurity.sql b/src/test/regress/sql/rowsecurity.sql
86index 44deb42..3015d89 100644
87--- a/src/test/regress/sql/rowsecurity.sql
88+++ b/src/test/regress/sql/rowsecurity.sql
89@@ -1839,6 +1839,26 @@ SELECT * FROM rls_tbl;
90 DROP TABLE rls_tbl;
91 RESET SESSION AUTHORIZATION;
92
93+-- CVE-2023-2455: inlining an SRF may introduce an RLS dependency
94+create table rls_t (c text);
95+insert into rls_t values ('invisible to bob');
96+alter table rls_t enable row level security;
97+grant select on rls_t to regress_rls_alice, regress_rls_bob;
98+create policy p1 on rls_t for select to regress_rls_alice using (true);
99+create policy p2 on rls_t for select to regress_rls_bob using (false);
100+create function rls_f () returns setof rls_t
101+ stable language sql
102+ as $$ select * from rls_t $$;
103+prepare q as select current_user, * from rls_f();
104+set role regress_rls_alice;
105+execute q;
106+set role regress_rls_bob;
107+execute q;
108+
109+RESET ROLE;
110+DROP FUNCTION rls_f();
111+DROP TABLE rls_t;
112+
113 --
114 -- Clean up objects
115 --
116--
1172.25.1
118
diff --git a/meta-oe/recipes-dbs/postgresql/files/not-check-libperl.patch b/meta-oe/recipes-dbs/postgresql/files/not-check-libperl.patch
index fa46912eef..b742bd53bd 100644
--- a/meta-oe/recipes-dbs/postgresql/files/not-check-libperl.patch
+++ b/meta-oe/recipes-dbs/postgresql/files/not-check-libperl.patch
@@ -1,4 +1,4 @@
1From 56b830edecff1cac5f8a8a956e7a7eeef2aa7c17 Mon Sep 17 00:00:00 2001 1From 09fad1883f3312965a8d066f8477166eaa4db2c7 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com> 2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 27 Nov 2018 13:25:15 +0800 3Date: Tue, 27 Nov 2018 13:25:15 +0800
4Subject: [PATCH] not check libperl under cross compiling 4Subject: [PATCH] not check libperl under cross compiling
@@ -15,15 +15,16 @@ Signed-off-by: Roy Li <rongqing.li@windriver.com>
15 15
16update patch to version 11.1 16update patch to version 11.1
17Signed-off-by: Changqing Li <changqing.li@windriver.com> 17Signed-off-by: Changqing Li <changqing.li@windriver.com>
18
18--- 19---
19 configure.ac | 2 +- 20 configure.ac | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-) 21 1 file changed, 1 insertion(+), 1 deletion(-)
21 22
22diff --git a/configure.ac b/configure.ac 23diff --git a/configure.ac b/configure.ac
23index fba79ee..7170f26 100644 24index 159f2a2..d0f0b14 100644
24--- a/configure.ac 25--- a/configure.ac
25+++ b/configure.ac 26+++ b/configure.ac
26@@ -2261,7 +2261,7 @@ Use --without-tcl to disable building PL/Tcl.]) 27@@ -2332,7 +2332,7 @@ Use --without-tcl to disable building PL/Tcl.])
27 fi 28 fi
28 29
29 # check for <perl.h> 30 # check for <perl.h>
@@ -32,6 +33,3 @@ index fba79ee..7170f26 100644
32 ac_save_CPPFLAGS=$CPPFLAGS 33 ac_save_CPPFLAGS=$CPPFLAGS
33 CPPFLAGS="$CPPFLAGS $perl_includespec" 34 CPPFLAGS="$CPPFLAGS $perl_includespec"
34 AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])], 35 AC_CHECK_HEADER(perl.h, [], [AC_MSG_ERROR([header file <perl.h> is required for Perl])],
35--
362.34.1
37
diff --git a/meta-oe/recipes-dbs/postgresql/files/remove_duplicate.patch b/meta-oe/recipes-dbs/postgresql/files/remove_duplicate.patch
deleted file mode 100644
index 92a3dcc710..0000000000
--- a/meta-oe/recipes-dbs/postgresql/files/remove_duplicate.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1Remove duplicate code for riscv
2
3Upstream-Status: Pending
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5
6--- a/src/include/storage/s_lock.h
7+++ b/src/include/storage/s_lock.h
8@@ -341,30 +341,6 @@ tas(volatile slock_t *lock)
9 #endif /* HAVE_GCC__SYNC_INT32_TAS */
10 #endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */
11
12-
13-/*
14- * RISC-V likewise uses __sync_lock_test_and_set(int *, int) if available.
15- */
16-#if defined(__riscv)
17-#ifdef HAVE_GCC__SYNC_INT32_TAS
18-#define HAS_TEST_AND_SET
19-
20-#define TAS(lock) tas(lock)
21-
22-typedef int slock_t;
23-
24-static __inline__ int
25-tas(volatile slock_t *lock)
26-{
27- return __sync_lock_test_and_set(lock, 1);
28-}
29-
30-#define S_UNLOCK(lock) __sync_lock_release(lock)
31-
32-#endif /* HAVE_GCC__SYNC_INT32_TAS */
33-#endif /* __riscv */
34-
35-
36 /* S/390 and S/390x Linux (32- and 64-bit zSeries) */
37 #if defined(__s390__) || defined(__s390x__)
38 #define HAS_TEST_AND_SET
diff --git a/meta-oe/recipes-dbs/postgresql/postgresql_14.5.bb b/meta-oe/recipes-dbs/postgresql/postgresql_14.9.bb
index 315f6db565..f779ea7abd 100644
--- a/meta-oe/recipes-dbs/postgresql/postgresql_14.5.bb
+++ b/meta-oe/recipes-dbs/postgresql/postgresql_14.9.bb
@@ -1,21 +1,17 @@
1require postgresql.inc 1require postgresql.inc
2 2
3LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=75af6e3eeec4a06cdd2e578673236fc3" 3LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c31f662bb2bfb3b4187fe9a53e0ffe7c"
4 4
5SRC_URI += "\ 5SRC_URI += "\
6 file://not-check-libperl.patch \ 6 file://not-check-libperl.patch \
7 file://0001-Add-support-for-RISC-V.patch \ 7 file://0001-Add-support-for-RISC-V.patch \
8 file://0001-Improve-reproducibility.patch \ 8 file://0001-Improve-reproducibility.patch \
9 file://0001-configure.ac-bypass-autoconf-2.69-version-check.patch \ 9 file://0001-configure.ac-bypass-autoconf-2.69-version-check.patch \
10 file://remove_duplicate.patch \
11 file://0001-config_info.c-not-expose-build-info.patch \ 10 file://0001-config_info.c-not-expose-build-info.patch \
12 file://0001-Properly-NULL-terminate-GSS-receive-buffer-on-error-.patch \
13 file://0001-postgresql-fix-ptest-failure-of-sysviews.patch \ 11 file://0001-postgresql-fix-ptest-failure-of-sysviews.patch \
14 file://CVE-2023-2454.patch \
15 file://CVE-2023-2455.patch \
16" 12"
17 13
18SRC_URI[sha256sum] = "d4f72cb5fb857c9a9f75ec8cf091a1771272802f2178f0b2e65b7b6ff64f4a30" 14SRC_URI[sha256sum] = "b1fe3ba9b1a7f3a9637dd1656dfdad2889016073fd4d35f13b50143cbbb6a8ef"
19 15
20CVE_CHECK_IGNORE += "\ 16CVE_CHECK_IGNORE += "\
21 CVE-2017-8806 \ 17 CVE-2017-8806 \