NetBSD Problem Report #52933

From www@NetBSD.org  Thu Jan 18 18:02:11 2018
Return-Path: <www@NetBSD.org>
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 B89137A1B5
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 18 Jan 2018 18:02:11 +0000 (UTC)
Message-Id: <20180118180210.C4F5C803AC@mollari.NetBSD.org>
Date: Thu, 18 Jan 2018 18:02:10 +0000 (UTC)
From: jakllsch@kollasch.net
Reply-To: jakllsch@kollasch.net
To: gnats-bugs@NetBSD.org
Subject: earmv7hfeb kernel modules are fragile and CTF doesn't help
X-Send-Pr-Version: www-1.0

>Number:         52933
>Category:       port-arm32
>Synopsis:       earmv7hfeb kernel modules are fragile and CTF doesn't help
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 18 18:05:00 +0000 2018
>Last-Modified:  Thu Jan 18 18:13:01 +0000 2018
>Originator:     Jonathan Kollasch
>Release:        -current circa 8.99.12
>Organization:
>Environment:
NetBSD  8.99.12 NetBSD 8.99.12 (SUNXI) #336: Thu Jan 18 11:02:40 CST 2018  jakllsch@terminus:/local/jakllsch/netbsd/obj/evbarm-earmv7hfeb/sys/arch/evbarm/compile/SUNXI evbarm earmv7hfeb
>Description:
Kernel modules for BE8 ARMv[67] are currently built as BE32 objects, the kernel bswaps .text on load.  If ctfconvert is run the kmod, the BE8 symbols ($a, $t, $d) become corrupted, and much of the .text is left with big endian wordcode, which is incorrect and often invalid in a BE8 kernel.

`objdump --special-syms -t modules/examples/hello/hello.o` before ctfconvert:
...
00000000 l       .text  00000000 $a
...
00000010 l       .debug_frame   00000000 $d
...

after ctfconvert:
...
00000000 l       .text  00000000 $a
...
00000010 l       .text  00000000 $d
...

this now-stray $d inhibits the previous $a which was expected to cover the rest of the .text.

It might also be argued that BE8 .kmods should be built for ARMv[67]-EB BE8 kernels.
>How-To-Repeat:
modload ./hello.kmod;
observe crash due to undefined instructions or failure to load due to opposite-endian relocations.
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-arm32-maintainer->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Thu, 18 Jan 2018 18:13:01 +0000
Responsible-Changed-Why:
take


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.