Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOzzC-002O2z-GC for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2024 13:25:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sOzz9-008wUR-Fo for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Jul 2024 13:25:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOzz9-008wUF-2d for pgsql-hackers@lists.postgresql.org; Wed, 03 Jul 2024 13:25:23 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sOzz7-000DzM-3h for pgsql-hackers@postgresql.org; Wed, 03 Jul 2024 13:25:22 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4WDgWL1nGbz49PyX; Wed, 3 Jul 2024 16:25:18 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1720013118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bvRXbOAciht2A8+DfBE9+cSxZDecuW2WC/svrI/AKTw=; b=OTxTJf8bXqOjX7Ejc0wzDfLsM5iNLI5uSnVzhcNKYb+hlnT1Z+63S/VjdZPtTHBByiqzFf xwGsSTZ0G7SFL5MiokSprB6D64GM0neIQPnveSyrk4Vsri1YIOxd7AQHpGK01x+V+kYAO8 JEcju8czDo0VZ20l/kJW78dVk7aMWJKWP5mCWFCBwcz326/EDH+L+QRtX4pbJy/MHrVdzw P3zxwio3l//ynGTqIxK9gouKT8S+uCpH3OtzJu39HByAsnoyL8xAy8b8xoTtCd7qPKScQj u3ClSOHNA7tT46VMqiiDWzeTAg28U8ruAOoAkxFjk/9Vei/aIITb1hZCxkIAKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1720013118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bvRXbOAciht2A8+DfBE9+cSxZDecuW2WC/svrI/AKTw=; b=HzOW/4VJDrtJC1LmxC71VrbWIL3E8L/cP6bnbnNtqwyAJ+ZTU6f23XHOveq/m2uwvh/myN THHeLOqBGDOGMYEBMlSAjXZTIWJoOO2jIt0AHtkSuFta8Izw1IvLyWjGRgPuZyKXBuCTF5 1/y5VAvTon2Czf+pPJA+VDYYf/7H/UA6hQ4TXhNj42bRb/xaLwKfN0dspynKW8Y9r7ewQY k2j8iTwCZFyDAfPWO+Mwk8lVvaVlWxaeuWvjr2fkWeBfXMwp+srCo5f94j5HZsxPGz1pJ9 Znpi7X0kz3RPFkUmjefgpXvt2ZdD6TMrwNlJaKyWMEQ9CZTZwYmLdSD/+xp+hQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1720013118; a=rsa-sha256; cv=none; b=XNBLx05UNZdSb4A2xBDAkR92ji9Uko1hXixbaDNs3kC7JTN+NLuQlbUeLqTlmroj0VegTi BSLC/+NClRERI1Jmqgt3PFqv9ctLf44GBFy1bs0aHrFXnh/BqMxMlj2bq6nu9ABbY6Skal cWtrrEJDXCekv20Jt/kLbHdsSCJ5fyx8sZyJC2ZDzhiEalgEwcJUjcpVTUogzhg9BZOkRH 7gTk05CwUFk3J0aMhTQ/1LvF0N75CH27gdZdVt/1wt7JOh/Fyr9n+QjdCsfKPe8kpKodYs co04x/N5kWltgjef2osciOrxHcM/qp6UHGgk00nB/5qHr1ACClXJ6R/ZsXXvmQ== Message-ID: <205c33e6-0ec3-4ab3-8700-e02f95e15199@iki.fi> Date: Wed, 3 Jul 2024 16:25:18 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Refactoring backend fork+exec code To: Thomas Munro , Nathan Bossart Cc: pgsql-hackers , reid.thompson@crunchydata.com, Robert Haas , Andres Freund , Tristan Partin References: <59527c9b-c3f7-4d0c-a3f1-00d0ed5cc186@iki.fi> <20240122210740.7vq5fd4woixpwx3f@awork3.anarazel.de> <8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi> <20240123195009.44wtutga24p5sh3s@awork3.anarazel.de> <08eff756-beeb-4a11-9eb5-d45b6af38998@iki.fi> <5997ff317a5827496537580078bcd19f4441f8d2.camel@crunchydata.com> <606a62d6-321c-4967-92c1-2d4e20a2c136@iki.fi> <20240207182521.wyt5dmd75l4v27zk@awork3.anarazel.de> <2136fb4f-1630-43e9-9cf6-b32772b4b0a0@iki.fi> <20240214213711.2gjlezqll37mg7lg@awork3.anarazel.de> <8f695109-8341-4f7c-8b0d-3cadc7eddc9e@iki.fi> <0c247a78-9dac-4584-8e87-39f2b45bec68@iki.fi> <861f42c1-01c4-42e6-ab2f-d5743ff69607@iki.fi> <53a0a952-1b58-4346-941c-6b767108963a@iki.fi> <47965166-073f-49c8-9e8d-fd6ba37c61fb@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 18/05/2024 08:24, Thomas Munro wrote: > 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); Fixed, thanks! On 17/06/2024 21:36, Nathan Bossart wrote: > While looking into [0], I noticed that main() still only checks for the > --fork prefix, but IIUC commit aafc05d removed all --fork* options except > for --forkchild. I've attached a patch to strengthen the check in main(). > This is definitely just a nitpick. Fixed this too, thanks! -- Heikki Linnakangas Neon (https://neon.tech)