From 12e35b6d3e1cb079cd85a092223524f8e909a7da Mon Sep 17 00:00:00 2001 From: nwen Date: Thu, 5 Aug 2021 10:52:18 +0800 Subject: [PATCH 1/2] secure compilation --- src/common/port/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/port/Makefile b/src/common/port/Makefile index c4181ed8f..efe7741b0 100644 --- a/src/common/port/Makefile +++ b/src/common/port/Makefile @@ -32,8 +32,8 @@ VERSION = 1 override CPPFLAGS := -I$(top_builddir)/src/common/port -DFRONTEND $(CPPFLAGS) $(CFLAGS_SSE42) LIBS += $(PTHREAD_LIBS) -override CPPFLAGS := $(filter-out -fPIE, $(CPPFLAGS)) -fPIC -override CFLAGS := $(filter-out -fPIE, $(CFLAGS)) -fPIC +override CPPFLAGS := $(filter-out -fPIE, $(CPPFLAGS)) -fPIC -fstack-protector-all +override CFLAGS := $(filter-out -fPIE, $(CFLAGS)) -fPIC -fstack-protector-all override CPPSources=$(shell find -name "*.cpp" ! -name "path.cpp" | sort) ifneq "$(MAKECMDGOALS)" "clean" From f868b1d93557674a0ca508dc15329caaaf0c6da8 Mon Sep 17 00:00:00 2001 From: nwen Date: Thu, 5 Aug 2021 11:32:19 +0800 Subject: [PATCH 2/2] no massage returned, when GUC is set in the init session if thread pool --- src/gausskernel/process/threadpool/threadpool_worker.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gausskernel/process/threadpool/threadpool_worker.cpp b/src/gausskernel/process/threadpool/threadpool_worker.cpp index 001f052d7..b28dca884 100644 --- a/src/gausskernel/process/threadpool/threadpool_worker.cpp +++ b/src/gausskernel/process/threadpool/threadpool_worker.cpp @@ -660,6 +660,9 @@ static void init_session_share_memory() static bool InitSession(knl_session_context* session) { + /* non't send ereport to client now */ + t_thrd.postgres_cxt.whereToSendOutput = DestNone; + /* Switch context to Session context. */ AutoContextSwitch memSwitch(session->mcxt_group->GetMemCxtGroup(MEMORY_CONTEXT_DEFAULT)); @@ -681,6 +684,9 @@ static bool InitSession(knl_session_context* session) /* Read in remaining GUC variables */ read_nondefault_variables(); + + /* now safe to ereport to client */ + t_thrd.postgres_cxt.whereToSendOutput = DestRemote; /* Init port and connection. */ if (!InitPort(session->proc_cxt.MyProcPort)) {