From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77964 invoked by alias); 12 Feb 2020 12:35:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 77937 invoked by uid 89); 12 Feb 2020 12:35:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:references:from:autocrypt:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hHppiY7c8Ym2TlOqzk6ESUX1Hge+tOGSa54qhRoMU6g=; b=L1Ibx3y2qIFtnxrptfULZ1cexSooR8vmyJ8bk7Yw/PJcNICEGrsTfgIZP1hfkZCTom /gaWGAj1eBq9/0W1JSX56Ng77KksRgkyFxL4i0CmlERn9FDCBbLZZSVelExdhRArsZxv wc9PEznTCPgUvFDgoFhhVPrU22BL/dAsadZNh0/g7NS9sw/iUgSgbWcyl3/Qwq84CXOX hmwZ/Zm40vyBmxuLEBqdG92ZDB4p7OuytmtBlpWwFcu7fW7jKlhirnf5DkzMB+mjzHpZ +goDb9mUe/NojWTHcBO7qe9XL/7NrLY9i1fDogMHSQAS8P+wY6ZKHXts96N/trY7w2tL J1Zw== Return-Path: To: Florian Weimer Cc: libc-alpha@sourceware.org References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> <20200210192038.23588-3-adhemerval.zanella@linaro.org> <878sl9pe78.fsf@oldenburg2.str.redhat.com> <10c5636d-6ea7-e95c-3a3c-67be298472fd@linaro.org> <874kvxnczu.fsf@mid.deneb.enyo.de> <87tv3wltbb.fsf@mid.deneb.enyo.de> From: Adhemerval Zanella Subject: Re: [PATCH 03/15] sparc: Use Linux kABI for syscall return Message-ID: <7b15c63a-8379-d549-1a31-83803a365c5e@linaro.org> Date: Wed, 12 Feb 2020 12:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <87tv3wltbb.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2020-02/txt/msg00469.txt.bz2 On 11/02/2020 18:15, Florian Weimer wrote: > * Adhemerval Zanella: > >>> But ERESTART_RESTARTBLOCK is not 4095, so glibc with this change will >>> now treat certain internal kernel error codes as errors, while they >>> were previously reported as success. This looks like a kernel bug, in >>> that ERESTART_RESTARTBLOCK was not updated when more error codes were >>> added. On the other hand, these error codes should never leak into >>> userspace. >> >> My understanding is such errors should not be visible by the application, >> as indicated by include/linux/errno.h comment. And it seems to be the >> case for sparc, at least on: > > These error codes tend to leak from device drivers and other less > scrutinized parts of the kernel. It's not actually about the > ERESTART_RESTARTBLOCK value as such, there are other values larger > than that: > > #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ > #define EPROBE_DEFER 517 /* Driver requests probe retry */ > #define EOPENSTALE 518 /* open found a stale dentry */ > #define ENOPARAM 519 /* Parameter not supported */ > > /* Defined for the NFSv3 protocol */ > #define EBADHANDLE 521 /* Illegal NFS file handle */ > #define ENOTSYNC 522 /* Update synchronization mismatch */ > #define EBADCOOKIE 523 /* Cookie is stale */ > #define ENOTSUPP 524 /* Operation is not supported */ > > And so on. > > Like I said, it looks like someone forgot to update this code. It > probably should use the 4095 boundary and not specific error codes > anyway. (We had a similar problem in glibc itself in the s390 > socketcall support.) This code seems to come from since initial git repository (Linux-2.6.12-rc2). >From a glibc standpoint, the error handling will be the same in fact, since what indicates the syscall has failed is the carry condition code value, not the syscall returned value ('o0' register).