From 68979757bc2813c52f751a1e7fbc784567798b31 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 2 Jun 2000 00:27:08 +0000 Subject: Update. * elf/elf.h (ELF64_R_INFO): Cast sym value to Elf64_Xword before shifting. --- ChangeLog | 3 +++ elf/elf.h | 2 +- manual/arith.texi | 8 +++---- manual/memory.texi | 64 ++++++++++++++++++++++++++++++++++++----------------- manual/sysinfo.texi | 35 ++++++++++++++--------------- 5 files changed, 69 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index c581f7907f..7d24f09dec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-06-01 Ulrich Drepper + * elf/elf.h (ELF64_R_INFO): Cast sym value to Elf64_Xword before + shifting. + * sysdeps/i386/elf/setjmp.S: Work around change is recent binutils. gas now emits a jump through the PLT instead of a relative jump if the jump target is an exported symbol. diff --git a/elf/elf.h b/elf/elf.h index 042dcbdb31..b9b34429e7 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -476,7 +476,7 @@ typedef struct #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) -#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type)) +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) /* Program segment header. */ diff --git a/manual/arith.texi b/manual/arith.texi index 2112ef2fce..c967bc670c 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -51,7 +51,7 @@ These @code{typedef}s are in @file{stdint.h}. If you require that an integer be represented in exactly N bits, use one of the following types, with the obvious mapping to bit size and signedness: -@itemize +@itemize @bullet @item int8_t @item int16_t @item int32_t @@ -68,7 +68,7 @@ size, the corresponding above type does not exist. If you don't need a specific storage size, but want the smallest data structure with @emph{at least} N bits, use one of these: -@itemize +@itemize @bullet @item int8_least_t @item int16_least_t @item int32_least_t @@ -84,7 +84,7 @@ that allows the fastest access while having at least N bits (and among data structures with the same access speed, the smallest one), use one of these: -@itemize +@itemize @bullet @item int8_fast_t @item int16_fast_t @item int32_fast_t @@ -100,7 +100,7 @@ which it is being used, use one of the following. If you use these, you should write code that takes into account the variable size and range of the integer. -@itemize +@itemize @bullet @item intmax_t @item uintmax_t @end itemize diff --git a/manual/memory.texi b/manual/memory.texi index b0996a5064..fc364194df 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -5,7 +5,7 @@ @cindex storage allocation This chapter describes how processes manage and use memory in a system -that uses the GNU C library. +that uses the GNU C library. The GNU C Library has several functions for dynamically allocating virtual memory in various ways. They vary in generality and in @@ -79,7 +79,7 @@ is at which addresses, and that process is called memory allocation. Allocation usually brings to mind meting out scarce resources, but in the case of virtual memory, that's not a major goal, because there is generally much more of it than anyone needs. Memory allocation within a -process is mainly just a matter of making sure that the same byte of +process is mainly just a matter of making sure that the same byte of memory isn't used to store two different things. Processes allocate memory in two major ways: by exec and @@ -133,11 +133,11 @@ a contiguous range of virtual addresses. Three important segments are: @itemize @bullet -@item +@item The @dfn{text segment} contains a program's instructions and literals and static constants. It is allocated by exec and stays the same size for -the life of the virtual address space. +the life of the virtual address space. @item The @dfn{data segment} is working storage for the program. It can be @@ -145,7 +145,7 @@ preallocated and preloaded by exec and the process can extend or shrink it by calling functions as described in @xref{Resizing the Data Segment}. Its lower end is fixed. -@item +@item The @dfn{stack segment} contains a program stack. It grows as the stack grows, but doesn't shrink when the stack shrinks. @@ -154,7 +154,7 @@ grows, but doesn't shrink when the stack shrinks. @node Memory Allocation -@section Allocating Storage For a Program's Data +@section Allocating Storage For Program Data This section covers how ordinary programs manage storage for their data, including the famous @code{malloc} function and some fancier facilities @@ -280,8 +280,7 @@ any time (or never). block and clear it. * Efficiency and Malloc:: Efficiency considerations in use of these functions. -* Aligned Memory Blocks:: Allocating specially aligned memory: - @code{memalign} and @code{valloc}. +* Aligned Memory Blocks:: Allocating specially aligned memory. * Malloc Tunable Parameters:: Use @code{mallopt} to adjust allocation parameters. * Heap Consistency Checking:: Automatic checking for errors. @@ -383,8 +382,8 @@ The block that @code{malloc} gives you is guaranteed to be aligned so that it can hold any type of data. In the GNU system, the address is always a multiple of eight on most systems, and a multiple of 16 on 64-bit systems. Only rarely is any higher boundary (such as a page -boundary) necessary; for those cases, use @code{memalign} or -@code{valloc} (@pxref{Aligned Memory Blocks}). +boundary) necessary; for those cases, use @code{memalign}, +@code{posix_memalign} or @code{valloc} (@pxref{Aligned Memory Blocks}). Note that the memory located after the end of the block is likely to be in use for something else; perhaps a block already allocated by another @@ -617,12 +616,13 @@ after calling @code{free} wastes memory. The size threshold for The address of a block returned by @code{malloc} or @code{realloc} in the GNU system is always a multiple of eight (or sixteen on 64-bit systems). If you need a block whose address is a multiple of a higher -power of two than that, use @code{memalign} or @code{valloc}. These -functions are declared in @file{stdlib.h}. +power of two than that, use @code{memalign}, @code{posix_memalign}, or +@code{valloc}. These functions are declared in @file{stdlib.h}. With the GNU library, you can use @code{free} to free the blocks that -@code{memalign} and @code{valloc} return. That does not work in BSD, -however---BSD does not provide any way to free such blocks. +@code{memalign}, @code{posix_memalign}, and @code{valloc} return. That +does not work in BSD, however---BSD does not provide any way to free +such blocks. @comment malloc.h stdlib.h @comment BSD @@ -634,6 +634,22 @@ somewhat larger block, and then returning an address within the block that is on the specified boundary. @end deftypefun +@comment stdlib.h +@comment POSIX +@deftypefun int posix_memalign (void **@var{memptr}, size_t @var{alignment}, size_t @var{size}) +The @code{posix_memalign} function is similar to the @code{memalign} +function in that it returns a buffer of @var{size} bytes aligned to a +multiple of @var{alignment}. But it adds one requirement to the +parameter @var{alignment}: the value must be a power of two multiple of +@code{sizeof (void *)}. + +If the function succeeds in allocation memory a pointer to the allocated +memory is returned in @code{*@var{memptr}} and the return value is zero. +Otherwise the function returns an error value indicating the problem. + +This function was introduced in POSIX 1003.1d. +@end deftypefun + @comment malloc.h stdlib.h @comment BSD @deftypefun {void *} valloc (size_t @var{size}) @@ -790,6 +806,14 @@ immediately. This can be useful because otherwise a crash may happen much later, and the true cause for the problem is then very hard to track down. +There is one problem with @code{MALLOC_CHECK_}: in SUID or SGID binaries +it could possibly be exploited since diverging from the normal programs +behaviour it now writes something to the standard error desriptor. +Therefore the use of @code{MALLOC_CHECK_} is disabled by default for +SUID and SGID binaries. It can be enabled again by the system +administrator by adding a file @file{/etc/suid-debug} (the content is +not important it could be empty). + So, what's the difference between using @code{MALLOC_CHECK_} and linking with @samp{-lmcheck}? @code{MALLOC_CHECK_} is orthogonal with respect to @samp{-lmcheck}. @samp{-lmcheck} has been added for backward @@ -1034,7 +1058,7 @@ This is the total size of memory occupied by free (not in use) chunks. @item int keepcost This is the size of the top-most releasable chunk that normally -borders the end of the heap (i.e. the high end of the virtual address +borders the end of the heap (i.e. the high end of the virtual address space's data segment). @end table @@ -2323,7 +2347,7 @@ The function has no effect if @var{addr} is lower than the low end of the data segment. (This is considered success, by the way). The function fails if it would cause the data segment to overlap another -segment or exceed the process' data storage limit (@pxref{Limits on +segment or exceed the process' data storage limit (@pxref{Limits on Resources}). The function is named for a common historical case where data storage @@ -2333,7 +2357,7 @@ toward it from the top of the segment and the curtain between them is called the @dfn{break}. The return value is zero on success. On failure, the return value is -@code{-1} and @code{errno} is set accordingly. The following @code{errno} +@code{-1} and @code{errno} is set accordingly. The following @code{errno} values are specific to this function: @table @code @@ -2392,7 +2416,7 @@ pages. @subsection Why Lock Pages Because page faults cause paged out pages to be paged in transparently, -a process rarely needs to be concerned about locking pages. However, +a process rarely needs to be concerned about locking pages. However, there are two reasons people sometimes are: @itemize @bullet @@ -2457,7 +2481,7 @@ In Linux, locked pages aren't as locked as you might think. Two virtual pages that are not shared memory can nonetheless be backed by the same real frame. The kernel does this in the name of efficiency when it knows both virtual pages contain identical data, and does it -even if one or both of the virtual pages are locked. +even if one or both of the virtual pages are locked. But when a process modifies one of those pages, the kernel must get it a separate frame and fill it with the page's data. This is known as a @@ -2639,7 +2663,7 @@ with @code{munlockall} and @code{munlock}. address space and turn off @code{MCL_FUTURE} future locking mode. The return value is zero if the function succeeds. Otherwise, it is -@code{-1} and @code{errno} is set accordingly. The only way this +@code{-1} and @code{errno} is set accordingly. The only way this function can fail is for generic reasons that all functions and system calls can fail, so there are no specific @code{errno} values. diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi index 7cc43ecc25..ee5009b2ac 100644 --- a/manual/sysinfo.texi +++ b/manual/sysinfo.texi @@ -42,7 +42,7 @@ to a more rigorous naming convention as part of the Domain Name System @enumerate @item -hostname +hostname @cindex hostname @item domain name @@ -53,16 +53,16 @@ You will note that ``hostname'' looks a lot like ``host name'', but is not the same thing, and that people often incorrectly refer to entire host names as ``domain names.'' -In DNS, the full host name is properly called the FQDN (Fully Qualified +In DNS, the full host name is properly called the FQDN (Fully Qualified Domain Name) and consists of the hostname, then a period, then the domain name. The domain name itself usually has multiple components separated by periods. So for example, a system's hostname may be -@samp{chicken} and its domain name might be @samp{ai.mit.edu}, so +@samp{chicken} and its domain name might be @samp{ai.mit.edu}, so its FQDN (which is its host name) is @samp{chicken.ai.mit.edu}. @cindex FQDN Adding to the confusion, though, is that DNS is not the only name space -in which a computer needs to be known. Another name space is the +in which a computer needs to be known. Another name space is the NIS (aka YP) name space. For NIS purposes, there is another domain name, which is called the NIS domain name or the YP domain name. It need not have anything to do with the DNS domain name. @@ -74,7 +74,7 @@ need not have anything to do with the DNS domain name. Confusing things even more is the fact that in DNS, it is possible for multiple FQDNs to refer to the same system. However, there is always exactly one of them that is the true host name, and it is called the -canonical FQDN. +canonical FQDN. In some contexts, the host name is called a ``node name.'' @@ -83,7 +83,7 @@ For more information on DNS host naming, @xref{Host Names}. @pindex hostname @pindex hostid @pindex unistd.h -Prototypes for these functions appear in @file{unistd.h}. +Prototypes for these functions appear in @file{unistd.h}. The programs @code{hostname}, @code{hostid}, and @code{domainname} work by calling these functions. @@ -195,7 +195,7 @@ to @var{id}. Only privileged processes are permitted to do this. Usually it happens just once, at system boot time. The proper way to establish the primary IP address of a system -is to configure the IP address resolver to associate that IP address with +is to configure the IP address resolver to associate that IP address with the system's host name as returned by @code{gethostname}. For example, put a record for the system in @file{/etc/hosts}. @@ -224,9 +224,9 @@ associated data type are declared in the header file @file{sys/utsname.h}. @pindex sys/utsname.h -As a bonus, @code{uname} also gives some information identifying the +As a bonus, @code{uname} also gives some information identifying the particular system your program is running on. This is the same information -which you can get with functions targetted to this purpose described in +which you can get with functions targetted to this purpose described in @ref{Host Identification}. @@ -284,7 +284,7 @@ see @ref{Host Identification}. @item char domainname[] This is the NIS or YP domain name. It is the same value returned by -@code{getdomainname}; see @ref{Host Identification}. This element +@code{getdomainname}; see @ref{Host Identification}. This element is a relatively recent invention and use of it is not as portable as use of the rest of the structure. @@ -919,7 +919,7 @@ The file system type @var{fstype} is not known to the kernel. The file @var{dev} is not a block device special file. @item EBUSY -@itemize +@itemize @bullet @item The device is already mounted. @@ -933,7 +933,7 @@ The request is to remount read-only, but there are files open for write. @end itemize @item EINVAL -@itemize +@itemize @bullet @item A remount was attempted, but there is no filesystem mounted over the @@ -945,7 +945,7 @@ The supposed filesystem has an invalid superblock. @end itemize @item EACCESS -@itemize +@itemize @bullet @item The filesystem is inherently read-only (possibly due to a switch on the @@ -1110,7 +1110,7 @@ returned value. If you don't want the parameter value returned, specify a null pointer for @var{oldval}. -To set the parameter, specify the address and length of the new value +To set the parameter, specify the address and length of the new value as @var{newval} and @var{newlen}. If you don't want to set the parameter, specify a null pointer as @var{newval}. @@ -1134,10 +1134,10 @@ failures that apply to all system calls, the following are the @table @code @item EPERM -The process is not permitted to access one of the components of the +The process is not permitted to access one of the components of the path of the system parameter or is not permitted to access the system parameter itself in the way (read or write) that it requested. -@c There is some indication in the Linux 2.2 code that the code is trying to +@c There is some indication in the Linux 2.2 code that the code is trying to @c return EACCESS here, but the EACCESS value never actually makes it to the @c user. @item ENOTDIR @@ -1164,7 +1164,7 @@ small. @end deftypefun If you have a Linux kernel with the @code{proc} filesystem, you can get -and set most of the same parameters by reading and writing to files in +and set most of the same parameters by reading and writing to files in the @code{sys} directory of the @code{proc} filesystem. In the @code{sys} directory, the directory structure represents the hierarchical structure of the parameters. E.g. you can display the free page thresholds with @@ -1190,4 +1190,3 @@ parameters are: @item @code{bdflush} @end itemize - -- cgit v1.2.3