Commit Graph

20087 Commits

Author SHA1 Message Date
Michael Kerrisk fc894c8f55 execve.2: Linux is not alone in ignoring the set-UID and set-GID bits for scripts
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:42:10 +02:00
Michael Kerrisk b7921eb677 credentials.7: SEE ALSO: add tcgetsid(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-18 20:51:11 +02:00
Michael Kerrisk 8adf58622f proc.5: Minor fix: add some paragraph breaks to /proc/[pid]/attr/current text
Break the text up a little, to improve readability.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-18 20:51:11 +02:00
Michael Kerrisk 283db6f607 chdir.2: Add ENOTDIR error for fchdir()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-17 20:36:37 +02:00
Michael Kerrisk 7c17e8f3cb on_exit.3: Atack variables may be out of scope when exit handler is invoked
Here's a program for doing experiments:

/* on_expt_scope_expt.c

   (C) Michael Kerrisk, 2019, Licensed GNU GPLv2+
*/

char *tos;

static void
exitFunc(int status, void *p)
{
    int efloc;
    int *xp = (int *) p;

    printf("====== Entered exit handler\n");
    printf("&efloc = %p (0x%llx)\n",
            (void *) &efloc, (long long) (tos - (char *) &efloc));
    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);

    if (*xp != INIT_VALUE)
        printf("It looks like the variable passed to the exit handler "
                "has gone out of scope\n");

    /* Produce a core dump, which we can examine with GDB to look at the
       frames on the stack, if desired */

    printf("===\n");
    printf("About to abort\n");
    abort();
}

static void
recur(int lev, int *xp)
{
    int rloc;
    int big[65536-12];  /* 12*4 == 48 other bytes allocated on
                           this stack frame */
    tos = (char *) &rloc;

    big[0] = lev;
    big[0]++;

    printf("&rloc = %p (%d)    (%d)\n", (void *) &rloc, lev, *xp);

    if (lev > 1)
        recur(lev - 1, xp);
    else {
        printf("exit() from recur()\n");
        exit(EXIT_SUCCESS);
    }
}

int
main(int argc, char *argv[])
{
    int lev;
    int *xp;
    int xx;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s {s|h} [how]\n", argv[0]);
        fprintf(stderr, "\ts => exitFunc() arg is in main() stack\n");
        fprintf(stderr, "\th => exitFunc() arg is allocated on heapn");
        fprintf(stderr, "\tIf 'how' is not present, then return from main()\n");
        fprintf(stderr, "\tIf 'how' is 0, then exit() from main()\n");
        fprintf(stderr, "\tIf 'how' is > 0, then make 'how' recursive "
                        "function calls, and then exit()\n");
        exit(EXIT_FAILURE);
    }

    tos = (char *) &xp;

    if (argv[1][0] == 'h') {
        xp = malloc(sizeof(int));
        if (xp == NULL) {
            perror("malloc");
            exit(EXIT_FAILURE);
        }
        printf("Argument for exitFunc() is allocated on heap\n");
    } else {
        xp = &xx;
        printf("Argument for exitFunc() is allocated on stack in main()\n");
    }

    *xp = INIT_VALUE;

    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);
    printf("===\n");

    on_exit(exitFunc, xp);

    if (argc == 2) {
        printf("return from main\n");
        return 0;
    }

    lev = atoi(argv[2]);

    if (lev < 1) {
        printf("Calling exit() from main\n");
        exit(EXIT_SUCCESS);
    } else {
        recur(lev, xp);
    }
}

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-15 13:57:31 +02:00
Mark Wielaard f92ea96bab pkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.
To get the pkey_alloc, pkey_free and pkey_mprotect functions
_GNU_SOURCE needs to be defined before including sys/mman.h.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14 17:09:00 +02:00
Mark Wielaard a4a0b74234 mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0
The mprotect.2 NOTES say:

    On systems that do not support protection keys in
    hardware, pkey_mprotect() may still be used, but pkey must
    be set to 0.  When called this way, the operation of
    pkey_mprotect() is equivalent to mprotect().

But this is not what the glibc manual says:

    It is also possible to call pkey_mprotect with a key value
    of -1, in which case it will behave in the same way as
    mprotect.

Which is correct. Both the glibc implementation and the
kernel check whether pkey is -1. 0 is not a valid pkey when
memory protection keys are not supported in hardware.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14 17:06:50 +02:00
Michael Kerrisk e6017d5615 exec.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:52:57 +02:00
Michael Kerrisk 3c2423ee69 exec.3: Minor tweaks to Matthew Kenigsberg's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:52:57 +02:00
Matthew Kenigsberg df7271bb32 exec.3: Explain function groupings
I've found the exec man page quite difficult to read when trying
to find the behavior for a specific function. Since the names of
the functions are inline and the order of the descriptions isn't
clear, it's hard to find which paragraphs apply to each function.
I thought it would be much easier to read if the grouping based on
letters is stated.
2019-06-13 21:52:01 +02:00
Tobias Klauser ec7c749319 vdso.7: Mention removal of Blackfin port
The Blackfin port was removed in Linux 4.17. Mention this in the
section concerning Blackfin vDSO functions.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:27:27 +02:00
Michael Kerrisk 58ba48e40a fanotify.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 23:13:43 +02:00
Matthew Bobrowski f5230cf176 fanotify.7: Reword FAN_REPORT_FID data structure inclusion semantics
Improved the readability of a sentence that describes the use of
FAN_REPORT_FID and how this particular flag influences what data
structures a listening application could expect to receive when
describing an event.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 23:12:45 +02:00
Tobias Klauser 77479ef629 vdso.7: Document vDSO for RISCV
Document the symbols exported by the RISCV vDSO which is present
from kernel 4.15 onwards.

