Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jul 2017 06:40:52 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Mark Millard <markmi@dsl-only.net>
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: head -r320521 (e.g.): another powerpc64 problem: programs using fgets crash trying to store address over code instead of into __cleanup_info__
Message-ID:  <20170702034052.GE1935@kib.kiev.ua>
In-Reply-To: <B203F272-002C-48BE-ADB1-8D03881380C1@dsl-only.net>
References:  <B203F272-002C-48BE-ADB1-8D03881380C1@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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).

Yes, I think you are right.  I also see how this worked on amd64,
where I tested the change.

Try this.

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)
 
 static int
 stub_zero(void)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170702034052.GE1935>