setarch
Run program under specified architecture environment
SYNOPSIS
setarch architecture [options] program [arguments...]
PARAMETERS
architecture
Specifies the target architecture (e.g., i386, x86_64). This is mandatory.
-v
Verbose mode; displays information about the set environment.
-B
Run in backward-compatible mode. Sets personality to ADDR_COMPAT_LAYOUT.
-L
Run in backwards-compatible mode with mmap using the legacy brk (ADDR_LIMIT_32BIT) for memory regions
-3
Sets the personality to ADDR_NO_RANDOMIZE. Disables address space layout randomization (ASLR).
-I
Sets the personality to MMAP_PAGE_ZERO. Maps page zero as readable and writable.
-F
Sets the personality to STICKY_TIMEOUTS. Makes select/poll return immediatelly after a certain timeout.
-T
Sets the personality to SHORT_INODE. uses smaller inode numbers
-X
Sets the personality to WHOLE_SECONDS. Rounds time functions to whole seconds.
-Z
Sets the personality to FDPIC_FUNCTIONS. Uses FDPIC function calling conventions
program
The program to execute under the specified architecture.
arguments
Arguments passed to the executed program.
DESCRIPTION
The setarch command modifies the process execution environment to match a particular architecture. This is primarily useful for running binaries compiled for different architectures on a system that supports multiple architectures. setarch allows you to specify the architecture, personality, and other execution domain settings for a program, effectively emulating a different environment than the native system architecture.
It's commonly used to run older programs that rely on specific kernel behaviors or system calls present in older architectures. By adjusting the environment, it can enable compatibility and allow legacy applications to function correctly. However, it's important to note that setarch doesn't perform binary translation. It only modifies the runtime environment's behavior; the target architecture must still be compatible with the underlying hardware.
Improper usage of setarch can lead to unexpected program behavior or crashes, so careful consideration of the target architecture and its compatibility with the host system is crucial.
CAVEATS
setarch relies on the kernel's ability to emulate certain aspects of different architectures. It does not perform binary translation and may not work for all architectures or programs.
Compatibility depends heavily on the specific program, target architecture, and kernel support.
ARCHITECTURE SUPPORT
The available architectures depend on the kernel's configuration and capabilities. Common examples include i386, x86_64, arm, and powerpc.
Refer to your system's documentation for a complete list.
PERSONALITY
The personality is a kernel mechanism that allows a program to behave differently than normal by applying different execution domain flags. The various options provided with setarch modify this personality. For example, disabling ASLR can be helpful for debugging, but should generally be avoided for security reasons.
HISTORY
The setarch command evolved as a utility to ease the transition between different processor architectures, particularly as Linux systems began to support multiple instruction sets and ABI's. It allows administrators and developers to simulate older environments without the overhead or complexity of full virtualization.
It has been crucial for running legacy software on newer hardware.
SEE ALSO
chroot(1), namespaces(7)