All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laura Abbott <labbott@redhat.com>
Cc: Kees Cook <keescook@chromium.org>, Jann Horn <jannh@google.com>,
	Igor Stoppa <igor.stoppa@huawei.com>,
	Boris Lukashev <blukashev@sempervictus.com>,
	Christopher Lameter <cl@linux.com>,
	Matthew Wilcox <willy@infradead.org>,
	Jerome Glisse <jglisse@redhat.com>,
	Michal Hocko <mhocko@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
Date: Wed, 14 Feb 2018 19:28:42 +0000	[thread overview]
Message-ID: <CAKv+Gu8CNGFKLhX2XRuesn3n3k5P2bYS8qKWTTNXGFnr7SUVUA@mail.gmail.com> (raw)
In-Reply-To: <2f23544a-bd24-1e71-967b-e8d1cf5a20a3@redhat.com>

On 14 February 2018 at 19:06, Laura Abbott <labbott@redhat.com> wrote:
> On 02/13/2018 01:43 PM, Kees Cook wrote:
>>
>> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott <labbott@redhat.com> wrote:
>>>
>>> No, arm64 doesn't fixup the aliases, mostly because arm64 uses larger
>>> page sizes which can't be broken down at runtime. CONFIG_PAGE_POISONING
>>> does use 4K pages which could be adjusted at runtime. So yes, you are
>>> right we would have physmap exposure on arm64 as well.
>>
>>
>> Errr, so that means even modules and kernel code are writable via the
>> arm64 physmap? That seems extraordinarily bad. :(
>>
>> -Kees
>>
>
> (adding linux-arm-kernel and changing the subject)
>
> Kernel code should be fine, if it isn't that is a bug that should be
> fixed.

We take care to ensure that the linear alias of the core kernel's
.text and .rodata segments are mapped read-only. When we first moved
the kernel out of the linear region, we did not map it there at all
anymore, but that broke hibernation so we had to put something back.

> Modules yes are not fully protected. The conclusion from past
> experience has been that we cannot safely break down larger page sizes
> at runtime like x86 does. We could theoretically
> add support for fixing up the alias if PAGE_POISONING is enabled but
> I don't know who would actually use that in production. Performance
> is very poor at that point.
>

As long as the linear alias of the module is mapped down to pages, we
should be able to tweak the permissions. I take it that PAGE_POISONING
does more than just that?

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-security-module@vger.kernel.org
Subject: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
Date: Wed, 14 Feb 2018 19:28:42 +0000	[thread overview]
Message-ID: <CAKv+Gu8CNGFKLhX2XRuesn3n3k5P2bYS8qKWTTNXGFnr7SUVUA@mail.gmail.com> (raw)
In-Reply-To: <2f23544a-bd24-1e71-967b-e8d1cf5a20a3@redhat.com>

On 14 February 2018 at 19:06, Laura Abbott <labbott@redhat.com> wrote:
> On 02/13/2018 01:43 PM, Kees Cook wrote:
>>
>> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott <labbott@redhat.com> wrote:
>>>
>>> No, arm64 doesn't fixup the aliases, mostly because arm64 uses larger
>>> page sizes which can't be broken down at runtime. CONFIG_PAGE_POISONING
>>> does use 4K pages which could be adjusted at runtime. So yes, you are
>>> right we would have physmap exposure on arm64 as well.
>>
>>
>> Errr, so that means even modules and kernel code are writable via the
>> arm64 physmap? That seems extraordinarily bad. :(
>>
>> -Kees
>>
>
> (adding linux-arm-kernel and changing the subject)
>
> Kernel code should be fine, if it isn't that is a bug that should be
> fixed.

We take care to ensure that the linear alias of the core kernel's
.text and .rodata segments are mapped read-only. When we first moved
the kernel out of the linear region, we did not map it there at all
anymore, but that broke hibernation so we had to put something back.

> Modules yes are not fully protected. The conclusion from past
> experience has been that we cannot safely break down larger page sizes
> at runtime like x86 does. We could theoretically
> add support for fixing up the alias if PAGE_POISONING is enabled but
> I don't know who would actually use that in production. Performance
> is very poor at that point.
>

As long as the linear alias of the module is mapped down to pages, we
should be able to tweak the permissions. I take it that PAGE_POISONING
does more than just that?
--
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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laura Abbott <labbott@redhat.com>
Cc: Kees Cook <keescook@chromium.org>, Jann Horn <jannh@google.com>,
	Igor Stoppa <igor.stoppa@huawei.com>,
	Boris Lukashev <blukashev@sempervictus.com>,
	Christopher Lameter <cl@linux.com>,
	Matthew Wilcox <willy@infradead.org>,
	Jerome Glisse <jglisse@redhat.com>,
	Michal Hocko <mhocko@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
Date: Wed, 14 Feb 2018 19:28:42 +0000	[thread overview]
Message-ID: <CAKv+Gu8CNGFKLhX2XRuesn3n3k5P2bYS8qKWTTNXGFnr7SUVUA@mail.gmail.com> (raw)
In-Reply-To: <2f23544a-bd24-1e71-967b-e8d1cf5a20a3@redhat.com>

On 14 February 2018 at 19:06, Laura Abbott <labbott@redhat.com> wrote:
> On 02/13/2018 01:43 PM, Kees Cook wrote:
>>
>> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott <labbott@redhat.com> wrote:
>>>
>>> No, arm64 doesn't fixup the aliases, mostly because arm64 uses larger
>>> page sizes which can't be broken down at runtime. CONFIG_PAGE_POISONING
>>> does use 4K pages which could be adjusted at runtime. So yes, you are
>>> right we would have physmap exposure on arm64 as well.
>>
>>
>> Errr, so that means even modules and kernel code are writable via the
>> arm64 physmap? That seems extraordinarily bad. :(
>>
>> -Kees
>>
>
> (adding linux-arm-kernel and changing the subject)
>
> Kernel code should be fine, if it isn't that is a bug that should be
> fixed.

We take care to ensure that the linear alias of the core kernel's
.text and .rodata segments are mapped read-only. When we first moved
the kernel out of the linear region, we did not map it there at all
anymore, but that broke hibernation so we had to put something back.

> Modules yes are not fully protected. The conclusion from past
> experience has been that we cannot safely break down larger page sizes
> at runtime like x86 does. We could theoretically
> add support for fixing up the alias if PAGE_POISONING is enabled but
> I don't know who would actually use that in production. Performance
> is very poor at that point.
>

As long as the linear alias of the module is mapped down to pages, we
should be able to tweak the permissions. I take it that PAGE_POISONING
does more than just that?

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
Date: Wed, 14 Feb 2018 19:28:42 +0000	[thread overview]
Message-ID: <CAKv+Gu8CNGFKLhX2XRuesn3n3k5P2bYS8qKWTTNXGFnr7SUVUA@mail.gmail.com> (raw)
In-Reply-To: <2f23544a-bd24-1e71-967b-e8d1cf5a20a3@redhat.com>

On 14 February 2018 at 19:06, Laura Abbott <labbott@redhat.com> wrote:
> On 02/13/2018 01:43 PM, Kees Cook wrote:
>>
>> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott <labbott@redhat.com> wrote:
>>>
>>> No, arm64 doesn't fixup the aliases, mostly because arm64 uses larger
>>> page sizes which can't be broken down at runtime. CONFIG_PAGE_POISONING
>>> does use 4K pages which could be adjusted at runtime. So yes, you are
>>> right we would have physmap exposure on arm64 as well.
>>
>>
>> Errr, so that means even modules and kernel code are writable via the
>> arm64 physmap? That seems extraordinarily bad. :(
>>
>> -Kees
>>
>
> (adding linux-arm-kernel and changing the subject)
>
> Kernel code should be fine, if it isn't that is a bug that should be
> fixed.

We take care to ensure that the linear alias of the core kernel's
.text and .rodata segments are mapped read-only. When we first moved
the kernel out of the linear region, we did not map it there at all
anymore, but that broke hibernation so we had to put something back.

> Modules yes are not fully protected. The conclusion from past
> experience has been that we cannot safely break down larger page sizes
> at runtime like x86 does. We could theoretically
> add support for fixing up the alias if PAGE_POISONING is enabled but
> I don't know who would actually use that in production. Performance
> is very poor at that point.
>

As long as the linear alias of the module is mapped down to pages, we
should be able to tweak the permissions. I take it that PAGE_POISONING
does more than just that?

  reply	other threads:[~2018-02-14 19:28 UTC|newest]

Thread overview: 171+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 17:56 [kernel-hardening] [RFC PATCH v11 0/6] mm: security: ro protection for dynamic data Igor Stoppa
2018-01-24 17:56 ` Igor Stoppa
2018-01-24 17:56 ` Igor Stoppa
2018-01-24 17:56 ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 1/6] genalloc: track beginning of allocations Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 2/6] genalloc: selftest Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 3/6] struct page: add field for vm_struct Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 4/6] Protectable Memory Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 19:10   ` [kernel-hardening] " Jann Horn
2018-01-24 19:10     ` Jann Horn
2018-01-24 19:10     ` Jann Horn
2018-01-25 11:59     ` Igor Stoppa
2018-01-25 11:59       ` Igor Stoppa
2018-01-25 11:59       ` Igor Stoppa
2018-01-25 11:59       ` Igor Stoppa
2018-01-25 15:14       ` Boris Lukashev
2018-01-25 15:14         ` Boris Lukashev
2018-01-25 15:14         ` Boris Lukashev
2018-01-25 15:38         ` Jerome Glisse
2018-01-25 15:38           ` Jerome Glisse
2018-01-25 15:38           ` Jerome Glisse
2018-01-26 12:28           ` Igor Stoppa
2018-01-26 12:28             ` Igor Stoppa
2018-01-26 12:28             ` Igor Stoppa
2018-01-26 16:36             ` Boris Lukashev
2018-01-26 16:36               ` Boris Lukashev
2018-01-26 16:36               ` Boris Lukashev
2018-01-30 13:46               ` Igor Stoppa
2018-01-30 13:46                 ` Igor Stoppa
2018-01-30 13:46                 ` Igor Stoppa
2018-01-26  5:35     ` Matthew Wilcox
2018-01-26  5:35       ` Matthew Wilcox
2018-01-26  5:35       ` Matthew Wilcox
2018-01-26 11:46       ` Igor Stoppa
2018-01-26 11:46         ` Igor Stoppa
2018-01-26 11:46         ` Igor Stoppa
2018-01-26 11:46         ` Igor Stoppa
2018-02-02 18:39       ` Christopher Lameter
2018-02-02 18:39         ` Christopher Lameter
2018-02-02 18:39         ` Christopher Lameter
2018-02-03 15:38         ` Igor Stoppa
2018-02-03 15:38           ` Igor Stoppa
2018-02-03 15:38           ` Igor Stoppa
2018-02-03 15:38           ` Igor Stoppa
2018-02-03 19:57           ` Igor Stoppa
2018-02-03 19:57             ` Igor Stoppa
2018-02-03 19:57             ` Igor Stoppa
2018-02-03 19:57             ` Igor Stoppa
2018-02-03 20:12             ` Boris Lukashev
2018-02-03 20:12               ` Boris Lukashev
2018-02-03 20:12               ` Boris Lukashev
2018-02-03 20:32               ` Igor Stoppa
2018-02-03 20:32                 ` Igor Stoppa
2018-02-03 20:32                 ` Igor Stoppa
2018-02-03 22:29                 ` Boris Lukashev
2018-02-03 22:29                   ` Boris Lukashev
2018-02-03 22:29                   ` Boris Lukashev
2018-02-04 15:05                   ` Igor Stoppa
2018-02-04 15:05                     ` Igor Stoppa
2018-02-04 15:05                     ` Igor Stoppa
2018-02-12 23:27                     ` Kees Cook
2018-02-12 23:27                       ` Kees Cook
2018-02-12 23:27                       ` Kees Cook
2018-02-13  0:40                       ` Laura Abbott
2018-02-13  0:40                         ` Laura Abbott
2018-02-13  0:40                         ` Laura Abbott
2018-02-13  1:25                         ` Kees Cook
2018-02-13  1:25                           ` Kees Cook
2018-02-13  1:25                           ` Kees Cook
2018-02-13  3:39                           ` Jann Horn
2018-02-13  3:39                             ` Jann Horn
2018-02-13  3:39                             ` Jann Horn
2018-02-13 16:09                             ` Laura Abbott
2018-02-13 16:09                               ` Laura Abbott
2018-02-13 16:09                               ` Laura Abbott
2018-02-13 21:43                               ` Kees Cook
2018-02-13 21:43                                 ` Kees Cook
2018-02-13 21:43                                 ` Kees Cook
2018-02-14 19:06                                 ` arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory) Laura Abbott
2018-02-14 19:06                                   ` Laura Abbott
2018-02-14 19:06                                   ` Laura Abbott
2018-02-14 19:06                                   ` Laura Abbott
2018-02-14 19:28                                   ` Ard Biesheuvel [this message]
2018-02-14 19:28                                     ` Ard Biesheuvel
2018-02-14 19:28                                     ` Ard Biesheuvel
2018-02-14 19:28                                     ` Ard Biesheuvel
2018-02-14 20:13                                     ` Laura Abbott
2018-02-14 20:13                                       ` Laura Abbott
2018-02-14 20:13                                       ` Laura Abbott
2018-02-14 20:13                                       ` Laura Abbott
2018-02-14 19:29                                   ` Kees Cook
2018-02-14 19:29                                     ` Kees Cook
2018-02-14 19:29                                     ` Kees Cook
2018-02-14 19:29                                     ` Kees Cook
2018-02-14 19:35                                     ` Kees Cook
2018-02-14 19:35                                       ` Kees Cook
2018-02-14 19:35                                       ` Kees Cook
2018-02-14 19:35                                       ` Kees Cook
2018-02-20 16:28                                     ` Igor Stoppa
2018-02-20 16:28                                       ` Igor Stoppa
2018-02-20 16:28                                       ` Igor Stoppa
2018-02-20 16:28                                       ` Igor Stoppa
2018-02-21 22:22                                       ` Kees Cook
2018-02-21 22:22                                         ` Kees Cook
2018-02-21 22:22                                         ` Kees Cook
2018-02-21 22:22                                         ` Kees Cook
2018-02-14 19:48                                   ` Kees Cook
2018-02-14 19:48                                     ` Kees Cook
2018-02-14 19:48                                     ` Kees Cook
2018-02-14 19:48                                     ` Kees Cook
2018-02-14 22:13                                     ` Tycho Andersen
2018-02-14 22:13                                       ` Tycho Andersen
2018-02-14 22:13                                       ` Tycho Andersen
2018-02-14 22:13                                       ` Tycho Andersen
2018-02-14 22:27                                       ` Kees Cook
2018-02-14 22:27                                         ` Kees Cook
2018-02-14 22:27                                         ` Kees Cook
2018-02-14 22:27                                         ` Kees Cook
2018-02-13 15:20                         ` [kernel-hardening] [PATCH 4/6] Protectable Memory Igor Stoppa
2018-02-13 15:20                         ` Igor Stoppa
2018-02-13 15:20                         ` Igor Stoppa
2018-02-13 15:20                         ` Igor Stoppa
2018-02-13 15:20                         ` [kernel-hardening] " Igor Stoppa
     [not found]                         ` <5a83024c.64369d0a.a1e94.cdd6SMTPIN_ADDED_BROKEN@mx.google.com>