See kernel source files in arch/riscv/kernel/vdso.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 22:40:27 +02:00
Michael Kerrisk 794b5143e4 fanotify.7: Minor fixes after feedback from Matthew Bobrowski
Reported-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-10 11:11:01 +02:00
Jakub Wilk ed7e38aded Changes.old: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 14:04:14 +02:00
Michael Kerrisk 3051b98c42 fanotify.7: Reorder text in EXAMPLE
Group each example shell session together with each example
program.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 26f6196ab6 fanotify.7: ffix: boldface user commands in shell sessions
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 7877c84647 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 525b88e128 fanotify.7: Reformat program output to fit in 80 columns
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 2d26ddfa55 fanotify.7: Clarify logic in ESTALE check
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:00 +02:00
Michael Kerrisk 6f10bd3260 fanotify.7: Minor code consistency clean-ups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk c662400632 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk 5ff63f5163 fanotify.7: Minor code typesetting fix-ups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk 87d12b1b2f fanotify.7: Minor fix: format comments consistently
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:21:07 +02:00
Michael Kerrisk fa6d3b26e1 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:21:07 +02:00
Michael Kerrisk eae836e071 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: s/object/filesystem object/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Michael Kerrisk 817c8240f3 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew Bobrowski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Matthew Bobrowski 0a4db6dc74 fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events
Details relating to the new initialization flag FAN_REPORT_FID has been
added. As part of the FAN_REPORT_FID feature, a new set of event masks are
available and have been documented accordingly.

A simple example program has been added to also support the understanding
and use of FAN_REPORT_FID and directory modification events.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:37:54 +02:00
Petr Vaněk 59a4d9b398 syscalls.2: tfix
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:22:36 +02:00
Michael Kerrisk ada54d9f2e strcat.3: Fix off-by-one error in example code
Reported-by: Eric Sanchis <eric.sanchis@iut-rodez.fr>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:09:45 +02:00
Michael Kerrisk c0f8924419 man-pages-5.02.lsm: Update primary site; remove alternate site
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-07 05:51:12 +02:00
Michael Kerrisk 44a0081973 socket.7: select()/poll()/epoll honor SO_RCVLOWAT since Linux 2.6.28
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-31 16:45:51 +02:00
Michael Kerrisk defef3518e elf.5: SEE ALSO: add ld.so(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-28 09:32:40 +02:00
Michael Kerrisk d339d3feb7 cpuid.4: SEE ALSO: add cpuid(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 13:18:26 +02:00
Michael Kerrisk bc7d51d2bc ld.so.8: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 12:28:23 +02:00
Michael Kerrisk 0e1ad2f01a ld.so.8: Note some further details of secure-execution mode
Note some further details of the treatment of environment
variables in secure execution mode. In particular (as noted by
Matthias Hertel), note that ignored environment variables are also
stripped from the environment. Furthermore, there are some other
variables, not used by the dynamic linker itself, that are also
treated in this way (see the glibc source file
sysdeps/generic/unsecvars.h).

Reported-by: Matthias Hertel <Matthias.Hertel@rohde-schwarz.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 09:48:16 +02:00
Michael Kerrisk f3da99c4ee cgroup_namespaces.7: In the example shell session, give second shell a different prompt
Give the shell in the second cgroup namespace a different prompt,
so as to clearly distinguish the two namespaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:55:01 +02:00
Michael Kerrisk 727e560920 cgroup_namespaces.7: Some wording fixes to improve clarity
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:54:50 +02:00
Michael Kerrisk c9d68a690b cgroup_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:50:41 +02:00
Michael Kerrisk ad34717f77 cgroup_namespaces.7: wfix: s/original namespace/initial namespace/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:16:36 +02:00
Michael Kerrisk ef12969735 cgroup_namespaces.7: wfix: remove some superfluous (and slightly misleading) words
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:14:05 +02:00
Michael Kerrisk 3859874937 user_namespaces.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-18 22:00:05 +02:00
Michael Kerrisk cb7c96bfdd prctl.2: tfix
Reported-by: Tomas Skäre <tomas.skare@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16 12:22:32 -05:00
Michael Kerrisk a546e6601b pthread_spin_init.3: tfix
Reported-by: Kumar Chaudhary, Naveen <naveen.kumar.chaudhary@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16 12:20:09 -05:00
Michael Kerrisk 9e7cbbc25a Changes.old: Tweaks to 5.01 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-09 14:07:02 +02:00
Michael Kerrisk 480d885861 Start of man-pages-5.02: updating Changes and Changes.old 2019-05-09 09:46:26 +02:00
Michael Kerrisk bbe5764f06 Start of man-pages-5.02: updating .Announce and .lsm files 2019-05-09 09:46:26 +02:00
Michael Kerrisk 0fa09084ec Start of man-pages-5.02: renaming .Announce and .lsm files 2019-05-09 09:46:26 +02:00
Michael Kerrisk 80e710925c Ready for 5.01 2019-05-09 09:44:04 +02:00