From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22554 invoked from network); 1 Aug 2022 17:50:25 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 1 Aug 2022 17:50:25 -0000 Received: (qmail 1318 invoked by uid 550); 1 Aug 2022 17:50:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1277 invoked from network); 1 Aug 2022 17:50:21 -0000 Date: Mon, 1 Aug 2022 13:50:09 -0400 From: Rich Felker To: "Alex Xu (Hello71)" Cc: musl@lists.openwall.com Message-ID: <20220801175008.GP7074@brightrain.aerifal.cx> References: <20220701150910.347715-1-alex_y_xu.ref@yahoo.ca> <20220701150910.347715-1-alex_y_xu@yahoo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701150910.347715-1-alex_y_xu@yahoo.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] use __scc and unsigned long for socketcall On Fri, Jul 01, 2022 at 11:09:10AM -0400, Alex Xu (Hello71) wrote: > otherwise, pointer arguments are sign-extended on x32, resulting in > EFAULT. > --- > src/internal/syscall.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/src/internal/syscall.h b/src/internal/syscall.h > index 4f41e1dc..7c74775c 100644 > --- a/src/internal/syscall.h > +++ b/src/internal/syscall.h > @@ -58,22 +58,22 @@ hidden long __syscall_ret(unsigned long), > #define __syscall_cp(...) __SYSCALL_DISP(__syscall_cp,__VA_ARGS__) > #define syscall_cp(...) __syscall_ret(__syscall_cp(__VA_ARGS__)) > > -static inline long __alt_socketcall(int sys, int sock, int cp, long a, long b, long c, long d, long e, long f) > +static inline long __alt_socketcall(int sys, int sock, int cp, syscall_arg_t a, syscall_arg_t b, syscall_arg_t c, syscall_arg_t d, syscall_arg_t e, syscall_arg_t f) > { OK. > long r; > if (cp) r = __syscall_cp(sys, a, b, c, d, e, f); > else r = __syscall(sys, a, b, c, d, e, f); > if (r != -ENOSYS) return r; > #ifdef SYS_socketcall > - if (cp) r = __syscall_cp(SYS_socketcall, sock, ((long[6]){a, b, c, d, e, f})); > - else r = __syscall(SYS_socketcall, sock, ((long[6]){a, b, c, d, e, f})); > + if (cp) r = __syscall_cp(SYS_socketcall, sock, ((unsigned long[6]){a, b, c, d, e, f})); > + else r = __syscall(SYS_socketcall, sock, ((unsigned long[6]){a, b, c, d, e, f})); > #endif > return r; Does this part have any functional change or purpose? I'm not seeing it. > } > #define __socketcall(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 0, \ > - (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) > + __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f)) > #define __socketcall_cp(nm, a, b, c, d, e, f) __alt_socketcall(SYS_##nm, __SC_##nm, 1, \ > - (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) > + __scc(a), __scc(b), __scc(c), __scc(d), __scc(e), __scc(f)) > > /* fixup legacy 16-bit junk */ Looks good. Rich