Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-16 Thread Baoquan He
On 03/16/17 at 09:14am, Ingo Molnar wrote: > > * Borislav Petkov wrote: > > So what I'd do is keep KERNEL_IMAGE_SIZE and make it default 1G and use it > > everywhere. > > > > Then, define a separate define which is used only in vmlinux.lds.S to > > enforce the size check. Having

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-16 Thread Baoquan He
On 03/16/17 at 09:14am, Ingo Molnar wrote: > > * Borislav Petkov wrote: > > So what I'd do is keep KERNEL_IMAGE_SIZE and make it default 1G and use it > > everywhere. > > > > Then, define a separate define which is used only in vmlinux.lds.S to > > enforce the size check. Having MAPPING_SIZE

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-16 Thread Ingo Molnar
* Borislav Petkov wrote: > Ok, > > TBH, I still don't like adding yet another define and paying attention > to whether I should use image size or mapping size. After your patch, > KERNEL_IMAGE_SIZE is used to enforce the actual image size from > exploding: > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-16 Thread Ingo Molnar
* Borislav Petkov wrote: > Ok, > > TBH, I still don't like adding yet another define and paying attention > to whether I should use image size or mapping size. After your patch, > KERNEL_IMAGE_SIZE is used to enforce the actual image size from > exploding: > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Baoquan He
On 03/04/17 at 12:55pm, Borislav Petkov wrote: > On Sat, Mar 04, 2017 at 06:10:37PM +0800, Baoquan He wrote: > > > BUT(!), don't take my word for it. Rather, do what the maintainers > > > propose. Who knows, they might have a much better idea. > > > > Sorry about that. Just think your words are

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Baoquan He
On 03/04/17 at 12:55pm, Borislav Petkov wrote: > On Sat, Mar 04, 2017 at 06:10:37PM +0800, Baoquan He wrote: > > > BUT(!), don't take my word for it. Rather, do what the maintainers > > > propose. Who knows, they might have a much better idea. > > > > Sorry about that. Just think your words are

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Borislav Petkov
On Sat, Mar 04, 2017 at 06:10:37PM +0800, Baoquan He wrote: > > BUT(!), don't take my word for it. Rather, do what the maintainers > > propose. Who knows, they might have a much better idea. > > Sorry about that. Just think your words are very convincing on removing > people's doubt if it's risky

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Borislav Petkov
On Sat, Mar 04, 2017 at 06:10:37PM +0800, Baoquan He wrote: > > BUT(!), don't take my word for it. Rather, do what the maintainers > > propose. Who knows, they might have a much better idea. > > Sorry about that. Just think your words are very convincing on removing > people's doubt if it's risky

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Baoquan He
On 03/03/17 at 04:23pm, Borislav Petkov wrote: > Ok, > > TBH, I still don't like adding yet another define and paying attention > to whether I should use image size or mapping size. After your patch, > KERNEL_IMAGE_SIZE is used to enforce the actual image size from > exploding: > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-04 Thread Baoquan He
On 03/03/17 at 04:23pm, Borislav Petkov wrote: > Ok, > > TBH, I still don't like adding yet another define and paying attention > to whether I should use image size or mapping size. After your patch, > KERNEL_IMAGE_SIZE is used to enforce the actual image size from > exploding: > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
Ok, TBH, I still don't like adding yet another define and paying attention to whether I should use image size or mapping size. After your patch, KERNEL_IMAGE_SIZE is used to enforce the actual image size from exploding: arch/x86/include/asm/page_32_types.h:43:#define KERNEL_IMAGE_SIZE (512

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
Ok, TBH, I still don't like adding yet another define and paying attention to whether I should use image size or mapping size. After your patch, KERNEL_IMAGE_SIZE is used to enforce the actual image size from exploding: arch/x86/include/asm/page_32_types.h:43:#define KERNEL_IMAGE_SIZE (512

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Sun, Feb 26, 2017 at 12:09:08PM +0800, Baoquan He wrote: > Am I right on understanding it? That's exactly what I mean: KERNEL_IMAGE_SIZE is 512M by default but we're not hard-constrained to it - we're hard-constrained to a 1G limit as this is the 1G which is covered by level2_kernel_pgt. And

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Sun, Feb 26, 2017 at 12:09:08PM +0800, Baoquan He wrote: > Am I right on understanding it? That's exactly what I mean: KERNEL_IMAGE_SIZE is 512M by default but we're not hard-constrained to it - we're hard-constrained to a 1G limit as this is the 1G which is covered by level2_kernel_pgt. And

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > OK, I am trying to make things clearer, seems I failed. I thought kernel > iamge size is only allowed to be 512M at most, but can be mapped into 1G > region. It doesn't look like it. But we could be missing something. You could try

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > OK, I am trying to make things clearer, seems I failed. I thought kernel > iamge size is only allowed to be 512M at most, but can be mapped into 1G > region. It doesn't look like it. But we could be missing something. You could try

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 01:16pm, Borislav Petkov wrote: > On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > > OK, I am trying to make things clearer, seems I failed. I thought kernel > > iamge size is only allowed to be 512M at most, but can be mapped into 1G > > region. > > It doesn't look

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 01:16pm, Borislav Petkov wrote: > On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > > OK, I am trying to make things clearer, seems I failed. I thought kernel > > iamge size is only allowed to be 512M at most, but can be mapped into 1G > > region. > > It doesn't look

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 03:28pm, Borislav Petkov wrote: > On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > > And another meaning of defining kernel iamge size and mapping size > > differently is we can randomize the limited kernel image in the mapping > > area. If they are the same or kernel

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 03:28pm, Borislav Petkov wrote: > On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > > And another meaning of defining kernel iamge size and mapping size > > differently is we can randomize the limited kernel image in the mapping > > area. If they are the same or kernel

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 11:07pm, Baoquan He wrote: > On 03/03/17 at 03:28pm, Borislav Petkov wrote: > > On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > > > And another meaning of defining kernel iamge size and mapping size > > > differently is we can randomize the limited kernel image in the

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 11:07pm, Baoquan He wrote: > On 03/03/17 at 03:28pm, Borislav Petkov wrote: > > On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > > > And another meaning of defining kernel iamge size and mapping size > > > differently is we can randomize the limited kernel image in the

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > And another meaning of defining kernel iamge size and mapping size > differently is we can randomize the limited kernel image in the mapping > area. If they are the same or kernel image can be very large, the > position will be fixed or

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Borislav Petkov
On Fri, Mar 03, 2017 at 09:11:52PM +0800, Baoquan He wrote: > And another meaning of defining kernel iamge size and mapping size > differently is we can randomize the limited kernel image in the mapping > area. If they are the same or kernel image can be very large, the > position will be fixed or

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 08:52pm, Baoquan He wrote: > On 03/03/17 at 01:16pm, Borislav Petkov wrote: > > On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > > > OK, I am trying to make things clearer, seems I failed. I thought kernel > > > iamge size is only allowed to be 512M at most, but can be

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 08:52pm, Baoquan He wrote: > On 03/03/17 at 01:16pm, Borislav Petkov wrote: > > On Fri, Mar 03, 2017 at 08:06:16PM +0800, Baoquan He wrote: > > > OK, I am trying to make things clearer, seems I failed. I thought kernel > > > iamge size is only allowed to be 512M at most, but can be

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 12:43pm, Borislav Petkov wrote: > On Sun, Feb 26, 2017 at 12:09:08PM +0800, Baoquan He wrote: > > Am I right on understanding it? > > That's exactly what I mean: KERNEL_IMAGE_SIZE is 512M by default but > we're not hard-constrained to it - we're hard-constrained to a 1G limit > as

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-03-03 Thread Baoquan He
On 03/03/17 at 12:43pm, Borislav Petkov wrote: > On Sun, Feb 26, 2017 at 12:09:08PM +0800, Baoquan He wrote: > > Am I right on understanding it? > > That's exactly what I mean: KERNEL_IMAGE_SIZE is 512M by default but > we're not hard-constrained to it - we're hard-constrained to a 1G limit > as

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-25 Thread Baoquan He
Hi Boris, Thanks a lot for your comments, sorry so late to reply! On 02/14/17 at 06:32pm, Borislav Petkov wrote: > > diff --git a/arch/x86/include/asm/page_64_types.h > > b/arch/x86/include/asm/page_64_types.h > > index 9215e05..24c9098 100644 > > --- a/arch/x86/include/asm/page_64_types.h > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-25 Thread Baoquan He
Hi Boris, Thanks a lot for your comments, sorry so late to reply! On 02/14/17 at 06:32pm, Borislav Petkov wrote: > > diff --git a/arch/x86/include/asm/page_64_types.h > > b/arch/x86/include/asm/page_64_types.h > > index 9215e05..24c9098 100644 > > --- a/arch/x86/include/asm/page_64_types.h > >

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-14 Thread Borislav Petkov
On Thu, Feb 02, 2017 at 08:54:35PM +0800, Baoquan He wrote: > In x86, KERNEL_IMAGE_SIZE is used to limit the size of kernel image in > running space, but also represents the size of kernel image mapping area. > This looks good when kernel virtual address is invariable inside 512M > area and kernel

Re: [PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-14 Thread Borislav Petkov
On Thu, Feb 02, 2017 at 08:54:35PM +0800, Baoquan He wrote: > In x86, KERNEL_IMAGE_SIZE is used to limit the size of kernel image in > running space, but also represents the size of kernel image mapping area. > This looks good when kernel virtual address is invariable inside 512M > area and kernel

[PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-02 Thread Baoquan He
In x86, KERNEL_IMAGE_SIZE is used to limit the size of kernel image in running space, but also represents the size of kernel image mapping area. This looks good when kernel virtual address is invariable inside 512M area and kernel image size is not bigger than 512M. Along with the adding of

[PATCH v4 1/3] x86: Introduce a new constant KERNEL_MAPPING_SIZE

2017-02-02 Thread Baoquan He
In x86, KERNEL_IMAGE_SIZE is used to limit the size of kernel image in running space, but also represents the size of kernel image mapping area. This looks good when kernel virtual address is invariable inside 512M area and kernel image size is not bigger than 512M. Along with the adding of