Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
On Tue, Aug 18, 2020 at 10:00:16PM +0200, Christoph Hellwig wrote: > On Tue, Aug 18, 2020 at 12:59:05PM -0700, Kees Cook wrote: > > > I didn't see a problem bisecting, do you have something particular in > > > mind? > > > > Oh, I misunderstood this patch to be a fix for compilation. Is this just > > a correctness fix? > > It prepares for using the definition from assembly, which is done in > the next patch. Ah! Okay; thanks. Reviewed-by: Kees Cook -- Kees Cook
Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
On Tue, Aug 18, 2020 at 12:59:05PM -0700, Kees Cook wrote: > > I didn't see a problem bisecting, do you have something particular in > > mind? > > Oh, I misunderstood this patch to be a fix for compilation. Is this just > a correctness fix? It prepares for using the definition from assembly, which is done in the next patch.
Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
On Tue, Aug 18, 2020 at 09:55:39PM +0200, Christoph Hellwig wrote: > On Tue, Aug 18, 2020 at 12:44:49PM -0700, Kees Cook wrote: > > On Mon, Aug 17, 2020 at 09:32:09AM +0200, Christoph Hellwig wrote: > > > For 64-bit the only hing missing was a strategic _AC, and for 32-bit we > > > > typo: thing > > > > > need to use __PAGE_OFFSET instead of PAGE_OFFSET in the TASK_SIZE > > > definition to escape the explicit unsigned long cast. This just works > > > because __PAGE_OFFSET is defined using _AC itself and thus never needs > > > the cast anyway. > > > > Shouldn't this be folded into the prior patch so there's no bisection > > problem? > > I didn't see a problem bisecting, do you have something particular in > mind? Oh, I misunderstood this patch to be a fix for compilation. Is this just a correctness fix? -- Kees Cook
Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
On Tue, Aug 18, 2020 at 12:44:49PM -0700, Kees Cook wrote: > On Mon, Aug 17, 2020 at 09:32:09AM +0200, Christoph Hellwig wrote: > > For 64-bit the only hing missing was a strategic _AC, and for 32-bit we > > typo: thing > > > need to use __PAGE_OFFSET instead of PAGE_OFFSET in the TASK_SIZE > > definition to escape the explicit unsigned long cast. This just works > > because __PAGE_OFFSET is defined using _AC itself and thus never needs > > the cast anyway. > > Shouldn't this be folded into the prior patch so there's no bisection > problem? I didn't see a problem bisecting, do you have something particular in mind?
Re: [PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
On Mon, Aug 17, 2020 at 09:32:09AM +0200, Christoph Hellwig wrote: > For 64-bit the only hing missing was a strategic _AC, and for 32-bit we typo: thing > need to use __PAGE_OFFSET instead of PAGE_OFFSET in the TASK_SIZE > definition to escape the explicit unsigned long cast. This just works > because __PAGE_OFFSET is defined using _AC itself and thus never needs > the cast anyway. Shouldn't this be folded into the prior patch so there's no bisection problem? -Kees > > Signed-off-by: Christoph Hellwig > --- > arch/x86/include/asm/page_32_types.h | 4 ++-- > arch/x86/include/asm/page_64_types.h | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/include/asm/page_32_types.h > b/arch/x86/include/asm/page_32_types.h > index 26236925fb2c36..f462895a33e452 100644 > --- a/arch/x86/include/asm/page_32_types.h > +++ b/arch/x86/include/asm/page_32_types.h > @@ -44,8 +44,8 @@ > /* > * User space process size: 3GB (default). > */ > -#define IA32_PAGE_OFFSET PAGE_OFFSET > -#define TASK_SIZEPAGE_OFFSET > +#define IA32_PAGE_OFFSET __PAGE_OFFSET > +#define TASK_SIZE__PAGE_OFFSET > #define TASK_SIZE_LOWTASK_SIZE > #define TASK_SIZE_MAXTASK_SIZE > #define DEFAULT_MAP_WINDOW TASK_SIZE > diff --git a/arch/x86/include/asm/page_64_types.h > b/arch/x86/include/asm/page_64_types.h > index 996595c9897e0a..838515daf87b36 100644 > --- a/arch/x86/include/asm/page_64_types.h > +++ b/arch/x86/include/asm/page_64_types.h > @@ -76,7 +76,7 @@ > * > * With page table isolation enabled, we map the LDT in ... [stay tuned] > */ > -#define TASK_SIZE_MAX((1UL << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE) > +#define TASK_SIZE_MAX((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - > PAGE_SIZE) > > #define DEFAULT_MAP_WINDOW ((1UL << 47) - PAGE_SIZE) > > -- > 2.28.0 > -- Kees Cook
[PATCH 08/11] x86: make TASK_SIZE_MAX usable from assembly code
For 64-bit the only hing missing was a strategic _AC, and for 32-bit we need to use __PAGE_OFFSET instead of PAGE_OFFSET in the TASK_SIZE definition to escape the explicit unsigned long cast. This just works because __PAGE_OFFSET is defined using _AC itself and thus never needs the cast anyway. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index 26236925fb2c36..f462895a33e452 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h @@ -44,8 +44,8 @@ /* * User space process size: 3GB (default). */ -#define IA32_PAGE_OFFSET PAGE_OFFSET -#define TASK_SIZE PAGE_OFFSET +#define IA32_PAGE_OFFSET __PAGE_OFFSET +#define TASK_SIZE __PAGE_OFFSET #define TASK_SIZE_LOW TASK_SIZE #define TASK_SIZE_MAX TASK_SIZE #define DEFAULT_MAP_WINDOW TASK_SIZE diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 996595c9897e0a..838515daf87b36 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h @@ -76,7 +76,7 @@ * * With page table isolation enabled, we map the LDT in ... [stay tuned] */ -#define TASK_SIZE_MAX ((1UL << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE) +#define TASK_SIZE_MAX ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE) #define DEFAULT_MAP_WINDOW ((1UL << 47) - PAGE_SIZE) -- 2.28.0