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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20101217165319.98670d66.akpm@linux-foundation.org>
Date:	Fri, 17 Dec 2010 16:53:19 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Dan Rosenberg <drosenberg@...curity.com>
Cc:	linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org, netdev@...r.kernel.org,
	jmorris@...ei.org, eugeneteo@...nel.org, kees.cook@...onical.com,
	mingo@...e.hu, davem@...emloft.net
Subject: Re: [PATCH v2] kptr_restrict for hiding kernel pointers from
 unprivileged users

On Fri, 10 Dec 2010 19:05:24 -0500
Dan Rosenberg <drosenberg@...curity.com> wrote:

> +	case 'K':
> +		if (kptr_restrict) {
> +			if (in_irq() || in_serving_softirq() || in_nmi())
> +				WARN(1, "%%pK used in interrupt context.\n");
> +
> +			else if (capable(CAP_SYSLOG))
> +				break;
> +
> +			if (spec.field_width == -1) {
> +				spec.field_width = 2 * sizeof(void *);
> +				spec.flags |= ZEROPAD;
> +			}
> +			return number(buf, end, 0, spec);
> +		}
> +		break;

Also, we should emit the runtime warning even if kptr_restrict is
false.  Otherwise programmers might ship buggy code because they didn't
enable kptr_restrict during testing.

So what I ended up with was

	case 'K':
		/*
		 * %pK cannot be used in IRQ context because it tests
		 * CAP_SYSLOG.
		 */
		if (in_irq() || in_serving_softirq() || in_nmi())
			WARN_ONCE(1, "%%pK used in interrupt context.\n");

		if (!kptr_restrict)
			break;		/* %pK does not obscure pointers */

		if (capable(CAP_SYSLOG))
			break;		/* privileged apps expose pointers */

		if (spec.field_width == -1) {
			spec.field_width = 2 * sizeof(void *);
			spec.flags |= ZEROPAD;
		}
		return number(buf, end, 0, spec);

How does that look?


Also...  permitting root to bypass the %pK obscuring seems pretty lame,
really.  I bet a *lot* of the existing %p sites are already root-only
(eg, driver initialisation).  So much of the value is lost.
--
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