Re: [PATCH] Fix user data corrupted by old value return of sysctl



Yi Yang wrote:
>If the user reads a sysctl entry which is of string type
> by sysctl syscall, this call probably corrupts the user data
> right after the old value buffer, the issue lies in sysctl_string
> seting 0 to oldval[len], len is the available buffer size
> specified by the user, obviously, this will write to the first
> byte of the user memory place immediate after the old value buffer
>, the correct way is that sysctl_string doesn't set 0, the user
>should do it by self in the program.

That's not just data corruption -- it's also a buffer overrun.
Granted, it's "only" a one-byte overrun, but I have seen one-byte
overruns be exploitable occasionally in the past. So this sounds
to me like a potential security issue, too.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Linux 2.6.17-rc2
    ... using the reference counting and VM traversal to actually fill the ... user-space buffer it spliced into the kernel-space one (contrast this ... Do we plan to do vmsplice() to sockets? ... vmsplicereally just fills the pipe with the user data, ...
    (Linux-Kernel)
  • Re: [PATCH] Fix user data corrupted by old value return of sysctl
    ... > On Fri, 30 Dec 2005, Yi Yang wrote: ... >> If the user reads a sysctl entry which is of string type ... >> byte of the user memory place immediate after the old value buffer, ...
    (Linux-Kernel)
  • Re: [PATCH] Fix VIDIOCGAP corruption in ivtv
    ... VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names ... that are too long and does not truncate them so corrupts a few bytes ... Mike, this one should obviously go into a 2.6.25 dot-release, and I ...
    (Linux-Kernel)
  • Re: [PATCH] Fix user data corrupted by old value return of sysctl
    ... >> If the user reads a sysctl entry which is of string type ... >> byte of the user memory place immediate after the old value buffer, ... > instead of adding one to the length of the string, ... Always do zero-pad please. ...
    (Linux-Kernel)
  • Re: [PATCH] Fix user data corrupted by old value return of sysctl
    ... > If the user reads a sysctl entry which is of string type ... > right after the old value buffer, ... at least if the result fits in the buffer. ...
    (Linux-Kernel)