Re: [Xen-devel] [PATCH 1/2] x86: make sure module array is large enough in pvh-boot.c
On Fri, Sep 28, 2018 at 09:06:25AM -0600, Jan Beulich wrote: > >>> On 28.09.18 at 10:24, wrote: > > The relocation code in __start_xen requires one extra element in the > > module array. By the looks of it the temporary array is already large > > enough. Add a BUG_ON to catch any issue in the future. > > > > While at it, turn another ASSERT to BUG_ON as well. > > Hmm, a little strange - I thought we had agreed on panic() before. > The extra output BUG_ON() produces is unlikely to be helpful here. > With this switched to panic() it certainly can have my ack. Oops, I have no idea why I agreed to use panic but wrote BUG_ON instead. My memory has failed me. I will resend this patch. Wei. > > Jan > > ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/2] x86: make sure module array is large enough in pvh-boot.c
>>> On 28.09.18 at 10:24, wrote: > The relocation code in __start_xen requires one extra element in the > module array. By the looks of it the temporary array is already large > enough. Add a BUG_ON to catch any issue in the future. > > While at it, turn another ASSERT to BUG_ON as well. Hmm, a little strange - I thought we had agreed on panic() before. The extra output BUG_ON() produces is unlikely to be helpful here. With this switched to panic() it certainly can have my ack. Jan ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 1/2] x86: make sure module array is large enough in pvh-boot.c
The relocation code in __start_xen requires one extra element in the module array. By the looks of it the temporary array is already large enough. Add a BUG_ON to catch any issue in the future. While at it, turn another ASSERT to BUG_ON as well. Signed-off-by: Wei Liu --- xen/arch/x86/guest/pvh-boot.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/guest/pvh-boot.c b/xen/arch/x86/guest/pvh-boot.c index 0e9e5bfdf6..2e103105fa 100644 --- a/xen/arch/x86/guest/pvh-boot.c +++ b/xen/arch/x86/guest/pvh-boot.c @@ -42,7 +42,14 @@ static void __init convert_pvh_info(void) module_t *mod; unsigned int i; -ASSERT(pvh_info->magic == XEN_HVM_START_MAGIC_VALUE); +BUG_ON(pvh_info->magic != XEN_HVM_START_MAGIC_VALUE); + +/* + * Temporary module array needs to be at least one element bigger than + * required. The extra element is used to aid relocation. See + * arch/x86/setup.c:__start_xen(). + */ +BUG_ON(ARRAY_SIZE(pvh_mbi_mods) <= pvh_info->nr_modules); /* * Turn hvm_start_info into mbi. Luckily all modules are placed under 4GB -- 2.11.0 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel