https://bugs.kde.org/show_bug.cgi?id=513257
--- Comment #5 from Mark Wielaard <[email protected]> --- (In reply to mcermak from comment #4) > (In reply to Mark Wielaard from comment #3) > > +POST(sys_lsm_list_modules) > > +{ > > + POST_MEM_WRITE((Addr)ARG2, sizeof(__vki_u32)); > > + POST_MEM_WRITE(ARG1, *(__vki_u32 *)ARG2); > > +} > > > > The first POST_MEM_WRITE is correct, the kernel will write out the actual > > size used. But also redundant because the value is (should) already (be) > > defined when going into the syscall. The value might change, but whether or > > not it is defined doesn't. > > Just to make sure I'm getting this right: Does the above mean that for > memcheck's ARG2 memory bookkeeping purposes, the > PRE_MEM_READ("lsm_list_modules(size)", ARG2, sizeof(__vki_u32)); is > sufficient, and for that exact reason POST_MEM_WRITE((Addr)ARG2, > sizeof(__vki_u32)); can be dropped? Doesn't memcheck need to track memory > reads separately from memory writes? Yes. What memcheck tracks is whether the address is accessible and whether the value at the address is defined. Technically the POST_MEM_WRITE isn't redundant. Whatever the value was (and whether it was defined or not) after the syscall it will have a defined value, because the kernel will have written to it (if it was addressable). But if that (new) value is derived from an undefined input value then I think we shouldn't really count it as properly defined. It doesn't really hurt though. The user will get a warning going into the syscall if the value at ARG2 isn't defined. And that might be enough. We can certainly pretend that afterwards the value is properly defined if the syscall succeeds (by accident). -- You are receiving this mail because: You are watching all bug changes.
