| Summary: | valgrind VT_GETSTATE error | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Garrett D'Amore <garrett_damore> |
| Component: | general | Assignee: | Nicholas Nethercote <njn> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | njn |
| Priority: | NOR | ||
| Version First Reported In: | 3.2.1 | ||
| Target Milestone: | blocking3.5.0 | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Committed as r10437. Thanks for the report; sorry it took so long to be fixed. |
The handler for VT_GETSTATE assumes that the state structure is read by the Linux kernel. It is not; and it is perfectly reasonable to pass it an unitialized structure. On exit, only two fields are initialized on return, but valgrind gets that part right. Here's the diff: Index: coregrind/m_syswrap/syswrap-generic.c =================================================================== --- coregrind/m_syswrap/syswrap-generic.c (revision 6412) +++ coregrind/m_syswrap/syswrap-generic.c (working copy) @@ -3992,7 +3992,6 @@ PRE_MEM_READ( "ioctl(VT_SETMODE)", ARG3, sizeof(struct vki_vt_mode) ); break; case VKI_VT_GETSTATE: - PRE_MEM_READ( "ioctl(VT_GETSTATE)", ARG3, sizeof(struct vki_vt_stat) ); PRE_MEM_WRITE( "ioctl(VT_GETSTATE).v_active", (Addr) &(((struct vki_vt_stat*) ARG3)->v_active), sizeof(((struct vki_vt_stat*) ARG3)->v_active));