[lkml]   [2006]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [Patch][RFC] Disabling per-tgid stats on task exit in taskstats
    Paul Jackson wrote:

    >Shailabh wrote:
    >>I don't know if there are buffer overflow
    >>issues in passing a string
    >I don't know if this comment applies to "the standard netlink way of
    >passing it up using NLA_STRING", but the way I deal with buffer length
    >issues in the cpuset code is to insist that the user code express the
    >list in no fewer than 100 + 6 * NR_CPUS bytes:
    >From kernel/cpuset.c:
    > /* Crude upper limit on largest legitimate cpulist user might write. */
    > if (nbytes > 100 + 6 * NR_CPUS)
    > return -E2BIG;
    >This lets the user specify the buffer size passed in, but prevents
    >them from trying a denial of service attack on the kernel by trying
    >to pass in a huge buffer.
    >If the user can't figure out how to write the desired cpulist in
    >that size, then tough toenails.

    Perhaps I should use the the other ascii format for specifying cpumasks
    since its more amenable
    to specifying an upper bound for the length of the ascii string and is
    more compact ?

    That format (the one used in lib/bitmap.c:bitmap_parse) is comma
    separated chunks of hex digits
    with each chunk specifying 32 bits of the desired cpumask.

    ((NR_CPUS + 32) / 32) * 8 + 1
    (8 hex characters for each 32 cpus, and 1 extra character for null
    would be an upper bound that would accomodate all the cpus for sure.

    Thoughts ?


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-07-04 02:11    [W:0.020 / U:7.992 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site