Compare commits

...

12 Commits

Author SHA1 Message Date
Alejandro Colomar 65dfda3dd1 sched_setattr.2: Use syscall(SYS_...); for system calls without a wrapper
Document also why each header is required

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar d4d006687d s390_sthyi.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar c6450cf82b s390_sthyi.2: Replace numeric constant by its name (macro)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Eugene Syromyatnikov <evgsyr@gmail.com>
Cc: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar cca4e32eb3 s390_runtime_instr.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar f908665187 s390_pci_mmio_write.2: Use syscall(SYS_...); for system calls without a wrapper; fix includes too
This function doesn't use any flags or special types, so there's
no reason to include <asm/unistd.h>; remove it.  Add the includes
needed for syscall(2) only.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar 56cfe81cfb s390_guarded_storage.2: Use syscall(SYS_...); for system calls without a wrapper
Also document why each header is needed.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar cc6f5bf20f rename.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 16:44:37 +12:00
Michael Kerrisk 090fdddb43 memfd_create.2, mmap.2, shmget.2: Document the EPERM for huge page allocations
This error can occur if the caller is does not have CAP_IPC_LOCK
and is not a member of the sysctl_hugetlb_shm_group.

Reported-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 15:42:04 +12:00
Michael Kerrisk 6cee0ddeb4 proc.5: Document /proc/sys/vm/sysctl_hugetlb_shm_group
As a deprecated feature, it appears that the RLIMIT_MEMLOCK
can also be used to permit huge page allocation, but let's
not document that for now.

In the Linux 5.12, see fs/hugetlbfs/inode.c.

static int can_do_hugetlb_shm(void)
{
        kgid_t shm_group;
        shm_group = make_kgid(&init_user_ns, sysctl_hugetlb_shm_group);
        return capable(CAP_IPC_LOCK) || in_group_p(shm_group);
}

...

struct file *hugetlb_file_setup(const char *name, size_t size,
                                vm_flags_t acctflag, struct user_struct **user,
                                int creat_flags, int page_size_log)
{
        ...
        if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) {
                *user = current_user();
                if (user_shm_lock(size, *user)) {
                        task_lock(current);
                        pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
                                current->comm, current->pid);
                        task_unlock(current);
                } else {
                        *user = NULL;
                        return ERR_PTR(-EPERM);
                }
        }
        ...
}

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 15:38:39 +12:00
Michael Kerrisk 3dcdef9437 capabilities.7: CAP_IPC_LOCK also governs memory allocation using huge pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 14:08:37 +12:00
Alejandro Colomar f603c6f39d console_codes.4: tfix
The correct meaning of SGR is "Select Graphic Rendition".

See:
<https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf>
<https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub86.pdf>
<https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters>

Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 13:18:34 +12:00
Michael Kerrisk 20f1ee9317 ctime.3: Restore documentation of 'tm_gmtoff' field
Accidentally deleted in commit ba39b288ab.

Reported-by: Katsuhiro Numata <byakkomon@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 12:56:46 +12:00
13 changed files with 107 additions and 37 deletions

View File

@ -201,6 +201,19 @@ The
.BR memfd_create ()
system call first appeared in Linux 3.17;
glibc support was added in version 2.27.
.TP
.B EPERM
The
.B MFD_HUGETLB
flag was specified, but the caller was not privileged (did not have the
.B CAP_IPC_LOCK
capability)
and is not a member of the
.I sysctl_hugetlb_shm_group
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
.BR proc (5).
.SH CONFORMING TO
The
.BR memfd_create ()

View File

@ -628,6 +628,18 @@ was mounted no-exec.
The operation was prevented by a file seal; see
.BR fcntl (2).
.TP
.B EPERM
The
.B MAP_HUGETLB
flag was specified, but the caller was not privileged (did not have the
.B CAP_IPC_LOCK
capability)
and is not a member of the
.I sysctl_hugetlb_shm_group
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
.TP
.B ETXTBSY
.B MAP_DENYWRITE
was set but the object specified by

View File

