This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bounds checking ioctl data


I have the following defined in sysdeps/generic/bp-checks.h:

------------------------------------------------------------------------------
#  if defined (_IOC_SIZESHIFT) && defined (_IOC_SIZEBITS)

/* Extract the size of the ioctl parameter argument and check its bounds.  */
#   define CHECK_IOCTL(ARG, CMD) \
  CHECK_N ((ARG), (((CMD) >> _IOC_SIZESHIFT) & ((1 << _IOC_SIZEBITS) - 1)))

#  else
#   define CHECK_IOCTL(ARG, CMD) __ptrvalue (ARG)
#  endif
------------------------------------------------------------------------------

The problem is that _IOC_SIZEBITS and _IOC_SIZESHIFT are not defined
in glibc, but rather in the OS kernel sources.  In order to make these
work, should I clone these definitions in glibc?  If so, where?
Should it go in a file that's private to glibc, or should it be public
so that conflicting definitions in the glibc part and the OS part will
trigger diagnostics.

Please advise.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]