]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #9014 from keszybz/fuzz-journal-remote
authorLennart Poettering <lennart@poettering.net>
Thu, 31 May 2018 13:33:44 +0000 (15:33 +0200)
committerGitHub <noreply@github.com>
Thu, 31 May 2018 13:33:44 +0000 (15:33 +0200)
A fuzzer for journal-remote

man/sd_journal_get_fd.xml
man/systemd-portabled.service.xml
src/nspawn/nspawn.c
src/portable/portablectl.c
src/portable/portabled-image-bus.c
src/run/run.c
src/test/test-sleep.c
src/tmpfiles/tmpfiles.c
sysctl.d/50-default.conf

index ec1ba37f1e33b1868d7e83e71e7b0fd9588b6891..c396c6a79b1e789c7b1fc6fed68aef4fffc16d5f 100644 (file)
@@ -199,22 +199,27 @@ else {
     immediately for all journal changes. Returns 0 if there might be a
     latency involved.</para>
 
-    <para><function>sd_journal_process()</function> and
-    <function>sd_journal_wait()</function> return one of
-    <constant>SD_JOURNAL_NOP</constant>,
-    <constant>SD_JOURNAL_APPEND</constant> or
-    <constant>SD_JOURNAL_INVALIDATE</constant> on success or a
-    negative errno-style error code. If
-    <constant>SD_JOURNAL_NOP</constant> is returned, the journal did
-    not change since the last invocation. If
-    <constant>SD_JOURNAL_APPEND</constant> is returned, new entries
-    have been appended to the end of the journal. If
-    <constant>SD_JOURNAL_INVALIDATE</constant>, journal files were
-    added or removed (possibly due to rotation). In the latter event,
-    live-view UIs should probably refresh their entire display, while
-    in the case of <constant>SD_JOURNAL_APPEND</constant>, it is
-    sufficient to simply continue reading at the previous end of the
-    journal.</para>
+    <para><function>sd_journal_process()</function> and <function>sd_journal_wait()</function> return a negative
+    errno-style error code, or one of <constant>SD_JOURNAL_NOP</constant>, <constant>SD_JOURNAL_APPEND</constant> or
+    <constant>SD_JOURNAL_INVALIDATE</constant> on success:</para>
+
+    <itemizedlist>
+      <listitem><para>If <constant>SD_JOURNAL_NOP</constant> is returned, the journal did not change since the last
+      invocation.</para></listitem>
+
+      <listitem><para>If <constant>SD_JOURNAL_APPEND</constant> is returned, new entries have been appended to the end
+      of the journal. In this case it is sufficient to simply continue reading at the previous end location of the
+      journal, to read the newly added entries.</para></listitem>
+
+      <listitem><para>If <constant>SD_JOURNAL_INVALIDATE</constant>, journal files were added to or removed from the
+      set of of journal files watched (e.g. due to rotation or vacuuming), and thus entries might have appeared or
+      disappeared at arbitrary places in the log stream, possibly before or after the previous end of the log
+      stream. If <constant>SD_JOURNAL_INVALIDATE</constant> is returned, live-view UIs that want to reflect on screen
+      the precise state of the log data on disk should probably refresh their entire display (relative to the cursor of
+      the log entry on the top of the screen). Programs only interested in a strictly sequencial stream of log data may
+      treat <constant>SD_JOURNAL_INVALIDATE</constant> the same way as <constant>SD_JOURNAL_APPEND</constant>, thus
+      ignoring any changes to the log view earlier than the old end of the log stream.</para></listitem>
+    </itemizedlist>
   </refsect1>
 
   <refsect1>
index 7b1c3ae68cbadb551c0da1855ff9997cd34cb1d3..91da27eba826cf364db3ad83a0a37893a255932c 100644 (file)
@@ -45,7 +45,6 @@
     <para>Most of <command>systemd-portabled</command>'s functionality is accessible through the
     <citerefentry><refentrytitle>portablectl</refentrytitle><manvolnum>1</manvolnum></citerefentry> command.</para>
 
-
     <para>See the <ulink url="https://github.com/systemd/systemd/blob/master/doc/PORTABLE_SERVICES.md">Portable
     Services Documentation</ulink> for details about the concepts this service implements.</para>
   </refsect1>
index 2548c989a91412211d0b5979288bb06d04974db1..5792ae9587dd4697883a897d85a58ca768e26eb9 100644 (file)
@@ -1952,7 +1952,7 @@ static int setup_kmsg(int kmsg_socket) {
         if (r < 0)
                 return r;
 
-        fd = open(from, O_RDWR|O_NDELAY|O_CLOEXEC);
+        fd = open(from, O_RDWR|O_NONBLOCK|O_CLOEXEC);
         if (fd < 0)
                 return log_error_errno(errno, "Failed to open fifo: %m");
 
@@ -4478,7 +4478,7 @@ int main(int argc, char *argv[]) {
                 isatty(STDIN_FILENO) > 0 &&
                 isatty(STDOUT_FILENO) > 0;
 
-        master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY);
+        master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
         if (master < 0) {
                 r = log_error_errno(errno, "Failed to acquire pseudo tty: %m");
                 goto finish;
index 200435caae1928b8d24854db95ba26c45d47656e..4051875b76dc138a1fff27275144d8af788064fe 100644 (file)
@@ -104,8 +104,7 @@ static int extract_prefix(const char *path, char **ret) {
         if (!filename_is_valid(name))
                 return -EINVAL;
 
-        *ret = name;
-        name = NULL;
+        *ret = TAKE_PTR(name);
 
         return 0;
 }
@@ -142,18 +141,20 @@ static int determine_matches(const char *image, char **l, bool allow_any, char *
                 if (!arg_quiet)
                         log_info("(Matching all unit files.)");
         } else {
-                _cleanup_free_ char *joined = NULL;
 
                 k = strv_copy(l);
                 if (!k)
                         return log_oom();
 
-                joined = strv_join(k, "', '");
-                if (!joined)
-                        return log_oom();
+                if (!arg_quiet) {
+                        _cleanup_free_ char *joined = NULL;
+
+                        joined = strv_join(k, "', '");
+                        if (!joined)
+                                return log_oom();
 
-                if (!arg_quiet)
                         log_info("(Matching unit files with prefixes '%s'.)", joined);
+                }
         }
 
         *ret = TAKE_PTR(k);
@@ -883,14 +884,14 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case 'p':
+                        if (streq(optarg, "help"))
+                                return dump_profiles();
+
                         if (!filename_is_valid(optarg)) {
                                 log_error("Unit profile name not valid: %s", optarg);
                                 return -EINVAL;
                         }
 
-                        if (streq(optarg, "help"))
-                                return dump_profiles();
-
                         arg_profile = optarg;
                         break;
 
@@ -899,7 +900,12 @@ static int parse_argv(int argc, char *argv[]) {
                                 arg_copy_mode = NULL;
                         else if (STR_IN_SET(optarg, "copy", "symlink"))
                                 arg_copy_mode = optarg;
-                        else {
+                        else if (streq(optarg, "help")) {
+                                puts("auto\n"
+                                     "copy\n"
+                                     "symlink");
+                                return 0;
+                        } else {
                                 log_error("Failed to parse --copy= argument: %s", optarg);
                                 return -EINVAL;
                         }
index 1dc6b77b3ba49a34ea4771cd5d573031c3e83381..02a2db23524dbb50d25f0840cef474941d90da7e 100644 (file)
@@ -156,7 +156,6 @@ int bus_image_common_get_metadata(
 
         for (i = 0; i < hashmap_size(unit_files); i++) {
 
-
                 r = sd_bus_message_open_container(reply, 'e', "say");
                 if (r < 0)
                         return r;
index 6a271eed75832d7a5fe3c3917bd8dce3ccbe3c56..733daffb8cbd96fed374cc14dac3f4a8e31e504e 100644 (file)
@@ -917,7 +917,7 @@ static int start_transient_service(
         if (arg_stdio == ARG_STDIO_PTY) {
 
                 if (arg_transport == BUS_TRANSPORT_LOCAL) {
-                        master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY);
+                        master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
                         if (master < 0)
                                 return log_error_errno(errno, "Failed to acquire pseudo tty: %m");
 
index 1c5b56f4a04f12540eeff9753bc4e98c28b6925c..47174232548e177a5eae661f458abd8d014b9319 100644 (file)
@@ -30,7 +30,7 @@ static int test_fiemap(const char *path) {
         if (fd < 0)
                 return log_error_errno(errno, "failed to open %s: %m", path);
         r = read_fiemap(fd, &fiemap);
-        if (r == -ENOTSUP) {
+        if (r == -EOPNOTSUPP) {
                 log_info("Skipping test, not supported");
                 exit(EXIT_TEST_SKIP);
         }
index 049e24b8bd0b0fc33657cb9245729cb7fa1581e4..ae39d720a24b4194a38dc8945133c5d798264c70 100644 (file)
@@ -1245,7 +1245,7 @@ static int write_one_file(Item *i, const char *path) {
 
         RUN_WITH_UMASK(0000) {
                 mac_selinux_create_file_prepare(path, S_IFREG);
-                fd = open(path, flags|O_NDELAY|O_CLOEXEC|O_WRONLY|O_NOCTTY, i->mode);
+                fd = open(path, flags|O_NONBLOCK|O_CLOEXEC|O_WRONLY|O_NOCTTY, i->mode);
                 mac_selinux_create_file_clear();
         }
 
index e263cf06284a98a2fb402767b023f20ab9eb9808..b67ae87ca6b75523017ab281f63991bc7e975224 100644 (file)
@@ -33,6 +33,9 @@ net.ipv4.conf.all.promote_secondaries = 1
 # Fair Queue CoDel packet scheduler to fight bufferbloat
 net.core.default_qdisc = fq_codel
 
+# Request Explicit Congestion Notification (ECN) on both in and outgoing connections
+net.ipv4.tcp_ecn = 1
+
 # Enable hard and soft link protection
 fs.protected_hardlinks = 1
 fs.protected_symlinks = 1