Re: Refactoring backend fork+exec code

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, reid(dot)thompson(at)crunchydata(dot)com, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tristan Partin <tristan(at)neon(dot)tech>
Subject: Re: Refactoring backend fork+exec code
Date: 2024-05-18 05:24:45
Message-ID: CA+hUKG+e-dV7YWBzfBZXsgovgRuX5VmvmOT+v0aXiZJ-EKbXcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 18, 2024 at 10:41 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> Committed, with some final cosmetic cleanups. Thanks everyone!

Nitpicking from UBSan with EXEC_BACKEND on Linux (line numbers may be
a bit off, from a branch of mine):

../src/backend/postmaster/launch_backend.c:772:2: runtime error: null
pointer passed as argument 2, which is declared to never be null
==13303==Using libbacktrace symbolizer.
#0 0x5555564b0202 in save_backend_variables
../src/backend/postmaster/launch_backend.c:772
#1 0x5555564b0242 in internal_forkexec
../src/backend/postmaster/launch_backend.c:311
#2 0x5555564b0bdd in postmaster_child_launch
../src/backend/postmaster/launch_backend.c:244
#3 0x5555564b3121 in StartChildProcess
../src/backend/postmaster/postmaster.c:3928
#4 0x5555564b933a in PostmasterMain
../src/backend/postmaster/postmaster.c:1357
#5 0x5555562de4ad in main ../src/backend/main/main.c:197
#6 0x7ffff667ad09 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
#7 0x555555e34279 in _start
(/tmp/cirrus-ci-build/build/tmp_install/usr/local/pgsql/bin/postgres+0x8e0279)

This silences it:

- memcpy(param->startup_data, startup_data, startup_data_len);
+ if (startup_data_len > 0)
+ memcpy(param->startup_data, startup_data, startup_data_len);

(I found that out by testing EXEC_BACKEND on CI. I also learned that
the Mac and FreeBSD tasks fail with EXEC_BACKEND because of SysV shmem
bleating. We probably should go and crank up the relevant sysctls in
the .cirrus.tasks.yml...)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-05-18 05:29:12 Re: race condition when writing pg_control
Previous Message Jacob Burroughs 2024-05-18 05:18:00 Re: libpq compression (part 3)