Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Tue, Feb 20, 2018 at 8:28 AM, Igor Stoppawrote: > > > On 14/02/18 21:29, Kees Cook wrote: >> On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: > > [...] > >>> Kernel code should be fine, if it isn't that is a bug that should be >>> fixed. Modules yes are not fully protected. The conclusion from past >> >> I think that's a pretty serious problem: we can't have aliases with >> mismatched permissions; this degrades a deterministic protection >> (read-only) to a probabilistic protection (knowing where the alias of >> a target is mapped). Having an attack be "needs some info leaks" >> instead of "need execution control to change perms" is a much lower >> bar, IMO. > > Why "need execution control to change permission"? > Or, iow, what does it mean exactly? > ROP/JOP? Data-oriented control flow hijack? Right, I mean, if an attacker has already gained execute control, they can just call the needed functions to change memory permissions. But that isn't needed if there is a mismatch between physmap and virtmap: i.e. they can write to the physmap without needing to change perms first. > One can argue that this sort of R/W activity probably does require some > form of execution control, but AFAIK, the only way to to prevent it, is > to have CFI - btw, is there any standardization in that sense? I meant that I don't want a difference in protection between physmap and virtmap. I'd like to be able to reason the smae about the exposures in either. > So, from my (pessimistic?) perspective, the best that can be hoped for, > is to make it much harder to figure out where the data is located. > > Virtual mapping has this side effect, compared to linear mapping. Right, this is good, for sure. No complaints there at all. It's why I think pmalloc and arm64 physmap perms are separate issues. -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Tue, Feb 20, 2018 at 8:28 AM, Igor Stoppa wrote: > > > On 14/02/18 21:29, Kees Cook wrote: >> On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: > > [...] > >>> Kernel code should be fine, if it isn't that is a bug that should be >>> fixed. Modules yes are not fully protected. The conclusion from past >> >> I think that's a pretty serious problem: we can't have aliases with >> mismatched permissions; this degrades a deterministic protection >> (read-only) to a probabilistic protection (knowing where the alias of >> a target is mapped). Having an attack be "needs some info leaks" >> instead of "need execution control to change perms" is a much lower >> bar, IMO. > > Why "need execution control to change permission"? > Or, iow, what does it mean exactly? > ROP/JOP? Data-oriented control flow hijack? Right, I mean, if an attacker has already gained execute control, they can just call the needed functions to change memory permissions. But that isn't needed if there is a mismatch between physmap and virtmap: i.e. they can write to the physmap without needing to change perms first. > One can argue that this sort of R/W activity probably does require some > form of execution control, but AFAIK, the only way to to prevent it, is > to have CFI - btw, is there any standardization in that sense? I meant that I don't want a difference in protection between physmap and virtmap. I'd like to be able to reason the smae about the exposures in either. > So, from my (pessimistic?) perspective, the best that can be hoped for, > is to make it much harder to figure out where the data is located. > > Virtual mapping has this side effect, compared to linear mapping. Right, this is good, for sure. No complaints there at all. It's why I think pmalloc and arm64 physmap perms are separate issues. -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 14/02/18 21:29, Kees Cook wrote: > On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbottwrote: [...] >> Kernel code should be fine, if it isn't that is a bug that should be >> fixed. Modules yes are not fully protected. The conclusion from past > > I think that's a pretty serious problem: we can't have aliases with > mismatched permissions; this degrades a deterministic protection > (read-only) to a probabilistic protection (knowing where the alias of > a target is mapped). Having an attack be "needs some info leaks" > instead of "need execution control to change perms" is a much lower > bar, IMO. Why "need execution control to change permission"? Or, iow, what does it mean exactly? ROP/JOP? Data-oriented control flow hijack? Unless I misunderstand the meaning of "need execution control", I think that "need write capability to arbitrary data address" should be sufficient, albeit uncomfortable to use. OTOH, "need read/write capability from/to arbitrary data address" would be enough, I think, assuming that one knows the offset where to write to - but that information could be inferred, for example, by scanning the memory for known patterns. IMHO the attack surface is so vast that it's not unreasonable to expect that it will be possible to fish out means to perform arbitrary R/W into kernel address space. Ex: some more recent/less tested driver. One can argue that this sort of R/W activity probably does require some form of execution control, but AFAIK, the only way to to prevent it, is to have CFI - btw, is there any standardization in that sense? So, from my (pessimistic?) perspective, the best that can be hoped for, is to make it much harder to figure out where the data is located. Virtual mapping has this side effect, compared to linear mapping. But, once easier attack targets are removed, I suspect the page mapping will become the next target. -- igor
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 14/02/18 21:29, Kees Cook wrote: > On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: [...] >> Kernel code should be fine, if it isn't that is a bug that should be >> fixed. Modules yes are not fully protected. The conclusion from past > > I think that's a pretty serious problem: we can't have aliases with > mismatched permissions; this degrades a deterministic protection > (read-only) to a probabilistic protection (knowing where the alias of > a target is mapped). Having an attack be "needs some info leaks" > instead of "need execution control to change perms" is a much lower > bar, IMO. Why "need execution control to change permission"? Or, iow, what does it mean exactly? ROP/JOP? Data-oriented control flow hijack? Unless I misunderstand the meaning of "need execution control", I think that "need write capability to arbitrary data address" should be sufficient, albeit uncomfortable to use. OTOH, "need read/write capability from/to arbitrary data address" would be enough, I think, assuming that one knows the offset where to write to - but that information could be inferred, for example, by scanning the memory for known patterns. IMHO the attack surface is so vast that it's not unreasonable to expect that it will be possible to fish out means to perform arbitrary R/W into kernel address space. Ex: some more recent/less tested driver. One can argue that this sort of R/W activity probably does require some form of execution control, but AFAIK, the only way to to prevent it, is to have CFI - btw, is there any standardization in that sense? So, from my (pessimistic?) perspective, the best that can be hoped for, is to make it much harder to figure out where the data is located. Virtual mapping has this side effect, compared to linear mapping. But, once easier attack targets are removed, I suspect the page mapping will become the next target. -- igor
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 2:13 PM, Tycho Andersenwrote: > On Wed, Feb 14, 2018 at 11:48:38AM -0800, Kees Cook wrote: >> On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: >> > fixed. 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. >> >> XPFO forces 4K pages on the physmap[1] for similar reasons. I have no >> doubt about performance changes, but I'd be curious to see real >> numbers. Did anyone do benchmarks on just the huge/4K change? (Without >> also the XPFO overhead?) >> >> If this, XPFO, and PAGE_POISONING all need it, I think we have to >> start a closer investigation. :) > > I haven't but it shouldn't be too hard. What benchmarks are you > thinking? Unless I'm looking at some specific micro benchmark, I tend to default to looking at kernel build benchmarks but that gets pretty noisy. Laura regularly uses hackbench, IIRC. I'm not finding the pastebin I had for that, though. I wonder if we need a benchmark subdirectory in tools/testing/, so we could collect some of these common tools? All benchmarks are terrible, but at least we'd have the same terrible benchmarks. :) -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 2:13 PM, Tycho Andersen wrote: > On Wed, Feb 14, 2018 at 11:48:38AM -0800, Kees Cook wrote: >> On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: >> > fixed. 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. >> >> XPFO forces 4K pages on the physmap[1] for similar reasons. I have no >> doubt about performance changes, but I'd be curious to see real >> numbers. Did anyone do benchmarks on just the huge/4K change? (Without >> also the XPFO overhead?) >> >> If this, XPFO, and PAGE_POISONING all need it, I think we have to >> start a closer investigation. :) > > I haven't but it shouldn't be too hard. What benchmarks are you > thinking? Unless I'm looking at some specific micro benchmark, I tend to default to looking at kernel build benchmarks but that gets pretty noisy. Laura regularly uses hackbench, IIRC. I'm not finding the pastebin I had for that, though. I wonder if we need a benchmark subdirectory in tools/testing/, so we could collect some of these common tools? All benchmarks are terrible, but at least we'd have the same terrible benchmarks. :) -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:48:38AM -0800, Kees Cook wrote: > On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbottwrote: > > fixed. 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. > > XPFO forces 4K pages on the physmap[1] for similar reasons. I have no > doubt about performance changes, but I'd be curious to see real > numbers. Did anyone do benchmarks on just the huge/4K change? (Without > also the XPFO overhead?) > > If this, XPFO, and PAGE_POISONING all need it, I think we have to > start a closer investigation. :) I haven't but it shouldn't be too hard. What benchmarks are you thinking? Tycho
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:48:38AM -0800, Kees Cook wrote: > On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: > > fixed. 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. > > XPFO forces 4K pages on the physmap[1] for similar reasons. I have no > doubt about performance changes, but I'd be curious to see real > numbers. Did anyone do benchmarks on just the huge/4K change? (Without > also the XPFO overhead?) > > If this, XPFO, and PAGE_POISONING all need it, I think we have to > start a closer investigation. :) I haven't but it shouldn't be too hard. What benchmarks are you thinking? Tycho
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 02/14/2018 11:28 AM, Ard Biesheuvel wrote: On 14 February 2018 at 19:06, Laura Abbottwrote: On 02/13/2018 01:43 PM, Kees Cook wrote: On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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? Page poisoning does exactly that. The argument I was trying to make was that if nobody really uses page poisoning except for debugging it might not be worth it to fix up the alias. Thinking a bit more, this is a terrible argument for many reasons so yes I agree that we can just fix up the alias if PAGE_POISONING (or other features) are enabled. Thanks, Laura
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 02/14/2018 11:28 AM, Ard Biesheuvel wrote: On 14 February 2018 at 19:06, Laura Abbott wrote: On 02/13/2018 01:43 PM, Kees Cook wrote: On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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? Page poisoning does exactly that. The argument I was trying to make was that if nobody really uses page poisoning except for debugging it might not be worth it to fix up the alias. Thinking a bit more, this is a terrible argument for many reasons so yes I agree that we can just fix up the alias if PAGE_POISONING (or other features) are enabled. Thanks, Laura
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbottwrote: > fixed. 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. XPFO forces 4K pages on the physmap[1] for similar reasons. I have no doubt about performance changes, but I'd be curious to see real numbers. Did anyone do benchmarks on just the huge/4K change? (Without also the XPFO overhead?) If this, XPFO, and PAGE_POISONING all need it, I think we have to start a closer investigation. :) -Kees [1] http://www.openwall.com/lists/kernel-hardening/2017/09/07/13 -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: > fixed. 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. XPFO forces 4K pages on the physmap[1] for similar reasons. I have no doubt about performance changes, but I'd be curious to see real numbers. Did anyone do benchmarks on just the huge/4K change? (Without also the XPFO overhead?) If this, XPFO, and PAGE_POISONING all need it, I think we have to start a closer investigation. :) -Kees [1] http://www.openwall.com/lists/kernel-hardening/2017/09/07/13 -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:29 AM, Kees Cookwrote: > Why does using finer granularity on the physmap degrade performance? I > assume TLB pressure, but what is heavily using that area? (I must not > be understanding what physmap actually gets used for -- I thought it > was just a convenience to have a 1:1 virt/phys map for some lookups?) Jann has sorted me out: it's that physmap isn't an _alias_ for the buddy allocator memory areas; it's used directly. -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:29 AM, Kees Cook wrote: > Why does using finer granularity on the physmap degrade performance? I > assume TLB pressure, but what is heavily using that area? (I must not > be understanding what physmap actually gets used for -- I thought it > was just a convenience to have a 1:1 virt/phys map for some lookups?) Jann has sorted me out: it's that physmap isn't an _alias_ for the buddy allocator memory areas; it's used directly. -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbottwrote: > On 02/13/2018 01:43 PM, Kees Cook wrote: >> >> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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. Modules yes are not fully protected. The conclusion from past I think that's a pretty serious problem: we can't have aliases with mismatched permissions; this degrades a deterministic protection (read-only) to a probabilistic protection (knowing where the alias of a target is mapped). Having an attack be "needs some info leaks" instead of "need execution control to change perms" is a much lower bar, IMO. > 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. Why does using finer granularity on the physmap degrade performance? I assume TLB pressure, but what is heavily using that area? (I must not be understanding what physmap actually gets used for -- I thought it was just a convenience to have a 1:1 virt/phys map for some lookups?) -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On Wed, Feb 14, 2018 at 11:06 AM, Laura Abbott wrote: > On 02/13/2018 01:43 PM, Kees Cook wrote: >> >> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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. Modules yes are not fully protected. The conclusion from past I think that's a pretty serious problem: we can't have aliases with mismatched permissions; this degrades a deterministic protection (read-only) to a probabilistic protection (knowing where the alias of a target is mapped). Having an attack be "needs some info leaks" instead of "need execution control to change perms" is a much lower bar, IMO. > 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. Why does using finer granularity on the physmap degrade performance? I assume TLB pressure, but what is heavily using that area? (I must not be understanding what physmap actually gets used for -- I thought it was just a convenience to have a 1:1 virt/phys map for some lookups?) -Kees -- Kees Cook Pixel Security
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 14 February 2018 at 19:06, Laura Abbottwrote: > On 02/13/2018 01:43 PM, Kees Cook wrote: >> >> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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?
Re: arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 14 February 2018 at 19:06, Laura Abbott wrote: > On 02/13/2018 01:43 PM, Kees Cook wrote: >> >> On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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?
arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 02/13/2018 01:43 PM, Kees Cook wrote: On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbottwrote: 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. 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. Thanks, Laura
arm64 physmap (was Re: [kernel-hardening] [PATCH 4/6] Protectable Memory)
On 02/13/2018 01:43 PM, Kees Cook wrote: On Tue, Feb 13, 2018 at 8:09 AM, Laura Abbott 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. 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. Thanks, Laura