All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <dchinner@redhat.com>
To: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Michal Hocko <mhocko@kernel.org>,
	Laura Abbott <labbott@redhat.com>,
	Jerome Glisse <jglisse@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Christoph Lameter <cl@linux.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data
Date: Thu, 22 Feb 2018 08:36:29 +1100	[thread overview]
Message-ID: <20180221213629.GF3728@rh> (raw)
In-Reply-To: <46a9610a-182b-4765-9d83-cab6297377f3@huawei.com>

On Wed, Feb 21, 2018 at 11:56:22AM +0200, Igor Stoppa wrote:
> On 21/02/18 03:36, Dave Chinner wrote:
> > On Tue, Feb 20, 2018 at 03:56:00PM -0800, Matthew Wilcox wrote:
> >> On Wed, Feb 21, 2018 at 08:36:04AM +1100, Dave Chinner wrote:
> >>> FWIW, I'm not wanting to use it to replace static variables. All the
> >>> structures are dynamically allocated right now, and get assigned to
> >>> other dynamically allocated pointers. I'd likely split the current
> >>> structures into a "ro after init" 
> 
> I would prefer to use a different terminology, because, if I have
> understood the use case, this is not exactly the same as __ro_after_init

I want a dynamically allocated "write once" structure.

A "write once" structure is, conceptually, is exactly the same as
"ro after init". Implementation wise, it may be different to
"__ro_after_init", especially when compared to static/global
variables.

It seems lots of people get confused when discussing concepts vs
implementation... :)

> >>> 	......
> >>
> >> No, you'd do:
> >>
> >> struct xfs_mount_ro {
> >> 	[...]
> >> };
> 
> is this something that is readonly from the beginning and then shared
> among mount points or is it specific to each mount point?

It's dynamically allocated for each mount point, made read-only
before the mount completes and lives for the length of the mount
point.

> >> struct xfs_mount {
> >> 	const struct xfs_mount_ro *ro;
> >> 	[...]
> >> };
> > 
> > .... so that's pretty much the same thing :P
> 
> The "const" modifier is a nice way to catch errors through the compiler,
> iff the ro data will not be initialized through this handle, when it's
> still writable.

That's kinda implied by the const, isn't it? If we don't do it that
way, then the compiler will throw errors....

Cheers,

Dave.
-- 
Dave Chinner
dchinner@redhat.com

WARNING: multiple messages have this Message-ID (diff)
From: dchinner@redhat.com (Dave Chinner)
To: linux-security-module@vger.kernel.org
Subject: [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data
Date: Thu, 22 Feb 2018 08:36:29 +1100	[thread overview]
Message-ID: <20180221213629.GF3728@rh> (raw)
In-Reply-To: <46a9610a-182b-4765-9d83-cab6297377f3@huawei.com>

On Wed, Feb 21, 2018 at 11:56:22AM +0200, Igor Stoppa wrote:
> On 21/02/18 03:36, Dave Chinner wrote:
> > On Tue, Feb 20, 2018 at 03:56:00PM -0800, Matthew Wilcox wrote:
> >> On Wed, Feb 21, 2018 at 08:36:04AM +1100, Dave Chinner wrote:
> >>> FWIW, I'm not wanting to use it to replace static variables. All the
> >>> structures are dynamically allocated right now, and get assigned to
> >>> other dynamically allocated pointers. I'd likely split the current
> >>> structures into a "ro after init" 
> 
> I would prefer to use a different terminology, because, if I have
> understood the use case, this is not exactly the same as __ro_after_init

I want a dynamically allocated "write once" structure.

A "write once" structure is, conceptually, is exactly the same as
"ro after init". Implementation wise, it may be different to
"__ro_after_init", especially when compared to static/global
variables.

It seems lots of people get confused when discussing concepts vs
implementation... :)

> >>> 	......
> >>
> >> No, you'd do:
> >>
> >> struct xfs_mount_ro {
> >> 	[...]
> >> };
> 
> is this something that is readonly from the beginning and then shared
> among mount points or is it specific to each mount point?

It's dynamically allocated for each mount point, made read-only
before the mount completes and lives for the length of the mount
point.

> >> struct xfs_mount {
> >> 	const struct xfs_mount_ro *ro;
> >> 	[...]
> >> };
> > 
> > .... so that's pretty much the same thing :P
> 
> The "const" modifier is a nice way to catch errors through the compiler,
> iff the ro data will not be initialized through this handle, when it's
> still writable.

That's kinda implied by the const, isn't it? If we don't do it that
way, then the compiler will throw errors....

Cheers,

Dave.
-- 
Dave Chinner
dchinner at redhat.com
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Dave Chinner <dchinner@redhat.com>
To: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Michal Hocko <mhocko@kernel.org>,
	Laura Abbott <labbott@redhat.com>,
	Jerome Glisse <jglisse@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Christoph Lameter <cl@linux.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data
Date: Thu, 22 Feb 2018 08:36:29 +1100	[thread overview]
Message-ID: <20180221213629.GF3728@rh> (raw)
In-Reply-To: <46a9610a-182b-4765-9d83-cab6297377f3@huawei.com>

On Wed, Feb 21, 2018 at 11:56:22AM +0200, Igor Stoppa wrote:
> On 21/02/18 03:36, Dave Chinner wrote:
> > On Tue, Feb 20, 2018 at 03:56:00PM -0800, Matthew Wilcox wrote:
> >> On Wed, Feb 21, 2018 at 08:36:04AM +1100, Dave Chinner wrote:
> >>> FWIW, I'm not wanting to use it to replace static variables. All the
> >>> structures are dynamically allocated right now, and get assigned to
> >>> other dynamically allocated pointers. I'd likely split the current
> >>> structures into a "ro after init" 
> 
> I would prefer to use a different terminology, because, if I have
> understood the use case, this is not exactly the same as __ro_after_init

