svn commit: r286221 - head/sys/amd64/cloudabi64
Ed Schouten
ed at FreeBSD.org
Mon Aug 3 07:29:58 UTC 2015
Author: ed
Date: Mon Aug 3 07:29:57 2015
New Revision: 286221
URL: https://svnweb.freebsd.org/changeset/base/286221
Log:
Set p_osrel to __FreeBSD_version on process startup.
Certain system calls have quirks applied to make them work as if called
on an older version of FreeBSD. As CloudABI executables don't have the
FreeBSD OS release number in the ELF header, this value is set to zero,
making the system calls fall back to typically historic, non-standard
behaviour.
Reviewed by: kib
Modified:
head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c
==============================================================================
--- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Mon Aug 3 07:28:23 2015 (r286220)
+++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Mon Aug 3 07:29:57 2015 (r286221)
@@ -73,10 +73,20 @@ cloudabi64_fixup(register_t **stack_base
{
char canarybuf[64];
Elf64_Auxargs *args;
+ struct thread *td;
void *argdata, *canary;
size_t argdatalen;
int error;
+ /*
+ * CloudABI executables do not store the FreeBSD OS release
+ * number in their header. Set the OS release number to the
+ * latest version of FreeBSD, so that system calls behave as if
+ * called natively.
+ */
+ td = curthread;
+ td->td_proc->p_osrel = __FreeBSD_version;
+
/* Store canary for stack smashing protection. */
argdata = *stack_base;
arc4rand(canarybuf, sizeof(canarybuf), 0);
@@ -108,7 +118,7 @@ cloudabi64_fixup(register_t **stack_base
VAL(CLOUDABI_AT_PAGESZ, args->pagesz),
PTR(CLOUDABI_AT_PHDR, args->phdr),
VAL(CLOUDABI_AT_PHNUM, args->phnum),
- VAL(CLOUDABI_AT_TID, curthread->td_tid),
+ VAL(CLOUDABI_AT_TID, td->td_tid),
#undef VAL
#undef PTR
{ .a_type = CLOUDABI_AT_NULL },
More information about the svn-src-all
mailing list