From patchwork Wed Jun 8 13:30:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 69667 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2526917qgf; Wed, 8 Jun 2016 07:29:28 -0700 (PDT) X-Received: by 10.200.51.35 with SMTP id t32mr1002984qta.91.1465396168676; Wed, 08 Jun 2016 07:29:28 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u45si565466qtb.52.2016.06.08.07.29.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 07:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAeU4-00006D-5q for patch@linaro.org; Wed, 08 Jun 2016 10:29:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZn-0004el-Ab for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZm-0005tH-8E for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:19 -0400 Received: from mail-lf0-x22a.google.com ([2a00:1450:4010:c07::22a]:32774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZm-0005t9-0n for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:18 -0400 Received: by mail-lf0-x22a.google.com with SMTP id s64so5911677lfe.0 for ; Wed, 08 Jun 2016 06:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TGBXdAux0oSbDqTlKe/8x87pwo7ck/PUbf8bpQLnLFk=; b=eAbhLm0I7bzseCDrqzCMs7vMF25mLHxqWkwJ/S9DVI4v6r553GH2vMS+gS3Z2jkfR9 PjmjVaWqD38+YaDYfi7croOTf6ygPoZYze67au3/m0VLywOWUCsMUKMwAUQgl0B0idxa tsCJOiDdjkD4AT4s4a3+PfY9GJ2GmrfSVKOtI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TGBXdAux0oSbDqTlKe/8x87pwo7ck/PUbf8bpQLnLFk=; b=fJSSktM1FQkbYgfE5EmPWJVJ5wztBPuQcAHy5DY8upVUBUGiai7PoTEab+n0KilxkS z3O0C/jd59T/2prUvV0rOFBQmWXxxA1P7zFRJr2WKUWvbb2kbeT1t7OOII9tH0+Te2NF g1Q/2fH+2zb1158qgqaG2PJUuptDcz8wKYnN0tBJ5VRCETKJVlqJN+pLEV6C/aW2wzIZ g+huuN31xBjF7lAuDOZekL1syQpPE+9gQHaO2mmtMDA/d5XYGcnFExBiweErNMNzcY3c HD908HAhbVbJ4KuDMP8hVYFZ9DfzTVn2LMamJPR0UtOKiZ82hZsUBhr3GUqB6AjjNuw9 1BnQ== X-Gm-Message-State: ALyK8tKX0yz0gLs+y53irqJcyzhpypVISJvAIoKdDvJrdi4sun+PoihfOPjxcM+50ZSBg/M1 X-Received: by 10.46.71.206 with SMTP id u197mr963984lja.16.1465392677116; Wed, 08 Jun 2016 06:31:17 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.31.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:16 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:22 +0300 Message-Id: <8efb2ed5ec192f7e83c5e48753e695d5cbc161b2.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22a Subject: [Qemu-devel] [PULL 41/44] linux-user: Correct signedness of target_flock l_start and l_len fields X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The l_start and l_len fields in the various target_flock structures are supposed to be '__kernel_off_t' or '__kernel_loff_t', which means they should be signed, not unsigned. Correcting the structure definitions means that __get_user() and __put_user() will correctly sign extend them if the guest is using 32 bit offsets and the host is using 64 bit offsets. This fixes failures in the LTP 'fcntl14' tests where it checks that negative seek offsets work correctly. We reindent the structures to drop hard tabs since we're touching 40% of the fields anyway. RV: long long -> abi_llong as suggested by Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall_defs.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) -- 2.1.4 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 124754f..6ee9251 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2289,34 +2289,34 @@ struct target_statfs64 { #endif struct target_flock { - short l_type; - short l_whence; - abi_ulong l_start; - abi_ulong l_len; - int l_pid; + short l_type; + short l_whence; + abi_long l_start; + abi_long l_len; + int l_pid; }; struct target_flock64 { - short l_type; - short l_whence; + short l_type; + short l_whence; #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) - int __pad; + int __pad; #endif - unsigned long long l_start; - unsigned long long l_len; - int l_pid; + abi_llong l_start; + abi_llong l_len; + int l_pid; } QEMU_PACKED; #ifdef TARGET_ARM struct target_eabi_flock64 { - short l_type; - short l_whence; - int __pad; - unsigned long long l_start; - unsigned long long l_len; - int l_pid; + short l_type; + short l_whence; + int __pad; + abi_llong l_start; + abi_llong l_len; + int l_pid; } QEMU_PACKED; #endif