lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1642563828.4126628.1429625220545.JavaMail.zimbra@redhat.com>
Date:	Tue, 21 Apr 2015 10:07:00 -0400 (EDT)
From:	Ulrich Obergfell <uobergfe@...hat.com>
To:	Chris Metcalf <cmetcalf@...hip.com>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	Don Zickus <dzickus@...hat.com>,
	Ingo Molnar <mingo@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andrew Jones <drjones@...hat.com>,
	chai wen <chaiw.fnst@...fujitsu.com>,
	Fabian Frederick <fabf@...net.be>,
	Aaron Tomlin <atomlin@...hat.com>,
	Ben Zhang <benzh@...omium.org>,
	Christoph Lameter <cl@...ux.com>,
	Gilad Ben-Yossef <gilad@...yossef.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	linux-kernel@...r.kernel.org, Jonathan Corbet <corbet@....net>,
	linux-doc@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v9 2/3] watchdog: add watchdog_cpumask sysctl to assist
 nohz


Chris,

I think it would also be nice to check the plausibility of the user input.

+int proc_watchdog_cpumask(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+        int err;
+
+        mutex_lock(&watchdog_proc_mutex);
+        err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
+        if (!err && write) {
+                /* Remove impossible cpus to keep sysctl output cleaner. */
+                cpumask_and(watchdog_cpumask, watchdog_cpumask,
+                            cpu_possible_mask);
+
+                if (watchdog_enabled && watchdog_thresh)
+                        smpboot_update_cpumask_percpu_thread(&watchdog_threads,
+                                                             watchdog_cpumask);
+        }
+        mutex_unlock(&watchdog_proc_mutex);
+        return err;
+}

I think the user should only be allowed to specify a mask that is a subset of
tick_nohz_full_mask as only those CPUs don't have a watchdog thread by default.
In other words, the user should not be able to interfere with housekeeping CPUs.

For example, add a plausibility check like so:

  save watchdog_cpumask because proc_do_large_bitmap() is going to change it

  proc_do_large_bitmap()

  // return an error if the user-specified mask includes a housekeeping CPU
  if (watchdog_cpumask and 'negated tick_nohz_full_mask') {
      restore saved watchdog_cpumask
      return -EINVAL
  }


Regards,

Uli
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