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

Bug#383465: Contains obfuscated source code, DFSG violation?



On Tue, Aug 29, 2006 at 01:21:26AM +0200, Steinar H. Gunderson wrote:
> On Thu, Aug 17, 2006 at 02:12:17PM +0100, Matthew Garrett wrote:
> > The nv driver appears to be heavily obfuscated and is effectively 
> > The idea that nvidia do not posess an electronic list of register names 
> > and offsets is entirely implausible. The only rational explanation is 
> > that register information is postprocessed out in order to reduce 
> > information leakage. 
> 
> Or that nVidia never wrote the driver in the first place. I cannot find any
> nVidia copyrights on it -- it seems to have been reverse-engineered and then
> written up by the current copyright holders.

The output of the below has been tidied up a bit to remove duplicates:
daniels@endtroducing:~/x/xorg/driver/xf86-video-nv/src% for i in *.[ch]; do echo -n $i:\  ; grep Copyright $i || echo no copyright; done 
nv_const.h: no copyright
nv_cursor.c: |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
nv_dac.c: |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
nv_dga.c: no copyright
nv_dma.h: |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
nv_driver.c:  * Copyright 1996-1997  David J. McKay
nv_hw.c: |*       Copyright 1993-2003 NVIDIA, Corporation.  All rights reserved.      *|
nv_include.h: no copyright
nv_local.h: |*       Copyright 1993-2003 NVIDIA, Corporation.  All rights reserved.      *|
nv_proto.h: no copyright
nv_setup.c: |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
nv_shadow.c:    Copyright (c) 1999,  The XFree86 Project Inc. 
nv_type.h: no copyright
nv_video.c: no copyright
nv_xaa.c: |*       Copyright 2003 NVIDIA, Corporation.  All rights reserved.           *|
nvreg.h:  * Copyright 1996-1997  David J. McKay
nvvga.h:  * Copyright 1996-1997  David J. McKay
riva_const.h: no copyright
riva_cursor.c:  * Copyright 1996-1997  David J. McKay
riva_dac.c:  * Copyright 1996-1997  David J. McKay
riva_dga.c: no copyright
riva_driver.c:  * Copyright 1996-1997  David J. McKay
riva_hw.c: |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
riva_hw.h: |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
riva_include.h: no copyright
riva_local.h: |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
riva_proto.h: no copyright
riva_setup.c:  * Copyright 1996-1997  David J. McKay
riva_shadow.c:    Copyright (c) 1999,  The XFree86 Project Inc. 
riva_tbl.h: |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|
riva_type.h: no copyright
riva_xaa.c: |*       Copyright 1993-1999 NVIDIA, Corporation.  All rights reserved.      *|

So, of those, a few Riva files for the ancient Riva 128 chipset are
copyright David J. McKay as well as nvreg.h and nvvga.h,
riva_shadow.c and nv_shadow.c are copyright XFree86, and
riva_include.h, riva_proto.h, riva_type.h, riva_dga.c, riva_const.h,
nv_video.c, nv_type.h, nv_proto.h, nv_include.h, nv_dga.c,
and nv_const.h have no copyright.  The rest are NVIDIA.

riva_shadow.c and nv_shadow.c implement a 'shadow framebuffer' option,
which isn't about hardware access.  The files were almost certainly just
taken from some other driver, with a quick sed run.

Assuming the dates for David McKay's copyright run correct, they are
almost nine years old now.  nvreg.h does not actually contain register
definitions, but is a fairly trivial set of macros and declaration of a
few pointers to register locations (extern unsigned char *nvDAC, et al).
nvvga.h contains a register definition for the NV1, which was released
in 1995.  All the fun parts of the Riva driver -- and this is for an
ancient chip -- are in NVIDIA-copyrighted files, like riva_hw.c:
    VGA_WR08(chip->PCIO, 0x3D4, 0x19); tmp = VGA_RD08(chip->PCIO, 0x3D5);
    VGA_WR08(chip->PCIO, 0x3D5, (offset & 0x01F) | (tmp & ~0x1F));
    VGA_WR08(chip->PCIO, 0x3D4, 0x2D); tmp = VGA_RD08(chip->PCIO, 0x3D5);
    VGA_WR08(chip->PCIO, 0x3D5, (offset & 0x60) | (tmp & ~0x60));
and riva_tbl.h:
static unsigned nv3TablePRAMIN[][2] =
{
    {0x00000500, 0x00010000},
    {0x00000501, 0x007FFFFF},
    {0x00000200, 0x80000000},
    {0x00000201, 0x00C20341},
    {0x00000204, 0x80000001},
    [...]

But 'nv' is the interesting one, since that supports current
hardware, and nv_hw.c is the one with genius section such as:
    cr11 = VGA_RD08(pNv->PCIO, 0x3D5);
    if(Lock) cr11 |= 0x80;
    else cr11 &= ~0x80;
    VGA_WR08(pNv->PCIO, 0x3D5, cr11);

Sadly this isn't even remotely out of the ordinary for the nv driver:
it's one of the most benign sections I could find in the first function
of nv_hw.c.

For recent history, looking at:
http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-nv.git;a=shortlog
you can see that all code commits have been made either by Aaron
Plattner (an NVIDIA employee, as you can see from his email address,
also you can google him on site:lists.freedesktop.org to see him
offering to maintain nv), or by Mark Vojkovitch (another NVIDIA
employee) via Alan Coopersmith, because Mark doesn't like committing to
X.Org.

Looking at the old XFree86 history:
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/drivers/nv/
nv_driver.c and nv_hw.c in particular, you can see that Mark has been
responsible for every commit that hasn't been of the trivial 'add a
missing #include' variety.  Commits such as this:
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/drivers/nv/nv_hw.c.diff?r1=1.1&r2=1.2
which I refuse to accept were written in that as its original form, what
with Mark being an NVIDIA employee and having access to the data books
(he has repeatedly publicly stated this in the past) and all.

I hope this clears everything up for you: the driver may look like it's
reverse-engineered, but in reality it's just a shockingly-written
driver, complete with massive sed hacks.  (Back In The Day, around NV1
era, there used to be an unobfuscated driver.  NVIDIA reversed this
decision, and by the time Riva 128 rolled around, the driver was
deliberately obfuscated, by means of removing all the symbolic names and
replacing them with unintelligible hex constants.)

Cheers,
Daniel

Attachment: signature.asc
Description: Digital signature


Reply to: