Bug 283084 - Kernel land variable and warning message "uninitialised value"
Summary: Kernel land variable and warning message "uninitialised value"
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.7 SVN
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 10:27 UTC by Fred M
Modified: 2011-10-02 18:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fred M 2011-09-30 10:27:49 UTC
Hello All,

I think it is a bug or a usercase not managed

Valgrind is working on userland binary, but what is the impact of the Kernel/driver land ?

By Example : 

int my_tab[100];

ioctl(fd, IOCTL_MY_FUNC , &my_tab )

if ( my_tab[0] != my_value ) 

I have a warning on the if condition.  ==720== Conditional jump or move depends on uninitialised value(s)

I check in my driver source code and the value is set.

But I am asking, if is it possible to remove the wrong warning ? 
   Conditional jump or move depends on uninitialised value(s)


Best Regards,
Frédéric
Comment 1 Tom Hughes 2011-09-30 10:51:55 UTC
You will need to teach valgrind about your ioctl as it has to be told what bytes each system call reads/writes (see the code in coregrind/m_syswrap).

Alternatively make sure your ioctl number correctly encodes the size and direction hints so that valgrind can use those to work out what is read/written.

If this is an ioctl that is part of mainstream kernel.org kernels then we can probably help if you tell us what ioctl it is, but as things stand there is no information here that would allow us to make any changes to valgrind so I am closing this.
Comment 2 Fred M 2011-09-30 12:27:34 UTC
It s little bit confused.

I am working on my own ioctl/driver
#define MY_DRIVER_GET_EVENT   _IOR (MY_DRIVER_MAGIC_NUMBER, 1, my_structure)

in the "coregrind/m_syswrap" I just see a line
    LINXY(__NR_ioctl,             sys_ioctl),   

What do you mean by teach to valgrind ?
Comment 3 Fred M 2011-09-30 12:35:47 UTC
oh I see, 

Should I redevelop the function PRE(sys_ioctl)

With all my case, 

   case VKI_MY_DRIVER_GET_EVENT:
      PRE_MEM_READ( "ioctl(MY_DRIVER_GET_EVENT)", ARG3, sizeof(my_structure) );


Is there any script to do it ?  ( parsing the headerq where I define my ioctl, and transode in C ? )

Best Regards,
Frédéric
Comment 4 Tom Hughes 2011-09-30 12:49:29 UTC
Yes, you would need to change PRE(sys_ioctl) and POST(sys_ioctl). See README_MISSING_SYSCALL_OR_IOCTL for more information.
Comment 5 Christian Borntraeger 2011-09-30 18:51:26 UTC
> I am working on my own ioctl/driver
> #define MY_DRIVER_GET_EVENT   _IOR (MY_DRIVER_MAGIC_NUMBER, 1, my_structure)

Actually as long as _IOR is correctly describing the interaction, valgrind 
should handle that already, no?
Comment 6 Tom Hughes 2011-09-30 19:33:53 UTC
Yes, which is what I said in my first reply ;-)
Comment 7 Fred M 2011-10-02 18:48:22 UTC
But I declare correctly my ioctl ? 
and I set the variable in my driver. I will try to add some logs in valgrind tomorrow.