NetBSD Problem Report #55701

From jakllsch@kollasch.net  Wed Oct  7 18:46:09 2020
Return-Path: <jakllsch@kollasch.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D6A8B1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  7 Oct 2020 18:46:09 +0000 (UTC)
Message-Id: <20201007184603.GO21814@tazenda.kollasch.net>
Date: Wed, 7 Oct 2020 13:46:04 -0500
From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
Reply-To: jakllsch@kollasch.net
To: gnats-bugs@NetBSD.org
Subject: ecp_nistp521.c fails on Alpha

>Number:         55701
>Category:       lib
>Synopsis:       ecp_nistp521.c fails on Alpha
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 07 18:50:00 +0000 2020
>Closed-Date:    
>Last-Modified:  Sat Feb 22 15:30:02 +0000 2025
>Originator:     Jonathan A. Kollasch
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: NetBSD toliman.kollasch.net 9.99.73 NetBSD 9.99.73 (GENERIC) #0: Tue Oct 6 16:39:23 UTC 2020 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/alpha/compile/GENERIC alpha
Architecture: alpha
Machine: alpha
>Description:
src/crypto/external/bsd/openssl/dist/crypto/ec/ecp_nistp521.c does unaligned accesses
>How-To-Repeat:
start sshd, observe unaligned load/store warnings from kernel while it loads the ecdsa host key
>Fix:
define OPENSSL_NO_EC_NISTP_64_GCC_128 for Alpha

>Release-Note:

>Audit-Trail:
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55701 CVS commit: src/crypto/external/bsd/openssl/include/openssl
Date: Thu, 8 Oct 2020 16:00:09 +0000

 Module Name:	src
 Committed By:	jakllsch
 Date:		Thu Oct  8 16:00:09 UTC 2020

 Modified Files:
 	src/crypto/external/bsd/openssl/include/openssl: opensslconf.h

 Log Message:
 openssl: Define OPENSSL_NO_EC_NISTP_64_GCC_128 for Alpha too

 The ecp_nistp521.c code depends on doing unaligned 64-bit accesses,
 which the NetBSD/alpha kernel doesn't like to trap and emulate.

 fixes PR lib/55701


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 \
     src/crypto/external/bsd/openssl/include/openssl/opensslconf.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55701 CVS commit: src/crypto/external/bsd/openssl.old/include/openssl
Date: Sat, 8 Jul 2023 23:42:49 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Jul  8 23:42:48 UTC 2023

 Modified Files:
 	src/crypto/external/bsd/openssl.old/include/openssl: opensslconf.h

 Log Message:
 openssl.old: Remove OPENSSL_NO_EC_NISTP_64_GCC_128 hack for alpha.

 Unaligned memory access reported in PR lib/55701 has been fixed by
 upstream commit:

 https://github.com/openssl/openssl/commit/77286fe3ec6b9777934e67e35f3b7007143b0734

 Actually, kernel no longer complains with machdep.unaligned_print=1,
 for sshd(8), ssh(1), and full ATF run.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     src/crypto/external/bsd/openssl.old/include/openssl/opensslconf.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55701 CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64
Date: Sat, 8 Jul 2023 23:54:27 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Jul  8 23:54:27 UTC 2023

 Modified Files:
 	src/crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64: ec.inc

 Log Message:
 Sprinkle OPENSSL_NO_EC_NISTP_64_GCC_128 for aarch64eb.

 Otherwise, the following tests fail with wrong results:

 - crypto/libcrypto/t_ciphers:evp
 - crypto/libcrypto/t_pubkey:ec

 Official document says ec_nistp_64_gcc_128 does not support big endian:
 https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-ec_nistp_64_gcc_128
 Thanks @a_rin for pointing this out on Twitter!

 Note that an equivalent hack was present in openssl.old for aarch64eb,
 alpha, and sparc64. But:

 - alpha received upstream fix (PR lib/55701)
 - sparc64 has been fixed differently (PR port-sparc64/57472)


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 \
     src/crypto/external/bsd/openssl/lib/libcrypto/arch/aarch64/ec.inc

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Tue, 03 Sep 2024 13:00:46 +0000
State-Changed-Why:
changes committed


