Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2019 19:48:24 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351783 - head/sys/amd64/linux
Message-ID:  <201909031948.x83JmOKl070151@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Sep  3 19:48:23 2019
New Revision: 351783
URL: https://svnweb.freebsd.org/changeset/base/351783

Log:
  Unbreak Linux binaries linked against new glibc, such as the ones
  from recent Ubuntu versions.  Without it they segfault on startup.
  
  Reviewed by:	emaste
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20687

Modified:
  head/sys/amd64/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- head/sys/amd64/linux/linux_sysvec.c	Tue Sep  3 19:48:02 2019	(r351782)
+++ head/sys/amd64/linux/linux_sysvec.c	Tue Sep  3 19:48:23 2019	(r351783)
@@ -343,6 +343,12 @@ linux_copyout_strings(struct image_params *imgp)
 	 */
 	vectp -= imgp->args->argc + 1 + imgp->args->envc + 1;
 
+	/*
+	 * Starting with 2.24, glibc depends on a 16-byte stack alignment.
+	 * One "long argc" will be prepended later.
+	 */
+	vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8);
+
 	/* vectp also becomes our initial stack base. */
 	stack_base = (register_t *)vectp;
 



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