Re: [HACKERS] pg_hba_file_settings view patch

Поиск
Список
Период
Сортировка
От Haribabu Kommi
Тема Re: [HACKERS] pg_hba_file_settings view patch
Дата
Msg-id CAJrrPGep=zHW3cpT0+Udz_e9zA-fCzwYsR9qaw9UtFjdeKAocA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_hba_file_settings view patch  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Список pgsql-hackers


On Tue, Nov 29, 2016 at 9:15 PM, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:
Here's backtrace and some debugging information
Program terminated with signal 11, Segmentation fault.
#0  0x00000000007f96cd in shm_mq_sendv (mqh=0x121e998,
iov=0x7ffc9b7b79f0, iovcnt=2, nowait=1 '\001') at shm_mq.c:357
357        Assert(mq->mq_sender == MyProc);
(gdb) where
#0  0x00000000007f96cd in shm_mq_sendv (mqh=0x121e998,
iov=0x7ffc9b7b79f0, iovcnt=2, nowait=1 '\001') at shm_mq.c:357
#1  0x00000000006d8387 in mq_putmessage (msgtype=88 'X', s=0x0, len=0)
at pqmq.c:165
#2  0x0000000000515147 in ParallelWorkerMain (main_arg=141900502) at
parallel.c:1120
#3  0x0000000000783063 in StartBackgroundWorker () at bgworker.c:726
#4  0x0000000000795b77 in do_start_bgworker (rw=0x1216f00) at postmaster.c:5535
#5  0x0000000000795e4f in maybe_start_bgworker () at postmaster.c:5710
#6  0x0000000000794eb3 in sigusr1_handler (postgres_signal_arg=10) at
postmaster.c:4959
#7  <signal handler called>
#8  0x00002b005933a693 in select () from /lib/x86_64-linux-gnu/libc.so.6
#9  0x0000000000790720 in ServerLoop () at postmaster.c:1665
#10 0x000000000078fe76 in PostmasterMain (argc=8, argv=0x11eef40) at
postmaster.c:1309
#11 0x00000000006d8f1d in main (argc=8, argv=0x11eef40) at main.c:228
(gdb) p mq->mq_sender
Cannot access memory at address 0x6b636568635f707d
(gdb) p mq
$1 = (shm_mq *) 0x6b636568635f706d

I found the reason to the crash. This is because of new discard_hba() call that
is added in InitPostgres after authentication.

The PostmasterContext is deleted and set it to NULL for all children processes
except normal backend process. But because of addition of discard_hba() function
call in InitPostgres, the parsed_hba_context is checked for NULL and freed. For
all other childrens except normal backend, this pointer is not NULL and it leads to
freeing of some other memory and that leads to the crash of the parallel worker.

The freeing of parsed_hba_context memory is required only for normal backend
processes after authentication, so moved the discard_hba() function call into the
if block solved the problem.

But anyway the logic of reading hba rules is changed for pg_hba_rules view, so
this patch is not required anyway. Just for reference I attached updated patch.

 
Regards,
Hari Babu
Fujitsu Australia
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] createdb warnings on OS X
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: [HACKERS] PoC: Make it possible to disallow WHERE-less UPDATE andDELETE