From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8SPWONUL6mrIbgsAWB0awg (envelope-from ) for ; Tue, 03 Nov 2026 11:29:09 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BbGhJNgk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E55981E052; Tue, 03 Nov 2026 11:29:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DCCFD1E052 for ; Tue, 03 Nov 2026 11:29:08 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B8664B99F56 for ; Tue, 3 Nov 2026 16:29:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B8664B99F56 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BbGhJNgk Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id A343C4BA23E9 for ; Tue, 3 Nov 2026 16:27:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A343C4BA23E9 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A343C4BA23E9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793723249; cv=none; b=ckyq1G0iioP3v9keJIGhwy8qqnzFj7jsWESRV9ci8WCuDa1tMNGcaDIFRhJpmq0ZJdsPssbt/gNHWAejy/cYQQhVsPHO+8oxCzoEmDCrxyjT/1MYBetKjEjctulkYET18qbXfC3HU1E6KgFX8BFHPXfdFiuoojKJmZeIwMlp5PY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793723249; c=relaxed/simple; bh=l2avoPPKjGDq8E7tsXAZFvMF+sFiTZFXV/dOCL0Zotg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=F/Jtjzs49MwEs8d2SpL6SSuCsxwHREL/IXRNpqv69glfZEJm8X6yThSVvS0YkEl87i73SNRAZ5wc+tTcXmOsGb/X+/GKnlmGUgNJK1IKyBKi4uGLkl/xvuzWvwJ8noGn8BVDGbCvaoVtHpFJIB5Rjf4JkCSXou2gnSOQAmrcljo= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BbGhJNgk DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A343C4BA23E9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793723249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=59sRgHdp6CxnAMO0GxoP637mBcy6jnLmqxyENzmjxsA=; b=BbGhJNgk+WPC8DYdW5wED5mJ00MasOvti6/VkfgzbHjPbj6s2m8ZIIfhUB3nIOGNoj6yCI 2GkMBxtBejK5qkvLEtrHZIqdX/Xvzq8z4ugZXf9HLtidu47eMQSuzkUDJF+Tut/fyLUnr1 7tX8vj1/PefniDpNsEHp3icrmO0k+3E= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-3kMxRSojOvCUmUYJz0usug-1; Tue, 03 Nov 2026 11:27:28 -0500 X-MC-Unique: 3kMxRSojOvCUmUYJz0usug-1 X-Mimecast-MFC-AGG-ID: 3kMxRSojOvCUmUYJz0usug_1793723247 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e0461e040so3701796f8f.0 for ; Tue, 03 Nov 2026 08:27:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793723247; x=1794328047; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=59sRgHdp6CxnAMO0GxoP637mBcy6jnLmqxyENzmjxsA=; b=kl4dWKoK07ZonDgH6Cvwmvb8jF8v+dcg7IYJJa6eQcIdFXtY4Se7gfqIKM0BI6Yye5 tfVF6EI9jgBQ66+hybTGg3hoBONZp+oXBCBBr00UH0U+KNL2qk+2+/slT8BBi4Y9rkR/ UD1q5CewR7JOw3NGqbcQC+jEfmtFBzAXHo+i4Of5Mqj5kyEq/oHb5R6nUkH9SQnKhVMn vZzgnnI74zXNXPikpObqq7Tqss2WymUcbAJYHu+NppAbyQ6E4Xg7hG5CpvEaXW5aWnQ1 zZeRSjWJgiqyBB1ugW5O/+hNxEdwHedcsCJaYg4Y32g8lhgcuqboyu1h6vKX8UwZfD2X WaWQ== X-Forwarded-Encrypted: i=1; AKwUvBzqArysE2AqFcXW33bjKhLXokikfqn2wEgM/YfEPHOugcz6E4LSdcxR+m5KSXY+WWpZtccgcFBkQH1fyA==@sourceware.org X-Gm-Message-State: APuU4Z/el77zTq7siDD14+IWLD48EBvlJhopWMGAtwku/oU0nzWblWCI XLxe0+oPwvd4T2QGuk+p+SqqurPxPrMJFiQD1byGw2qxDFirdaiJX6F7Rrmmyr2IEf6BjkH9UWF ArQWGurcDRXHQzAiyCKnRBG6Eeur8zXUC3uhUm5AVlHLK50li2miDBmFG6bMOG/s= X-Gm-Gg: AYBFou1p6zA9eDTVQ2U/7fLK1Vh1hFIweNg5rEk6jtI9/gBPN7HRFNjF+I/uW4k3+cw rY8Zr05T0INo3r5j7xWqMvBPHOrrnrm98UNt2Uh8rVUhSOxk5ES14pzGcEUs4hQeMrLF15SeO5v T+l4v9N6JWcoCFL6zRL5LOOCdtJLrqgWoSZ77WF6H4y1QJc20386RHOVZuNLh1ZgKZZTeqKDWBK XLTN6y+c4HLzMUDl3OELtB+5OD/rO25S64awNgJTglL9ZzyDCLhyiuW4VxHBfViLAUjrFQAquGG +dKsfAgQaA5OXj9rliVeePNDWQ45M4aDMkZcj1Xwk8bIkBCAoojJycdQY8tzBrLKWuH/UJax7A/ /QfW38D4Cb9nmcmWuZzR8vv3FFpF09PSR64R0d0Y0ww== X-Received: by 2002:a05:6000:4a19:b0:48c:4442:54e with SMTP id ffacd0b85a97d-48e6e4f4405mr28268366f8f.30.1793723246946; Tue, 03 Nov 2026 08:27:26 -0800 (PST) X-Received: by 2002:a05:6000:4a19:b0:48c:4442:54e with SMTP id ffacd0b85a97d-48e6e4f4405mr28268304f8f.30.1793723246484; Tue, 03 Nov 2026 08:27:26 -0800 (PST) Received: from localhost ([213.31.44.62]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b8011csm29375402f8f.31.2026.11.03.08.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2026 08:27:25 -0800 (PST) From: Andrew Burgess To: Abhay Kandpal , gdb-patches@sourceware.org Cc: Ulrich.Weigand@de.ibm.com, eliz@gnu.org, cel@linux.ibm.com, abhay.k@ibm.com, Abhay Kandpal Subject: Re: [PATCH v4 1/2] gdbserver: widen the stat fields returned by the vFile packets In-Reply-To: <20261029092124.233055-2-abhay@linux.ibm.com> References: <20261029092124.233055-1-abhay@linux.ibm.com> <20261029092124.233055-2-abhay@linux.ibm.com> Date: Tue, 03 Nov 2026 16:27:24 +0000 Message-ID: <877bit7udv.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: bkdSbmRBmz7NlTNd5nV8G-nFC4KZP84hSk5eO4u7IOk_1793723247 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Abhay Kandpal writes: > @@ -48816,6 +48831,41 @@ Note that due to size differences between the host, target, and protocol > representations of @code{struct stat} members, these members could eventually > get truncated on the target. > > +@node struct stat64 > +@unnumberedsubsubsec struct stat64 > +@cindex struct stat64, in file-i/o protocol > + > +When the @samp{stat64} feature has been negotiated, the buffer returned > +by the @samp{vFile:fstat}, @samp{vFile:stat} and @samp{vFile:lstat} > +packets uses the following representation instead: > + > +@smallexample > +struct stat64 @{ > + uint64_t st_dev; /* device */ > + uint64_t st_ino; /* inode */ > + mode_t st_mode; /* protection */ > + uint64_t st_nlink; /* number of hard links */ > + unsigned int st_uid; /* user ID of owner */ > + unsigned int st_gid; /* group ID of owner */ > + uint64_t st_rdev; /* device type (if inode device) */ > + uint64_t st_size; /* total size, in bytes */ > + uint64_t st_blksize; /* blocksize for filesystem I/O */ > + uint64_t st_blocks; /* number of blocks allocated */ > + uint64_t st_atime; /* time of last access */ > + uint64_t st_mtime; /* time of last modification */ > + uint64_t st_ctime; /* time of last change */ > +@}; > +@end smallexample In the '@node strut stat' we have this text: The integral datatypes conform to the definitions given in the appropriate section (see @ref{Integral Datatypes}, for details) so this structure is of size 64 bytes. The 'Integral Datatypes' section gives some definitions for on the wire data types. uint64_t is not defined here, but 'long' and 'unsigned long' are defined as the 64-bit type. I think you should update the struct definition here to use the existing type. It might be a good idea to include that same boilerplate paragraph, but with the size updated from 64 to 92. > @@ -179,19 +204,27 @@ host_to_bigendian (LONGEST num, char *buf, int bytes) > buf[i] = (num >> (8 * (bytes - i - 1))) & 0xff; > } > > -/* Pack a host-format integer into an fio_uint_t. */ > +/* Pack a host-format integer into an fio_uint_t, warning if the value > + does not fit. */ > > static inline void > host_to_fileio_uint (long num, fio_uint_t fnum) > { > + if ((ULONGEST) num > 0xffffffff) > + warning (_("file-i/o: value %s does not fit in 32 bits and will be " > + "truncated"), plongest (num)); I have similar feedback to Ulrich here, but reach a slightly different conclusion. I also see an additional problem in addition to the truncation that Ulrich pointed out, on hosts where 'long' is 4-bytes, this warning could trigger incorrectly. A 32-bit negative value with the top bit set, when sign-extended to a 64-bit unsigned will have all of the top 32-bits set, which will trigger this warning when it shouldn't. My gut says that host_to_fileio_uint should take NUM as ULONGEST, it's mostly being called for unsigned fields anyway. We can always add an additional helper host_to_fileio_int which takes a LONGEST for signed fields. Thanks, Andrew