2018-02-13 18:10                           ` Laura Abbott
2018-02-13 18:10                             ` Laura Abbott
2018-02-13 18:10                             ` Laura Abbott
2018-02-20 17:16                             ` Igor Stoppa
2018-02-20 17:16                               ` Igor Stoppa
2018-02-20 17:16                               ` Igor Stoppa
2018-02-21 22:37                               ` Kees Cook
2018-02-21 22:37                                 ` Kees Cook
2018-02-21 22:37                                 ` Kees Cook
2018-02-05 15:40           ` Christopher Lameter
2018-02-05 15:40             ` Christopher Lameter
2018-02-05 15:40             ` Christopher Lameter
2018-02-09 11:17             ` Igor Stoppa
2018-02-09 11:17               ` Igor Stoppa
2018-02-09 11:17               ` Igor Stoppa
2018-02-09 11:17               ` Igor Stoppa
2018-01-26 19:41   ` [kernel-hardening] " Igor Stoppa
2018-01-26 19:41     ` Igor Stoppa
2018-01-26 19:41     ` Igor Stoppa
2018-01-26 19:41     ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 5/6] Documentation for Pmalloc Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 19:14   ` [kernel-hardening] " Ralph Campbell
2018-01-24 19:14     ` Ralph Campbell
2018-01-24 19:14     ` Ralph Campbell
2018-01-24 19:14     ` Ralph Campbell
2018-01-25  7:53     ` [kernel-hardening] " Igor Stoppa
2018-01-25  7:53       ` Igor Stoppa
2018-01-25  7:53       ` Igor Stoppa
2018-01-25  7:53       ` Igor Stoppa
2018-01-24 17:56 ` [kernel-hardening] [PATCH 6/6] Pmalloc: self-test Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` Igor Stoppa
2018-01-24 17:56   ` 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=CAKv+Gu8CNGFKLhX2XRuesn3n3k5P2bYS8qKWTTNXGFnr7SUVUA@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=blukashev@sempervictus.com \
    --cc=cl@linux.com \
    --cc=hch@infradead.org \
    --cc=igor.stoppa@huawei.com \
    --cc=jannh@google.com \
    --cc=jglisse@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mhocko@kernel.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.