dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Fix authentication kernel crash
Date: Wed, 25 Jan 2012 18:26:55 +0100	[thread overview]
Message-ID: <4F203B5F.3030006@vmware.com> (raw)
In-Reply-To: <20120124144743.GE3980@phenom.ffwll.local>

On 01/24/2012 03:47 PM, Daniel Vetter wrote:
> On Tue, Jan 24, 2012 at 10:31:46AM +0100, Thomas Hellstrom wrote:
>> If the master tries to authenticate a client using drm_authmagic and
>> that client has already closed its drm file descriptor,
>> either wilfully or because it was terminated, the
>> call to drm_authmagic will dereference a stale pointer into kmalloc'ed memory
>> and corrupt it.
>>
>> Typically this results in a hard system hang.
>>
>> This patch fixes that problem by removing any authentication tokens
>> (struct drm_magic_entry) open for a file descriptor when that file
>> descriptor is closed.
>>
>> Signed-off-by: Thomas Hellstrom<thellstrom@vmware.com>
> Ok, I've wandered around a bit in this and noticed that the locking is the
> usual convoluted disaster. We seem to randomly grab dev->struct_mutex in
> the auth and master ioctl, but all the real protect seems to be due to
> taking the global mutex in all relevant paths.
>
> I guess I can't volunteer you to clean this up ;-)

It would be pretty easy to make thos ioctls unlocked (we should probably 
also have an idr managing the magic number)
but my wife is having twins in a couple of weeks and
I've got a long list of bugs to fix before that for the vmwgfx launch so I
unfortunately have to pass this time.

/Thomas

  reply	other threads:[~2012-01-25 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24  9:31 [PATCH] drm: Fix authentication kernel crash Thomas Hellstrom
2012-01-24 14:47 ` Daniel Vetter
2012-01-25 17:26   ` Thomas Hellstrom [this message]
2012-01-24 17:12 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2012-01-24 17:54 Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F203B5F.3030006@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox