[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] x86/oprofile: remove compat accessors usage from backtrace
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 27 Apr 2021 20:09:38 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8EtjslWbA3PPA9T1H+hic1zK3kJFLC2l/VM20RxDb94=; b=PWLfM8wVqCSHPEvoTlGyHAUggE91TiXKMGP5mcXqOwz8LhD8GKrK1hETvFvxueyKGHW9cYBSajsE91aRVipQK0Qza/+uczbJpT6PzDgQqEz8RXCBu6W47Dh1+ZLiMkKe2HweGMtZubkKf8rek/8zv5zxI4taLlOf7UVpmOj+Gim6J3VPWkF2MmNSQawpKV4Snct23FgqAqmZefAm31FofHofrv3R3Mwm/z7qH5Kx84etphM4GSV80mBNA7wIQ2g3czt3y5YtvJOpuh5apjp0if75ySpzdXWmhfUUXPpdajyoKov2BkTEMkYCK2RnAU5+DR5Q3fNAUp3S4OCQNCaFyA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XjUZw2r3+XR5inio0OGo2Kw2wgCCw4VvDBfI41tMWcBIJ6S8tfkU4nPgciw/JjZFpS6W/JtbFxH6C5IOUxfYBDLBuwynfhjH6f0pXg5RjgPanaHjhT721etGxhtaGUMxt1a5tzVJ9K/3NbVgHCqAsc05tCHxjl1+b3Rx9rfG4o5Xp5mvN+J8fpVSUM236KaISeaF7kvxTm8DnGtL1OhEoDBFLF031zlqwXggbU/E8M72jIIgO1lgwxoy9JPQaOjZJ2qi29mR/94am8rAkn8cVheOeyBnlwQwLXs4gB1PBMaqnuyI4agzOxitvTPHrG4qbuTCVX4BzSa+L5/cwXNSag==
- Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 27 Apr 2021 18:09:51 +0000
- Ironport-hdrordr: A9a23:O2ZqBa5eS4t5v+hxVwPXwXiEI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoexzh3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdxHW3tV2kZ 1te60WMrDNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2BXQotLhj0JbTqzOEtwWQVAGN4VFI CE4NBGujqnfh0sH76GL1MCWPXOoMCOqYnvZgQICwVixA6Fiz6p77CSKWnk4j41VTRTzbA+tV XUigCR3NTZj9iX6D/5k1XS4ZNfhcf7xrJ4avCkp8AJJlzX+2SVTat7XbnqhkFRnMiO7xIQnM DIs1McOa1Img/sV0WUhTeo5AX6yjYp7BbZuC+lqF/uu9bwSj5/K+cpv/MhTjLj50AtvM5x3c twtgrz3fonbmKzoA3H69fFTB1snEavyEBS6dI7tHBDTZAYLIZYsI13xjIlLL47ACn45Io7ed Meav302fA+SyL/U1np+kNrwNCqQ00pGAaHTkUoqqWuokZrtUE84E0CyMMFmHAcsLo7Vplf/u zBdp9ljbdUU6YtHO5ALdZEZfHyJn3GQBrKPm7XCVP7FJsfM3aIj5Ls+r066MyjZZRg9up8pL 3xFHdj8UIicUPnDsODmLdR9ArWfWm7VTPxjulD+plQoNTHNfrWGBzGbGprv9qrov0ZDMGece 20IohqD/jqKnarMZpV3jf5R4JZJRAlIYwok+d+f2jLjtPAK4XsuOCeWu3UPqDRHTEtXX66LW AEWBT1OcVc/mGmUnL1m3HqKjHQU3262ag1PLnR/uAVxo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mRodps5b2OvLVOOGlIzIcY0H4WjPIjmZhd6uuw9pES1Q4qHE98c0/o7eHTDKQoI zjo+Bg7tBPYdmRjIJOYVlQVmiNNktkGXtggO50VTwoKeQI1brGQvtLFGhCvr11FaxvaACqjf0G 7VI=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Apr 27, 2021 at 05:31:25PM +0200, Jan Beulich wrote:
> On 27.04.2021 16:21, Roger Pau Monne wrote:
> > Remove the unneeded usage of the compat layer to copy frame pointers
> > from guest address space. Instead just use raw_copy_from_guest.
> >
> > While there change the accessibility check of one frame_head beyond to
> > be performed as part of the copy, like it's done in the Linux code.
> > Note it's unclear why this is needed.
> >
> > Also drop the explicit truncation of the head pointer in the 32bit
> > case as all callers already pass a zero extended value. The first
> > value being rsp from the guest registers, and further calls will use
> > ebp from frame_head_32bit struct.
> >
> > Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> > ---
> > Changes since v2:
> > - Keep accessibility check for one frame_head beyond.
> > - Fix coding style.
>
> I'm indeed more comfortable with this variant, so
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Andrew - can you live with the 2-frame thingy staying around?
>
> > @@ -51,52 +49,35 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
> > else
> > return is_pv_32bit_vcpu(vcpu);
> > }
> > -#endif
> >
> > static struct frame_head *
> > dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
> > int mode)
> > {
> > - frame_head_t bufhead;
> > + /* Also check accessibility of one struct frame_head beyond. */
> > + frame_head_t bufhead[2];
> >
> > -#ifdef CONFIG_COMPAT
> > if ( is_32bit_vcpu(vcpu) )
> > {
> > - DEFINE_COMPAT_HANDLE(frame_head32_t);
> > - __compat_handle_const_frame_head32_t guest_head =
> > - { .c = (unsigned long)head };
> > - frame_head32_t bufhead32;
> > -
> > - /* Also check accessibility of one struct frame_head beyond */
> > - if (!compat_handle_okay(guest_head, 2))
> > - return 0;
> > - if (__copy_from_compat(&bufhead32, guest_head, 1))
> > - return 0;
> > - bufhead.ebp = (struct frame_head *)(unsigned long)bufhead32.ebp;
> > - bufhead.ret = bufhead32.ret;
> > - }
> > - else
> > -#endif
> > - {
> > - XEN_GUEST_HANDLE_PARAM(const_frame_head_t) guest_head =
> > - const_guest_handle_from_ptr(head, frame_head_t);
> > + frame_head32_t bufhead32[2];
> >
> > - /* Also check accessibility of one struct frame_head beyond */
> > - if (!guest_handle_okay(guest_head, 2))
> > - return 0;
> > - if (__copy_from_guest(&bufhead, guest_head, 1))
> > + if ( raw_copy_from_guest(&bufhead32, head, sizeof(bufhead32)) )
>
> As a minor remark, personally I'd prefer the & to be dropped here
> and ...
>
> > return 0;
> > + bufhead[0].ebp = (struct frame_head *)(unsigned
> > long)bufhead32[0].ebp;
> > + bufhead[0].ret = bufhead32[0].ret;
> > }
> > + else if ( raw_copy_from_guest(&bufhead, head, sizeof(bufhead)) )
>
> ... here (and doing so while committing would be easy), but I'm
> not going to insist.
Sure, the & is a leftover from when bufhead wasn't an array, or else I
wouldn't have added it.
Would you be OK to drop the '&' and adjust the message mentioning
Linux <= 5.11 on commit?
If not I don't mind sending an updated version.
Thanks, Roger.
|