[Lldb-commits] [PATCH] D95601: [lldb][AArch64] Add memory tag reading to lldb-server
Muhammad Omair Javaid via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 9 06:13:44 PST 2021
omjavaid added inline comments.
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1357
+ if (error.Fail())
+ return error;
> DavidSpickett wrote:
> > DavidSpickett wrote:
> > > omjavaid wrote:
> > > > ptrace request is a success if number of tags requested is not equal to no of tags read? If not then this and following condition may be redundant.
> > > Well ptracewrapper doesn't check the iovec, but I'll check the kernel source to see if it's actually possible for it to fail that way.
> > In `linux/arch/arm64/kernel/mte.c` `__access_remote_tags` there is a comment:
> > ```
> > +/*
> > + * Access MTE tags in another process' address space as given in mm. Update
> > + * the number of tags copied. Return 0 if any tags copied, error otherwise.
> > + * Inspired by __access_remote_vm().
> > + */
> > ```
> > *any tags* being the key words.
> > So the scenario is:
> > * ask to read from addr X in page 0, with length of pagesize+some so the range spills into page 1
> > * kernel can access page 0, reads tags until the end of the page
> > * tries to access page 1 to read the rest, fails, returns 0 (success) since *some* tags were read
> > * we see the ptrace call succeeded but with less tags than we expected
> > I don't see it's worth dealing with this corner case here since lldb will look before it leaps. It would have errored much earlier here because either page 1 isn't in the tracee's memory regions or it wasn't MTE enabled.
> Added a comment in the code too.
This means emitting less than requested number of tags is legit. However we have set tags vector size equal to whatever we have requested. We set error string which is actually not being used anywhere and can be removed in favor of a log message to help with debugging if needed.
Also we need to resize the vector after ptrace request so we use this size in gdb remote reply.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the lldb-commits