From: Laura Abbott <labbott@redhat.com>
To: Jianyu Zhan <nasa4836@gmail.com>,
Laura Abbott <labbott@fedoraproject.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-hardening@lists.openwall.com,
Kees Cook <keescook@chromium.org>
Subject: [kernel-hardening] Re: [RFC][PATCH 2/3] mm/page_poison.c: Enable PAGE_POISONING as a separate option
Date: Tue, 26 Jan 2016 12:27:35 -0800 [thread overview]
Message-ID: <56A7D6B7.20301@redhat.com> (raw)
In-Reply-To: <CAHz2CGXc6=r_D1L6nUTj7A_bbX7GeUFb5+0TZWh55UUA6hiQ7w@mail.gmail.com>
On 01/25/2016 10:39 PM, Jianyu Zhan wrote:
> On Tue, Jan 26, 2016 at 12:55 AM, Laura Abbott
> <labbott@fedoraproject.org> wrote:
>> --- a/mm/debug-pagealloc.c
>> +++ b/mm/debug-pagealloc.c
>> @@ -8,11 +8,5 @@
>>
>> void __kernel_map_pages(struct page *page, int numpages, int enable)
>> {
>> - if (!page_poisoning_enabled())
>> - return;
>> -
>> - if (enable)
>> - unpoison_pages(page, numpages);
>> - else
>> - poison_pages(page, numpages);
>> + kernel_poison_pages(page, numpages, enable);
>> }
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 63358d9..c733421 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -1002,6 +1002,7 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
>> PAGE_SIZE << order);
>> }
>> arch_free_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 0);
>> kernel_map_pages(page, 1 << order, 0);
>>
>> return true;
>> @@ -1396,6 +1397,7 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
>> set_page_refcounted(page);
>>
>> arch_alloc_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 1);
>> kernel_map_pages(page, 1 << order, 1);
>> kasan_alloc_pages(page, order);
>>
>
> kernel_map_pages() will fall back to page poisoning scheme for
> !ARCH_SUPPORTS_DEBUG_PAGEALLOC.
>
> IIUC, calling kernel_poison_pages() before kernel_map_pages() will be
> equivalent to call kernel_poison_pages()
> twice?!
>
>
Yes, you are absolutely right. In the !ARCH_SUPPORTS_DEBUG_PAGEALLOC
case we shouldn't need to do anything in kernel_map_pages.
>
>
> Thanks,
> Jianyu Zhan
>
Thanks,
Laura
WARNING: multiple messages have this Message-ID (diff)
From: Laura Abbott <labbott@redhat.com>
To: Jianyu Zhan <nasa4836@gmail.com>,
Laura Abbott <labbott@fedoraproject.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-hardening@lists.openwall.com,
Kees Cook <keescook@chromium.org>
Subject: Re: [RFC][PATCH 2/3] mm/page_poison.c: Enable PAGE_POISONING as a separate option
Date: Tue, 26 Jan 2016 12:27:35 -0800 [thread overview]
Message-ID: <56A7D6B7.20301@redhat.com> (raw)
In-Reply-To: <CAHz2CGXc6=r_D1L6nUTj7A_bbX7GeUFb5+0TZWh55UUA6hiQ7w@mail.gmail.com>
On 01/25/2016 10:39 PM, Jianyu Zhan wrote:
> On Tue, Jan 26, 2016 at 12:55 AM, Laura Abbott
> <labbott@fedoraproject.org> wrote:
>> --- a/mm/debug-pagealloc.c
>> +++ b/mm/debug-pagealloc.c
>> @@ -8,11 +8,5 @@
>>
>> void __kernel_map_pages(struct page *page, int numpages, int enable)
>> {
>> - if (!page_poisoning_enabled())
>> - return;
>> -
>> - if (enable)
>> - unpoison_pages(page, numpages);
>> - else
>> - poison_pages(page, numpages);
>> + kernel_poison_pages(page, numpages, enable);
>> }
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 63358d9..c733421 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -1002,6 +1002,7 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
>> PAGE_SIZE << order);
>> }
>> arch_free_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 0);
>> kernel_map_pages(page, 1 << order, 0);
>>
>> return true;
>> @@ -1396,6 +1397,7 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
>> set_page_refcounted(page);
>>
>> arch_alloc_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 1);
>> kernel_map_pages(page, 1 << order, 1);
>> kasan_alloc_pages(page, order);
>>
>
> kernel_map_pages() will fall back to page poisoning scheme for
> !ARCH_SUPPORTS_DEBUG_PAGEALLOC.
>
> IIUC, calling kernel_poison_pages() before kernel_map_pages() will be
> equivalent to call kernel_poison_pages()
> twice?!
>
>
Yes, you are absolutely right. In the !ARCH_SUPPORTS_DEBUG_PAGEALLOC
case we shouldn't need to do anything in kernel_map_pages.
>
>
> Thanks,
> Jianyu Zhan
>
Thanks,
Laura
--
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: Laura Abbott <labbott@redhat.com>
To: Jianyu Zhan <nasa4836@gmail.com>,
Laura Abbott <labbott@fedoraproject.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-hardening@lists.openwall.com,
Kees Cook <keescook@chromium.org>
Subject: Re: [RFC][PATCH 2/3] mm/page_poison.c: Enable PAGE_POISONING as a separate option
Date: Tue, 26 Jan 2016 12:27:35 -0800 [thread overview]
Message-ID: <56A7D6B7.20301@redhat.com> (raw)
In-Reply-To: <CAHz2CGXc6=r_D1L6nUTj7A_bbX7GeUFb5+0TZWh55UUA6hiQ7w@mail.gmail.com>
On 01/25/2016 10:39 PM, Jianyu Zhan wrote:
> On Tue, Jan 26, 2016 at 12:55 AM, Laura Abbott
> <labbott@fedoraproject.org> wrote:
>> --- a/mm/debug-pagealloc.c
>> +++ b/mm/debug-pagealloc.c
>> @@ -8,11 +8,5 @@
>>
>> void __kernel_map_pages(struct page *page, int numpages, int enable)
>> {
>> - if (!page_poisoning_enabled())
>> - return;
>> -
>> - if (enable)
>> - unpoison_pages(page, numpages);
>> - else
>> - poison_pages(page, numpages);
>> + kernel_poison_pages(page, numpages, enable);
>> }
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index 63358d9..c733421 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -1002,6 +1002,7 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
>> PAGE_SIZE << order);
>> }
>> arch_free_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 0);
>> kernel_map_pages(page, 1 << order, 0);
>>
>> return true;
>> @@ -1396,6 +1397,7 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
>> set_page_refcounted(page);
>>
>> arch_alloc_page(page, order);
>> + kernel_poison_pages(page, 1 << order, 1);
>> kernel_map_pages(page, 1 << order, 1);
>> kasan_alloc_pages(page, order);
>>
>
> kernel_map_pages() will fall back to page poisoning scheme for
> !ARCH_SUPPORTS_DEBUG_PAGEALLOC.
>
> IIUC, calling kernel_poison_pages() before kernel_map_pages() will be
> equivalent to call kernel_poison_pages()
> twice?!
>
>
Yes, you are absolutely right. In the !ARCH_SUPPORTS_DEBUG_PAGEALLOC
case we shouldn't need to do anything in kernel_map_pages.
>
>
> Thanks,
> Jianyu Zhan
>
Thanks,
Laura
next prev parent reply other threads:[~2016-01-26 20:27 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-25 16:55 [kernel-hardening] [RFC][PATCH 0/3] Sanitization of buddy pages Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 16:55 ` [kernel-hardening] [RFC][PATCH 1/3] mm/debug-pagealloc.c: Split out page poisoning from debug page_alloc Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-26 6:26 ` [kernel-hardening] " Jianyu Zhan
2016-01-26 6:26 ` Jianyu Zhan
2016-01-26 6:26 ` Jianyu Zhan
2016-01-26 20:25 ` [kernel-hardening] " Laura Abbott
2016-01-26 20:25 ` Laura Abbott
2016-01-26 20:25 ` Laura Abbott
2016-01-25 16:55 ` [kernel-hardening] [RFC][PATCH 2/3] mm/page_poison.c: Enable PAGE_POISONING as a separate option Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-26 6:39 ` [kernel-hardening] " Jianyu Zhan
2016-01-26 6:39 ` Jianyu Zhan
2016-01-26 6:39 ` Jianyu Zhan
2016-01-26 20:27 ` Laura Abbott [this message]
2016-01-26 20:27 ` Laura Abbott
2016-01-26 20:27 ` Laura Abbott
2016-01-25 16:55 ` [kernel-hardening] [RFC][PATCH 3/3] mm/page_poisoning.c: Allow for zero poisoning Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 16:55 ` Laura Abbott
2016-01-25 20:16 ` [kernel-hardening] " Dave Hansen
2016-01-25 20:16 ` Dave Hansen
2016-01-25 22:05 ` Kees Cook
2016-01-25 22:05 ` Kees Cook
2016-01-26 1:33 ` Laura Abbott
2016-01-26 1:33 ` Laura Abbott
2016-01-26 6:05 ` [kernel-hardening] Re: [RFC][PATCH 0/3] Sanitization of buddy pages Sasha Levin
2016-01-26 6:05 ` Sasha Levin
2016-01-26 6:05 ` Sasha Levin
2016-01-26 20:34 ` [kernel-hardening] " Laura Abbott
2016-01-26 20:34 ` Laura Abbott
2016-01-26 20:34 ` Laura Abbott
2016-01-26 9:08 ` [kernel-hardening] " Mathias Krause
2016-01-26 9:08 ` Mathias Krause
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=56A7D6B7.20301@redhat.com \
--to=labbott@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=labbott@fedoraproject.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=nasa4836@gmail.com \
--cc=vbabka@suse.cz \
/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.