From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [212.27.42.4]) by sourceware.org (Postfix) with ESMTPS id 032853858CDB for ; Fri, 30 Sep 2022 16:29:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 032853858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=opteya.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=opteya.com Received: from [IPV6:2a01:e35:39f2:1220:8ac6:b523:a987:2b83] (unknown [IPv6:2a01:e35:39f2:1220:8ac6:b523:a987:2b83]) by smtp4-g21.free.fr (Postfix) with ESMTPS id D430819F5BE; Fri, 30 Sep 2022 18:29:26 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------AYLFRBCxx2FscjFgqWEyMmmu" Message-ID: <55da3486-8246-c18f-4676-569c385b968d@opteya.com> Date: Fri, 30 Sep 2022 18:29:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Content-Language: fr-FR To: Wilco Dijkstra , Adhemerval Zanella , "libc-alpha@sourceware.org" , Yu Chien Peter Lin References: <20220929192756.3310704-1-adhemerval.zanella@linaro.org> <20220929192756.3310704-2-adhemerval.zanella@linaro.org> From: Yann Droneaud Organization: OPTEYA In-Reply-To: X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,HTML_MESSAGE,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------AYLFRBCxx2FscjFgqWEyMmmu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Le 30/09/2022 à 17:09, Wilco Dijkstra via Libc-alpha a écrit : > Hi Adhemerval, > > This looks good to me assuming Hurd is 32-bit only. > > Reviewed-by: Wilco Dijkstra > > Cheers, > Wilco > > > From: Adhemerval Zanella > > Use INTERNAL_SYSCALL_CALL instead of INLINE_SYSCALL_CALL.  This > requires emulate the semantic for hurd call (so __arc4random_buf > uses the fallback). > > Checked on x86_64-linux-gnu. > --- > diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h > index ae58b734e3..5d2d2b4b8a 100644 > --- a/sysdeps/mach/hurd/not-cancel.h > +++ b/sysdeps/mach/hurd/not-cancel.h > @@ -25,6 +25,7 @@ >  #include >  #include >  #include > +#include >  #include >  #include > > @@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel; >  #define __fcntl64_nocancel(...) \ >    __fcntl_nocancel (__VA_ARGS__) > > -#define __getrandom_nocancel(buf, size, flags) \ > -  __getrandom (buf, size, flags) > +static inline int ssize_t > +__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) > +{ > +  int save_errno = errno; > +  int r = __getrandom (buf, buflen, flags); ssize_t r > +  r = r == -1 ? -errno : r; > +  __set_errno (save_errno); > +  return r; > +} > Regards. -- Yann Droneaud OPTEYA --------------AYLFRBCxx2FscjFgqWEyMmmu--