From owner-freebsd-hackers@freebsd.org Sun Jul 2 04:53:57 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B97C5D9D400 for ; Sun, 2 Jul 2017 04:53:57 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-15.reflexion.net [208.70.210.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 686DC7FECE for ; Sun, 2 Jul 2017 04:53:56 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 8037 invoked from network); 2 Jul 2017 04:58:12 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 2 Jul 2017 04:58:12 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.1) with SMTP; Sun, 02 Jul 2017 00:53:55 -0400 (EDT) Received: (qmail 26071 invoked from network); 2 Jul 2017 04:53:55 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 2 Jul 2017 04:53:55 -0000 Received: from [192.168.1.114] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id B9F90EC81E6; Sat, 1 Jul 2017 21:53:54 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: head -r320521 (e.g.): another powerpc64 problem: programs using fgets crash trying to store address over code instead of into __cleanup_info__ From: Mark Millard In-Reply-To: <20170702034052.GE1935@kib.kiev.ua> Date: Sat, 1 Jul 2017 21:53:54 -0700 Cc: FreeBSD PowerPC ML , FreeBSD Current , freebsd-hackers@freebsd.org, bob prohaska Content-Transfer-Encoding: quoted-printable Message-Id: <63F748A7-9750-4065-B268-6E19A6BEC829@dsl-only.net> References: <20170702034052.GE1935@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jul 2017 04:53:57 -0000 On 2017-Jul-1, at 8:40 PM, Konstantin Belousov = wrote: > On Sat, Jul 01, 2017 at 07:42:11PM -0700, Mark Millard wrote: >> powerpc64 is having programs crash with an attempt >> to store addresses over code instead of into >> __cleanup_info__ when fgets is used. ntpd is an >> example. As is sshd (although I've looked at >> its details less). >=20 > Yes, I think you are right. I also see how this worked on amd64, > where I tested the change. >=20 > Try this. >=20 > diff --git a/lib/libc/gen/_pthread_stubs.c = b/lib/libc/gen/_pthread_stubs.c > index 18a23216d50..fcf7ff04fed 100644 > --- a/lib/libc/gen/_pthread_stubs.c > +++ b/lib/libc/gen/_pthread_stubs.c > @@ -279,10 +279,11 @@ STUB_FUNC2(pthread_kill, PJT_KILL, int, void *, = int) > STUB_FUNC2(pthread_setcancelstate, PJT_SETCANCELSTATE, int, int, void = *) > STUB_FUNC2(pthread_setcanceltype, PJT_SETCANCELTYPE, int, int, void *) > STUB_FUNC(pthread_testcancel, PJT_TESTCANCEL, void) > -STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, int, int) > -STUB_FUNC2(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, = void*, void *); > -STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, int, int) > -STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, int, int) > +STUB_FUNC1(__pthread_cleanup_pop_imp, PJT_CLEANUP_POP_IMP, void, int) > +STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, = void *, > + void *, void *); > +STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int) > +STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int) >=20 > static int > stub_zero(void) That fixed the issue for my powerpc64 context. For examples: sshd and ntpd are running. I'll go rebuild the rest of my contexts now. Thanks! =3D=3D=3D Mark Millard markmi at dsl-only.net