platform/upstream/systemd.git
7 years agoman: mention machines.target in systemd.special(7) (#5371)
Zbigniew Jędrzejewski-Szmek [Fri, 17 Feb 2017 07:44:26 +0000 (02:44 -0500)]
man: mention machines.target in systemd.special(7) (#5371)

Also sort <refsynopsisdiv>.

7 years agoMerge pull request #5370 from evverx/fix-test-journal-importer
Martin Pitt [Thu, 16 Feb 2017 20:35:13 +0000 (21:35 +0100)]
Merge pull request #5370 from evverx/fix-test-journal-importer

build-sys: treat journal-data/journal-[12].txt as TEST_DATA_FILES

7 years agonss: fix error to ERANGE for nss calls with too little buffer space (#5365)
Lennart Poettering [Thu, 16 Feb 2017 20:29:09 +0000 (21:29 +0100)]
nss: fix error to ERANGE for nss calls with too little buffer space (#5365)

This is a follow-up for #5359, fixing the error codes in a similar way
for the other NSS modules.

(user/group lookup calls don't have h_errnop, hence we don't update that
in those cases)

7 years agobuild-sys: add exec-privatedevices-[yes|no]-capability-sys-rawio to TEST_DATA_FILES
Evgeny Vereshchagin [Thu, 16 Feb 2017 19:28:17 +0000 (19:28 +0000)]
build-sys: add exec-privatedevices-[yes|no]-capability-sys-rawio to TEST_DATA_FILES

This is a follow-up for 625d8769fa6394a30

7 years agobuild-sys: treat journal-data/journal-[12].txt as TEST_DATA_FILES
Evgeny Vereshchagin [Thu, 16 Feb 2017 19:17:19 +0000 (19:17 +0000)]
build-sys: treat journal-data/journal-[12].txt as TEST_DATA_FILES

Fixes:
```
Found container virtualization none.
Assertion 'imp.fd >= 0' failed at ../src/test/test-journal-importer.c:43, function test_basic_parsing(). Aborting.
FAIL: test-journal-importer (code: 134)
```
See https://github.com/systemd/systemd/pull/5366#issuecomment-280353804

7 years agohwdb update
Lennart Poettering [Thu, 16 Feb 2017 17:15:55 +0000 (18:15 +0100)]
hwdb update

7 years agoMerge pull request #4526 from keszybz/coredump-python
Lennart Poettering [Thu, 16 Feb 2017 10:24:03 +0000 (11:24 +0100)]
Merge pull request #4526 from keszybz/coredump-python

Collect interpreter backtraces in systemd-coredump

7 years agolibsystemd-network: ipv4ll probe conflict counter (#5361)
Jason Reeder [Thu, 16 Feb 2017 10:14:38 +0000 (04:14 -0600)]
libsystemd-network: ipv4ll probe conflict counter (#5361)

A bug exists where the conflict counter is cleared
regardless of whether or not the next probe attempt leads to
a successful address acquisition. This causes 'bursts' of
MAX_CONFLICTS probes followed by a delay of
RATE_LIMIT_INTERVAL instead of a single probe each
RATE_LIMIT_INTERVAL when beyond MAX_CONFLICTS.

The conflict counter should only be cleared after an
address is successfully acquired. This commit achieves that
goal.

From RFC3927:
A host should maintain a counter of the number of address
conflicts it has experienced in the process of trying to
acquire an address, and if the number of conflicts exceeds
MAX_CONFLICTS then the host MUST limit the rate at which it
probes for new addresses to no more than one new address per
RATE_LIMIT_INTERVAL.  This is to prevent catastrophic ARP
storms in pathological failure cases, such as a rogue host
that answers all ARP probes, causing legitimate hosts to go
into an infinite loop attempting to select a usable address.

Signed-off-by: Jason Reeder <jasonreeder@gmail.com>
7 years agonss-resolve: Fix assertion in ifindex_to_scopeid. (#5360)
Maarten de Vries [Thu, 16 Feb 2017 10:00:49 +0000 (11:00 +0100)]
nss-resolve: Fix assertion in ifindex_to_scopeid. (#5360)

7 years agonss-resolve: report ERANGE for small buffers. (#5359)
Maarten de Vries [Thu, 16 Feb 2017 09:52:04 +0000 (10:52 +0100)]
nss-resolve: report ERANGE for small buffers. (#5359)

The correct error code to report when a provided buffer is too small is
ERANGE. This is recognized by glibc, which will then try again with a
larger buffer. The old behaviour of reporting ENOMEM has no special
meaning for glibc. The error will simply be propagated to the
application, and a later retry will trigger the same error again.

Additionally, h_errnop must be set to NETDB_INTERNAL to have glibc look
at errnop for details.

More information at:
https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html

7 years agovirt: swap order of cpuid and dmi again, but properly detect oracle (#5355)
Christian Hesse [Wed, 15 Feb 2017 22:51:31 +0000 (23:51 +0100)]
virt: swap order of cpuid and dmi again, but properly detect oracle (#5355)

This breaks again, this time for setups where Qemu is not reported via DMI for whatever
reason. So swap order of cpuid and dmi again, but properly detect oracle.

See issue #5318.

7 years agotest-ipcrm: use configured nobody user name (#5350)
Zbigniew Jędrzejewski-Szmek [Wed, 15 Feb 2017 09:22:22 +0000 (04:22 -0500)]
test-ipcrm: use configured nobody user name (#5350)

"nfsnobody" is now obsolete.

7 years agocoredump: add note about lack of rollback on oom
Zbigniew Jędrzejewski-Szmek [Mon, 16 Jan 2017 01:25:35 +0000 (20:25 -0500)]
coredump: add note about lack of rollback on oom

7 years agocoredumpctl: display non-coredump coredump entries too
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 18:34:31 +0000 (13:34 -0500)]
coredumpctl: display non-coredump coredump entries too

$ ./coredumpctl --no-pager -1
TIME                            PID   UID   GID SIG COREFILE EXE
Sun 2016-11-06 10:10:51 EST   29514  1002  1002   - -        /usr/bin/python3.5

$ ./coredumpctl info 29514
           PID: 29514 (python3)
           UID: 1002 (zbyszek)
           GID: 1002 (zbyszek)
        Reason: ZeroDivisionError
     Timestamp: Sun 2016-11-06 10:10:51 EST (3h 22min ago)
  Command Line: python3 systemd_coredump_exception_handler.py
    Executable: /usr/bin/python3.5
 Control Group: /user.slice/user-1002.slice/user@1002.service/gnome-terminal-server.service
          Unit: user@1002.service
     User Unit: gnome-terminal-server.service
         Slice: user-1002.slice
     Owner UID: 1002 (zbyszek)
       Boot ID: 1531fd22ec84429e85ae888b12fadb91
    Machine ID: 519a16632fbd4c71966ce9305b360c9c
      Hostname: laptop
       Storage: none
       Message: Process 29514 (systemd_coredump_exception_handler.py) of user zbyszek failed with ZeroDivisionError: division by

                Traceback (most recent call last):
                  File "systemd_coredump_exception_handler.py", line 134, in <module>
                    g()
                  File "systemd_coredump_exception_handler.py", line 133, in g
                    f()
                  File "systemd_coredump_exception_handler.py", line 131, in f
                    div0 = 1 / 0
                ZeroDivisionError: division by zero

                Local variables in innermost frame:
                  a=3
                  h=<function f at 0x7efdc14b6ea0>

7 years agotree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_ID
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 17:48:23 +0000 (12:48 -0500)]
tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_ID

Embedding sd_id128_t's in constant strings was rather cumbersome. We had
SD_ID128_CONST_STR which returned a const char[], but it had two problems:
- it wasn't possible to statically concatanate this array with a normal string
- gcc wasn't really able to optimize this, and generated code to perform the
  "conversion" at runtime.
Because of this, even our own code in coredumpctl wasn't using
SD_ID128_CONST_STR.

Add a new macro to generate a constant string: SD_ID128_MAKE_STR.
It is not as elegant as SD_ID128_CONST_STR, because it requires a repetition
of the numbers, but in practice it is more convenient to use, and allows gcc
to generate smarter code:

$ size .libs/systemd{,-logind,-journald}{.old,}
   text    data     bss     dec     hex filename
1265204  149564    4808 1419576  15a938 .libs/systemd.old
1260268  149564    4808 1414640  1595f0 .libs/systemd
 246805   13852     209  260866   3fb02 .libs/systemd-logind.old
 240973   13852     209  255034   3e43a .libs/systemd-logind
 146839    4984      34  151857   25131 .libs/systemd-journald.old
 146391    4984      34  151409   24f71 .libs/systemd-journald

It is also much easier to check if a certain binary uses a certain MESSAGE_ID:

$ strings .libs/systemd.old|grep MESSAGE_ID
MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x
MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x
MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x
MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x

$ strings .libs/systemd|grep MESSAGE_ID
MESSAGE_ID=c7a787079b354eaaa9e77b371893cd27
MESSAGE_ID=b07a249cd024414a82dd00cd181378ff
MESSAGE_ID=641257651c1b4ec9a8624d7a40a9e1e7
MESSAGE_ID=de5b426a63be47a7b6ac3eaac82e2f6f
MESSAGE_ID=d34d037fff1847e6ae669a370e694725
MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5
MESSAGE_ID=1dee0369c7fc4736b7099b38ecb46ee7
MESSAGE_ID=39f53479d3a045ac8e11786248231fbf
MESSAGE_ID=be02cf6855d2428ba40df7e9d022f03d
MESSAGE_ID=7b05ebc668384222baa8881179cfda54
MESSAGE_ID=9d1aaa27d60140bd96365438aad20286

7 years agocoredumpctl: just use argv instead of building a temporary set
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 16:29:31 +0000 (11:29 -0500)]
coredumpctl: just use argv instead of building a temporary set

No functional change, and we don't lose match order.

7 years agoman: describe systemd-coredump --backtrace
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 15:48:15 +0000 (10:48 -0500)]
man: describe systemd-coredump --backtrace

7 years agocoredump: with --backtrace accept a journal entry on stdin
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 15:06:32 +0000 (10:06 -0500)]
coredump: with --backtrace accept a journal entry on stdin

The entry must be a single entry in the journal export format, including the
terminating double newline. The MESSAGE field is now generated on the sender
side.

The advantage is that the reporter can easily pass additional metadata.
Continuing with the example of the python excepthook:

COREDUMP_PYTHON_EXECUTABLE=/usr/bin/python3
COREDUMP_PYTHON_VERSION=3.5.2 (default, Sep 14 2016, 11:28:32)
                        [GCC 6.2.1 20160901 (Red Hat 6.2.1-1)]
COREDUMP_PYTHON_THREAD_INFO=sys.thread_info(name='pthread', lock='semaphore', version='NPTL 2.24')
COREDUMP_PYTHON_EXCEPTION_TYPE=ZeroDivisionError
COREDUMP_PYTHON_EXCEPTION_VALUE=division by zero
MESSAGE=Process 29514 (systemd_coredump_exception_handler.py) of user zbyszek failed with ZeroDivisionError: division by zero

        Traceback (most recent call last):
          File "systemd_coredump_exception_handler.py", line 134, in <module>
            g()
          File "systemd_coredump_exception_handler.py", line 133, in g
            f()
          File "systemd_coredump_exception_handler.py", line 131, in f
            div0 = 1 / 0
        ZeroDivisionError: division by zero

        Local variables in innermost frame:
          a=3
          h=<function f at 0x7efdc14b6ea0>

One consideration is whether to use the Journal Export Format, or send packets
over a UNIX socket instead. The advantage of current solution is that although
parsing is more complicated on the receiver side, it is much easier to use on the
sender side. I hope this can be used by various languages for which writing
binary structures to a UNIX socket is harder and more likely to be done wrong
than piping of a simple textyish format.

7 years agotest-journal-importer: add a test case with broken input
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 05:01:17 +0000 (01:01 -0400)]
test-journal-importer: add a test case with broken input

7 years agotest-journal-importer: new test file to check the newly exported importer code
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 03:27:00 +0000 (23:27 -0400)]
test-journal-importer: new test file to check the newly exported importer code

Only one test case is added, but it is enough to check basic sanity of the
code (single-line and binary fields and trusted fields, allocation and freeing).

7 years agoMove export format parsing from src/journal-remote/ to src/basic/
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 02:40:54 +0000 (22:40 -0400)]
Move export format parsing from src/journal-remote/ to src/basic/

No functional change.

7 years agocoredump: implement logging of external backtraces with --backtrace
Zbigniew Jędrzejewski-Szmek [Mon, 31 Oct 2016 02:42:44 +0000 (22:42 -0400)]
coredump: implement logging of external backtraces with --backtrace

This is useful for example for Python progams. By installing a python
sys.execepthook we can store the backtrace in the journal. We gather the
backtrace in the python process, and call systemd-coredump to attach additional
fields (COREDUMP_COMM, COREDUMP_EXE, COREDUMP_UNIT, COREDUMP_USER_UNIT,
COREDUMP_OWNER_UID, COREDUMP_SLICE, COREDUMP_CMDLINE, COREDUMP_CGROUP,
COREDUMP_OPEN_FDS, COREDUMP_PROC_STATUS, COREDUMP_PROC_MAPS,
COREDUMP_PROC_LIMITS, COREDUMP_PROC_MOUNTINFO, COREDUMP_CWD, COREDUMP_ROOT,
COREDUMP_ENVIRON, COREDUMP_CONTAINER_CMDLINE). This could also be done in the
python process, but doing this in systemd-coredump saves quite a bit of
duplicate work and unifies the handling of various tricky fields like
COREDUMP_CONTAINER_CMDLINE in one place.

(Of course this applies to any other language which does not dump cores
but wants to log a traceback, e.g. ruby.)

journal entry:
    _TRANSPORT=journal
    _UID=1002
    _GID=1002
    _CAP_EFFECTIVE=0
    _AUDIT_LOGINUID=1002
    _SYSTEMD_OWNER_UID=1002
    _SYSTEMD_SLICE=user-1002.slice
    _SYSTEMD_USER_SLICE=-.slice
    _SELINUX_CONTEXT=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    _BOOT_ID=1531fd22ec84429e85ae888b12fadb91
    _MACHINE_ID=519a16632fbd4c71966ce9305b360c9c
    _HOSTNAME=laptop
    _AUDIT_SESSION=1
    _SYSTEMD_UNIT=user@1002.service
    _SYSTEMD_INVOCATION_ID=3c4238d790a44aca9576ecdb2c7576d3
    COREDUMP_UNIT=user@1002.service
    COREDUMP_USER_UNIT=gnome-terminal-server.service
    COREDUMP_UID=1002
    COREDUMP_GID=1002
    COREDUMP_OWNER_UID=1002
    COREDUMP_SLICE=user-1002.slice
    COREDUMP_CGROUP=/user.slice/user-1002.slice/user@1002.service/gnome-terminal-server.service
    COREDUMP_PROC_LIMITS=Limit                     Soft Limit           Hard Limit           Units
                         Max cpu time              unlimited            unlimited            seconds
                         Max file size             unlimited            unlimited            bytes
                         Max data size             unlimited            unlimited            bytes
                         Max stack size            8388608              unlimited            bytes
                         Max core file size        unlimited            unlimited            bytes
                         Max resident set          unlimited            unlimited            bytes
                         Max processes             15413                15413                processes
                         Max open files            4096                 4096                 files
                         Max locked memory         65536                65536                bytes
                         Max address space         unlimited            unlimited            bytes
                         Max file locks            unlimited            unlimited            locks
                         Max pending signals       15413                15413                signals
                         Max msgqueue size         819200               819200               bytes
                         Max nice priority         0                    0
                         Max realtime priority     0                    0
                         Max realtime timeout      unlimited            unlimited            us
    COREDUMP_PROC_CGROUP=1:name=systemd:/
                         0::/user.slice/user-1002.slice/user@1002.service/gnome-terminal-server.service
    COREDUMP_PROC_MOUNTINFO=17 39 0:17 / /sys rw,nosuid,nodev,noexec,relatime shared:6 - sysfs sysfs rw,seclabel
                            18 39 0:4 / /proc rw,nosuid,nodev,noexec,relatime shared:5 - proc proc rw
                            19 39 0:6 / /dev rw,nosuid shared:2 - devtmpfs devtmpfs rw,seclabel,size=1972980k,nr_inodes=493245,mode=755
                            20 17 0:18 / /sys/kernel/security rw,nosuid,nodev,noexec,relatime shared:7 - securityfs securityfs rw
                            21 19 0:19 / /dev/shm rw,nosuid,nodev shared:3 - tmpfs tmpfs rw,seclabel
                            22 19 0:20 / /dev/pts rw,nosuid,noexec,relatime shared:4 - devpts devpts rw,seclabel,gid=5,mode=620,ptmxmode=000
                            23 39 0:21 / /run rw,nosuid,nodev shared:12 - tmpfs tmpfs rw,seclabel,mode=755
                            24 17 0:22 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:8 - cgroup2 cgroup rw
                            25 17 0:23 / /sys/fs/pstore rw,nosuid,nodev,noexec,relatime shared:9 - pstore pstore rw,seclabel
                            36 17 0:24 / /sys/kernel/config rw,relatime shared:10 - configfs configfs rw
                            39 0 0:26 /root / rw,relatime shared:1 - btrfs /dev/mapper/fedora-root2 rw,seclabel,ssd,space_cache,subvolid=257,subvol=/root
                            26 17 0:16 / /sys/fs/selinux rw,relatime shared:11 - selinuxfs selinuxfs rw
                            27 19 0:15 / /dev/mqueue rw,relatime shared:13 - mqueue mqueue rw,seclabel
                            28 18 0:30 / /proc/sys/fs/binfmt_misc rw,relatime shared:14 - autofs systemd-1 rw,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13663
                            29 17 0:7 / /sys/kernel/debug rw,relatime shared:15 - debugfs debugfs rw,seclabel
                            30 19 0:31 / /dev/hugepages rw,relatime shared:16 - hugetlbfs hugetlbfs rw,seclabel
                            31 18 0:32 / /proc/fs/nfsd rw,relatime shared:17 - nfsd nfsd rw
                            32 28 0:33 / /proc/sys/fs/binfmt_misc rw,relatime shared:18 - binfmt_misc binfmt_misc rw
                            57 39 0:34 / /tmp rw,relatime shared:19 - tmpfs none rw,seclabel
                            61 57 0:35 / /tmp/test rw,relatime shared:20 - autofs systemd-1 rw,fd=48,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18251
                            59 39 8:1 / /boot rw,relatime shared:21 - ext4 /dev/sda1 rw,seclabel,data=ordered
                            60 39 253:2 / /home rw,relatime shared:22 - ext4 /dev/mapper/fedora-home rw,seclabel,data=ordered
                            65 39 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime shared:23 - rpc_pipefs sunrpc rw
                            136 23 0:39 / /run/user/1002 rw,nosuid,nodev,relatime shared:91 - tmpfs tmpfs rw,seclabel,size=397432k,mode=700,uid=1002,gid=1002
                            211 23 0:41 / /run/user/42 rw,nosuid,nodev,relatime shared:163 - tmpfs tmpfs rw,seclabel,size=397432k,mode=700,uid=42,gid=42
                            329 136 0:44 / /run/user/1002/gvfs rw,nosuid,nodev,relatime shared:277 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1002,group_id=1002
                            287 61 253:3 / /tmp/test rw,relatime shared:236 - ext4 /dev/mapper/fedora-test rw,seclabel,data=ordered
                            217 23 0:42 / /run/user/1000 rw,nosuid,nodev,relatime shared:168 - tmpfs tmpfs rw,seclabel,size=397432k,mode=700,uid=1000,gid=1000
                            225 217 0:43 / /run/user/1000/gvfs rw,nosuid,nodev,relatime shared:175 - fuse.gvfsd-fuse gvfsd-fuse rw,user_id=1000,group_id=1000
    COREDUMP_ROOT=/
    PRIORITY=2
    CODE_FILE=src/coredump/coredump.c
    SYSLOG_IDENTIFIER=lt-systemd-coredump
    _COMM=lt-systemd-core
    _SYSTEMD_CGROUP=/user.slice/user-1002.slice/user@1002.service/gnome-terminal-server.service
    _SYSTEMD_USER_UNIT=gnome-terminal-server.service
    MESSAGE_ID=1f4e0a44a88649939aaea34fc6da8c95
    CODE_FUNC=process_traceback
    COREDUMP_COMM=python3
    COREDUMP_EXE=/usr/bin/python3.5
    COREDUMP_CMDLINE=python3 systemd_coredump_exception_handler.py
    COREDUMP_CWD=/home/zbyszek/src/systemd-coredump-python
    COREDUMP_RLIMIT=-1
    COREDUMP_OPEN_FDS=0:/dev/pts/1
                      pos: 0
                      flags: 0102002
                      mnt_id: 22

                      1:/dev/pts/1
                      pos: 0
                      flags: 0102002
                      mnt_id: 22

                      2:/dev/pts/1
                      pos: 0
                      flags: 0102002
                      mnt_id: 22
    CODE_LINE=1284
    COREDUMP_SIGNAL=ZeroDivisionError: division by zero
    COREDUMP_ENVIRON=LANG=en_US.utf8
                     DISPLAY=:0
                     ...
                     MANWIDTH=90
                     LC_MESSAGES=en_US.utf8
                     PYTHONPATH=.
                     _=/usr/bin/python3
    COREDUMP_PID=14498
    COREDUMP_PROC_STATUS=Name: python3
                         Umask: 0002
                         State: S (sleeping)
                         Tgid: 14498
                         Ngid: 0
                         Pid: 14498
                         PPid: 16245
                         TracerPid: 0
                         Uid: 1002 1002 1002 1002
                         Gid: 1002 1002 1002 1002
                         FDSize: 64
                         Groups:
                         NStgid: 14498
                         NSpid: 14498
                         NSpgid: 14498
                         NSsid: 16245
                         VmPeak:    34840 kB
                         VmSize:    34792 kB
                         VmLck:        0 kB
                         VmPin:        0 kB
                         VmHWM:     9332 kB
                         VmRSS:     9332 kB
                         RssAnon:     4872 kB
                         RssFile:     4460 kB
                         RssShmem:        0 kB
                         VmData:     5012 kB
                         VmStk:      136 kB
                         VmExe:        4 kB
                         VmLib:     5452 kB
                         VmPTE:       84 kB
                         VmPMD:       12 kB
                         VmSwap:        0 kB
                         HugetlbPages:        0 kB
                         Threads: 1
                         SigQ: 0/15413
                         SigPnd: 0000000000000000
                         ShdPnd: 0000000000000000
                         SigBlk: 0000000000000000
                         SigIgn: 0000000001001000
                         SigCgt: 0000000180000002
                         CapInh: 0000000000000000
                         CapPrm: 0000000000000000
                         CapEff: 0000000000000000
                         CapBnd: 0000003fffffffff
                         CapAmb: 0000000000000000
                         Seccomp: 0
                         Cpus_allowed: f
                         Cpus_allowed_list: 0-3
                         Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
                         Mems_allowed_list: 0
                         voluntary_ctxt_switches: 2
                         nonvoluntary_ctxt_switches: 47
    COREDUMP_PROC_MAPS=55cb7b7fe000-55cb7b7ff000 r-xp 00000000 00:1a 5289186                    /usr/bin/python3.5
                       55cb7b9ff000-55cb7ba00000 r--p 00001000 00:1a 5289186                    /usr/bin/python3.5
                       55cb7ba00000-55cb7ba01000 rw-p 00002000 00:1a 5289186                    /usr/bin/python3.5
                       55cb7c007000-55cb7c189000 rw-p 00000000 00:00 0                          [heap]
                       7f4da2d51000-7f4da2d54000 r-xp 00000000 00:1a 5279150                    /usr/lib64/python3.5/lib-dynload/resource.cpython-35m-x86_64-linux-gnu.so
                       7f4da2d54000-7f4da2f53000 ---p 00003000 00:1a 5279150                    /usr/lib64/python3.5/lib-dynload/resource.cpython-35m-x86_64-linux-gnu.so
                       7f4da2f53000-7f4da2f54000 r--p 00002000 00:1a 5279150                    /usr/lib64/python3.5/lib-dynload/resource.cpython-35m-x86_64-linux-gnu.so
                       7f4da2f54000-7f4da2f55000 rw-p 00003000 00:1a 5279150                    /usr/lib64/python3.5/lib-dynload/resource.cpython-35m-x86_64-linux-gnu.so
                       7f4da2f55000-7f4da2f5d000 r-xp 00000000 00:1a 5279143                    /usr/lib64/python3.5/lib-dynload/math.cpython-35m-x86_64-linux-gnu.so
                       7f4da2f5d000-7f4da315c000 ---p 00008000 00:1a 5279143                    /usr/lib64/python3.5/lib-dynload/math.cpython-35m-x86_64-linux-gnu.so
                       7f4da315c000-7f4da315d000 r--p 00007000 00:1a 5279143                    /usr/lib64/python3.5/lib-dynload/math.cpython-35m-x86_64-linux-gnu.so
                       7f4da315d000-7f4da315f000 rw-p 00008000 00:1a 5279143                    /usr/lib64/python3.5/lib-dynload/math.cpython-35m-x86_64-linux-gnu.so
                       7f4da315f000-7f4da319f000 rw-p 00000000 00:00 0
                       7f4da319f000-7f4da31a4000 r-xp 00000000 00:1a 5279151                    /usr/lib64/python3.5/lib-dynload/select.cpython-35m-x86_64-linux-gnu.so
                       7f4da31a4000-7f4da33a3000 ---p 00005000 00:1a 5279151                    /usr/lib64/python3.5/lib-dynload/select.cpython-35m-x86_64-linux-gnu.so
                       7f4da33a3000-7f4da33a4000 r--p 00004000 00:1a 5279151                    /usr/lib64/python3.5/lib-dynload/select.cpython-35m-x86_64-linux-gnu.so
                       7f4da33a4000-7f4da33a6000 rw-p 00005000 00:1a 5279151                    /usr/lib64/python3.5/lib-dynload/select.cpython-35m-x86_64-linux-gnu.so
                       7f4da33a6000-7f4da33a9000 r-xp 00000000 00:1a 5279130                    /usr/lib64/python3.5/lib-dynload/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so
                       7f4da33a9000-7f4da35a8000 ---p 00003000 00:1a 5279130                    /usr/lib64/python3.5/lib-dynload/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so
                       7f4da35a8000-7f4da35a9000 r--p 00002000 00:1a 5279130                    /usr/lib64/python3.5/lib-dynload/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so
                       7f4da35a9000-7f4da35aa000 rw-p 00003000 00:1a 5279130                    /usr/lib64/python3.5/lib-dynload/_posixsubprocess.cpython-35m-x86_64-linux-gnu.so
                       7f4da35aa000-7f4da362a000 rw-p 00000000 00:00 0
                       7f4da362a000-7f4da362c000 r-xp 00000000 00:1a 5279122                    /usr/lib64/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
                       7f4da362c000-7f4da382b000 ---p 00002000 00:1a 5279122                    /usr/lib64/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
                       7f4da382b000-7f4da382c000 r--p 00001000 00:1a 5279122                    /usr/lib64/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
                       7f4da382c000-7f4da382e000 rw-p 00002000 00:1a 5279122                    /usr/lib64/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
                       7f4da382e000-7f4da39ee000 rw-p 00000000 00:00 0
                       7f4da39ee000-7f4da3bab000 r-xp 00000000 00:1a 4844904                    /usr/lib64/libc-2.24.so
                       7f4da3bab000-7f4da3daa000 ---p 001bd000 00:1a 4844904                    /usr/lib64/libc-2.24.so
                       7f4da3daa000-7f4da3dae000 r--p 001bc000 00:1a 4844904                    /usr/lib64/libc-2.24.so
                       7f4da3dae000-7f4da3db0000 rw-p 001c0000 00:1a 4844904                    /usr/lib64/libc-2.24.so
                       7f4da3db0000-7f4da3db4000 rw-p 00000000 00:00 0
                       7f4da3db4000-7f4da3ebc000 r-xp 00000000 00:1a 4844910                    /usr/lib64/libm-2.24.so
                       7f4da3ebc000-7f4da40bb000 ---p 00108000 00:1a 4844910                    /usr/lib64/libm-2.24.so
                       7f4da40bb000-7f4da40bc000 r--p 00107000 00:1a 4844910                    /usr/lib64/libm-2.24.so
                       7f4da40bc000-7f4da40bd000 rw-p 00108000 00:1a 4844910                    /usr/lib64/libm-2.24.so
                       7f4da40bd000-7f4da40bf000 r-xp 00000000 00:1a 4844928                    /usr/lib64/libutil-2.24.so
                       7f4da40bf000-7f4da42be000 ---p 00002000 00:1a 4844928                    /usr/lib64/libutil-2.24.so
                       7f4da42be000-7f4da42bf000 r--p 00001000 00:1a 4844928                    /usr/lib64/libutil-2.24.so
                       7f4da42bf000-7f4da42c0000 rw-p 00002000 00:1a 4844928                    /usr/lib64/libutil-2.24.so
                       7f4da42c0000-7f4da42c3000 r-xp 00000000 00:1a 4844908                    /usr/lib64/libdl-2.24.so
                       7f4da42c3000-7f4da44c2000 ---p 00003000 00:1a 4844908                    /usr/lib64/libdl-2.24.so
                       7f4da44c2000-7f4da44c3000 r--p 00002000 00:1a 4844908                    /usr/lib64/libdl-2.24.so
                       7f4da44c3000-7f4da44c4000 rw-p 00003000 00:1a 4844908                    /usr/lib64/libdl-2.24.so
                       7f4da44c4000-7f4da44dc000 r-xp 00000000 00:1a 4844920                    /usr/lib64/libpthread-2.24.so
                       7f4da44dc000-7f4da46dc000 ---p 00018000 00:1a 4844920                    /usr/lib64/libpthread-2.24.so
                       7f4da46dc000-7f4da46dd000 r--p 00018000 00:1a 4844920                    /usr/lib64/libpthread-2.24.so
                       7f4da46dd000-7f4da46de000 rw-p 00019000 00:1a 4844920                    /usr/lib64/libpthread-2.24.so
                       7f4da46de000-7f4da46e2000 rw-p 00000000 00:00 0
                       7f4da46e2000-7f4da4917000 r-xp 00000000 00:1a 5277535                    /usr/lib64/libpython3.5m.so.1.0
                       7f4da4917000-7f4da4b17000 ---p 00235000 00:1a 5277535                    /usr/lib64/libpython3.5m.so.1.0
                       7f4da4b17000-7f4da4b1c000 r--p 00235000 00:1a 5277535                    /usr/lib64/libpython3.5m.so.1.0
                       7f4da4b1c000-7f4da4b7f000 rw-p 0023a000 00:1a 5277535                    /usr/lib64/libpython3.5m.so.1.0
                       7f4da4b7f000-7f4da4baf000 rw-p 00000000 00:00 0
                       7f4da4baf000-7f4da4bd4000 r-xp 00000000 00:1a 4844897                    /usr/lib64/ld-2.24.so
                       7f4da4bdf000-7f4da4c10000 rw-p 00000000 00:00 0
                       7f4da4c10000-7f4da4c61000 r--p 00000000 00:1a 5225117                    /usr/lib/locale/pl_PL.utf8/LC_CTYPE
                       7f4da4c61000-7f4da4d91000 r--p 00000000 00:1a 4844827                    /usr/lib/locale/en_US.utf8/LC_COLLATE
                       7f4da4d91000-7f4da4d95000 rw-p 00000000 00:00 0
                       7f4da4dc1000-7f4da4dc2000 r--p 00000000 00:1a 4844832                    /usr/lib/locale/en_US.utf8/LC_NUMERIC
                       7f4da4dc2000-7f4da4dc3000 r--p 00000000 00:1a 4844795                    /usr/lib/locale/en_US.utf8/LC_TIME
                       7f4da4dc3000-7f4da4dc4000 r--p 00000000 00:1a 4844793                    /usr/lib/locale/en_US.utf8/LC_MONETARY
                       7f4da4dc4000-7f4da4dc5000 r--p 00000000 00:1a 4844830                    /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
                       7f4da4dc5000-7f4da4dc6000 r--p 00000000 00:1a 4844847                    /usr/lib/locale/en_US.utf8/LC_PAPER
                       7f4da4dc6000-7f4da4dc7000 r--p 00000000 00:1a 4844831                    /usr/lib/locale/en_US.utf8/LC_NAME
                       7f4da4dc7000-7f4da4dc8000 r--p 00000000 00:1a 4844790                    /usr/lib/locale/en_US.utf8/LC_ADDRESS
                       7f4da4dc8000-7f4da4dc9000 r--p 00000000 00:1a 4844794                    /usr/lib/locale/en_US.utf8/LC_TELEPHONE
                       7f4da4dc9000-7f4da4dca000 r--p 00000000 00:1a 4844792                    /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
                       7f4da4dca000-7f4da4dd1000 r--s 00000000 00:1a 4845203                    /usr/lib64/gconv/gconv-modules.cache
                       7f4da4dd1000-7f4da4dd2000 r--p 00000000 00:1a 4844791                    /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
                       7f4da4dd2000-7f4da4dd4000 rw-p 00000000 00:00 0
                       7f4da4dd4000-7f4da4dd5000 r--p 00025000 00:1a 4844897                    /usr/lib64/ld-2.24.so
                       7f4da4dd5000-7f4da4dd6000 rw-p 00026000 00:1a 4844897                    /usr/lib64/ld-2.24.so
                       7f4da4dd6000-7f4da4dd7000 rw-p 00000000 00:00 0
                       7ffd24da1000-7ffd24dc2000 rw-p 00000000 00:00 0                          [stack]
                       7ffd24de8000-7ffd24dea000 r--p 00000000 00:00 0                          [vvar]
                       7ffd24dea000-7ffd24dec000 r-xp 00000000 00:00 0                          [vdso]
                       ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    COREDUMP_TIMESTAMP=1477877460000000
    MESSAGE=Process 14498 (python3) of user 1002 failed with ZeroDivisionError: division by zero:

            Traceback (most recent call last):
              File "systemd_coredump_exception_handler.py", line 89, in <module>
                g()
              File "systemd_coredump_exception_handler.py", line 88, in g
                f()
              File "systemd_coredump_exception_handler.py", line 86, in f
                div0 = 1 / 0  # pylint: disable=W0612
            ZeroDivisionError: division by zero

            Local variables in innermost frame:
              h=<function f at 0x7f4da3606e18>
              a=3
    _PID=14499
    _SOURCE_REALTIME_TIMESTAMP=1477877460025975

7 years agocoredump: split out metadata gathering to a separate function
Zbigniew Jędrzejewski-Szmek [Sun, 30 Oct 2016 21:37:38 +0000 (17:37 -0400)]
coredump: split out metadata gathering to a separate function

In preparation for subsequenct changes...

Various stack allocations are changed to use the heap. This might be minimally
slower, but probably doesn't matter. The upside is that we will now properly
free all memory that is allocated.

7 years agoHACKING: mkosi is now packaged for Fedora
Zbigniew Jędrzejewski-Szmek [Sun, 6 Nov 2016 02:21:17 +0000 (22:21 -0400)]
HACKING: mkosi is now packaged for Fedora

Also dnf requires sudo.

7 years agoMerge pull request #4733 from poettering/binds-to
Zbigniew Jędrzejewski-Szmek [Wed, 15 Feb 2017 04:06:50 +0000 (23:06 -0500)]
Merge pull request #4733 from poettering/binds-to

When we are about to start a unit, check the deps again.

7 years agoMerge pull request #5343 from eworm-de/virt-kvm
Djalal Harouni [Tue, 14 Feb 2017 20:45:23 +0000 (21:45 +0100)]
Merge pull request #5343 from eworm-de/virt-kvm

virt: detect qemu/kvm as 'kvm'

7 years agoMerge pull request #5346 from namhyung/coredump-reverse
Lennart Poettering [Tue, 14 Feb 2017 18:14:11 +0000 (19:14 +0100)]
Merge pull request #5346 from namhyung/coredump-reverse

Update for coredumpctl -r option

7 years agovirt: detect qemu/kvm as 'kvm'
Christian Hesse [Tue, 14 Feb 2017 13:51:12 +0000 (14:51 +0100)]
virt: detect qemu/kvm as 'kvm'

In commit 050e65a we swapped order of detect_vm_{cpuid,dmi}(). That
fixed Virtualbox but broke qemu with kvm, which is expected to return
'kvm'. So check for qemu/kvm first, then DMI, CPUID last.

This fixes #5318.

Signed-off-by: Christian Hesse <mail@eworm.de>
7 years agoshell_completion: Add -r option for coredumpctl
Namhyung Kim [Tue, 14 Feb 2017 14:08:46 +0000 (23:08 +0900)]
shell_completion: Add -r option for coredumpctl

7 years agoman: coredumpctl: Add description of -r option
Namhyung Kim [Tue, 14 Feb 2017 13:59:10 +0000 (22:59 +0900)]
man: coredumpctl: Add description of -r option

7 years agoMerge pull request #5335 from poettering/resolved-some-fixes
Lennart Poettering [Tue, 14 Feb 2017 14:09:43 +0000 (15:09 +0100)]
Merge pull request #5335 from poettering/resolved-some-fixes

some post-mdns fixes for resolved

7 years agoman: extend the docs on BindsTo= and Requires= a bit
Lennart Poettering [Tue, 29 Nov 2016 21:03:44 +0000 (22:03 +0100)]
man: extend the docs on BindsTo= and Requires= a bit

Let's emphasize that both really should be combined with After=.

7 years agocore: explicitly verify that BindsTo= deps are in order before dispatch start operati...
Lennart Poettering [Thu, 24 Nov 2016 17:47:48 +0000 (18:47 +0100)]
core: explicitly verify that BindsTo= deps are in order before dispatch start operation of a unit

Let's make sure we verify that all BindsTo= are in order before we actually go
and dispatch a start operation to a unit. Normally the job queue should already
have made sure all deps are in order, but this might not have been sufficient
in two cases: a) when the user changes deps during runtime and reloads the
daemon, and b) when the user placed BindsTo= dependencies without matching
After= dependencies, so that we don't actually wait for the bound to unit to be
up before upping also the binding unit.

See: #4725

7 years agoDefine clone order on ppc (#5325)
Zbigniew Jędrzejewski-Szmek [Tue, 14 Feb 2017 10:27:40 +0000 (05:27 -0500)]
Define clone order on ppc (#5325)

This was tested on ppc64le. Assume the same is true for ppc64.

7 years agoresolved: restore ANY reply behaviour for mDNS
Lennart Poettering [Tue, 14 Feb 2017 10:12:08 +0000 (11:12 +0100)]
resolved: restore ANY reply behaviour for mDNS

This restores behaviour of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2: for
mDNS (and mDNS only) we'll match replies to transactions honouring ANY
matches.

7 years agoresolved: size the mdns announce answer array properly
Lennart Poettering [Mon, 13 Feb 2017 19:45:40 +0000 (20:45 +0100)]
resolved: size the mdns announce answer array properly

The array doesn't grow dynamically, hence pick the right size at the
moment of allocation. Let's simply multiply the number of addresses of
this link by 2, as that's how many RRs we maintain for it.

7 years agorules: add persistent by-path drm rules (#5337)
Marc-Andre Lureau [Tue, 14 Feb 2017 09:18:27 +0000 (13:18 +0400)]
rules: add persistent by-path drm rules (#5337)

Create persistent symlinks for DRM devices, ex:
/dev/dri/by-path/pci-0000:00:02.0-card -> /dev/dri/card1
/dev/dri/by-path/pci-0000:00:02.0-render -> /dev/dri/renderD129
etc...

This allows to configure DRM device usage with stable paths.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agoMerge pull request #5298 from martinpitt/relocatable-tests
Zbigniew Jędrzejewski-Szmek [Tue, 14 Feb 2017 02:13:50 +0000 (21:13 -0500)]
Merge pull request #5298 from martinpitt/relocatable-tests

test: make unit tests relocatable and add an "install-tests" make target

7 years agofstab-generator: quiesce false-positive -Werror=format-nonliteral (#5336)
Martin Pitt [Tue, 14 Feb 2017 01:58:22 +0000 (02:58 +0100)]
fstab-generator: quiesce false-positive -Werror=format-nonliteral (#5336)

Commit ae3251851 changed the fprintf() format argument into a variable
which triggers a gcc 6.3 warning/error:

  src/fstab-generator/fstab-generator.c:243:17: error: format not a string literal,
  argument types not checked [-Werror=format-nonliteral]
                 fprintf(f, format, res);

This is a false positive, as the function is only being called with
constant (not user-definable) arguments which are valid format strings.

7 years agobuildsys: add "install-tests" target
Martin Pitt [Sun, 12 Feb 2017 22:53:53 +0000 (23:53 +0100)]
buildsys: add "install-tests" target

Add a new "install-tests" make target that installs our unit test-*
executables and their test data files into /usr/lib/systemd/tests/.
This is useful for packaging the tests to run them with root privileges
or in CI.

Fixes #5257

7 years agotest: make unit tests relocatable
Martin Pitt [Sun, 12 Feb 2017 22:14:43 +0000 (23:14 +0100)]
test: make unit tests relocatable

It is useful to package test-* binaries and run them as root under
autopkgtest or manually on particular machines. They currently have a
built-in hardcoded absolute path to their test data, which does not work
when running the test programs from any other path than the original
build directory.

By default, make the tests look for their data in
<test_exe_directory>/testdata/ so that they can be called from any
directory (provided that the corresponding test data is installed
correctly). As we don't have a fixed static path in the build tree (as
build and source tree are independent), set $TEST_DIR with "make check"
to point to <srcdir>/test/, as we previously did with an automake
variable.

7 years agotest: move resolved test data into test/
Martin Pitt [Sun, 12 Feb 2017 21:39:21 +0000 (22:39 +0100)]
test: move resolved test data into test/

Moe test-resolve's test data from src/resolve/test-data to
test/test-resolve/ to be consistent with test/test-{execute,path}/. This
will make it easier to make the tests relocatable.

7 years agofstab-generator: add x-systemd.before and x-systemd.after fstab options (#5330)
Ruslan Bilovol [Mon, 13 Feb 2017 19:50:22 +0000 (21:50 +0200)]
fstab-generator: add x-systemd.before and x-systemd.after fstab options (#5330)

Currently fstab entries with 'nofail' option are mounted
asynchronously and there is no way how to specify dependencies
between such fstab entry and another units. It means that
users are forced to write additional dependency units manually.

The patch introduces new systemd fstab options:

x-systemd.before=<PATH>
x-systemd.after=<PATH>

 - to specify another mount dependency (PATH is translated to unit name)

x-systemd.before=<UNIT>
x-systemd.after=<UNIT>

 - to specify arbitrary UNIT dependency

For example mount where A should be mounted before local-fs.target unit:

 /dev/sdb1    /mnt/test/A     none    nofail,x-systemd.before=local-fs.target

7 years agoresolved: name announce timer event source
Lennart Poettering [Mon, 13 Feb 2017 19:45:25 +0000 (20:45 +0100)]
resolved: name announce timer event source

7 years agoresolved: let's propagate errors from dns_scope_announce() and elsewhere
Lennart Poettering [Mon, 13 Feb 2017 19:44:11 +0000 (20:44 +0100)]
resolved: let's propagate errors from dns_scope_announce() and elsewhere

We don't actually make use of the return value for now, but it matches
our coding style elsewhere, and it actually shortens our code quite a
bit.

Also, add a missing OOM check after dns_answer_new().

7 years agoresolved: count the number of addresses per link
Lennart Poettering [Mon, 13 Feb 2017 19:41:09 +0000 (20:41 +0100)]
resolved: count the number of addresses per link

This becomes handy later on. Moreover, we keep track of similar counters
for other objects like this too, hence adding this here too is obvious.

7 years agoresolved: don't return ANY transactions when looking for transactions
Lennart Poettering [Mon, 13 Feb 2017 19:34:39 +0000 (20:34 +0100)]
resolved: don't return ANY transactions when looking for transactions

This reverts a part of 53fda2bb933694c9bdb1bbf1f5583e39673b74b2:

On classic DNS and LLMNR ANY requests may be replied to with any kind of
RR, and the reply does not have to be comprehensive: these protocols
simply define that if there's an RRset that can answer the question,
then at least one should be sent as reply, but not necessarily all. This
means it's not safe to "merge" transactions for arbitrary RR types into
ANY requests, as the reply might not answer the specific question.

As the merging is primarily an optimization, let's undo this for now.
This logic may be readded later, in a way that only applies to mDNS.

Also, there's an OOM problem with this chunk: dns_resource_key_new()
might fail due to OOM and this is not handled. (This is easily removed
though, by using DNS_RESOURCE_KEY_CONST()).

7 years agoMerge pull request #5331 from namhyung/coredump-reverse
Djalal Harouni [Mon, 13 Feb 2017 18:25:13 +0000 (19:25 +0100)]
Merge pull request #5331 from namhyung/coredump-reverse

Add -r/--reverse option to coredumpctl

7 years agoMerge pull request #5319 from keszybz/test-execute
Lennart Poettering [Mon, 13 Feb 2017 14:29:40 +0000 (15:29 +0100)]
Merge pull request #5319 from keszybz/test-execute

test-execute without capsh

7 years agoMerge pull request #5320 from jwrdegoede/cube-iwork8-air
Lennart Poettering [Mon, 13 Feb 2017 14:00:10 +0000 (15:00 +0100)]
Merge pull request #5320 from jwrdegoede/cube-iwork8-air

Extended evdev keyboard match rule + cube iwork8 air keymap fixup hwdb entry

7 years agocoredumpctl: Add -r/--reverse option
Namhyung Kim [Mon, 13 Feb 2017 13:55:25 +0000 (22:55 +0900)]
coredumpctl: Add -r/--reverse option

Like journalctl, users sometimes want to see coredump list in reverse
order.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
7 years agocoredumpctl: Remove dubious newline in the help message
Namhyung Kim [Mon, 13 Feb 2017 13:35:37 +0000 (22:35 +0900)]
coredumpctl: Remove dubious newline in the help message

It seems the -o opiton and -D option can be printed together.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
7 years agoMerge pull request #5322 from keszybz/silence-gcc-warning
Martin Pitt [Mon, 13 Feb 2017 07:58:57 +0000 (08:58 +0100)]
Merge pull request #5322 from keszybz/silence-gcc-warning

Silence gcc warnings

7 years agoMerge pull request #4832 from rojkov/mdns
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 20:38:51 +0000 (15:38 -0500)]
Merge pull request #4832 from rojkov/mdns

7 years agoseccomp: disable RestrictAddressFamilies= for the ABI we shall block, not the one...
Lennart Poettering [Sun, 12 Feb 2017 20:25:40 +0000 (21:25 +0100)]
seccomp: disable RestrictAddressFamilies= for the ABI we shall block, not the one we are compiled for (#5272)

It's a difference. Not a big one, but let's be correct here.

7 years agoman: busctl: improve capture description (#5321)
Lucas Werkmeister [Sun, 12 Feb 2017 20:20:08 +0000 (21:20 +0100)]
man: busctl: improve capture description (#5321)

7 years agoMerge pull request #5276 from poettering/resolved-cname
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 20:08:19 +0000 (15:08 -0500)]
Merge pull request #5276 from poettering/resolved-cname

a good number of resolved fixes

7 years agocore/dbus: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 18:22:18 +0000 (13:22 -0500)]
core/dbus: silence gcc warning about unitialized variable

src/core/dbus.c: In function 'find_unit':
src/core/dbus.c:334:15: warning: 'u' may be used uninitialized in this function [-Wmaybe-uninitialized]
         *unit = u;
               ^
src/core/dbus.c:301:15: note: 'u' was declared here
         Unit *u;
               ^

7 years agocore/manager: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 17:56:40 +0000 (12:56 -0500)]
core/manager: silence gcc warning about unitialized variable

At -O3, this was printed a hundred times for various callers of
manager_add_job_by_name(). AFAICT, there is no error and `unit` is always
intialized. Nevertheless, add explicit initialization to silence the noise.

src/core/manager.c: In function 'manager_start_target':
src/core/manager.c:1413:16: warning: 'unit' may be used uninitialized in this function [-Wmaybe-uninitialized]
         return manager_add_job(m, type, unit, mode, e, ret);
                ^
src/core/manager.c:1401:15: note: 'unit' was declared here
         Unit *unit;
               ^

7 years agocore/manager: make manager_load_unit*() functions always take output arg
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 17:40:09 +0000 (12:40 -0500)]
core/manager: make manager_load_unit*() functions always take output arg

We were inconsistent, manager_load_unit_prepare() would crash if _ret was ever NULL.
But none of the callers use NULL. So simplify things and require it to be non-NULL.

7 years agohwdb: Cube iwork8 air button keymap fixup
Hans de Goede [Sun, 12 Feb 2017 11:45:21 +0000 (12:45 +0100)]
hwdb: Cube iwork8 air button keymap fixup

The home and power buttons on the Cube iwork8 air tablet are swapped,
add a hwdb entry fixing this up.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agorules: Add extended evdev/input match rules for event nodes with the same name
Hans de Goede [Sun, 12 Feb 2017 11:33:22 +0000 (12:33 +0100)]
rules: Add extended evdev/input match rules for event nodes with the same name

Sometimes a system may have 2 input event nodes with the same name where
we only want to apply keyboard hwdb rules to 1 of the 2 devices.

This problem happens e.g. on devices where the soc_button_array driver is
used (e.g. intel atom based tablets) which registers 2 event nodes with
the name "gpio-keys".

This commit adds a new extended match rule which extends the match to also
check $attr{phys} and $attr{capabilities/ev}, allowing to differentiate
between devices with an identical name.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7 years agocore: skip ReadOnlyPaths= and other permission-related mounts on PermissionsStartOnly...
Lennart Poettering [Sun, 12 Feb 2017 05:44:46 +0000 (06:44 +0100)]
core: skip ReadOnlyPaths= and other permission-related mounts on PermissionsStartOnly= (#5309)

ReadOnlyPaths=, ProtectHome=, InaccessiblePaths= and ProtectSystem= are
about restricting access and little more, hence they should be disabled
if PermissionsStartOnly= is used or ExecStart= lines are prefixed with a
"+". Do that.

(Note that we will still create namespaces and stuff, since that's about
a lot more than just permissions. We'll simply disable the effect of
the four options mentioned above, but nothing else mount related.)

This also adds a test for this, to ensure this works as intended.

No documentation updates, as the documentation are already vague enough
to support the new behaviour ("If true, the permission-related execution
options…"). We could clarify this further, but I think we might want to
extend the switches' behaviour a bit more in future, hence leave it at
this for now.

Fixes: #5308

7 years agocalendarspec: fix duplicate detection (#5310)
Doug Christman [Sun, 12 Feb 2017 05:39:17 +0000 (00:39 -0500)]
calendarspec: fix duplicate detection (#5310)

a2eb5ea79c added a new field to `CalendarComponent`; update
`normalize_chain` to compare all fields when dropping duplicates

7 years agoshared: pass *unsigned_long to namespace_flag_from_string_many (#5315)
Evgeny Vereshchagin [Sun, 12 Feb 2017 05:38:16 +0000 (08:38 +0300)]
shared: pass *unsigned_long to namespace_flag_from_string_many (#5315)

Fixes:
```
src/shared/bus-unit-util.c: In function ‘bus_append_unit_property_assignment’:
src/shared/bus-unit-util.c:570:65: warning: passing argument 2 of ‘namespace_flag_from_string_many’ from incompatible pointer type [-Wincompatible-pointer-types]
                         r = namespace_flag_from_string_many(eq, &flags);
                                                                 ^
In file included from src/shared/bus-unit-util.c:31:0:
src/shared/nsflags.h:41:5: note: expected ‘long unsigned int *’ but argument is of type ‘uint64_t * {aka long long unsigned int *}’
 int namespace_flag_from_string_many(const char *name, unsigned long *ret);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Closes #5312

7 years agoshared: convert unsigned long to uint64_t explicitly (#5314)
Evgeny Vereshchagin [Sun, 12 Feb 2017 05:36:34 +0000 (08:36 +0300)]
shared: convert unsigned long to uint64_t explicitly (#5314)

Closes #5313

7 years agoMerge pull request #5303 from poettering/deleted-units
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:31:39 +0000 (00:31 -0500)]
Merge pull request #5303 from poettering/deleted-units

a small number of install and unit management related fixes

7 years agoIt's now ok to use Google NTP servers (#5311)
Michael Shields [Sun, 12 Feb 2017 05:30:40 +0000 (21:30 -0800)]
It's now ok to use Google NTP servers (#5311)

7 years agoman: systemd.journal-fields: document _SYSTEMD_INVOCATION_ID (#5316)
Lucas Werkmeister [Sun, 12 Feb 2017 05:27:58 +0000 (06:27 +0100)]
man: systemd.journal-fields: document _SYSTEMD_INVOCATION_ID (#5316)

#4067 added documentation to systemd.exec(5), but not systemd.journal-fields(7).

7 years agotest-execute: use __func__ to shorten messages
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:26:00 +0000 (00:26 -0500)]
test-execute: use __func__ to shorten messages

7 years agoREADME: document capsh's usefulness
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:22:20 +0000 (00:22 -0500)]
README: document capsh's usefulness

7 years agotest-execute: detect missing capsh in all tests
Zbigniew Jędrzejewski-Szmek [Sun, 12 Feb 2017 05:21:02 +0000 (00:21 -0500)]
test-execute: detect missing capsh in all tests

Fixes #5273.

7 years agoMerge pull request #5250 from ddstreet/test-sys-nodes-script
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 00:52:58 +0000 (19:52 -0500)]
Merge pull request #5250 from ddstreet/test-sys-nodes-script

replace test/sys.tar.xz with script to create test/sys/ contents

7 years agonetworkd: add IPv6ProxyNDPAddress support (#5174)
Florian Klink [Fri, 10 Feb 2017 23:47:55 +0000 (00:47 +0100)]
networkd: add IPv6ProxyNDPAddress support (#5174)

IPv6 Neighbor discovery proxy is the IPv6 equivalent to proxy ARP for IPv4.
It is required when ISPs do not unconditional route IPv6 subnets
to their designated target, but expect neighbor solicitation messages
for every address on a link.

A variable IPv6ProxyNDPAddress= is introduced to the [Network] section,
each representing a IPv6 neighbour proxy entry in the neighbour table.

7 years agobasic/architecture: adjust Risc-V ifdef (#5304)
Zbigniew Jędrzejewski-Szmek [Fri, 10 Feb 2017 22:48:22 +0000 (17:48 -0500)]
basic/architecture: adjust Risc-V ifdef (#5304)

https://lists.freedesktop.org/archives/systemd-devel/2017-February/038286.html

Let's keep both the old and new for now, so systemd builds correctly in either
environment. Later on we should drop the old.

7 years agoseccomp: order seccomp ABI list, so that our native ABI comes last (#5306)
Lennart Poettering [Fri, 10 Feb 2017 22:47:50 +0000 (23:47 +0100)]
seccomp: order seccomp ABI list, so that our native ABI comes last (#5306)

this way, we can still call seccomp ourselves, even if seccomp() is
blocked by the filter we are installing.

Fixes: #5300

7 years agotest: remove sys.tar.xz
Dan Streetman [Fri, 10 Feb 2017 20:29:52 +0000 (15:29 -0500)]
test: remove sys.tar.xz

The tarball is no longer needed, as the sys-script.py script creates
all the sys/ contents.

7 years agotest: change Makefile.am to use sys-script.py instead of sys.tar.xz
Dan Streetman [Fri, 10 Feb 2017 20:29:46 +0000 (15:29 -0500)]
test: change Makefile.am to use sys-script.py instead of sys.tar.xz

7 years agotest: create sys-script.py script
Dan Streetman [Fri, 10 Feb 2017 20:29:23 +0000 (15:29 -0500)]
test: create sys-script.py script

The script contains the contents of all sys/ test files, and creates
all dirs/links/files when run.  This replaces the sys.tar.xz tarball
that contained sys/, so changes to sys files only require a simple
commit in git, instead of checking in an entire new tarball for each
sys/ change.

7 years agotest: add script to convert sys/ into sys-script.py
Dan Streetman [Fri, 10 Feb 2017 20:27:18 +0000 (15:27 -0500)]
test: add script to convert sys/ into sys-script.py

Instead of keeping all sys/ nodes in a tarball, use a script
"sys-script.py" to create all the sys/ entries.

This adds a script to create that initial "sys-script.py" script, using
an existing sys/ directory, created from the sys.tar.xz contents.
The "sys-script.py" can then be edited or recreated later, when any sys/
files are added or modified; the change will be only a patch to the
"sys-script.py" script in git, instead of forcing git to store a new
binary tarball.

7 years agopath-lookup: if $HOME can be determined but $XDG_RUNTIME_DIR can't, is it
Lennart Poettering [Fri, 10 Feb 2017 14:18:23 +0000 (15:18 +0100)]
path-lookup: if $HOME can be determined but $XDG_RUNTIME_DIR can't, is it

So far, if either $HOME or $XDG_RUNTIME_DIR is not set we wouldn't use
either, and fail acquire_config_dirs() and acquire_control_dirs() in
their entireties. With this change, let's make use of the variables we
can acquire, and don't bother with the other.

Specifically this means: in both acquire_config_dirs() and
acquire_control_dirs() handle ENXIO from user_config_dir() and
user_runtime_dir() directly, instead of propagating it up and handling
it in the caller.

7 years agopath-lookup: drop redundant strv_isempty() check
Lennart Poettering [Fri, 10 Feb 2017 14:17:18 +0000 (15:17 +0100)]
path-lookup: drop redundant strv_isempty() check

If the strv is empty, then strv_extend_strv_concat() is a NOP anyway,
and hence there is no reason to guard for this explicitly.

7 years agopath-lookup: try harder acquiring them $HOME of a user
Lennart Poettering [Fri, 10 Feb 2017 14:16:11 +0000 (15:16 +0100)]
path-lookup: try harder acquiring them $HOME of a user

Let's use get_home_dir() for figuring out the home directory, so that
there's a good chance we succeed figuring out unit locations even if
$HOME isn't set.

Fixes: #5260

7 years agoinstall: never hit assert() when we can't figure out where to write configuration...
Lennart Poettering [Fri, 10 Feb 2017 14:14:18 +0000 (15:14 +0100)]
install: never hit assert() when we can't figure out where to write configuration symlinks

Under specific circumstances it might happen that we can't figure out
where to place our symlinks, for example because we are supposed to
create them in the runtime directory but $XDG_RUNTIME_DIR is not set. In
this case, return -ENXIO instead of hitting an assert().

(Yeah, the error isn't very descriptive, but for now this should at
least be good enough to remove the assert() being hit.)

7 years agoinstall: when disabling units, do so even if the unit is missing
Lennart Poettering [Fri, 10 Feb 2017 11:23:22 +0000 (12:23 +0100)]
install: when disabling units, do so even if the unit is missing

In some cases there might be unit symlinks in .wants/ or .requires/
directories even though the unit is otherwise fully removed. In this
case, don't fail removal, but still remove the symlinks.

This reworks the symlink marking logic to always add unit files that we
are missing to the changes list, but proceed with any symlink removal
for them. This way we'll still generate useful hints that a unit is
missing if you invoke "systemctl disable idontexist.service", but also
still remove any link to it.

Fixes: #4995

7 years agodbus: check selinux privilege before returning process list
Lennart Poettering [Fri, 10 Feb 2017 10:54:18 +0000 (11:54 +0100)]
dbus: check selinux privilege before returning process list

We protect less interetsing stuff with selinux "status", let's do that
here too.

7 years agocore: make sure to destroy all name watching bus slots when we are kicked off the...
Lennart Poettering [Fri, 10 Feb 2017 02:54:48 +0000 (03:54 +0100)]
core: make sure to destroy all name watching bus slots when we are kicked off the bus (#5294)

Fixes: #4528

7 years agotests: show journal on systemd-resolved.service failures (#5297)
Martin Pitt [Fri, 10 Feb 2017 02:30:44 +0000 (03:30 +0100)]
tests: show journal on systemd-resolved.service failures (#5297)

In networkd-test.py, show resolved's journal on failure, to debug issues
like https://github.com/systemd/systemd/pull/5283.

7 years agoseccomp: add forgotten munmap() syscall to @file-system (#5291)
Lennart Poettering [Fri, 10 Feb 2017 02:29:33 +0000 (03:29 +0100)]
seccomp: add forgotten munmap() syscall to @file-system (#5291)

We added mmap() and mmap2(), but forgot munmap(). Fix that.

Pointed out by @lucaswerkmeister:

https://github.com/systemd/systemd/pull/4537#issuecomment-273275298

7 years agoMerge pull request #5293 from poettering/seccomp-docs
Zbigniew Jędrzejewski-Szmek [Fri, 10 Feb 2017 02:28:12 +0000 (21:28 -0500)]
Merge pull request #5293 from poettering/seccomp-docs

Two doc fixes

7 years agoMerge pull request #5295 from poettering/shutup-canonicalize
Evgeny Vereshchagin [Fri, 10 Feb 2017 01:03:59 +0000 (04:03 +0300)]
Merge pull request #5295 from poettering/shutup-canonicalize

Shut up canonicalize debug log messages

7 years agodbus: permit seeing process list of units whose unit files are missing
Lennart Poettering [Thu, 9 Feb 2017 20:01:28 +0000 (21:01 +0100)]
dbus: permit seeing process list of units whose unit files are missing

Previously, we'd refuse the GetUnitProcesses() bus call if the unit file
couldn't be loaded. Which is wrong, as admins should be able to inspect
services whose unit files was deleted. Change this logic, so that we
permit introspecting the processes of any unit that is loaded,
regardless if it has a unit file or not.

(Note that we won't load unit files in GetUnitProcess(), but only
operate on already loaded ones. That's because only loaded units can
have processes — as that's how our GC logic works — and hence loading
the unit just for the process tree is pointless, as it would be empty).

See: #4995

7 years agodropin: always initialize return parameters on success
Lennart Poettering [Thu, 9 Feb 2017 19:10:03 +0000 (20:10 +0100)]
dropin: always initialize return parameters on success

Just as a matter of coding style: whenever we return successfully, let's
make sure all our return parameters are properly initialized to
something.

7 years agodropin: let's reduce duplicate a bit
Lennart Poettering [Thu, 9 Feb 2017 19:08:58 +0000 (20:08 +0100)]
dropin: let's reduce duplicate a bit

After generating the template name we can shortcut things and just call
unit_file_find_dirs() from inside itself, just with the new name and
save a good number of duplicate lines.

7 years agodropin: let's prefer strjoina() over strjoin()
Lennart Poettering [Thu, 9 Feb 2017 19:08:44 +0000 (20:08 +0100)]
dropin: let's prefer strjoina() over strjoin()

7 years agodropin: downgrade logging about paths we cannot canonicalize
Lennart Poettering [Thu, 9 Feb 2017 19:07:00 +0000 (20:07 +0100)]
dropin: downgrade logging about paths we cannot canonicalize

After all, most units won't have drop-in dirs, hence there's no point in
logging about that.

Fixes: #5252

7 years agoman: update pam_systemd and systemd-logind man pages a bit
Lennart Poettering [Thu, 9 Feb 2017 17:40:42 +0000 (18:40 +0100)]
man: update pam_systemd and systemd-logind man pages a bit

This builds on @utezduyar's #4640, but extends on it.

Fixes: #4550
Replaces: #4640

7 years agoman: improve documentation on seccomp regarding alternative ABIs
Lennart Poettering [Thu, 9 Feb 2017 17:27:02 +0000 (18:27 +0100)]
man: improve documentation on seccomp regarding alternative ABIs

Let's clarify that RestrictAddressFamilies= and MemoryDenyWriteExecute=
are only fully effective if non-native system call architectures are
disabled, since they otherwise may be used to circumvent the filters, as
the filters aren't equally effective on all ABIs.

Fixes: #5277

7 years agoIntroduce '## ' as internal comment prefix in .in files and filter out a comment...
Zbigniew Jędrzejewski-Szmek [Thu, 9 Feb 2017 15:28:37 +0000 (10:28 -0500)]
Introduce '## ' as internal comment prefix in .in files and filter out a comment (#5289)

Sometimes we have comments which don't make sense outside of the systemd
codebase, so let's filter them out from the user-visible files.

Fixes #5286.

7 years agoresolved: if strict DNSSEC mode is selected never downgrade below DNSSEC server featu...
Lennart Poettering [Wed, 8 Feb 2017 19:35:32 +0000 (20:35 +0100)]
resolved: if strict DNSSEC mode is selected never downgrade below DNSSEC server feature level due to packet loss

Fixes: #4315