From: Julien Grall <julien.grall@arm.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr_Tyshchenko@epam.com, Julien Grall <julien.grall@arm.com>, sstabellini@kernel.org, Andrii_Anisov@epam.com Subject: [PATCH 18/20] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings Date: Mon, 22 Apr 2019 17:49:35 +0100 [thread overview] Message-ID: <20190422164937.21350-19-julien.grall@arm.com> (raw) In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> The two helpers {destroy, modify}_xen_mappings don't check that the start is always before the end. This should never happen but if it happens, it will result to unexpected behavior. Catch such issues earlier on by adding an ASSERT in destroy_xen_mappings and modify_xen_mappings. Signed-off-by: Julien Grall <julien.grall@arm.com> --- xen/arch/arm/mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ee541a38e3..d6157c35d6 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1072,11 +1072,13 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns) int destroy_xen_mappings(unsigned long v, unsigned long e) { + ASSERT(v <= e); return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); } int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { + ASSERT(s <= e); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <julien.grall@arm.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr_Tyshchenko@epam.com, Julien Grall <julien.grall@arm.com>, sstabellini@kernel.org, Andrii_Anisov@epam.com Subject: [Xen-devel] [PATCH 18/20] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings Date: Mon, 22 Apr 2019 17:49:35 +0100 [thread overview] Message-ID: <20190422164937.21350-19-julien.grall@arm.com> (raw) Message-ID: <20190422164935.zKjff-pNPorc1cwKvgaXx8GlzJs-mrOuAayIUiLpXpQ@z> (raw) In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> The two helpers {destroy, modify}_xen_mappings don't check that the start is always before the end. This should never happen but if it happens, it will result to unexpected behavior. Catch such issues earlier on by adding an ASSERT in destroy_xen_mappings and modify_xen_mappings. Signed-off-by: Julien Grall <julien.grall@arm.com> --- xen/arch/arm/mm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ee541a38e3..d6157c35d6 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1072,11 +1072,13 @@ int populate_pt_range(unsigned long virt, unsigned long nr_mfns) int destroy_xen_mappings(unsigned long v, unsigned long e) { + ASSERT(v <= e); return create_xen_entries(REMOVE, v, INVALID_MFN, (e - v) >> PAGE_SHIFT, 0); } int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { + ASSERT(s <= e); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-04-22 16:50 UTC|newest] Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-22 16:49 [PATCH 00/20] xen/arm: Clean-up & fixes in boot/mm code Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-04-22 16:49 ` [PATCH 01/20] xen/const: Introduce _BITUL and _BITULL Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-04-25 12:15 ` Jan Beulich 2019-04-25 12:15 ` [Xen-devel] " Jan Beulich 2019-04-29 16:47 ` Julien Grall 2019-04-29 16:47 ` [Xen-devel] " Julien Grall 2019-04-30 6:57 ` Jan Beulich 2019-04-30 6:57 ` [Xen-devel] " Jan Beulich 2019-04-22 16:49 ` [PATCH 02/20] xen/arm: Rename SCTLR_* defines and remove unused one Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:56 ` Andrii Anisov 2019-05-03 15:56 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 03/20] xen/arm: processor: Use _BITUL instead of _AC(1, U) in SCTLR_ defines Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:56 ` Andrii Anisov 2019-05-03 15:56 ` [Xen-devel] " Andrii Anisov 2019-05-03 16:09 ` Julien Grall 2019-05-03 16:09 ` [Xen-devel] " Julien Grall 2019-05-03 16:12 ` Andrii Anisov 2019-05-03 16:12 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 04/20] xen/arm: Rework HSCTLR_BASE Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:56 ` Andrii Anisov 2019-05-03 15:56 ` [Xen-devel] " Andrii Anisov 2019-05-03 16:10 ` Julien Grall 2019-05-03 16:10 ` [Xen-devel] " Julien Grall 2019-05-03 16:17 ` Andrii Anisov 2019-05-03 16:17 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 05/20] xen/arm: Rework secondary_start prototype Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:56 ` Andrii Anisov 2019-05-03 15:56 ` [Xen-devel] " Andrii Anisov 2019-05-03 16:15 ` Julien Grall 2019-05-03 16:15 ` [Xen-devel] " Julien Grall 2019-04-22 16:49 ` [PATCH 06/20] xen/arm: Remove parameter cpuid from start_xen Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:56 ` Andrii Anisov 2019-05-03 15:56 ` [Xen-devel] " Andrii Anisov 2019-05-03 16:17 ` Julien Grall 2019-05-03 16:17 ` [Xen-devel] " Julien Grall 2019-05-03 16:19 ` Andrii Anisov 2019-05-03 16:19 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 07/20] xen/arm64: head: Remove unnecessary comment Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 08/20] xen/arm64: head: Move earlyprintk messages in .rodata.str Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 09/20] xen/arm64: head: Correctly report the HW CPU ID Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 10/20] xen/arm32: " Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 11/20] xen/arm32: head: Don't set MAIR0 and MAIR1 Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 12/20] xen/arm32: head: Always zero r3 before update a page-table entry Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-05-03 16:21 ` Julien Grall 2019-05-03 16:21 ` [Xen-devel] " Julien Grall 2019-04-22 16:49 ` [PATCH 13/20] xen/arm32: mm: Avoid to zero and clean cache for CPU0 domheap Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-05-03 17:06 ` Julien Grall 2019-05-03 17:06 ` [Xen-devel] " Julien Grall 2019-05-06 8:28 ` Andrii Anisov 2019-05-06 8:28 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 14/20] xen/arm32: mm: Avoid cleaning the cache for secondary CPUs page-tables Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:57 ` Andrii Anisov 2019-05-03 15:57 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 15/20] xen/arm: mm: Use the shorter version __aligned(PAGE_SIZE) to align page-tables Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:58 ` Andrii Anisov 2019-05-03 15:58 ` [Xen-devel] " Andrii Anisov 2019-05-03 17:09 ` Julien Grall 2019-05-03 17:09 ` [Xen-devel] " Julien Grall 2019-05-06 7:19 ` Andrii Anisov 2019-05-06 7:19 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 16/20] xen/arm: mm: Protect Xen page-table update with a spinlock Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:59 ` Andrii Anisov 2019-05-03 15:59 ` [Xen-devel] " Andrii Anisov 2019-05-03 17:19 ` Julien Grall 2019-05-03 17:19 ` [Xen-devel] " Julien Grall 2019-05-06 8:20 ` Andrii Anisov 2019-05-06 8:20 ` [Xen-devel] " Andrii Anisov 2019-05-06 16:54 ` Julien Grall 2019-05-06 16:54 ` [Xen-devel] " Julien Grall 2019-05-06 8:20 ` Andrii Anisov 2019-05-06 8:20 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 17/20] xen/arm: mm: Initialize page-tables earlier Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:59 ` Andrii Anisov 2019-05-03 15:59 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` Julien Grall [this message] 2019-04-22 16:49 ` [Xen-devel] [PATCH 18/20] xen/arm: mm: Check start is always before end in {destroy, modify}_xen_mappings Julien Grall 2019-05-03 15:59 ` Andrii Anisov 2019-05-03 15:59 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 19/20] xen/arm: Pair call to set_fixmap with call to clear_fixmap in copy_from_paddr Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-05-03 15:59 ` Andrii Anisov 2019-05-03 15:59 ` [Xen-devel] " Andrii Anisov 2019-04-22 16:49 ` [PATCH 20/20] xen/arm: Allow cleaning the directory even when CONFIG_EARLY_PRINTK is set Julien Grall 2019-04-22 16:49 ` [Xen-devel] " Julien Grall 2019-04-24 15:14 ` Julien Grall 2019-04-24 15:14 ` [Xen-devel] " Julien Grall
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=20190422164937.21350-19-julien.grall@arm.com \ --to=julien.grall@arm.com \ --cc=Andrii_Anisov@epam.com \ --cc=Oleksandr_Tyshchenko@epam.com \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.org \ /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: linkBe 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.