Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fabian Kilger <kilger@sec.in.tum.de>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2][PR GDB/32956] gdb: implement linux namespace support for fileio_stat
Date: Wed, 11 Jun 2025 17:06:55 +0200	[thread overview]
Message-ID: <16834303-10e1-4244-a858-6d93e3c9cd7c@sec.in.tum.de> (raw)
In-Reply-To: <87wm9iha5l.fsf@redhat.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 2848 bytes --]


On 6/11/25 11:58, Andrew Burgess wrote:
> Andrew Burgess <aburgess@redhat.com> writes:
> 
>> Fabian Kilger <kilger@sec.in.tum.de> writes:
>>
>>> While looking at it, I've noticed all implementations of stat functions
>>> actually use lstat and not stat. This maybe should be modified in the
>>> namespace case as well and I'll be changing this for v2. However, I
>>> could not directly find a rationale behind why *_stat functions call
>>> lstat instead. Possibly, it might make sense renaming the
>>> target_fileio_stat to target_fileio_lstat as well, though this would be
>>> an independent change.
>>
>> Without digging into the history I say for sure why it's lstat over
>> stat.
>>
>> I agree with you that renaming the API might make some sense, though I
>> suspect we're really a little stuck, the remote protocol packet is
>> called 'stat', which is unfortunate, we cannot really change that.
> 
> OK, so I dug into the history, and it would appear that (a) it was just
> a mistake, and (b) it was all my fault :-/
> 
> The code in question does want lstat, so really the whole API should
> have been called lstat.
> 
> Most of this can easily be fixed, but the remote protocol part we're
> unfortunately stuck with.  Though I wonder if we can "fix" this by just
> have a 'stat' and 'lstat' remote protocol packet, change 'stat' to do an
> actual 'stat', then on the GDB side we'll change the internal target API
> to be called 'lstat'.  This would effectively orphan the remote 'stat'
> packet, as nobody would use it, but that's OK I think, and only minimal
> overhead.  I'll take a look at rolling something like this together.
> 
> For you, right now, you should name your functions 'stat', but do an
> 'lstat' to be consistent.
> 
> Thanks,
> Andrew
> 

Following the same logic of '"correct" style takes precedent over
matching "incorrect" style', would it not make sense to start using
lstat in the name for those functions that actually perform lstat? The
code would be overall more clear if the functions are called _lstat and
perform lstat imo. In case a 'lstat' remote protocol packet will be
added, it would also be already clear if the existing functions are
already named lstat. Especially in the namespace helper code and the
communication protocol this lstat/stat name confusion would spread in a
call chain of like 5 functions.

Maybe my point would be more clear if I submit the current version of
the patch.

Best,
Fabian


-- 
Fabian Kilger, M.Sc.
Wissenschaftlicher Mitarbeiter

Technische Universität München
TUM School of Computation, Information and Technology
Chair of IT Security

Boltzmannstraße 3
Raum 01.08.053
85748 Garching (bei München)

Tel. +49 (0)89 289-18587
Fax +49 (0)89 289-18579

kilger@sec.in.tum.de
www.sec.in.tum.de

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 653 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  parent reply	other threads:[~2025-06-11 15:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-11 15:01 [PATCH 0/2][PR GDB/32956] gdb: fix GDB failing to find build-id debug files in linux mount namespaces Fabian Kilger
2025-05-11 15:01 ` [PATCH 1/2][PR GDB/32956] gdb: implement linux namespace support for fileio_stat Fabian Kilger
2025-05-23 18:14   ` Andrew Burgess
2025-05-24 20:25     ` Fabian Kilger
2025-06-11  9:43       ` Andrew Burgess
2025-05-24 10:46   ` Andrew Burgess
2025-05-24 19:43     ` Fabian Kilger
2025-05-24 20:43       ` Fabian Kilger
2025-06-11  9:47         ` Andrew Burgess
2025-06-11  9:58           ` Andrew Burgess
2025-06-11 13:29             ` Tom Tromey
2025-06-11 14:47               ` Andrew Burgess
2025-06-11 17:45                 ` Tom Tromey
2025-06-11 15:06             ` Fabian Kilger [this message]
2025-05-11 15:01 ` [PATCH 2/2][PR GDB/32956] gdb: query inferior's filesystem for build-id debug files Fabian Kilger
2025-05-23 18:20   ` Andrew Burgess
2025-05-24 19:54     ` Fabian Kilger
2025-06-10  9:10       ` Andrew Burgess
2025-06-11  8:11         ` Fabian Kilger
2025-06-11  9:35           ` Andrew Burgess
2025-06-11 14:00             ` Simon Marchi
2025-05-30 19:50 ` [PATCH 0/2][PR GDB/32956] gdb: fix GDB failing to find build-id debug files in linux mount namespaces Tom Tromey
2025-06-10 17:02   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16834303-10e1-4244-a858-6d93e3c9cd7c@sec.in.tum.de \
    --to=kilger@sec.in.tum.de \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox