From owner-svn-src-stable@freebsd.org Sun Nov 4 06:25:08 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68C4E10F55F2; Sun, 4 Nov 2018 06:25:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E98917B744; Sun, 4 Nov 2018 06:25:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA6C724AA7; Sun, 4 Nov 2018 06:25:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA46P7Cw093587; Sun, 4 Nov 2018 06:25:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA46P7Um093586; Sun, 4 Nov 2018 06:25:07 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811040625.wA46P7Um093586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 4 Nov 2018 06:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r340109 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 340109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E98917B744 X-Spamd-Result: default: False [-0.87 / 200.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.76)[-0.755,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 06:25:08 -0000 Author: bz Date: Sun Nov 4 06:25:07 2018 New Revision: 340109 URL: https://svnweb.freebsd.org/changeset/base/340109 Log: MFC r340009: carpstats are the last virtualised variable in the file and end up at the end of the vnet_set. The generated code uses an absolute relocation at one byte beyond the end of the carpstats array. This means the relocation for the vnet does not happen for carpstats initialisation and as a result the kernel panics on module load. This problem has only been observed with carp and only on i386. We considered various possible solutions including using linker scripts to add padding to all kernel modules for pcpu and vnet sections. While the symbols (by chance) stay in the order of appearance in the file adding an unused non-file-local variable at the end of the file will extend the size of set_vnet and hence make the absolute relocation for carpstats work (think of this as a single-module set_vnet padding). This is a (tmporary) hack. It is the least intrusive one as we need a timely solution for the upcoming release. We will revisit the problem in HEAD. For a lot more information and the possible alternate solutions please see the PR and the references therein. PR: 230857 Approved by: re (kib) Modified: stable/12/sys/netinet/ip_carp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/ip_carp.c ============================================================================== --- stable/12/sys/netinet/ip_carp.c Sun Nov 4 06:24:27 2018 (r340108) +++ stable/12/sys/netinet/ip_carp.c Sun Nov 4 06:25:07 2018 (r340109) @@ -2176,6 +2176,21 @@ static struct protosw in6_carp_protosw = { }; #endif +#ifdef VIMAGE +#if defined(__i386__) +/* + * XXX This is a hack to work around an absolute relocation outside + * set_vnet by one (on the stop symbol) for carpstats. Add a dummy variable + * to the end of the file in the hope that the linker will just keep the + * order (as it seems to do at the moment). It is understood to be fragile. + * See PR 230857 for a longer discussion of the problem and the referenced + * review for possible alternate solutions. Each is a hack; we just need + * the least intrusive one for the next release. + */ +VNET_DEFINE(char, carp_zzz) = 0xde; +#endif +#endif + static void carp_mod_cleanup(void) {