@ -39,7 +39,7 @@ rename, renameat, renameat2 \- change the name or location of a file
.PP
.BI "int rename(const char *" oldpath ", const char *" newpath );
.PP
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.BR "#include <fcntl.h> " "/* Definition of " AT_* " constants */"
.B #include <stdio.h>
.PP
.BI "int renameat(int " olddirfd ", const char *" oldpath ,

View File

@ -27,13 +27,20 @@
s390_guarded_storage \- operations with z/Architecture guarded storage facility
.SH SYNOPSIS
.nf
.B #include <asm/guarded_storage.h>
.BR "#include <asm/guarded_storage.h> " "/* Definition of " GS_* " constants */"
.BR "#include <sys/syscall.h> " \
"/* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int s390_guarded_storage(int " command ", struct gs_cb *" gs_cb ");"
.BI "int syscall(SYS_s390_guarded_storage, int " command ,
.BI " struct gs_cb *" gs_cb );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR s390_guarded_storage (2),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR s390_guarded_storage ()
@ -144,9 +151,6 @@ This Linux-specific system call is available only on the s390 architecture.
.PP
The guarded storage facility is available beginning with System z14.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
The description of the guarded storage facility along with related
instructions and Guarded Storage Control Block and
Guarded Storage Event Parameter List structure layouts

View File

@ -28,16 +28,19 @@ s390_pci_mmio_write, s390_pci_mmio_read \- transfer data to/from PCI
MMIO memory page
.SH SYNOPSIS
.nf
.B #include <asm/unistd.h>
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int s390_pci_mmio_write(unsigned long " mmio_addr ,
.BI "int syscall(SYS_s390_pci_mmio_write, unsigned long " mmio_addr ,
.BI " const void *" user_buffer ", size_t " length );
.BI "int s390_pci_mmio_read(unsigned long " mmio_addr ,
.BI "int syscall(SYS_s390_pci_mmio_read, unsigned long " mmio_addr ,
.BI " void *" user_buffer ", size_t " length );
.fi
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR s390_pci_mmio_write ()
@ -102,8 +105,5 @@ These system calls are available since Linux 3.19.
.SH CONFORMING TO
This Linux-specific system call is available only on the s390 architecture.
The required PCI support is available beginning with System z EC12.
.SH NOTES
Glibc does not provide wrappers for these system calls; call them using
.BR syscall (2)
.SH SEE ALSO
.BR syscall (2)

View File

@ -27,13 +27,18 @@
s390_runtime_instr \- enable/disable s390 CPU run-time instrumentation
.SH SYNOPSIS
.nf
.B #include <asm/runtime_instr.h>
.BR "#include <asm/runtime_instr.h>" " /* Definition of " S390_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int s390_runtime_instr(int " command ", int " signum ");"
.BI "int syscall(SYS_s390_runtime_instr, int " command ", int " signum );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR s390_runtime_instr (2),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR s390_runtime_instr ()
@ -97,9 +102,6 @@ This Linux-specific system call is available only on the s390 architecture.
The run-time instrumentation facility is available
beginning with System z EC12.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2)
.PP
The
.I asm/runtime_instr.h
header file is available

View File

@ -27,14 +27,20 @@
s390_sthyi \- emulate STHYI instruction
.SH SYNOPSIS
.nf
.B #include <asm/unistd.h>
.BR "#include <asm/sthyi.h>" " /* Definition of " STHYI_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int s390_sthyi(unsigned long " function_code ", void *" resp_buffer ","
.BI " uint64_t *" return_code ", unsigned long " flags ");"
.BI "int syscall(SYS_s390_sthyi, unsigned long " function_code ,
.BI " void *" resp_buffer ", uint64_t *" return_code ,
.BI " unsigned long " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR s390_sthyi (2),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR s390_sthyi ()
@ -49,7 +55,7 @@ The
argument indicates which function to perform.
The following code(s) are supported:
.TP
0
.B STHYI_FC_CP_IFL_CAP
Return CP (Central Processor) and IFL (Integrated Facility for Linux)
capacity information.
.PP
@ -58,7 +64,9 @@ The
argument specifies the address of a response buffer.
When the
.I function_code
is 0, the buffer must be one page (4K) in size.
is
.BR STHYI_FC_CP_IFL_CAP ,
the buffer must be one page (4K) in size.
If the system call returns 0,
the response buffer will be filled with CPU capacity information.
Otherwise, the response buffer's content is unchanged.
@ -126,9 +134,6 @@ This system call is available since Linux 4.15.
.SH CONFORMING TO
This Linux-specific system call is available only on the s390 architecture.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2)
.PP
For details of the STHYI instruction, see
.UR https://www.ibm.com\:/support\:/knowledgecenter\:/SSB27U_6.3.0\:/com.ibm.zvm.v630.hcpb4\:/hcpb4sth.htm
the documentation page

