[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#822179: xorg: X.Org X Server starts normally, crashes with Segmentation fault on starting any application



Hello,

James Clarke, on Sat 23 Apr 2016 14:44:52 +0100, wrote:
> I have attached a proposed patch which ensures XFD_SETSIZE never
> exceeds FD_SETSIZE.

Did you test it?

AIUI, nothing uses XFD_SETSIZE actually, it's just the default value
that X uses for FD_SETSIZE in case it's not already defined. I.e. your
change doesn't actually change anything: if FD_SETSIZE is define on
poll.h inclusion, it'll be used, not 512.  What probably actually breaks
is the

(howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) ||

lines when FD_SETSIZE is not big enough.  Probably these can be made
conditioned by the value of FD_SETSIZE, something like:

#if FD_SETSIZE >= 512
#define XFD_ANYSET_512(p) \
       ((howmany(FD_SETSIZE, NFDBITS) > 8 && (__XFDS_BITS(p, 8))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 9 && (__XFDS_BITS(p, 9))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 10 && (__XFDS_BITS(p, 10))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 11 && (__XFDS_BITS(p, 11))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 12 && (__XFDS_BITS(p, 12))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 13 && (__XFDS_BITS(p, 13))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 14 && (__XFDS_BITS(p, 14))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 15 && (__XFDS_BITS(p, 15))))
#else
#define XFD_ANYSET_512(p) 0
#endif

#define XFD_ANYSET(p) \
       ((howmany(FD_SETSIZE, NFDBITS) > 0 && (__XFDS_BITS(p, 0))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 1 && (__XFDS_BITS(p, 1))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 2 && (__XFDS_BITS(p, 2))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 3 && (__XFDS_BITS(p, 3))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 4 && (__XFDS_BITS(p, 4))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 5 && (__XFDS_BITS(p, 5))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 6 && (__XFDS_BITS(p, 6))) || \
        (howmany(FD_SETSIZE, NFDBITS) > 7 && (__XFDS_BITS(p, 7))) || \
	XFD_ANYSET_512(p))

Samuel


Reply to: