Commit Graph

20087 Commits

Author SHA1 Message Date
Michael Kerrisk 6549145309 pldd.1: ffix
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 13:03:00 -06:00
Michael Kerrisk 3319789c6a pldd.1: ffix: replace tab with spaces
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 13:00:26 -06:00
Michael Kerrisk fb11d20834 pldd.1: Note that the glibc 2.30 pldd fix has been backported on some distros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:58:51 -06:00
G. Branden Robinson da80c365d8 pldd.1: Minor wording fixes
* Establish the abbreviations DSO and PID in the lead paragraph
  since they are used later.
* Parallelize descriptions of help, usage, and version options
  with the "and exit" language used in getent(1), iconv(1),
  locale(1), localedef(1), memusage(1), memusagestat(1),
  mtrace(1), pldd(1), sprof(1), time(1), iconvconfig(8),
  zdump(8), and zic(8).

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:50:48 -06:00
G. Branden Robinson d3863db865 pldd.1: Document glibc's unbreakage of tool.
glibc 2.30 isn't released yet, but a fix has been committed, and
Debian has even cherry-picked it for Debian GNU/Linux 10
("buster").  pldd works nicely now.

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:48:55 -06:00
Michael Kerrisk 705ac54d0f signal.7: Minor text rework
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:18:08 -06:00
Michael Kerrisk 9b6aa9d133 signal.7: Some reworking of Michal Sekletar's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:15:32 -06:00
Michael Kerrisk cd9b34fc58 signal.7: Relocate Michal Sekletar's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:49:04 -06:00
Michal Sekletar e447e5bad3 signal.7: Clarify that siginfo_t isn't changed on coalescing
Confirmed by experiment by mtk:

$ cat siginfo_nonqueuing.c

                        } while (0)

static void
grimReaper(int sig, siginfo_t *si, void *ucontext)
{
    printf("caught signal %d\n", sig);

    printf("    si_pid=%ld, si_uid=%ld, si_status=%d\n",
            (long) si->si_pid, (long) si->si_uid, si->si_status);
}

static void
child(int sleepTime, uid_t uid, int status)
{
    switch (fork()) {
    case -1:
        errExit("fork");
    case 0:
        sleep(sleepTime);
        if (geteuid() == 0)
            setuid(uid);

        printf("Child %ld with UID %ld exiting with status %d\n",
                (long) getpid(),(long) getuid(), status);
        exit(status);
    default:
        return;
    }
}

int
main(int argc, char *argv[])
{
    struct sigaction sa;
    sigset_t blocking;

    sa.sa_sigaction = grimReaper;
    sa.sa_flags = SA_SIGINFO;
    sigemptyset(&sa.sa_mask);

    if (sigaction(SIGCHLD, &sa, NULL) == -1)
        errExit("sigaction");

    sigemptyset(&blocking);
    sigaddset(&blocking, SIGCHLD);
    if (sigprocmask(SIG_BLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    child(2, 20000, 20);
    child(3, 30000, 30);
    child(1, 10000, 10);

    sleep(5);

    if (sigprocmask(SIG_UNBLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    exit(EXIT_SUCCESS);
}
$ ./siginfo_nonqueuing
Child 4042 with UID 1000 exiting with status 10
Child 4040 with UID 1000 exiting with status 20
Child 4041 with UID 1000 exiting with status 30
caught signal 17
    si_pid=4042, si_uid=1000, si_status=10

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Lennart Poettering <lennart@poettering.net>

Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Michal Sekletar <msekleta@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:44:12 -06:00
Michael Kerrisk c7871135df signal.7: Add subsection on queuing and delivery semantics for standard signals
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:44:12 -06:00
Jakub Wilk ed386413f8 execve.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 10:15:48 -06:00
Michael Kerrisk 069be4fd22 bpf.2: Correct kernel version for JIT support on s390
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 18:05:50 +02:00
Michael Kerrisk ed33c6886c credentials.7: Note that /proc/PID/status shows a process's credentials
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 15:44:47 +02:00
Michael Kerrisk aa16684c95 signal.7: Various fields in /proc/PID/status show signal-related information
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 15:19:31 +02:00
Michael Kerrisk 9b8887eb94 proc.5: Correct description of /pro/PID/status 'ShdPnd' and 'SigPnd' fields
These fields are signal masks, not counters.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:54:10 +02:00
Michael Kerrisk a4e6603a52 proc.5: Clarify that various mask fields in /proc/PID/status are in hexadecimal
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:14:03 +02:00
Michael Kerrisk 8e2ca125e4 proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:11:07 +02:00
Michael Kerrisk 4c63ee20b0 tkill.2: glibc 2.30 provides a wrapper for tgkill()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-08 12:23:55 +02:00
Michael Kerrisk 5f2efacf9f ld.so.8: wfix: fix a clumsy wording that is hard to parse
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-05 10:16:01 +02:00
Michael Kerrisk ec8a211ed1 ld.so.8: Minor rewordings to ease readability
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 14:17:58 +02:00
Michael Kerrisk f642cc55db dlopen.3: wfix: consistently use "object" rather than "library"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 13:59:36 +02:00
Michael Kerrisk d031ca920e dlopen.3: Make it clear that RTLD_NODELETE also affects global variables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 11:46:16 +02:00
Michael Kerrisk 9bdbaa8ab2 dlopen.3: An object opened with RTLD_LOCAL can be promoted to RTLD_GLOBAL
Verified by experiment:

$ cat prog.c
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *x1Handle, *x2Handle, *yHandle;
    void (*funcp)(void);
    char *err;

    x1Handle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_LOCAL);
    if (x1Handle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    if (argc > 1) {
        x2Handle = dlopen("./lib_x2.so", RTLD_NOW | RTLD_GLOBAL);
        if (x2Handle == NULL) {
            fprintf(stderr, "dlopen: %s\n", dlerror());
            exit(EXIT_FAILURE);
        }
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_LOCAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c
#include <stdio.h>

void
x1_enter(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_x2.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    testfunc();
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x2.so lib_x2.c
cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c ./lib_x2.so
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c

cc $CFLAGS -o prog prog.c -ldl

$ sh Build.sh

$ ./prog
Called y1_enter

Called lib_y1.c::testfunc
$ ./prog x
Called y1_enter

Called lib_x2.c::testfunc

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 11:15:12 +02:00
Michael Kerrisk da6b9a6172 dlopen.3: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 10:55:49 +02:00
Michael Kerrisk 58a4ac49d4 dlopen.3: Clarify when an executable's symbols can be used for symbol resolution
The --export-dynamic linker option is not the only way that main's
global symbols may end up in the dynamic symbol table and thus be
used to satisfy symbol reference in a shared object. A symbol
may also be placed into the dynamic symbol table if ld(1)
notices a dependency in another object during the static link.

Verified by experiment; see previous commit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 10:06:36 +02:00
Michael Kerrisk 43898de488 dlopen.3: Clarify the rules for symbol resolution in a dlopen'ed object
The existing text wrongly implied that symbol look up first
occurred in the object and then in main, and did not mention
whether dependencies of main where used for symbol resolution.

Verified by experiment:

$ cat prog.c
#define _GNU_SOURCE
#include <link.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void            /* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is forced into prog's dynamic symbol table
   because of the static link-time reference in lib_m1.so */

void            /* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is not forced into prog's dynamic symbol table */

void            /* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *xHandle, *yHandle;
    void (*funcp)(void);
    char *err;

    xHandle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_GLOBAL);
    if (xHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_GLOBAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    /* Optionally display the link map() */

    if (argc > 1) {
        printf("Link map as shown from dl_iterate_phdr() callbacks:\n");
        dl_iterate_phdr(callback, NULL);
        printf("\n");
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_m1.c
#include <stdio.h>

void		/* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

#if 1
void
dummy(void)
{
    extern void prog_y1_exp(void);

    prog_y1_exp();	/* Forces prog_y1_exp into prog's dynamic symbol table,
			   so that it will be visible also to lib_y1.so */
}
#endif

$ cat lib_x1.c
#include <stdio.h>

void		/* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void		/* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    prog_x1();
    prog_y1_exp();
    prog_y1_noexp();
    x1_y1();
    m1_y1();
    y2();
}

$ cat lib_y2.c
#include <stdio.h>

void
y2(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c
cc $CFLAGS -g -fPIC -shared -o lib_y2.so lib_y2.c
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c ./lib_y2.so
cc $CFLAGS -g -fPIC -shared -o lib_m1.so lib_m1.c

#ED="-Wl,--export-dynamic"
cc $CFLAGS $ED -Wl,--rpath,$PWD -o prog prog.c -ldl lib_m1.so

$ sh Build.sh

$ ./prog x
Link map as shown from dl_iterate_phdr() callbacks:
	Name =
	Name = linux-vdso.so.1
	Name = /lib64/libdl.so.2
	Name = /home/mtk/tlpi/code/shlibs/dlopen_sym_res_expt/lib_m1.so
	Name = /lib64/libc.so.6
	Name = /lib64/ld-linux-x86-64.so.2
	Name = ./lib_x1.so
	Name = ./lib_y1.so
	Name = ./lib_y2.so

Called y1_enter

Called lib_x1.c::prog_x1
Called prog.c::prog_y1_exp
Called lib_y1.c::prog_y1_noexp
Called lib_x1.c::x1_y1
Called lib_m1.c::m1_y1
Called lib_y2.c::y2

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 09:45:55 +02:00
Michael Kerrisk ba20328e27 dlopen.3: Note that symbol use might keep a dlclose'd object in memory
My earlier commit was in error:

    commit 4a1af09bd1
    Author: Michael Kerrisk <mtk.manpages@gmail.com>
    Date:   Sat Mar 14 21:40:35 2015 +0100

        dlopen.3: Amend error in description of dlclose() behavior

    -If the reference count drops to zero and no other loaded libraries use
    -symbols in it, then the dynamic library is unloaded.
    +If the reference count drops to zero,
    +then the dynamic library is unloaded.

I doubted the removed text, because it provide little clue about
the scenario. The POSIX dlclose(3) specification actually details
the scenario sufficiently:

       Although  a dlclose() operation is not required to remove
       any functions or data objects  from  the  address  space,
       neither  is  an  implementation prohibited from doing so.
       The only restriction on such a removal is that  no  func‐
       tion nor data object shall be removed to which references
       have been relocated, until or unless all such  references
       are removed. For instance, an executable object file that
       had been loaded with a dlopen() operation specifying  the
       RTLD_GLOBAL flag might provide a target for dynamic relo‐
       cations performed in the processing of other  relocatable
       objects—in  such  environments, an application may assume
       that no relocation, once made, shall be undone or  remade
       unless  the  executable  object file containing the relo‐
       cated object has itself been removed.

Verified by experiment:

$ cat openlibs.c       # Test program

int
main(int argc, char *argv[])
{
    void *libHandle[MAX_LIBS];
    int lcnt;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s lib-path...\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    lcnt = 0;

    for (int j = 1; j < argc; j++) {
        if (argv[j][0] != '-') {
            if (lcnt >= MAX_LIBS) {
                fprintf(stderr, "Too many libraries (limit: %d)\n", MAX_LIBS);
                exit(EXIT_FAILURE);
            }

            printf("[%d] Opening %s\n", lcnt, argv[j]);
            libHandle[lcnt] = dlopen(argv[j], RTLD_NOW | RTLD_GLOBAL);
            if (libHandle[lcnt] == NULL) {
                fprintf(stderr, "dlopen: %s\n", dlerror());
                exit(EXIT_FAILURE);
            }
            lcnt++;

        } else {    /* "-N" closes the Nth handle */

            int i = atoi(&argv[j][1]);
            printf("Closing handle %d\n", i);
            dlclose(libHandle[i]);
        }

        sleep(1);
        printf("\n");
    }

    printf("Program about to exit\n");

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c

void x1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void x1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void x1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

$ cat lib_y1.c

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    /* The following reference, to a symbol in lib_x1.so shows that
       RTLD_GLOBAL may pin a library when it might otherwise have been
       released with dlclose() */
    extern void x1_func(void);
    x1_func();
}

$ cc -shared -fPIC -o lib_x1.so lib_x1.c
$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ cc -o openlibs openlibs.c -ldl

$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0

Closing handle 1
Called y1_dstor
Called x1_dstor

Program about to exit
<end program output>

Note that x1_dstor was called only when handle 1 (lib_y1.so) was closed.
But, if we edit lib_y1 to remove the reference to x1_func(), things are
different:

$ cat lib_y1.c      # After editing

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    // extern void x1_func(void);
    // x1_func();
}

$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0
Called x1_dstor

Closing handle 1
Called y1_dstor

Program about to exit
<end program output>

This time, x1_dstor was called when handle 0 (lib_x1.so) was closed.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 15:55:09 +02:00
Michael Kerrisk df77f62baf dlopen.3: Clarify that constructors are called only when library is first loaded
And fix a wording error that I introduced back in 2015.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 15:01:20 +02:00
Michael Kerrisk cbd8927ff5 dlopen.3: On dlclose(), destructors are called when reference count falls to 0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 14:56:15 +02:00
Michael Kerrisk df02277902 getauxval.3: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 10:19:00 +02:00
Michael Kerrisk b8cf6c2435 user_namespaces.7: Minor rewordings of recently added text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 10:09:24 +02:00
Michael Kerrisk 89a0bd8283 user_namespaces.7: Minor wording fix to recently added text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 06:20:44 +02:00
Michael Kerrisk 43f4bec190 user_namespaces.7: Describe the effect of file-related capabilities inside use namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 12:18:44 +02:00
Michael Kerrisk ea8ec5785c user_namespaces.7: Describe how kernel treats UIDs/GIDs when a process access to files
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 11:11:19 +02:00
Michael Kerrisk c99eb2b204 capabilities.7: CAP_FOWNER also allows modifying user xattrs on sticky directories
See fs/xattr.c::xattr_permission()"

        /*
         * In the user.* namespace, only regular files and directories can have
         * extended attributes. For sticky directories, only the owner and
         * privileged users can write attributes.
         */
        if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
                if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                        return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
                if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
                    (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
                        return -EPERM;
        }

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:37 +02:00
Michael Kerrisk fc8d1db1b4 xattr.7: s/extended system attributes/system extended attributes/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:06 +02:00
Michael Kerrisk b25d3e704c xattr.7: wfix: s/extended user attributes/user extended attributes/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:06 +02:00
Michael Kerrisk e2340cf748 unix.7: Note SCM_RIGHTS interaction with RLIMIT_NOFILE
If the file descriptors received in SCM_RIGHTS would cause
the process to its exceed RLIMIT_NOFILE limit, the excess
FDs are discarded.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-29 22:13:25 +02:00
Michael Kerrisk 1d03bca07f ipc.5: Remove old link to svipc.7/sysvipc.7 page
Long ago, the sysvipc.7 page was called ipc.5, which was both a
misnaming (too general a name) and an inconsistent section. The
page was renamed (to svipc.7) many years ago, and the link with
the old name has probably ceased to be needed. So, remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:40:21 +02:00
Michael Kerrisk 015f61c72a svipc.7: Add old name of sysvipc(7) page as a link
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:39:05 +02:00
Michael Kerrisk 343cdc5ac9 clone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shmctl.2, shmget.2, shmop.2, ftok.3, proc.5, namespaces.7: Change reference to svipc(7) to sysvipc(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:38:01 +02:00
Michael Kerrisk 880c105e22 sysvipc.7: Minor fixes for page renaming
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:33:16 +02:00
Michael Kerrisk 0587dba23b sysvipc.7: Rename svipc.7 to sysvipc.7
The name sysvipc is a bit more natural, and is the name used in
/proc/sysvipc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:31:50 +02:00
Michael Kerrisk 16f3fc8828 pid_namespaces.7: tfix
Reported-by: Guillaume Laporte <guillaume.laporte.adm@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-24 16:26:51 +02:00
Michael Kerrisk 173eb06cd8 ptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"
Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:04:58 +02:00
Michael Kerrisk 63059c4b52 execve.2: Some tweaks to Shawn Landden's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:38 +02:00
Shawn Landden 60f16bf2fe execve.2: Add more detail about Shebangs
Signed-off-by: Shawn Landden <shawn@git.icu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:37 +02:00
Michael Kerrisk 44dceef0cd execve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127)
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 21:06:11 +02:00
Michael Kerrisk 815d0561d0 execve.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:47:10 +02:00
Michael Kerrisk 8fa1a0223e execve.2: ffix: remove spaces that suggest a space is needed after #!
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:45:00 +02:00