View File

@ -29,17 +29,21 @@ sched_setattr, sched_getattr \-
set and get scheduling policy and attributes
.SH SYNOPSIS
.nf
.B #include <sched.h>
.BR "#include <sched.h>" " /* Definition of " SCHED_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int sched_setattr(pid_t " pid ", struct sched_attr *" attr ,
.BI " unsigned int " flags );
.BI "int sched_getattr(pid_t " pid ", struct sched_attr *" attr ,
.BI " unsigned int " size ", unsigned int " flags );
.BI "int syscall(SYS_sched_setattr, pid_t " pid ", struct sched_attr *" attr ,
.BI " unsigned int " flags );
.BI "int syscall(SYS_sched_getattr, pid_t " pid ", struct sched_attr *" attr ,
.BI " unsigned int " size ", unsigned int " flags );
.fi
.\" FIXME . Add feature test macro requirements
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.SS sched_setattr()
The

View File

@ -273,7 +273,13 @@ The
.B SHM_HUGETLB
flag was specified, but the caller was not privileged (did not have the
.B CAP_IPC_LOCK
capability).
capability)
and is not a member of the
.I sysctl_hugetlb_shm_group
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
.BR proc (5).
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4.
.\" SVr4 documents an additional error condition EEXIST.

View File

@ -425,6 +425,7 @@ The glibc version of \fIstruct tm\fP has additional fields
.PP
.in +4n
.EX
long tm_gmtoff; /* Seconds east of UTC */
const char *tm_zone; /* Timezone abbreviation */
.EE
.in

View File

@ -298,7 +298,7 @@ T}
.TE
.ad
.PP
.B ECMA-48 Set Graphics Rendition
.B ECMA-48 Select Graphic Rendition
.PP
The ECMA-48 SGR sequence ESC [ \fIparameters\fP m sets display
attributes.

View File

@ -5603,6 +5603,19 @@ user should run
.BR sync (1)
first.
.TP
.IR /proc/sys/vm/sysctl_hugetlb_shm_group " (since Linux 2.6.7)"
This writable file contains a group ID that is allowed
to allocate memory using huge pages.
If a process has a filesystem group ID or any supplememtary group ID that
matches this group ID,
then it can make huge-page allocations without holding the
.BR CAP_IPC_LOCK
capability; see
.BR memfd_create (2),
.BR mmap (2),
and
.BR shmget (2).
.TP
.IR /proc/sys/vm/legacy_va_layout " (since Linux 2.6.9)"
.\" The following is from Documentation/filesystems/proc.txt
If nonzero, this disables the new 32-bit memory-mapping layout;

View File

@ -205,11 +205,21 @@ the filesystem or any of the supplementary GIDs of the calling process.
.B CAP_IPC_LOCK
.\" FIXME . As at Linux 3.2, there are some strange uses of this capability
.\" in other places; they probably should be replaced with something else.
.PD 0
.RS
.IP * 2
Lock memory
.RB ( mlock (2),
.BR mlockall (2),
.BR mmap (2),
.BR shmctl (2));
.IP *
Allocate memory using huge pages
.RB ( memfd_create (2)
.BR mmap (2),
.BR shmctl (2)).
.PD 0
.RE
.TP
.B CAP_IPC_OWNER
Bypass permission checks for operations on System V IPC objects.