[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] build/clang: fix XSM dummy policy when using clang 4.0


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
  • Date: Fri, 10 Mar 2017 19:42:04 -0500
  • Delivery-date: Sat, 11 Mar 2017 00:42:19 +0000
  • Ironport-phdr: 9a23:I8nFkxz3ZgeQv8nXCy+O+j09IxM/srCxBDY+r6Qd2ukUIJqq85mqBkHD//Il1AaPBtSGra4VwLCM+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZPebgFIiTanbr5/KBq6oRvPusILnYZsN6E9xwfTrHBVYepW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbfVwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8rxmQwH0higZKzE58XnXis1ug6JdvBKhvAF0z4rNbI2IKPZyYqbRcNUUSmpbWsZaSjJPDIWyYYASC+YNJPhUo5X4q1YIsBCwBxSjBPn3xzFVmHH206000+MiHw/I0gMvENABv2jbotjuKKcfUvq4wLXUwTjNbf5b3yr25ojSchAmpPGBRbx+ftDXyUkuCQzFikibp4L7MDiI1+oNqXKU4PBuVemyjGMotg5xrSWxyccjkInGnJkYykzE9CplwIY1Ise0SEhgYdG+CpdQuCaaN5VvT84kXmpmuz46x6UbtZO0cyUG0pQqywPFZ/CZfIWE/AjvWPuXLDxlnnxqYqi/iAy38UW4z+38UdS730hSoypel9nMqmgN1xvO6sibUvd9/lmu2TKI1w3L9uFLO1o0lavGK5462LIwipoSvljDHi/xgkn2irOZdl449eSy7uTnY7HmqoedN49ylA7+LrwjltGwDOk3KAQDX3WX9f6i2LDs40H1WqhGguUzkqbDsZDaIcobprS+Aw9Qyoss9hm/ACq439QXh3kINklIeA6Hjof1O1HOJ+r0DfGkg1u2ijtryPfGPqP5DpXXMnfDiKvhfap660NE0gozyt9f6IxOCr0bOPL8QFLxucfEAR84Lwy02efnCdpn2owCXmKPB7eTMLnOvl+Q+uIvP+6MaZcauTnjLfgp/uPhgmEnmVADeamkxp8XaHGjHvR6OEWVe3XtjckHEWcSpAo+S+7qh0OeXj5PfXqyWLg85j5oQL6hWL3ESY23yISIwW+eGZtQaygSEFeDHG2ub4yZc/wNdDiTMolqlTlSEfCxRolk2RywuQvSz7t8MvGS6iAerYjk1tV++6vUjx5h2yZzCpGx2meMQmU8sm5AaCU/1a439UByxlqMy6FQn+1TFdsV4ehAFAg9K8iPnKRBF9nuV1eZLZ+yQ1G8T4DjWGtpQw==
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

On 03/06/2017 07:31 AM, Roger Pau Monne wrote:
There seems to be some weird bug in clang 4.0 that prevents xsm_pmu_op from
working as expected, and vpmu.o ends up with a reference to
__xsm_action_mismatch_detected which makes the build fail:

[...]
ld    -melf_x86_64_fbsd  -T xen.lds -N prelink.o  \
    xen/common/symbols-dummy.o -o xen/.xen-syms.0
prelink.o: In function `xsm_default_action':
xen/include/xsm/dummy.h:80: undefined reference to 
`__xsm_action_mismatch_detected'
xen/xen/include/xsm/dummy.h:80: relocation truncated to fit: R_X86_64_PC32 
against undefined symbol `__xsm_action_mismatch_detected'
ld: xen/xen/.xen-syms.0: hidden symbol `__xsm_action_mismatch_detected' isn't 
defined

Then doing a search in the objects files:

# find xen/ -type f -name '*.o' -print0 | xargs -0 bash -c \
  'for filename; do nm "$filename" | \
  grep -q __xsm_action_mismatch_detected && echo "$filename"; done' bash
xen/arch/x86/prelink.o
xen/arch/x86/cpu/vpmu.o
xen/arch/x86/cpu/built_in.o
xen/arch/x86/built_in.o

The current patch is the only way I've found to fix this so far, by simply
moving the XSM_PRIV check into the default case in xsm_pmu_op. This also fixes
the behavior of do_xenpmu_op, which will now return -EINVAL for unknown
XENPMU_* operations, instead of -EPERM when called by a privileged domain.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>

This also looks like a good patch for backporting.  The best alternative I
can think of is to disable the mismatch detection in non-DEBUG builds, but
I'd rather not do that unless this problem expands more than it has.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.