From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
Date: Fri, 21 Feb 2025 13:01:44 -0600

 All my Alpha hardware is now inoperative, and I believe this is fixed
 anyway.

From: Jason Thorpe <thorpej@me.com>
To: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
Cc: gnats-bugs@netbsd.org
Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
Date: Fri, 21 Feb 2025 11:24:41 -0800

 > On Feb 21, 2025, at 11:05=E2=80=AFAM, Jonathan A. Kollasch via gnats =
 <gnats-admin@NetBSD.org> wrote:
 >=20
 > The following reply was made to PR lib/55701; it has been noted by =
 GNATS.
 >=20
 > From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
 > To: gnats-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
 > Date: Fri, 21 Feb 2025 13:01:44 -0600
 >=20
 > All my Alpha hardware is now inoperative, and I believe this is fixed
 > anyway.

 Point me at the test case?  I have at least one running real 21064 =
 system.

 -- thorpej

From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: Jason Thorpe <thorpej@me.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
Date: Fri, 21 Feb 2025 13:41:18 -0600

 My recollection is that something either as simple as starting sshd or
 opening an connection (client? server? either?) caused a unaligned
 access message from the kernel.

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
Date: Sat, 22 Feb 2025 10:23:37 +0100

 On Fri, Feb 21, 2025 at 07:45:01PM +0000, Jonathan A. Kollasch via gnats wrote:
 >  My recollection is that something either as simple as starting sshd or
 >  opening an connection (client? server? either?) caused a unaligned
 >  access message from the kernel.

 Probably requires an exisiting host key of that type?

 But shouldn't

 	cd /usr/tests/crypto/libcrypto && atf-run | atf-report

 reproduce it too?

 Martin

From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@netbsd.org
Cc: lib-bug-people@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 "Jonathan A. Kollasch" <jakllsch@kollasch.net>
Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
Date: Sat, 22 Feb 2025 07:29:24 -0800

 > On Feb 22, 2025, at 1:25=E2=80=AFAM, Martin Husemann via gnats =
 <gnats-admin@NetBSD.org> wrote:
 >=20
 > The following reply was made to PR lib/55701; it has been noted by =
 GNATS.
 >=20
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@netbsd.org
 > Cc:=20
 > Subject: Re: lib/55701 (ecp_nistp521.c fails on Alpha)
 > Date: Sat, 22 Feb 2025 10:23:37 +0100
 >=20
 > On Fri, Feb 21, 2025 at 07:45:01PM +0000, Jonathan A. Kollasch via =
 gnats wrote:
 >> My recollection is that something either as simple as starting sshd =
 or
 >> opening an connection (client? server? either?) caused a unaligned
 >> access message from the kernel.
 >=20
 > Probably requires an exisiting host key of that type?
 >=20
 > But shouldn't
 >=20
 > cd /usr/tests/crypto/libcrypto && atf-run | atf-report
 >=20
 > reproduce it too?

 Summary for 5 test programs:
     20 passed test cases.
     1 failed test cases.
     0 expected failed test cases.
     0 skipped test cases.

 The failed test case was:

 Failed test cases:
     t_pubkey:dsa

     dsa: [301.541072s] Failed: Test case timed out after 300 seconds

 =E2=80=A6and there are no kernel message about unaligned fix-ups.

 [     1.000000] NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024
 [     1.000000]         =
 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/alpha/compile/GENERIC
 [     1.000000] AlphaStation 200 4/233, 233MHz, s/n=20
 [     1.000000] 8192 byte page size, 1 processor.
 [     1.000000] total memory =3D 384 MB
 [     1.000000] (2000 KB reserved for PROM, 382 MB used by NetBSD)
 [     1.000000] avail memory =3D 362 MB
 [     1.000000] timecounter: Timecounters tick every 0.976 msec
 [     1.000000] Kernelized RAIDframe activated
 [     1.000000] mainbus0 (root)
 [     1.000000] cpu0 at mainbus0: ID 0 (primary), 21064A-0 (EV45)

 -- thorpej

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.