[PATCH v2] powernv/opal-prd: Silence memcpy() run-time false positive warnings

Michael Ellerman mpe at ellerman.id.au
Tue Aug 15 20:47:34 AEST 2023


Joel Stanley <joel at jms.id.au> writes:
> On Fri, 7 Jul 2023 at 05:11, Mahesh Salgaonkar <mahesh at linux.ibm.com> wrote:
>>
>> opal_prd_msg_notifier extracts the opal prd message size from the message
>> header and uses it for allocating opal_prd_msg_queue_item that includes
>> the correct message size to be copied. However, while running under
>> CONFIG_FORTIFY_SOURCE=y, it triggers following run-time warning:
>>
>> [ 6458.234352] memcpy: detected field-spanning write (size 32) of single field "&item->msg" at arch/powerpc/platforms/powernv/opal-prd.c:355 (size 4)
>> [ 6458.234390] WARNING: CPU: 9 PID: 660 at arch/powerpc/platforms/powernv/opal-prd.c:355 opal_prd_msg_notifier+0x174/0x188 [opal_prd]
>> [...]
>> [ 6458.234709] NIP [c00800000e0c0e6c] opal_prd_msg_notifier+0x174/0x188 [opal_prd]
>> [ 6458.234723] LR [c00800000e0c0e68] opal_prd_msg_notifier+0x170/0x188 [opal_prd]
>> [ 6458.234736] Call Trace:
>> [ 6458.234742] [c0000002acb23c10] [c00800000e0c0e68] opal_prd_msg_notifier+0x170/0x188 [opal_prd] (unreliable)
>> [ 6458.234759] [c0000002acb23ca0] [c00000000019ccc0] notifier_call_chain+0xc0/0x1b0
>> [ 6458.234774] [c0000002acb23d00] [c00000000019ceac] atomic_notifier_call_chain+0x2c/0x40
>> [ 6458.234788] [c0000002acb23d20] [c0000000000d69b4] opal_message_notify+0xf4/0x2c0
>> [...]
>>
>> Split the copy to avoid false positive run-time warning.
>>
>> Reported-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
>> Signed-off-by: Mahesh Salgaonkar <mahesh at linux.ibm.com>
>
> I hit this on a box running the Ubuntu 6.2.0-27-generic kernel.
>
> Do we plan on merging this fix?

I thought it was papering over the issue rather than fixing the root
cause.

I'll send a new version, as soon as I can work out how to trigger that
code path.

cheers


More information about the Linuxppc-dev mailing list