s10_brand.c revision 794f0adb050e571bbfde4d2a19b9f88b852079dd
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 2N/A#
else /* ! __amd64 */ 2N/A "Solaris 10 Brand",
/* description of module */ 2N/A * The Nevada kernel clears %fs for threads in 64-bit x86 processes but S10's 2N/A * libc expects %fs to be nonzero. This causes some committed 2N/A * libraries, including libdoor. This function sets the specified LWP's %fs 2N/A * register to the legacy S10 selector value (LWPFS_SEL). 2N/A * The best solution to the aforementioned problem is backporting CRs 2N/A * 6467491 to Solaris 10 so that 64-bit x86 Solaris 10 processes 2N/A * would accept zero for %fs. Backporting the CRs is a requirement for running 2N/A * S10 Containers in PV domUs because 64-bit Xen clears %fsbase when %fs is 2N/A * nonzero. Such behavior breaks 64-bit processes because Xen has to fetch the 2N/A * FS segments' base addresses from the LWPs' GDTs, which are only capable of 2N/A * 32-bit addressing. 2N/A * The native ld.so.1 is invoked with a set of -e options which we also want to 2N/A * strip off. This function assumes the set of -e options immediately follows 2N/A * the native ld.so.1 command and is contiguous. This is OK, since we control 2N/A * the code in s10_isaexec_wrapper. We do it this way so we don't accidently 2N/A * strip a -e option from the native command itself. The format of an ld.so.1 2N/A * -e option looks like: 2N/A * len has an extra value for the trailing '\0' so this covers the 2N/A * appended " " in the following strcmps. 2N/A * Make sure that the process' interpreter is the native dynamic linker. 2N/A * Convention dictates that native processes executing within solaris10- 2N/A * branded zones are interpreted by the native dynamic linker (the 2N/A * process and its arguments are specified as arguments to the dynamic 2N/A * linker). If this convention is violated (i.e., 2N/A * brandsys(B_S10_NATIVE, ...) is invoked by a process that shouldn't be 2N/A * native), then do nothing and silently indicate success. 2N/A len +=
3;
/* to account for "/64" in the path */ 2N/A * The s10 brand needs to be able to get the pid of the 2N/A * current process and the pid of the zone's init, and it 2N/A * needs to do this on every process startup. Early in 2N/A * brand startup, we can't call getpid() because calls to 2N/A * getpid() represent a magical signal to some old-skool 2N/A * debuggers. By merging all of this into one call, we 2N/A * make this quite a bit cheaper and easier to handle in 2N/A * This subcommand enables the userland brand emulation library 2N/A * to determine whether a file descriptor refers to an extended 2N/A * file attributes directory. There is no standard syscall or 2N/A * libc function that can make such a determination. 2N/A * This subcommand exists so that the SYS_lwp_private and 2N/A * SYS_lwp_create syscalls can manually set the current thread's 2N/A * %fs register to the legacy S10 selector value for 64-bit x86 2N/A * Only correct the child's %fs register if the parent's %fs register 2N/A * is LWPFS_SEL. If the parent's %fs register is zero, then the Solaris 2N/A * 10 environment that we're emulating uses a version of libc that 2N/A * works when %fs is zero (i.e., it contains backports of CRs 6467491 2N/A * Shortcut: we know the first 32 signals are the same in both 2N/A * s10 and native Solaris. Just assign the first word. 2N/A * Copy the remainder of the initial set of common signals. 2N/A * Convert any native RT signals to their S10 values. 2N/A * Shortcut: we know the first 32 signals are the same in both 2N/A * s10 and native Solaris. Just assign the first word. * Copy the remainder of the initial set of common signals. * Convert any S10 RT signals to their native values. * Set up the table indicating which system calls we want to * interpose on. We should probably build this automatically from * a list of system calls that is shared with the user-space