1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
.TH SETARCH 8 "December 2017" "util-linux" "System Administration"
.SH NAME
setarch \- change reported architecture in new program environment and/or set personality flags
.SH SYNOPSIS
.B setarch
.RI [ arch ]
[options]
.RI [ program
.RI [ argument ...]]
.sp
.B setarch
.BR \-\-list | \-h | \-V
.sp
.B arch
[options]
.RI [ program
.RI [ argument ...]]
.SH DESCRIPTION
.B setarch
modifies execution domains and process personality flags.
.PP
The execution domains currently only affects the output of \fBuname -m\fR.
For example, on an AMD64 system, running \fBsetarch i386 \fIprogram\fR
will cause \fIprogram\fR to see i686 instead of x86_64 as the machine type.
It also allows to set various personality options.
The default \fIprogram\fR is \fB/bin/sh\fR.
.PP
Since version 2.33 the
.I arch
command line argument is optional and
.B setarch
may be used to change personality flags (ADDR_LIMIT_*, SHORT_INODE, etc) without
modification of the execution domain.
.SH OPTIONS
.TP
.B \-\-list
List the architectures that \fBsetarch\fR knows about. Whether \fBsetarch\fR
can actually set each of these architectures depends on the running kernel.
.TP
.B \-\-uname\-2.6
Causes the \fIprogram\fR to see a kernel version number beginning with 2.6.
Turns on UNAME26.
.TP
.BR \-v , " \-\-verbose"
Be verbose.
.TP
\fB\-3\fR, \fB\-\-3gb\fR
Specifies
.I program
should use a maximum of 3GB of address space. Supported on x86. Turns on
ADDR_LIMIT_3GB.
.TP
\fB\-\-4gb\fR
This option has no effect. It is retained for backward compatibility only,
and may be removed in future releases.
.TP
\fB\-B\fR, \fB\-\-32bit\fR
Limit the address space to 32 bits to emulate hardware. Supported on ARM
and Alpha. Turns on ADDR_LIMIT_32BIT.
.TP
\fB\-F\fR, \fB\-\-fdpic\-funcptrs\fR
Treat user-space function pointers to signal handlers as pointers to address
descriptors. This option has no effect on architectures that do not support
FDPIC ELF binaries. In kernel v4.14 support is limited to ARM, Blackfin,
Fujitsu FR-V, and SuperH CPU architectures.
.TP
\fB\-I\fR, \fB\-\-short\-inode\fR
Obsolete bug emulation flag. Turns on SHORT_INODE.
.TP
\fB\-L\fR, \fB\-\-addr\-compat\-layout\fR
Provide legacy virtual address space layout. Use when the
.I program
binary does not have PT_GNU_STACK ELF header. Turns on
ADDR_COMPAT_LAYOUT.
.TP
\fB\-R\fR, \fB\-\-addr\-no\-randomize\fR
Disables randomization of the virtual address space. Turns on
ADDR_NO_RANDOMIZE.
.TP
\fB\-S\fR, \fB\-\-whole\-seconds\fR
Obsolete bug emulation flag. Turns on WHOLE_SECONDS.
.TP
\fB\-T\fR, \fB\-\-sticky\-timeouts\fR
This makes
.BR select (2),
.BR pselect (2),
and
.BR ppoll (2)
system calls preserve the timeout value instead of modifying it to reflect
the amount of time not slept when interrupted by a signal handler. Use when
.I program
depends on this behavior. For more details see the timeout description in
.BR select (2)
manual page. Turns on STICKY_TIMEOUTS.
.TP
\fB\-X\fR, \fB\-\-read\-implies\-exec\fR
If this is set then
.BR mmap (3)
PROT_READ will also add the PROT_EXEC bit - as expected by legacy x86
binaries. Notice that the ELF loader will automatically set this bit when
it encounters a legacy binary. Turns on READ_IMPLIES_EXEC.
.TP
\fB\-Z\fR, \fB\-\-mmap\-page\-zero\fR
SVr4 bug emulation that will set
.BR mmap (3)
page zero as read-only. Use when
.I program
depends on this behavior, and the source code is not available to be fixed.
Turns on MMAP_PAGE_ZERO.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.SH EXAMPLES
setarch --addr-no-randomize mytestprog
.br
setarch ppc32 rpmbuild --target=ppc --rebuild foo.src.rpm
.br
setarch ppc32 -v -vL3 rpmbuild --target=ppc --rebuild bar.src.rpm
.br
setarch ppc32 --32bit rpmbuild --target=ppc --rebuild foo.src.rpm
.SH AUTHOR
.MT sopwith@redhat.com
Elliot Lee
.ME
.br
.MT jnovy@redhat.com
Jindrich Novy
.ME
.br
.MT kzak@redhat.com
Karel Zak
.ME
.SH "SEE ALSO"
.BR personality (2),
.BR select (2)
.SH AVAILABILITY
The setarch command is part of the util-linux package and is available from
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .
|