I want a dynamically allocated "write once" structure.

A "write once" structure is, conceptually, is exactly the same as
"ro after init". Implementation wise, it may be different to
"__ro_after_init", especially when compared to static/global
variables.

It seems lots of people get confused when discussing concepts vs
implementation... :)

> >>> 	......
> >>
> >> No, you'd do:
> >>
> >> struct xfs_mount_ro {
> >> 	[...]
> >> };
> 
> is this something that is readonly from the beginning and then shared
> among mount points or is it specific to each mount point?

It's dynamically allocated for each mount point, made read-only
before the mount completes and lives for the length of the mount
point.

> >> struct xfs_mount {
> >> 	const struct xfs_mount_ro *ro;
> >> 	[...]
> >> };
> > 
> > .... so that's pretty much the same thing :P
> 
> The "const" modifier is a nice way to catch errors through the compiler,
> iff the ro data will not be initialized through this handle, when it's
> still writable.

That's kinda implied by the const, isn't it? If we don't do it that
way, then the compiler will throw errors....

Cheers,

Dave.
-- 
Dave Chinner
dchinner@redhat.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2018-02-21 21:36 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 16:52 [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data Igor Stoppa
2018-02-12 16:52 ` Igor Stoppa
2018-02-12 16:52 ` Igor Stoppa
2018-02-12 16:52 ` Igor Stoppa
2018-02-12 16:52 ` [PATCH 1/6] genalloc: track beginning of allocations Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 23:52   ` Kees Cook
2018-02-12 23:52     ` Kees Cook
2018-02-12 23:52     ` Kees Cook
2018-02-20 17:07     ` Igor Stoppa
2018-02-20 17:07       ` Igor Stoppa
2018-02-20 17:07       ` Igor Stoppa
2018-02-21 22:29       ` Kees Cook
2018-02-21 22:29         ` Kees Cook
2018-02-21 22:29         ` Kees Cook
2018-02-21 22:35         ` Jonathan Corbet
2018-02-21 22:35           ` Jonathan Corbet
2018-02-21 22:35           ` Jonathan Corbet
2018-02-12 16:52 ` [PATCH 2/6] genalloc: selftest Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 23:50   ` Kees Cook
2018-02-12 23:50     ` Kees Cook
2018-02-12 23:50     ` Kees Cook
2018-02-20 16:59     ` Igor Stoppa
2018-02-20 16:59       ` Igor Stoppa
2018-02-20 16:59       ` Igor Stoppa
2018-02-21 22:28       ` Kees Cook
2018-02-21 22:28         ` Kees Cook
2018-02-21 22:28         ` Kees Cook
2018-02-22  9:14         ` Igor Stoppa
2018-02-22  9:14           ` Igor Stoppa
2018-02-22  9:14           ` Igor Stoppa
2018-02-22 18:28           ` Igor Stoppa
2018-02-22 18:28             ` Igor Stoppa
2018-02-22 18:28             ` Igor Stoppa
2018-02-12 16:52 ` [PATCH 3/6] struct page: add field for vm_struct Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52 ` [PATCH 4/6] Protectable Memory Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:52   ` Igor Stoppa
2018-02-12 16:53 ` [PATCH 5/6] Pmalloc: self-test Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 23:43   ` Kees Cook
2018-02-12 23:43     ` Kees Cook
2018-02-12 23:43     ` Kees Cook
2018-02-20 16:40     ` Igor Stoppa
2018-02-20 16:40       ` Igor Stoppa
2018-02-20 16:40       ` Igor Stoppa
2018-02-21 22:24       ` Kees Cook
2018-02-21 22:24         ` Kees Cook
2018-02-21 22:24         ` Kees Cook
2018-02-22  9:01         ` Igor Stoppa
2018-02-22  9:01           ` Igor Stoppa
2018-02-22  9:01           ` Igor Stoppa
2018-02-12 16:53 ` [PATCH 6/6] Documentation for Pmalloc Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 16:53   ` Igor Stoppa
2018-02-12 23:32 ` [RFC PATCH v16 0/6] mm: security: ro protection for dynamic data Kees Cook
2018-02-12 23:32   ` Kees Cook
2018-02-12 23:32   ` Kees Cook
2018-02-20  1:21   ` Dave Chinner
2018-02-20  1:21     ` Dave Chinner
2018-02-20  1:21     ` Dave Chinner
2018-02-20 18:03     ` Igor Stoppa
2018-02-20 18:03       ` Igor Stoppa
2018-02-20 18:03       ` Igor Stoppa
2018-02-20 21:36       ` Dave Chinner
2018-02-20 21:36         ` Dave Chinner
2018-02-20 21:36         ` Dave Chinner
2018-02-20 23:56         ` Matthew Wilcox
2018-02-20 23:56           ` Matthew Wilcox
2018-02-20 23:56           ` Matthew Wilcox
2018-02-21  1:36           ` Dave Chinner
2018-02-21  1:36             ` Dave Chinner
2018-02-21  1:36             ` Dave Chinner
2018-02-21  9:56             ` Igor Stoppa
2018-02-21  9:56               ` Igor Stoppa
2018-02-21  9:56               ` Igor Stoppa
2018-02-21 21:36               ` Dave Chinner [this message]
2018-02-21 21:36                 ` Dave Chinner
2018-02-21 21:36                 ` Dave Chinner
2018-02-22  8:58                 ` Igor Stoppa
2018-02-22  8:58                   ` Igor Stoppa
2018-02-22  8:58                   ` Igor Stoppa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221213629.GF3728@rh \
    --to=dchinner@redhat.com \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=hch@infradead.org \
    --cc=igor.stoppa@huawei.com \
    --cc=jglisse@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.