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 1t6ZY7-00Dvcn-Er for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2024 18:05:35 +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 1t6ZY5-004PXB-Kx for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2024 18:05:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t6ZBb-0046Nz-Ik for pgsql-bugs@lists.postgresql.org; Thu, 31 Oct 2024 17:42:19 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t6ZBY-003p5h-Vk for pgsql-bugs@lists.postgresql.org; Thu, 31 Oct 2024 17:42:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QweTmt5X8fCMERIRkFsfDfxnicJbsRtACOqrO0KpefI=; b=WGm12YkdhDUusI2h0sDh3il5Bg UGmpaKTZ0g1qTzTd4smZH3V6PG/q68SXFW+OaMBEh5ey0MrUBpMmSQtsiqPy9WK6vHNrcnx1Ndwzp Jt0MX9k+Z4qqHa7SCSCfLUD83scHn1u3YdB9Z0jDSzmeAb+ZxKn6YQyVq/u3WNlTZVeLQ67imnePK PuRh+fB3Rqj/PnecNxiRcDAcXn84c8772IgjjMvWfzuwKN/Z/VSocOWFWtpyju6FTgVn9DVcpCJZW dnlkyBQTXXDaDApImltn9uWTEnboTpmGk8pEhIRQZO6mItai2w5yB3u2R/6Hl+FG/s9S9p/VyKC5v nI/D34oQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1t6ZBS-009BMS-QK; Thu, 31 Oct 2024 17:42:11 +0000 From: Bastien =?ISO-8859-1?Q?Roucari=E8s?= To: pgsql-bugs@lists.postgresql.org, Heikki Linnakangas , pgsql-bugs@lists.postgresql.org, Heikki Linnakangas Subject: Re: Detection of hadware feature => please do not use signal Date: Thu, 31 Oct 2024 17:42:09 +0000 Message-ID: <193820057.q8YS0ZdlI3@portable-bastien> In-Reply-To: References: <4496616.iHFcN1HehY@portable-bastien> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart11275106.XtdUW7qJID"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Debian-User: rouca List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --nextPart11275106.XtdUW7qJID Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8"; protected-headers="v1" From: Bastien =?ISO-8859-1?Q?Roucari=E8s?= Subject: Re: Detection of hadware feature => please do not use signal Date: Thu, 31 Oct 2024 17:41:53 +0000 Message-ID: <193820057.q8YS0ZdlI3@portable-bastien> In-Reply-To: MIME-Version: 1.0 Le jeudi 31 octobre 2024, 17:29:45 UTC Heikki Linnakangas a =C3=A9crit : > On 31/10/2024 17:41, Bastien Roucari=C3=A8s wrote: > > Hi, > >=20 > > On debian side we will like to avoid use of sigill to detect feature. > >=20 > > https://sources.debian.org/src/postgresql-17/17.0-1/src/port/pg_crc32c_= armv8_choose.c/#L55 > >=20 > > is really bad. >=20 > Why is it bad? for a binary it is maybe safe for a library it is unsafe in Multi thread co= ntext to capture signal... And we are burned by a recent CVE in ssh due to signal handling. >=20 > > Could you use the canonical way under linux > >=20 > > #include > > #include > >=20 > > #if defined(__aarch64__) > > return !(getauxval(AT_HWCAP) & HWCAP_CRC32); > > #else > > return !(getauxval(AT_HWCAP2) & HWCAP2_CRC32); > > #endif >=20 > We used to do that, but it was changed in commit 1c72ec6f. Looking at=20 > the discussion that led to it, it's not clear to me why we switched [1].= =20 > Portablity to non-glibc systems maybe? Yes I suppose but a #ifdef __GLIBC__ #else #endif Will be safe >=20 > If there's a handy, portable way to check CPU capabilities, I agree it=20 > seem less hacky than catching SIGILL... unfortunatly no >=20 > [1]=20 > https://www.postgresql.org/message-id/CAEepm%3D02Run-Pk3xyt%2BRV3p1N%2B7c= KZxN95_MamaJw8Cnw%2BDwjQ%40mail.gmail.com >=20 >=20 --nextPart11275106.XtdUW7qJID Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEXQGHuUCiRbrXsPVqADoaLapBCF8FAmcjwWEACgkQADoaLapB CF/VAw/+MuMUMTMB/DnACQKgTJyein1qDBfawkrAwtOdWD4q5aNRPfFobAtUDh79 Z1PB4H9qdBX3xqOmYzKh/y7r+1u0t7fd7eADaPz0KgyRrW9JFHpFiA9upZAZRBli zZ4LxeN2rQDsq0trDsB/DRQ7HSnrK9luWArpm7bQwTh/c+N6bEgT2d2hOwNviSW6 2eO9mwsRbqGqz4GUH/CSNXBGEhOaPgXtSyBJuxUAvBEWYT07YwprKLum8uWe8B4J U+Bu4zhVPod/gMoSX+zsDVtllygWhZMxI1F7elahNYfljA6ZaazHCpYiWQxlr9+S 7Pgh3/S12KoByl5sll5L1LEhfEWSlsS1AKbuu5pjeProWY0Afl/1vbKQCVSELfHd UOyuFQas0B8cyARNT7wPvrv4WYxbzawDEw1n0uwXql9BffeTS+mDyQGWllfGiMPX Ye0hEz6ZnNf5bKHn73ceCY1i/haHYrOvhnZ54TxHtP8Ukvn1yDsp2eCCepBe7Y28 rBHHpWUnFy27aCet7KJlgK81eDzKuGX+yWxhq7SJGUtKWKXrkFpqV9LCkC4bWY4z vL+nOpyinrtQkgAHgbEGdG5UuEFAM8LZQMQCjzJVakJVstb723D5mwb+vfdxEWKC 7PM9ZwwTISE4IoVYWz39bDadt5kbH1XciGFHf5HBi2LGzH1JKuw= =iSnE -----END PGP SIGNATURE----- --nextPart11275106.XtdUW7qJID--