Re: [PATCH] x86/mm/mtrr: remove definition of DEBUG

2021-01-14 Thread Tom Rix
On 1/14/21 10:46 AM, Borislav Petkov wrote: > On Thu, Jan 14, 2021 at 08:27:43AM -0800, t...@redhat.com wrote: >> From: Tom Rix >> >> Defining DEBUG should only be done in development. >> So remove DEBUG. >> >> Signed-off-by: Tom Rix >> --- >&

Re: [PATCH] x86/mm/mtrr: remove definition of DEBUG

2021-01-14 Thread Borislav Petkov
On Thu, Jan 14, 2021 at 08:27:43AM -0800, t...@redhat.com wrote: > From: Tom Rix > > Defining DEBUG should only be done in development. > So remove DEBUG. > > Signed-off-by: Tom Rix > --- > arch/x86/kernel/cpu/mtrr/generic.c | 1 - > 1 file changed, 1 deletion(-)

[PATCH] x86/mm/mtrr: remove definition of DEBUG

2021-01-14 Thread trix
From: Tom Rix Defining DEBUG should only be done in development. So remove DEBUG. Signed-off-by: Tom Rix --- arch/x86/kernel/cpu/mtrr/generic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index a29997e6cf9e

[PATCH 4.9 45/45] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[PATCH 4.14 56/57] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[PATCH 4.19 76/77] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[PATCH 5.4 91/92] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[PATCH 5.10 142/145] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[PATCH 4.4 38/38] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-11 Thread Greg Kroah-Hartman
From: Ying-Tsun Huang commit cb7f4a8b1fb426a175d1708f05581939c61329d4 upstream. In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is returned. These condition checks are for ensuring the input memory

[tip: x86/urgent] x86/mtrr: Correct the range check before performing MTRR type lookups

2021-01-06 Thread tip-bot2 for Ying-Tsun Huang
Committer: Borislav Petkov CommitterDate: Wed, 06 Jan 2021 13:01:13 +01:00 x86/mtrr: Correct the range check before performing MTRR type lookups In mtrr_type_lookup(), if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, a write-back attribute is

[tip: x86/cleanups] x86/mtrr: Convert comma to semicolon

2020-12-30 Thread tip-bot2 for Zheng Yongjun
Committer: Borislav Petkov CommitterDate: Wed, 30 Dec 2020 08:56:35 +01:00 x86/mtrr: Convert comma to semicolon Replace a comma between expression statements with a semicolon. Signed-off-by: Zheng Yongjun Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20201216131159.14393-1

[PATCH -next] kernel: cpu: mtrr: convert comma to semicolon

2020-12-16 Thread Zheng Yongjun
Replace a comma between expression statements by a semicolon. Signed-off-by: Zheng Yongjun --- arch/x86/kernel/cpu/mtrr/cleanup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 5bd011737272

[PATCH v2] x86/mtrr: Correct the returned MTRR type of mtrr_type_lookup.

2020-12-14 Thread Ying-Tsun Huang
In mtrr_type_lookup, if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, write-back attribute is returned. These condition checks are for ensuring the input memory address region is mapped to the physical memory actually. However, if the end address is

Re: [PATCH] x86/mtrr: Correct the returned MTRR type of mtrr_type_lookup.

2020-12-14 Thread Huang, Ying-Tsun
On Fri, 11 Dec 2020, Borislav Petkov wrote: > [CAUTION: External Email] > > On Mon, Dec 07, 2020 at 02:12:26PM +0800, Ying-Tsun Huang wrote: > > In mtrr_type_lookup, if the input memory address region is not in the > > MTRR, over 4GB, and not over the top of memory,

Re: [PATCH] x86/mtrr: Correct the returned MTRR type of mtrr_type_lookup.

2020-12-11 Thread Borislav Petkov
On Mon, Dec 07, 2020 at 02:12:26PM +0800, Ying-Tsun Huang wrote: > In mtrr_type_lookup, if the input memory address region is not in the > MTRR, over 4GB, and not over the top of memory, write-back attribute > is returned. These condition checks are for ensuring the input memory > ad

[PATCH] x86/mtrr: Correct the returned MTRR type of mtrr_type_lookup.

