NetBSD Problem Report #46711

From julio+host-mini-jmmv@meroh.net  Tue Jul 17 03:08:29 2012
Return-Path: <julio+host-mini-jmmv@meroh.net>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 8A13363B85F
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 17 Jul 2012 03:08:29 +0000 (UTC)
Message-Id: <20120717030757.973BD161708@mini.meroh.net>
Date: Mon, 16 Jul 2012 23:07:57 -0400 (EDT)
From: julio+host-mini-jmmv@meroh.net
Reply-To: julio+host-mini-jmmv@meroh.net
To: gnats-bugs@gnats.NetBSD.org
Subject: Generating a gpg2 key causes a "user PGM trap" kernel loop
X-Send-Pr-Version: 3.95

>Number:         46711
>Category:       port-powerpc
>Synopsis:       Generating a gpg2 key causes a "user PGM trap" kernel loop
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-powerpc-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 17 03:10:00 +0000 2012
>Closed-Date:    Tue Dec 05 15:08:57 +0000 2017
>Last-Modified:  Tue Dec 05 15:08:57 +0000 2017
>Originator:     julio+host-mini-jmmv@meroh.net
>Release:        NetBSD 6.99.8
>Organization:

>Environment:


System: NetBSD mini.meroh.net 6.99.8 NetBSD 6.99.8 (MINI) #36: Mon Jul 16 19:29:36 EDT 2012 jmmv@netbsd.meroh.net:/home/jmmv/os/netbsd/macppc/obj/home/jmmv/os/netbsd/src/sys/arch/macppc/compile/MINI macppc
Architecture: powerpc
Machine: macppc
>Description:
	I installed gpg2 on a Mac Mini G4 running NetBSD/macppc 6.99.8 (with
	sources from 2012/07/01) and attempted to generate a new key with
	"gpg2 --gen-key".  I selected the default of 2 RSA keys, then 4096
	bits, then filed the user name and email address and, at that point,
	the kernel started spewing hundreds of messages like:

	trap: pid 28900.1 (gpg-agent): user PGM trap @ 0xfde6c7e8 (SRR1=0x8f032)

	in a continuous loop.  The machine remained responsive: the console was
	barely usable probably due to the unstoppable amount of fast output,
	but I could SSH into the machine and reboot it, albeit slowly.

	The printed message is protected by a cpu_printfataltraps guard in the
	source code (see sys/arch/powerpc/powerpc/trap.c), so I am not sure if
	the only problem here is an overeager printf and gpg-agent triggering
	it just too many times for whatever reason, or actually the desired
	signal is not being delivered to the caller process correctly.

	Regardless, this seems to me like a local DOS because the machine
	becomes unusable and can be triggered by an unprivileged user.

	I have no reasons to believe this is specific to my particular machine
	nor macppc either.  Because of the location of the message, this might
	affect all powerpc ports, hence why I'm using the port-powerpc
	category.
>How-To-Repeat:
	See the description above, but to summarize:
	1) Install a powerpc-based port, current.
	2) Install gpg2 from pkgsrc.
	3) Run gpg2 --gen-key.
	4) Follow the instructions.
	5) See the kernel printing lots of messages.
>Fix:


>Release-Note:

>Audit-Trail:
From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Mon, 16 Jul 2012 23:59:31 -0400

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Those are user mode traps.
 sysctl -w machdep.printfataltraps=3D0
 ?


 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (Darwin)
 Comment: GPGTools - http://gpgtools.org

 iQEVAwUBUATjJMpnzkX8Yg2nAQI/mQf+LvZNO4rN0foLkEcZrjqiVV/5ktnV5d8W
 7MvmJEAdsa1CebPzbefniNDcVyB8qBoF/jIXEZwSb58BSt3e4bGA+BpVJ50hXoPV
 vljT+/ocRBXKcV6QY2Vm6MF9or3dLuhj0UmCH9yMNXfy6AQjdaF74PHHgEigc0/X
 Ma+eEvUk1SnkDZ5dD88ibJoTmQTNekfm79Ra5fkl1+iLP6RgHebBPJZHTi4gvEa0
 kZCF66uJDh9DV1hoJmXO6UCZReaFXbQTdo/ToqkByyjQJsqHaT3NYUFRj29Dn0t0
 jb6m2LTNjzsUUjwUfMg2bthfxGiyyx5hOBILESN/YVVBZwpQQBjXyw=3D=3D
 =3DNh3C
 -----END PGP SIGNATURE-----

From: Julio Merino <julio@meroh.net>
To: gnats-bugs@NetBSD.org
Cc: port-powerpc-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, macallan@netbsd.org
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM
 trap" kernel loop
Date: Tue, 17 Jul 2012 14:11:35 -0400

 Humm... I tried that, and indeed the error message disappeared.  The
 program does not work anyway, but this is a different story.

 Anyway.  Is it useful for the kernel to print this?  The fact that,
 by default, all these messages can flood the console and render the
 machine almost unusable, all triggered from an unprivileged process...
 seems wrong.

From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Tue, 17 Jul 2012 18:49:42 -0400

 It should be turned off by default, otherwise you'd get kernel output
 on every single page fault.

From: Matt Thomas <matt@3am-software.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 julio+host-mini-jmmv@meroh.net
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Tue, 17 Jul 2012 16:01:37 -0700

 No true.  Just fatal traps that cause a process to exit.=

From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Tue, 17 Jul 2012 19:38:53 -0400

 Sorry, my bad. Either way, it should be turned off by default, I =20
 wonder why it's on.

From: Julio Merino <julio@meroh.net>
To: Matt Thomas <matt@3am-software.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM
 trap" kernel loop
Date: Tue, 17 Jul 2012 19:42:31 -0400

 Then, the real bug is that the process is not being properly killed?

From: Matt Thomas <matt@3am-software.com>
To: Julio Merino <julio@meroh.net>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Tue, 17 Jul 2012 16:52:59 -0700

 or it has a trap handler that is broken.

From: Julio Merino <jmmv@NetBSD.org>
To: Matt Thomas <matt@3am-software.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM
 trap" kernel loop
Date: Tue, 17 Jul 2012 22:14:37 -0400

 Meh, replying again because I did not realize the Android mail client
 would send HTML email... (and there doesn't seem to be a setting to
 change it).

 So, the real bug is that the process should be killed but isn't?  By
 reading the code, I get the impression that the process should receive
 a SIGILL, but this is obviously not happening.

From: Michael <macallan@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-powerpc/46711: Generating a gpg2 key causes a "user PGM trap" kernel loop
Date: Tue, 17 Jul 2012 22:26:11 -0400

 Isn't there a PR about powerpc not always delivering SIGILL?

State-Changed-From-To: open->feedback
State-Changed-By: chs@NetBSD.org
State-Changed-When: Sun, 05 Mar 2017 16:25:32 +0000
State-Changed-Why:
I tried this with -current from a few days ago and the problem reported here
didn't happen for me.  do you still see the problem?


State-Changed-From-To: feedback->closed
State-Changed-By: jmmv@NetBSD.org
State-Changed-When: Tue, 05 Dec 2017 15:08:57 +0000
State-Changed-Why:
There is no way for me to try this any longer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.