Bug 27892 - powerpc: scv ABI error handling fails to check IS_ERR_VALUE
Summary: powerpc: scv ABI error handling fails to check IS_ERR_VALUE
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.33
: P2 normal
Target Milestone: 2.34
Assignee: Matheus Castanho
URL: https://sourceware.org/pipermail/libc...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-20 14:23 UTC by Dmitry V. Levin
Modified: 2021-05-24 20:26 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc64*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry V. Levin 2021-05-20 14:23:04 UTC
Commit glibc-2.33~117 introduced RET_SCV macro that treats any negative value returned by syscall via scv ABI as an error, but this is not correct.

This bug was found by strace test suite.

Proposed fix was posted by Nicholas Piggin at
https://sourceware.org/pipermail/libc-alpha/2021-May/126534.html
Comment 1 Matheus Castanho 2021-05-24 20:26:22 UTC
Issue fixed on master for glibc 2.34:

commit 7de36744ee1325f35d3fe0ca079dd33c40b12267 
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Thu May 20 11:00:36 2021 -0300

    powerpc: Fix handling of scv return error codes [BZ #27892]
    
    When using scv for templated ASM syscalls, current code interprets any
    negative return value as error, but the only valid error codes are in
    the range -4095..-1 according to the ABI.
    
    This commit also fixes 'signal.gen.test' strace test, where the issue
    was first identified.
    
    Reviewed-by: Matheus Castanho <msc@linux.ibm.com>


This patch was also backported to 2.33 by commit 0ef0e6de7fdfa18328b09ba2afb4f0112d4bdab4.