2020-12-06 Thread Ying-Tsun Huang
In mtrr_type_lookup, if the input memory address region is not in the MTRR, over 4GB, and not over the top of memory, write-back attribute is returned. These condition checks are for ensuring the input memory address region is mapped to the physical memory actually. However, if the end address is

[tip: x86/cleanups] x86/mtrr: Fix a kernel-doc markup

2020-11-02 Thread tip-bot2 for Mauro Carvalho Chehab
:00 Committer: Borislav Petkov CommitterDate: Mon, 02 Nov 2020 19:58:53 +01:00 x86/mtrr: Fix a kernel-doc markup Kernel-doc markup should use this format: identifier - description Fix it. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Borislav Petkov Link: https

[PATCH v3 06/56] x86: mtrr: fix a kernel-doc markup

2020-10-23 Thread Mauro Carvalho Chehab
Kernel-doc markup should use this format: identifier - description Signed-off-by: Mauro Carvalho Chehab --- arch/x86/kernel/cpu/mtrr/mtrr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index

Re: [PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-17 Thread Andy Shevchenko
:25PM -0600, Tuowen Zhao wrote: > > > > > Some BIOS erroneously specifies write-combining BAR for intel-lpss-pci > > > > > in MTRR. This will cause the system to hang during boot. If possible, > > > > > this bug could be corrected with a firmware update.

Re: [PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-17 Thread Lee Jones
e-combining BAR for intel-lpss-pci > > > > in MTRR. This will cause the system to hang during boot. If possible, > > > > this bug could be corrected with a firmware update. > > > > > > > > Previous version: https://lkml.org/lkml/2019/10/14/575 > >

Re: [PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-17 Thread Andy Shevchenko
On Thu, Oct 17, 2019 at 08:31:16AM +0100, Lee Jones wrote: > On Thu, 17 Oct 2019, Andy Shevchenko wrote: > > On Wed, Oct 16, 2019 at 03:06:25PM -0600, Tuowen Zhao wrote: > > > Some BIOS erroneously specifies write-combining BAR for intel-lpss-pci > > > in MTRR. This wi

Re: [PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-17 Thread Lee Jones
On Thu, 17 Oct 2019, Andy Shevchenko wrote: > On Wed, Oct 16, 2019 at 03:06:25PM -0600, Tuowen Zhao wrote: > > Some BIOS erroneously specifies write-combining BAR for intel-lpss-pci > > in MTRR. This will cause the system to hang during boot. If possible, > > this bug coul

Re: [PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-17 Thread Andy Shevchenko
On Wed, Oct 16, 2019 at 03:06:25PM -0600, Tuowen Zhao wrote: > Some BIOS erroneously specifies write-combining BAR for intel-lpss-pci > in MTRR. This will cause the system to hang during boot. If possible, > this bug could be corrected with a firmware update. > > Previous

[PATCH v5 0/4] Fix MTRR bug for intel-lpss-pci

2019-10-16 Thread Tuowen Zhao
Some BIOS erroneously specifies write-combining BAR for intel-lpss-pci in MTRR. This will cause the system to hang during boot. If possible, this bug could be corrected with a firmware update. Previous version: https://lkml.org/lkml/2019/10/14/575 Changes from previous version: * implement

Re: [RFC PATCH 01/13] kvm: Enable MTRR to work with GFNs with perm bits

2019-10-14 Thread Edgecombe, Rick P
xtra permissions bits. This supports the KVM XO feature. > > > > TODO: Since MTRR is emulated using EPT permissions, the XO version of > > the gpa range will not inherrit the MTRR type with this implementation. > > There shouldn't be any legacy use of KVM XO,

Re: [RFC PATCH 01/13] kvm: Enable MTRR to work with GFNs with perm bits

2019-10-13 Thread Yu Zhang
On Thu, Oct 03, 2019 at 02:23:48PM -0700, Rick Edgecombe wrote: > Mask gfn by maxphyaddr in kvm_mtrr_get_guest_memory_type so that the > guests view of gfn is used when high bits of the physical memory are > used as extra permissions bits. This supports the KVM XO feature. > > TODO

[RFC PATCH 01/13] kvm: Enable MTRR to work with GFNs with perm bits

2019-10-03 Thread Rick Edgecombe
Mask gfn by maxphyaddr in kvm_mtrr_get_guest_memory_type so that the guests view of gfn is used when high bits of the physical memory are used as extra permissions bits. This supports the KVM XO feature. TODO: Since MTRR is emulated using EPT permissions, the XO version of the gpa range will not

Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-13 Thread Kani, Toshi
; > > > Make PAT(Page Attribute Table) independent from > > > > MTRR(Memory Type Range Register). > > > > Some environments (mainly virtual ones) support only PAT, but not MTRR > > > > because PAT replaces MTRR. > > > > It's tricky and

Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-13 Thread Borislav Petkov
On Tue, Aug 13, 2019 at 12:49:20AM -0700, Isaku Yamahata wrote: > In addition to Xen, KVM+qemu can enable/disable MTRR, PAT independently. > So user may want to disable MTRR to reduce attack surface. No, no "user may want" etc vague formulations. Just because some virt thin

Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-13 Thread Isaku Yamahata
On Fri, Aug 09, 2019 at 07:51:17PM +, "Kani, Toshi" wrote: > On Fri, 2019-08-09 at 09:06 +0200, Borislav Petkov wrote: > > On Thu, Aug 08, 2019 at 08:54:17PM -0700, Isaku Yamahata wrote: > > > Make PAT(Page Attribute Table) independent from > > > MTRR(Me

Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-09 Thread Kani, Toshi
On Fri, 2019-08-09 at 09:06 +0200, Borislav Petkov wrote: > On Thu, Aug 08, 2019 at 08:54:17PM -0700, Isaku Yamahata wrote: > > Make PAT(Page Attribute Table) independent from > > MTRR(Memory Type Range Register). > > Some environments (mainly virtual ones) support o

Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-09 Thread Borislav Petkov
On Thu, Aug 08, 2019 at 08:54:17PM -0700, Isaku Yamahata wrote: > Make PAT(Page Attribute Table) independent from > MTRR(Memory Type Range Register). > Some environments (mainly virtual ones) support only PAT, but not MTRR > because PAT replaces MTRR. > It's tricky and no gain

[PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-08 Thread Isaku Yamahata
Make PAT(Page Attribute Table) independent from MTRR(Memory Type Range Register). Some environments (mainly virtual ones) support only PAT, but not MTRR because PAT replaces MTRR. It's tricky and no gain to support both MTRR and PAT except compatibility. So some VM technologies don't su

[PATCH 2/3] x86/mtrr: split common funcs from generic.c

2019-08-08 Thread Isaku Yamahata
This is a preparation for make PAT(Page Attribute Table) independent from MTRR(Memory Type Range Register). It renames prefix of common functions in mtrr/generic.c from mtrr_ to mtrr_pat_ which are commonly used by both MTRR and PAT and moves out them from mtrr/generic.c to rendezvous.c. Only

[PATCH 3/3] x86/mtrr, pat: make PAT independent from MTRR

2019-08-08 Thread Isaku Yamahata
This patch makes PAT(Page Attribute Table) independent from MTRR(Memory Type Range Register) Some environments (mainly virtual ones) support only PAT, not MTRR. It's tricky and no gain to support both MTRR and PAT at the same time except compatibility because PAT replaces MTRR. So so

[PATCH 1/3] x86/mtrr: split common funcs from mtrr.c

2019-08-08 Thread Isaku Yamahata
This is a preparation for make PAT(Page Attribute Table) independent from MTRR(Memory Type Range Register). It renames prefix of common functions in mtrr.c from mtrr_ to mtrr_pat_ which are commonly used by both MTRR and PAT and moves out them from mtrr.c to rendezvous.c. Only prefix rename and

[tip:x86/urgent] x86: mtrr: cyrix: Mark expected switch fall-through

2019-08-07 Thread tip-bot for Gustavo A. R. Silva
Commit-ID: 7468a4eae541ce5aff65595aa502aa0a4def6615 Gitweb: https://git.kernel.org/tip/7468a4eae541ce5aff65595aa502aa0a4def6615 Author: Gustavo A. R. Silva AuthorDate: Mon, 5 Aug 2019 15:17:12 -0500 Committer: Thomas Gleixner CommitDate: Wed, 7 Aug 2019 15:12:01 +0200 x86: mtrr: cyrix

Re: [PATCH] x86: mtrr: cyrix: Mark expected switch fall-through

2019-08-05 Thread Kees Cook
On Mon, Aug 05, 2019 at 03:17:12PM -0500, Gustavo A. R. Silva wrote: > Mark switch cases where we are expecting to fall through. > > Fix the following warning (Building: i386_defconfig i386): > > arch/x86/kernel/cpu/mtrr/cyrix.c:99:6: warning: this statement may fall > t

[tip:x86/cpu] x86/mtrr: Skip cache flushes on CPUs with cache self-snooping

2019-06-27 Thread tip-bot for Ricardo Neri
Commit-ID: fd329f276ecaad7a371d6f91b9bbea031d0c3440 Gitweb: https://git.kernel.org/tip/fd329f276ecaad7a371d6f91b9bbea031d0c3440 Author: Ricardo Neri AuthorDate: Thu, 27 Jun 2019 19:35:37 -0700 Committer: Thomas Gleixner CommitDate: Fri, 28 Jun 2019 07:21:00 +0200 x86/mtrr: Skip cache

[PATCH v2 2/2] x86, mtrr: generic: Skip cache flushes on CPUs with cache self-snooping

2019-06-27 Thread Ricardo Neri
Programming MTRR registers in multi-processor systems is a rather lengthy process. Furthermore, all processors must program these registers in lock step and with interrupts disabled; the process also involves flushing caches and TLBs twice. As a result, the process may take a considerable amount

[PATCH v2 0/2] Speed MTRR programming up when we can

2019-06-27 Thread Ricardo Neri
This is the second iteration of this patchset. The first iteration can be viewed here [1]. Programming MTRR registers in multi-processor systems is a rather lengthy process. Furthermore, all processors must program these registers in lock step and with interrupts disabled; the process also

Re: [PATCH 0/2] Speed MTRR programming up when we can

2019-06-27 Thread Thomas Gleixner
On Thu, 27 Jun 2019, Ricardo Neri wrote: > By measuring the execution time of mtrr_aps_init() (from which MTRRs > in all CPUs are programmed in lock-step at boot), I find savings in the > time required to program MTRRs as follows: > > Platform time-with-wbinvd(ms) time-no-wbin

[PATCH 0/2] Speed MTRR programming up when we can

2019-06-27 Thread Ricardo Neri
Programming MTRR registers in multi-processor systems is a rather lengthy process. Furthermore, all processors must program these registers in lock step and with interrupts disabled; the process also involves flushing caches and TLBs twice. As a result, the process may take a considerable amount

[PATCH 2/2] x86, mtrr: generic: Skip cache flushes on CPUs with cache self-snooping

2019-06-27 Thread Ricardo Neri
Programming MTRR registers in multi-processor systems is a rather lengthy process. Furthermore, all processors must program these registers in lock step and with interrupts disabled; the process also involves flushing caches and TLBs twice. As a result, the process may take a considerable amount

[PATCH 06/16] x86/mtrr: use new match_string() helper + add gaps == minor fix

2019-05-08 Thread Alexandru Ardelean
n't), but this fixes that. Signed-off-by: Alexandru Ardelean --- arch/x86/kernel/cpu/mtrr/if.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 4ec7a5f7b94c..e67820a044cc 100644 --- a/arch/x86/kerne

[tip:x86/cleanups] x86/mtrr: Remove unused variable

2019-02-08 Thread tip-bot for Bo Yu
Commit-ID: c81cd5c08d676483bb09f4809660d2a1abea0062 Gitweb: https://git.kernel.org/tip/c81cd5c08d676483bb09f4809660d2a1abea0062 Author: Bo Yu AuthorDate: Fri, 8 Feb 2019 07:53:43 -0500 Committer: Thomas Gleixner CommitDate: Fri, 8 Feb 2019 14:32:33 +0100 x86/mtrr: Remove unused

[PATCH] x86: drop warning from mtrr: -Wunused-but-set-variable

2019-02-08 Thread Bo YU
From: Bo Yu There is a warning if enable W=1 when compile kernel: arch/x86/kernel/cpu/mtrr/cleanup.c:299:16: warning: variable ‘second_basek’ set but not used [-Wunused-but-set-variable] unsigned long second_basek, second_sizek; Signed-off-by: Bo Yu --- arch/x86/kernel/cpu/mtrr/cleanup.c

[PATCH 3.16 295/305] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2019-02-03 Thread Ben Hutchings
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH 4.4 12/88] x86/mtrr: Dont copy uninitialized gentry fields back to userspace

2019-01-11 Thread Greg Kroah-Hartman
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH 3.18 07/47] x86/mtrr: Dont copy uninitialized gentry fields back to userspace

2019-01-11 Thread Greg Kroah-Hartman
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH 4.14 27/36] x86/mtrr: Dont copy uninitialized gentry fields back to userspace

2018-12-28 Thread Greg Kroah-Hartman
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH 4.9 17/22] x86/mtrr: Dont copy uninitialized gentry fields back to userspace

2018-12-28 Thread Greg Kroah-Hartman
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH 4.19 26/46] x86/mtrr: Dont copy uninitialized gentry fields back to userspace

2018-12-28 Thread Greg Kroah-Hartman
userspace. Fix this by explicitly memset'ing gentry to zero, this also will zero any compiler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use

[PATCH AUTOSEL 3.18 08/12] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-26 Thread Sasha Levin
piler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls") Signed-off-by: Colin Ian King Signe

[PATCH AUTOSEL 4.4 16/21] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-26 Thread Sasha Levin
piler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls") Signed-off-by: Colin Ian King Signe

[PATCH AUTOSEL 4.9 30/35] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-26 Thread Sasha Levin
piler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls") Signed-off-by: Colin Ian King Signe

[PATCH AUTOSEL 4.14 44/59] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-26 Thread Sasha Levin
piler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls") Signed-off-by: Colin Ian King Signe

[PATCH AUTOSEL 4.19 69/97] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-26 Thread Sasha Levin
piler added padding fields that may be in struct (currently there are none). Detected by CoverityScan, CID#200783 ("Uninitialized scalar variable") Fixes: b263b31e8ad6 ("x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls") Signed-off-by: Colin Ian King Signe

[tip:x86/urgent] x86/mtrr: Don't copy uninitialized gentry fields back to userspace

2018-12-18 Thread tip-bot for Colin Ian King
Commit-ID: 32043fa065b51e0b1433e48d118821c71b5cd65d Gitweb: https://git.kernel.org/tip/32043fa065b51e0b1433e48d118821c71b5cd65d Author: Colin Ian King AuthorDate: Tue, 18 Dec 2018 17:29:56 + Committer: Thomas Gleixner CommitDate: Wed, 19 Dec 2018 00:00:16 +0100 x86/mtrr: Don&#

[tip:x86/cpu] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-27 Thread tip-bot for Pu Wen
Commit-ID: 39dc6f154dac134e4612827cb5283934c1862cb8 Gitweb: https://git.kernel.org/tip/39dc6f154dac134e4612827cb5283934c1862cb8 Author: Pu Wen AuthorDate: Sun, 23 Sep 2018 17:34:16 +0800 Committer: Borislav Petkov CommitDate: Thu, 27 Sep 2018 18:28:57 +0200 x86/cpu/mtrr: Support

[PATCH v8 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-23 Thread Pu Wen
v Petkov --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 765afd5..3668c5d 100644 --- a/arch/x86/kernel/cpu/mtrr/c

[PATCH v7 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-17 Thread Pu Wen
v Petkov --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 765afd5..3668c5d 100644 --- a/arch/x86/kernel/cpu/mtrr/c

Re: [PATCH v6 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-10 Thread Pu Wen
On 2018/9/11 2:06, Borislav Petkov wrote: On Mon, Sep 10, 2018 at 09:16:03PM +0800, Pu Wen wrote: The Hygon Dhyana CPU have a special magic MSR way to force WB for From the last review round: Also, it is "The ... CPU has a special..." Please take your time and incorporate *all* review feedb

Re: [PATCH v6 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-10 Thread Borislav Petkov
new revision out and drop review feedback. > memory >4GB, and support TOP_MEM2. Therefore, it is necessary to > add Hygon Dhyana support in amd_special_default_mtrr(). > > The number of variable MTRRs for Hygon is 2 as AMD's. > > Signed-off-by: Pu Wen > --- > ar

[PATCH v6 03/16] x86/cpu/mtrr: Support TOP_MEM2 and get MTRR number

2018-09-10 Thread Pu Wen
The Hygon Dhyana CPU have a special magic MSR way to force WB for memory >4GB, and support TOP_MEM2. Therefore, it is necessary to add Hygon Dhyana support in amd_special_default_mtrr(). The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-04 Thread Pu Wen
On 2018/9/4 16:02, Borislav Petkov wrote: shows only old mails so I'm going to assume this got fixed, finally! And you probably have received a *fixed* BIOS even, allegedly. So what's up? I tested the function on Hygon Dhyana platforms with the latest BIOS, found that this problem is indeed fi

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-04 Thread Borislav Petkov
initialization of the fixed MTRRs, then cleared to 0 for operation. Is your BIOS already broken? Searching the net for pr_err(FW_WARN "MTRR: CPU %u: SYSCFG[MtrrFixDramModEn]" " not cleared by BIOS, clearing this bit\n", shows

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-03 Thread Pu Wen
On 2018/9/4 3:04, Borislav Petkov wrote: It was "Hygon Dhyana" before now "Hygon" only. Can we agree on the naming nomenclature and stick with it. OK, agree on it. ... - if (!((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && - (boot_cpu_data.x86 >= 0x0f))) + if (!((boo

Re: [PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-09-03 Thread Borislav Petkov
n. > > The number of variable MTRRs for Hygon is 2 as AMD's. > > Signed-off-by: Pu Wen > --- > arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- > arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- > arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- > 3 files changed, 6 insertions(+)

[PATCH v5 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-29 Thread Pu Wen
hen cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(

[PATCH v4 03/16] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-19 Thread Pu Wen
hen cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(

[PATCH v3 03/17] x86/mtrr: get MTRR number and support TOP_MEM2

2018-08-11 Thread Pu Wen
hen cleared to 0 for operation. The number of variable MTRRs for Hygon is 2 as AMD's. Signed-off-by: Pu Wen --- arch/x86/kernel/cpu/mtrr/cleanup.c | 3 ++- arch/x86/kernel/cpu/mtrr/generic.c | 5 +++-- arch/x86/kernel/cpu/mtrr/mtrr.c| 2 +- 3 files changed, 6 insertions(+), 4 deletions(

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-15 Thread Al Viro
On Mon, Jul 16, 2018 at 12:03:39AM +0200, Ingo Molnar wrote: > > * Jann Horn wrote: > > > - A malicious user can pass an arbitrary file to a setuid binary as > > stdin/stdout/stderr. When the setuid binary (expecting stdin/stdout to > > be something normal, like a proper file or a pipe) then ca

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-15 Thread Linus Torvalds
On Sun, Jul 15, 2018 at 6:33 PM Jann Horn wrote: > > +Linus, Andy, Al from the other thread > > On Mon, Jul 16, 2018 at 12:03 AM Ingo Molnar wrote: > > > > BTW., a naive question: would it make sense to simply disallow 'special' > > fds to be passed to setuid binaries, and fix any user-space that

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-15 Thread Jann Horn
+Linus, Andy, Al from the other thread On Mon, Jul 16, 2018 at 12:03 AM Ingo Molnar wrote: > * Jann Horn wrote: > > > - A malicious user can pass an arbitrary file to a setuid binary as > > stdin/stdout/stderr. When the setuid binary (expecting stdin/stdout to > > be something normal, like a pr

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-15 Thread Ingo Molnar
* Jann Horn wrote: > - A malicious user can pass an arbitrary file to a setuid binary as > stdin/stdout/stderr. When the setuid binary (expecting stdin/stdout to > be something normal, like a proper file or a pipe) then calls read(0, > , ), if the kernel disregards the length argument and writ

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-09 Thread Andy Shevchenko
t; this happens, *the address limit checks are disabled*, allowing the > ->read() or ->write() handler to read and write *kernel memory* using > copy_from_user()/copy_to_user() and other "userspace" accessor > functions. The easiest way to trigger this behavior from userspace is &

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-09 Thread Jann Horn
en this happens, *the address limit checks are disabled*, allowing the ->read() or ->write() handler to read and write *kernel memory* using copy_from_user()/copy_to_user() and other "userspace" accessor functions. The easiest way to trigger this behavior from userspace is to use sys

Re: [PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-08 Thread Andy Shevchenko
this change? Only few places in the kernel do this way and I would like to understand why in most of the cases it's okay to supply maximum available length and here is not the one. > Fixes: 7f8ec5a4f01a ("x86/mtrr: Convert to use strncpy_from_user() > helper") > Signed-

[tip:x86/urgent] x86/mtrr: Don't copy out-of-bounds data in mtrr_write

2018-07-07 Thread tip-bot for Jann Horn
Commit-ID: 15279df6f26cf2013d713904b4a0c957ae8abb96 Gitweb: https://git.kernel.org/tip/15279df6f26cf2013d713904b4a0c957ae8abb96 Author: Jann Horn AuthorDate: Fri, 6 Jul 2018 23:50:03 +0200 Committer: Thomas Gleixner CommitDate: Sat, 7 Jul 2018 18:58:41 +0200 x86/mtrr: Don't cop

[PATCH] x86/mtrr: don't copy out-of-bounds data in mtrr_write

2018-07-06 Thread Jann Horn
Don't access the provided buffer out of bounds - this can cause a kernel out-of-bounds read when invoked through sys_splice() or other things that use kernel_write()/__kernel_write(). Fixes: 7f8ec5a4f01a ("x86/mtrr: Convert to use strncpy_from_user() helper") Signed-off-by: Jann

Re: [rcu:rcu/dev 5/99] arch/x86/kernel/cpu/mtrr/main.c:797: undefined reference to `rcu_cpu_starting'

2018-05-22 Thread Paul E. McKenney
make ARCH=i386 > > All errors (new ones prefixed by >>): Problems with !SMP, which I am beating up on... Thanx, Paul >arch/x86/kernel/cpu/mtrr/main.o: In function `mtrr_ap_init': > >> arch/x86/kernel/cpu/m

[rcu:rcu/dev 5/99] arch/x86/kernel/cpu/mtrr/main.c:797: undefined reference to `rcu_cpu_starting'

2018-05-22 Thread kbuild test robot
) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: git checkout 354238a30982b817262fe6f9d00f808451694366 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): arch/x86/kernel/cpu/mtrr/main.o: In function `mtrr_a

[tip:x86/mm] x86/mtrr: Convert to use strncpy_from_user() helper

2018-05-16 Thread tip-bot for Andy Shevchenko
Commit-ID: 7f8ec5a4f01aa7d03e94a3d99d7b5f9c02d7fe5a Gitweb: https://git.kernel.org/tip/7f8ec5a4f01aa7d03e94a3d99d7b5f9c02d7fe5a Author: Andy Shevchenko AuthorDate: Tue, 15 May 2018 21:05:35 +0300 Committer: Ingo Molnar CommitDate: Wed, 16 May 2018 09:47:23 +0200 x86/mtrr: Convert to

[tip:x86/mm] x86/mtrr: Convert to use match_string() helper

2018-05-16 Thread tip-bot for Andy Shevchenko
Commit-ID: 13a4db9d75ec5dbca4bd6229e149e061ef7a6bf0 Gitweb: https://git.kernel.org/tip/13a4db9d75ec5dbca4bd6229e149e061ef7a6bf0 Author: Andy Shevchenko AuthorDate: Tue, 15 May 2018 20:57:59 +0300 Committer: Ingo Molnar CommitDate: Wed, 16 May 2018 09:47:22 +0200 x86/mtrr: Convert to

[PATCH v1] x86/mtrr: Convert to use strncpy_from_user() helper

2018-05-15 Thread Andy Shevchenko
Replace the open coded string fetch from the user. Signed-off-by: Andy Shevchenko --- arch/x86/kernel/cpu/mtrr/if.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index e4adad68b5e5..3cbae60663fa

[PATCH v2] x86/mtrr: Convert to use match_string() helper

2018-05-15 Thread Andy Shevchenko
The helper returns index of the matching string in an array. Replace the open coded array lookup. Signed-off-by: Andy Shevchenko --- - reword commit message arch/x86/kernel/cpu/mtrr/if.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/x86

Re: [PATCH v1] x86/mtrr: Convert to use match_string() helper

2018-05-13 Thread Andy Shevchenko
On Sun, May 13, 2018 at 10:23 PM, Thomas Gleixner wrote: > On Fri, 4 May 2018, Andy Shevchenko wrote: > >> The new helper returns index of the matching string in an array. > > new helper? match_string() is in tree for 2 years. Old template. >> We are going to use it here. > > Are we going to use

[tip:x86/cleanups] x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes

2018-05-13 Thread tip-bot for Joe Perches
Commit-ID: e6d8c84a58380030457759ad6085f3792a76b2ce Gitweb: https://git.kernel.org/tip/e6d8c84a58380030457759ad6085f3792a76b2ce Author: Joe Perches AuthorDate: Thu, 10 May 2018 08:45:31 -0700 Committer: Thomas Gleixner CommitDate: Sun, 13 May 2018 21:25:18 +0200 x86/mtrr: Rename

Re: [PATCH v1] x86/mtrr: Convert to use match_string() helper

2018-05-13 Thread Thomas Gleixner
On Fri, 4 May 2018, Andy Shevchenko wrote: > The new helper returns index of the matching string in an array. new helper? match_string() is in tree for 2 years. > We are going to use it here. Are we going to use it ? When? "Replace the open coded array lookup." or something like that would be

Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-11 Thread Juergen Gross
On 09/05/18 17:11, Roger Pau Monné wrote: > On Wed, May 09, 2018 at 12:30:16PM +0100, Roger Pau Monné wrote: >> On Wed, May 09, 2018 at 11:56:40AM +0100, Andrew Cooper wrote: >>> On 09/05/18 11:21, Roger Pau Monne wrote: >>> I'm not sure that setting the de

[PATCH 05/18] x86/mtrr: Rename main.c to mtrr.c and remove duplicate prefixes

2018-05-10 Thread Joe Perches
Kbuild uses the first file as the name for KBUILD_MODNAME. mtrr uses main.c as its first file, so rename that file to mtrr.c and fixup the Makefile. Remove the now duplicate "mtrr: " prefixes from the logging calls. Signed-off-by: Joe Perches --- arch/x86/kernel/cpu/mtr

Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-10 Thread Wei Liu
On Wed, May 09, 2018 at 04:11:39PM +0100, Roger Pau Monné wrote: > On Wed, May 09, 2018 at 12:30:16PM +0100, Roger Pau Monné wrote: > > On Wed, May 09, 2018 at 11:56:40AM +0100, Andrew Cooper wrote: > > > On 09/05/18 11:21, Roger Pau Monne wrote: > > > I'm not su

Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-09 Thread Roger Pau Monné
On Wed, May 09, 2018 at 12:30:16PM +0100, Roger Pau Monné wrote: > On Wed, May 09, 2018 at 11:56:40AM +0100, Andrew Cooper wrote: > > On 09/05/18 11:21, Roger Pau Monne wrote: > > I'm not sure that setting the default MTRR type is going to be a > > clever idea in hinds

Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-09 Thread Roger Pau Monné
On Wed, May 09, 2018 at 11:56:40AM +0100, Andrew Cooper wrote: > On 09/05/18 11:21, Roger Pau Monne wrote: > > On PVH MTRR is not initialized by the firmware (because there's no > > firmware), so the kernel is started with MTRR disabled which means all > > memory acces

Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-09 Thread Andrew Cooper
On 09/05/18 11:21, Roger Pau Monne wrote: > On PVH MTRR is not initialized by the firmware (because there's no > firmware), so the kernel is started with MTRR disabled which means all > memory accesses are UC. > > So far there have been no issues (ie: slowdowns) caused by thi

[PATCH v2 1/3] xen/pvh: enable and set default MTRR type

2018-05-09 Thread Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC. So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through device

[PATCH v1] x86/mtrr: Convert to use match_string() helper

2018-05-03 Thread Andy Shevchenko
The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko --- arch/x86/kernel/cpu/mtrr/if.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86

[PATCH 1/3] xen/pvh: enable and set default MTRR type

2018-05-03 Thread Roger Pau Monne
On PVH MTRR is not initialized by the firmware (because there's no firmware), so the kernel is started with MTRR disabled which means all memory accesses are UC. So far there have been no issues (ie: slowdowns) caused by this because PVH only supported DomU mode without passed-through device

[PATCH][v4] PM / sleep: Do not delay the synchronization of MTRR during resume

2018-03-18 Thread Yu Chen
From: Chen Yu Sometimes it is too late for the APs to adjust their MTRRs to the valid ones saved before suspend - currently this action is performed by set_mtrr_state() after all the APs have been brought up. In some cases the BIOS might scribble the MTRR across suspend, as a result we might get

  1   2   3   4   5   6   7   8   9   10   >