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 1siPXi-003pyh-HP for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 02:33:18 +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 1siPXf-003U44-Mp for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 02:33:16 +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 1siPXf-003U3k-D6 for pgsql-hackers@lists.postgresql.org; Mon, 26 Aug 2024 02:33:15 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1siPXc-001VYN-3C for pgsql-hackers@postgresql.org; Mon, 26 Aug 2024 02:33:15 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5bec23c0ba8so597537a12.2 for ; Sun, 25 Aug 2024 19:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724639592; x=1725244392; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JK0Y2/nXYESCSaPnjixme0VrRo1PIlXW1jrCeFl7HPU=; b=QPindbS8qdDA8zG3L6/RJJ4rShwzUNGRFEMgpDK6uUzc0/HoahCWN3Vgz+Gr0+N36b DABmEhUwWP2GCfYzZMRWtvIwDQQJOE0WnpGu/UTYANFSavarLyNx9/Bw8onh42lNT/Sv YRgBnRD8OutJJxkoRfq0N88Zk47QvwpiKP5MVgVk1q+/dmLXH8AwiEnPXDYQWnJ62r9n fUooD3FsBTGlAGbbMafs4WXEa9WQod91Cnewo3ofKB1HdyZwbD11RdF9MmVnU3OrnwYh Zu6bvCTX3GQKlCC5i2NKAobiOtV/yBK73+3KO9/esXiAV5dUk9u5B/txS0cUIGnKwE8h /lMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724639592; x=1725244392; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JK0Y2/nXYESCSaPnjixme0VrRo1PIlXW1jrCeFl7HPU=; b=spnjo4LA9gxwYxUs7TMLx6PDr8E3kJWUjmSDPzQM4+jaUgeHM3gIBCoYIn4qFqioGW MP3QYcvbLR+eS8fyUjpKSvaxX4k+c7qiz+DNy8Qevzd2lGlw4P0A0rtiroIYoDsNfKXC asD1/bem5mi6emd6YrI2F1jG3Xl7GbIGcKTcaF0YRo4lbWUBlh17te7H8u/yiEsePYUr w0QEY0RiqyZmkzElOvYGV0c5VmsCRLfz4Qt+nAhFSv+YDIa1g5zJLQsoQXGKJrKIWaYA TdhDCBUf32hHLwUSo/axbVQ7HyfIGgNO3bo8pKgENXY949FDiDiM9zADTEp1yvN8Ckn7 zXdQ== X-Gm-Message-State: AOJu0Yxl7pllOifvSiEV/gDjO5ro+ponFE2M1bZSkgWcNaKYfjcXxa/f s/xK6cdN2EcAw1/ErYd0R8rp3aNW1vol/LJSyFRYrNEOGZ9gniM9UyfTLmM4dUlPo9khEdQ6O5n 6Xic3EGgWWnCnNWT7XbM0j8P5ZyTycL3gkkE= X-Google-Smtp-Source: AGHT+IFkQxrxGg6hD7AQFbdW2wxyHn27SP6a8c6ClpR6OUFfDZdJckawkuVXzkmyWGKvi9cNldw6A9f6KVqFcMC/q2I= X-Received: by 2002:a17:907:6d09:b0:a80:a3a8:9867 with SMTP id a640c23a62f3a-a86a54da34emr339515666b.9.1724639591283; Sun, 25 Aug 2024 19:33:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Munro Date: Mon, 26 Aug 2024 14:32:34 +1200 Message-ID: Subject: Re: Segfault in jit tuple deforming on arm64 due to LLVM issue To: Anthonin Bonnefoy Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Aug 24, 2024 at 12:22=E2=80=AFAM Anthonin Bonnefoy wrote: > On Thu, Aug 22, 2024 at 12:33=E2=80=AFPM Thomas Munro wrote: > > I fear that back-porting, for the LLVM project, would mean "we fix it > > in main/20.x, and also back-port it to 19.x". Do distros back-port > > further? > > That's also my fear, I'm not familiar with distros back-port policy > but eyeballing ubuntu package changelog[1], it seems to be mostly > build fixes. > > Given that there's no visible way to fix the relocation issue, I > wonder if jit shouldn't be disabled for arm64 until either the > RuntimeDyld fix is merged or the switch to JITLink is done. Disabling > jit tuple deforming may be enough but I'm not confident the issue > won't happen in a different part. We've experienced something a little similar before: In the early days of PostgreSQL LLVM, it didn't work at all on ARM or POWER. We sent a trivial fix[1] upstream that landed in LLVM 7; since it was a small and obvious problem and it took a long time for some distros to ship LLVM 7, we even contemplated hot-patching that LLVM function with our own copy (but, ugh, only for about 7 nanoseconds). That was before we turned JIT on by default, and was also easier to deal with because it was an obvious consistent failure in basic tests, so packagers probably just disabled the build option on those architectures. IIUC this one is a random and rare crash depending on malloc() and perhaps also the working size of your virtual memory dart board. (Annoyingly, I had tried to reproduce this quite a few times on small ARM systems when earlier reports came in, d'oh!). This degree of support window mismatch is probably what triggered RHEL to develop their new rolling LLVM version policy. Unfortunately, it's the other distros that tell *us* which versions to support, and not the reverse (for example CF #4920 is about to drop support for LLVM < 14, but that will only be for PostgreSQL 18+). Ultimately, if it doesn't work, and doesn't get fixed, it's hard for us to do much about it. But hmm, this is probably madness... I wonder if it would be feasible to detect address span overflow ourselves at a useful time, as a kind of band-aid defence... [1] https://www.postgresql.org/message-id/CAEepm%3D39F_B3Ou8S3OrUw%2BhJEUP3= p%3DwCu0ug-TTW67qKN53g3w%40mail.gmail.com