From: Jan Beulich <jbeulich@suse.com> To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org> Cc: Andrew Cooper <andrew.cooper3@citrix.com>, George Dunlap <George.Dunlap@eu.citrix.com>, Ian Jackson <ian.jackson@citrix.com>, Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>, Stefano Stabellini <sstabellini@kernel.org> Subject: [PATCH v2 1/2] common: map_vcpu_info() cosmetics Date: Tue, 22 Dec 2020 09:14:55 +0100 [thread overview] Message-ID: <29514f9a-b630-f66e-286e-8b73fcf4d58a@suse.com> (raw) In-Reply-To: <2a08aa31-fdbf-89ee-cd49-813f818b709a@suse.com> Use ENXIO instead of EINVAL to cover the two cases of the address not satisfying the requirements. This will make an issue here better stand out at the call site. Also add a missing compat-mode related size check: If the sizes differed, other code in the function would need changing. Accompany this by a change to the initial sizeof() expression, tying it to the type of the variable we're actually after (matching e.g. the alignof() added by XSA-327). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1241,17 +1241,18 @@ int map_vcpu_info(struct vcpu *v, unsign struct page_info *page; unsigned int align; - if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) ) - return -EINVAL; + if ( offset > (PAGE_SIZE - sizeof(*new_info)) ) + return -ENXIO; #ifdef CONFIG_COMPAT + BUILD_BUG_ON(sizeof(*new_info) != sizeof(new_info->compat)); if ( has_32bit_shinfo(d) ) align = alignof(new_info->compat); else #endif align = alignof(*new_info); if ( offset & (align - 1) ) - return -EINVAL; + return -ENXIO; if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) ) return -EINVAL;
next prev parent reply other threads:[~2020-12-22 8:15 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-22 8:13 [PATCH v2 0/2] common: XSA-327 follow-up Jan Beulich 2020-12-22 8:14 ` Jan Beulich [this message] 2021-04-01 16:02 ` [PATCH v2 1/2] common: map_vcpu_info() cosmetics Julien Grall 2020-12-22 8:15 ` [PATCH v2 2/2] evtchn/fifo: don't enforce higher than necessary alignment Jan Beulich 2021-04-21 14:36 ` [PATCH v3] " Jan Beulich 2021-04-21 19:52 ` Julien Grall 2021-04-22 9:19 ` Jan Beulich 2021-04-29 11:55 ` 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=29514f9a-b630-f66e-286e-8b73fcf4d58a@suse.com \ --to=jbeulich@suse.com \ --cc=George.Dunlap@eu.citrix.com \ --cc=andrew.cooper3@citrix.com \ --cc=ian.jackson@citrix.com \ --cc=julien@xen.org \ --cc=sstabellini@kernel.org \ --cc=wl@xen.org \ --cc=xen-devel@lists.xenproject.org \ --subject='Re: [PATCH v2 1/2] common: map_vcpu_info() cosmetics' \ /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: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).