]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/ldconfig/ldconfig.8
ldconfig(8): clarify language for files
[FreeBSD/FreeBSD.git] / sbin / ldconfig / ldconfig.8
1 .\"
2 .\" Copyright (c) 1993 Paul Kranenburg
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\"    must display the following acknowledgement:
15 .\"      This product includes software developed by Paul Kranenburg.
16 .\" 3. The name of the author may not be used to endorse or promote products
17 .\"    derived from this software without specific prior written permission
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd January 6, 2018
33 .Dt LDCONFIG 8
34 .Os
35 .Sh NAME
36 .Nm ldconfig
37 .Nd configure the shared library cache
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl 32
41 .Op Fl aout | Fl elf
42 .Op Fl Rimrsv
43 .Op Fl f Ar hints_file
44 .Op Ar directory | Ar
45 .Sh DESCRIPTION
46 The
47 .Nm
48 utility is used to prepare a set of
49 .Dq hints
50 for use by the dynamic linker
51 to facilitate quick lookup of shared libraries available in multiple
52 directories.
53 It scans a set of built-in system directories and any
54 .Ar directories
55 specified on the command line (in the given order) looking for
56 shared libraries and stores the results in a system file to forestall
57 the overhead that would otherwise result from the directory search
58 operations the dynamic linker would have to perform to load the
59 required shared libraries.
60 .Pp
61 Alternatively,
62 .Ar files
63 may be specified; these are expected to contain directories
64 to scan for shared libraries.
65 Each directory's pathname must start on a new
66 line.
67 Blank lines and lines starting with the comment character
68 .Ql \&#
69 are ignored.
70 Filenames must conform to the
71 .Pa lib*.so.[0-9]
72 pattern in order to be added to the hints file.
73 .Pp
74 For security reasons, directories which are world or group-writable or which
75 are not owned by root produce warning messages and are skipped, unless
76 the
77 .Fl i
78 option is present.
79 .Pp
80 The shared libraries which are found will be automatically available for loading
81 if needed by the program being prepared for execution.
82 This obviates the need
83 for storing search paths within the executable.
84 .Pp
85 The
86 .Ev LD_LIBRARY_PATH
87 environment variable can be used to override the use of
88 directories (or the order thereof) from the cache or to specify additional
89 directories where shared libraries might be found.
90 .Ev LD_LIBRARY_PATH
91 is a
92 .Sq \&:
93 separated list of directory paths which are searched by
94 the dynamic linker
95 when it needs to load a shared library.
96 It can be viewed as the run-time
97 equivalent of the
98 .Fl L
99 switch of
100 .Xr ld 1 .
101 .Pp
102 The
103 .Nm
104 utility is typically run as part of the boot sequence.
105 .Pp
106 The following options are recognized by
107 .Nm :
108 .Bl -tag -width indent
109 .It Fl 32
110 Generate the hints for 32-bit ABI shared libraries
111 on 64-bit systems that support running 32-bit binaries.
112 .It Fl aout
113 Generate the hints for a.out format shared libraries.
114 .It Fl elf
115 Generate the hints for ELF format shared libraries.
116 .It Fl R
117 Rescan the previously configured directories.
118 This opens the previous hints
119 file and fetches the directory list from the header.
120 Any additional pathnames
121 on the command line are also processed.
122 This is the default action when no parameters are given.
123 .It Fl f Ar hints_file
124 Read and/or update the specified hints file, instead of the standard file.
125 This option is provided primarily for testing.
126 .It Fl i
127 Run in insecure mode.
128 The security checks will not be performed.
129 .It Fl m
130 Instead of replacing the contents of the hints file
131 with those found in the directories specified,
132 .Dq merge
133 in new entries.
134 Directories recorded in the hints file by previous runs of
135 .Nm
136 are also rescanned for new shared libraries.
137 .It Fl r
138 List the current contents of the hints file
139 on the standard output.
140 The hints file is not modified.
141 The list of
142 directories stored in the hints file is included.
143 .It Fl s
144 Do not scan the built-in system directory
145 .Pq Dq /usr/lib
146 for shared libraries.
147 .It Fl v
148 Switch on verbose mode.
149 .El
150 .Sh SECURITY
151 Special care must be taken when loading shared libraries into the address
152 space of
153 .Ev set-user-Id
154 programs.
155 Whenever such a program is run by any user except the owner of the program,
156 the dynamic linker
157 will only load shared libraries from the hints
158 file.
159 In particular, the
160 .Ev LD_LIBRARY_PATH
161 is not used to search for libraries.
162 Thus, the role of ldconfig is dual.
163 In
164 addition to building a set of hints for quick lookup, it also serves to
165 specify the trusted collection of directories from which shared objects can
166 be safely loaded.
167 .Sh FILES
168 .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact
169 .It Pa /var/run/ld.so.hints
170 Standard hints file for the a.out dynamic linker.
171 .It Pa /var/run/ld-elf.so.hints
172 Standard hints file for the ELF dynamic linker.
173 .It Pa /etc/ld.so.conf
174 Conventional configuration file containing directory names for
175 invocations with
176 .Fl aout .
177 .It Pa /etc/ld-elf.so.conf
178 Conventional configuration file containing directory names for
179 invocations with
180 .Fl elf .
181 .It Pa /var/run/ld-elf32.so.hints
182 .It Pa /var/run/ld32.so.hints
183 Conventional configuration files containing directory names for
184 invocations with
185 .Fl 32 .
186 .El
187 .Sh SEE ALSO
188 .Xr ld 1 ,
189 .Xr link 5
190 .Sh HISTORY
191 A
192 .Nm
193 utility first appeared in SunOS 4.0, it appeared in its current form
194 in
195 .Fx 1.1 .
196 .Sh BUGS
197 Some security checks (for example, verifying root ownership of
198 added directories) are not performed when
199 .Fl aout
200 is specified.