From patchwork Wed Dec 24 17:16:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Metcalf X-Patchwork-Id: 423977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E4BF514007D for ; Thu, 25 Dec 2014 04:17:18 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=mih P3NtacIJRXEAXKG+sI9uiuuRm42CqhsTd5opE//pdJGcDNIgSWnKDQUmQaLuaqnA lvK3RPH/ztce3Vbyx4JSmDdSNB0jznG+BIoy9vJP4DJLrV+um00PXZVY2ytTRCC1 ivfgIvH6+uhjDBZKeVONBhCdZoEt26JEejYooYGQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=BXU/aTfpB etiP723XvMQ6LE8YcI=; b=xcNf16hSxNtV98BLGPArARCeDuVtTbowwAlyobGew IFU/GdiLDD76NTcHvCPeRSmb3/bc12SwI9vxLlOJtD6ZRgi0ElURfLWp6hdr6pbL mjnZCKSU1YvrWVTPKmcdw1xDFwXWXWqKt0XBCA5QCvPdU43JXM1oAR04R2N9oI7/ u8= Received: (qmail 4401 invoked by alias); 24 Dec 2014 17:17:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 4391 invoked by uid 89); 24 Dec 2014 17:17:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: emea01-db3-obe.outbound.protection.outlook.com Message-ID: <549AF507.2070506@ezchip.com> Date: Wed, 24 Dec 2014 12:16:55 -0500 From: Chris Metcalf User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: GLIBC Devel Subject: [PATCH] check error properly for tile vDSO calls X-ClientProxiedBy: BLUPR07CA0046.namprd07.prod.outlook.com (10.255.223.159) To DB3PR02MB0537.eurprd02.prod.outlook.com (25.160.51.149) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DB3PR02MB0537; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DB3PR02MB0537; X-Forefront-PRVS: 04359FAD81 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(6009001)(199003)(377424004)(189002)(86362001)(33656002)(107886001)(97736003)(4396001)(106356001)(110136001)(20776003)(47776003)(64706001)(15975445007)(77096005)(66066001)(65956001)(87266999)(50986999)(54356999)(36756003)(59896002)(92566001)(105586002)(65816999)(117156001)(42186005)(101416001)(122386002)(77156002)(62966003)(64126003)(120916001)(31966008)(80316001)(19580405001)(68736005)(229853001)(87976001)(65806001)(107046002)(83506001)(450100001)(46102003)(19580395003)(99396003)(40100003)(21056001)(50466002)(23676002)(18886065003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR02MB0537; H:[192.168.1.162]; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ezchip.com does not designate permitted sender hosts) X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:DB3PR02MB0537; X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2014 17:17:05.7974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR02MB0537 The -Werror code pointed out that we were not properly setting the error value for vDSO vsyscalls. Conventionally, tile returns the same "non-negative success, negative errno" value that x86 does (in r0), but it also returns "zero or positive errno" in r1, which is what the regular syscall code checks. This change uses that convention for the vDSO calls as well and fixes the warning. 2014-12-24 Chris Metcalf * sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h: Fix return type for __vdso_* functions in declarations. * sysdeps/unix/sysv/linux/tile/init-first.c: Likewise for definitions. * sysdeps/unix/sysv/linux/tile/sysdep.h (INLINE_VSYSCALL, INTERNAL_VSYSCALL): Use struct return types to check for error. diff --git a/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h index f5b04ba..382ca23 100644 --- a/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h @@ -22,10 +22,18 @@ #ifdef SHARED -extern long int (*__vdso_gettimeofday) (struct timeval *, void *) +struct syscall_return_value +{ + long int value; + long int error; +}; + +extern struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *, + void *) attribute_hidden; -extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *); +extern struct syscall_return_value (*__vdso_clock_gettime) (clockid_t, + struct timespec *); #endif diff --git a/sysdeps/unix/sysv/linux/tile/init-first.c b/sysdeps/unix/sysv/linux/tile/init-first.c index fa39b94..249dc99 100644 --- a/sysdeps/unix/sysv/linux/tile/init-first.c +++ b/sysdeps/unix/sysv/linux/tile/init-first.c @@ -19,9 +19,11 @@ #include #include -long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden; +struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *, void *) + attribute_hidden; -long int (*__vdso_clock_gettime) (clockid_t, struct timespec *) +struct syscall_return_value (*__vdso_clock_gettime) (clockid_t, + struct timespec *) __attribute__ ((nocommon)); strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h index d3b98bd..afecd02 100644 --- a/sysdeps/unix/sysv/linux/tile/sysdep.h +++ b/sysdeps/unix/sysv/linux/tile/sysdep.h @@ -217,7 +217,9 @@ __typeof (__vdso_##name) vdsop = __vdso_##name; \ if (vdsop != NULL) \ { \ - sc_ret = vdsop (args); \ + struct syscall_return_value rv = vdsop (args); \ + sc_ret = rv.value; \ + sc_err = rv.error; \ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ goto out; \ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ @@ -242,7 +244,9 @@ __typeof (__vdso_##name) vdsop = __vdso_##name; \ if (vdsop != NULL) \ { \ - v_ret = vdsop (args); \ + struct syscall_return_value rv = vdsop (args); \ + v_ret = rv.value; \ + err = rv.error; \ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ goto out; \