Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

16
sysutils/aperture/DESCR Normal file
View File

@@ -0,0 +1,16 @@
This module was originally written to help work around the security
feature of NetBSD that prevents read/write access to /dev/mem. It also
provide Pentium II and AMD K6 MTRR control in order to control
write-combining to the framebuffer memory.
XFree86 can take advantage of having direct access to video
memory (especially with VLB and PCI cards) and even requires it for
the most recent PCI or AGP video boards.
This driver works like the standard /dev/mem driver. It just allows
mapping of the VGA framebuffer and BIOS even if kernel security level
is > 0. The driver only implements the open(), close(), ioctl() and
mmap() calls. In order not to defeat kernel security, only one open()
at a time is allowed and only a process with effective user id of 0 can
perform it. So while you're running XFree86, no other process will be
allowed to open /dev/xf86.

30
sysutils/aperture/MESSAGE Normal file
View File

@@ -0,0 +1,30 @@
===========================================================================
$NetBSD: MESSAGE,v 1.2 2006/03/07 23:14:39 christos Exp $
Add the following line to /etc/lkm.conf:
${PREFIX}/lkm/xf86.o - - ${PREFIX}/lkm/xf86_mod_install - AFTERMOUNT
and set:
lkm=YES
in /etc/rc.conf. Then, /etc/rc.d/lkm3 restart
**************************
**** SECURITY WARNING ****
**************************
Please note that use of this driver only raises the bar somewhat
on breaking the securelevel abstraction. Loading this driver provides
the opening process with access to various things that can write
anywhere in memory (such as DMA engines, frame-buffer paint engines,
SMM). While one has to write a little more code to aim these memory
writers at the securelevel variable in kernel memory, it is not really
difficult to do so. Finally the fact that only one process can have
/dev/xf86 open at a time does not win much since root can kill it
at anytime and start another process. This exploit has to do with
root being able to change the security level and do things it could
not do before.
===========================================================================

View File

@@ -0,0 +1,44 @@
# $NetBSD: Makefile,v 1.38 2012/08/14 17:07:58 asau Exp $
DISTNAME= apNetBSD
PKGNAME= aperture-2.0
PKGREVISION= 7
CATEGORIES= sysutils x11
EXTRACT_SUFX= .shar
MASTER_SITES= ${MASTER_SITE_LOCAL:=${PKGNAME_NOREV}nb1/}
# The definitive location of the distfile is as below, but it's risky to depend
# on NetBSD-current files to stay stable, so don't we'll place new copies at
# MASTER_SITE_LOCAL and update this package accordingly.
#
#MASTER_SITES+= ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/xsrc/xfree/xc/programs/Xserver/hw/xfree86/etc/
MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= XFree86 Framebuffer "aperture" driver for NetBSD/i386
ONLY_FOR_PLATFORM= NetBSD-*-i386
NO_SRC_ON_FTP= Already in MASTER_SITE_LOCAL
PKG_DESTDIR_SUPPORT= none
WRKSRC= ${WRKDIR}
BUILD_TARGET= cleandir depend all
DIST_SUBDIR= ${PKGNAME_NOREV}nb5
INSTALL_TARGET= dirs includes install
MANCOMPRESSED_IF_MANZ= YES
NO_CONFIGURE= YES
OSVERSION_SPECIFIC= YES
MAKE_ENV+= BSDSRCDIR=${BSDSRCDIR:Q}
.include "../../mk/bsd.prefs.mk"
pre-extract:
.if !exists(${BSDSRCDIR}/sys/lib/libkern/libkern.h)
@${ECHO_MSG} "Need a kernel source tree in ${BSDSRCDIR}/sys."
@${ECHO_MSG} "(Or set BSDSRCDIR correctly in /etc/mk.conf.)"
@${FALSE}
.endif
.include "../../mk/bsd.pkg.mk"
LDFLAGS= # empty since we use BSD-style makefiles

11
sysutils/aperture/PLIST Normal file
View File

@@ -0,0 +1,11 @@
@comment $NetBSD: PLIST,v 1.3 2009/06/14 18:16:00 joerg Exp $
bin/memconfig
bin/xf86test
include/memrange.h
lkm/xf86.o
lkm/xf86_mod_install
@unexec ${RM} -f %D/lkm/xf86
man/cat4/xf86.0
man/cat8/memconfig.0
man/man4/xf86.4
man/man8/memconfig.8

View File

@@ -0,0 +1,12 @@
$NetBSD: distinfo,v 1.13 2006/05/31 02:31:56 tron Exp $
SHA1 (aperture-2.0nb5/apNetBSD.shar) = 66022d35f41df667bbc9ad86a8f2ded292e1098b
RMD160 (aperture-2.0nb5/apNetBSD.shar) = 74739d4d0a5d21d5098c3fab000ad4d622137895
Size (aperture-2.0nb5/apNetBSD.shar) = 66731 bytes
SHA1 (patch-aa) = 544d71b6524b7aaeb5deb985372599f1962af4fe
SHA1 (patch-ab) = fc3f65e9b9bc94880dc18e2091d7daccd3d480ad
SHA1 (patch-ac) = 676b2f426d6f9e725262342e0d7e9ac1c8418362
SHA1 (patch-ad) = bb3ae5f5c5f227d7d95ee68cb06e9f05157e3c5d
SHA1 (patch-ae) = b6ae1d888db3a0cbefd7088a7acf7ca881fdc767
SHA1 (patch-af) = 475c127658ba1050154a7dcabe39482c088e2d02
SHA1 (patch-ag) = cc4d08404f5fcd4fc01b1c711984506408e930bc

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-aa,v 1.2 2001/01/17 23:57:53 jlam Exp $
--- Makefile.inc.orig Fri Jan 12 14:09:51 2001
+++ Makefile.inc
@@ -3,8 +3,9 @@
# NetBSDApertureDir variable in xc/config/cf/host.def before rebuilding
# the X server
-APDIR= /usr/local/aperture
+APDIR= ${PREFIX}
+S= ${BSDSRCDIR}/sys
KMODDIR= ${APDIR}/lkm
BINDIR= ${APDIR}/bin
MANDIR= ${APDIR}/man

View File

@@ -0,0 +1,54 @@
$NetBSD: patch-ab,v 1.7 2003/11/11 13:00:24 wennmach Exp $
o add support for cpu_info (for recent kernel versions)
o do not define cpu_id, cpu_feature, cpu_vendor directly; leave that
to machine/cpu.h
--- module/xf86_mod.c.orig Fri Nov 7 16:29:19 2003
+++ module/xf86_mod.c Fri Nov 7 16:36:27 2003
@@ -10,6 +10,7 @@
#include <sys/lkm.h>
#include <sys/malloc.h>
+#include <machine/cpu.h>
#include <machine/specialreg.h>
#include "xf86_reg.h"
@@ -17,9 +18,11 @@
#include "memrange.h"
/* Pull in the cpuid values from locore.s */
-extern int cpu_id;
-extern int cpu_feature;
-extern char cpu_vendor[];
+#if __NetBSD_Version__ >= 106080000
+extern struct cpu_info cpu_info_primary;
+#define cpu_vendor ((char *)cpu_info_primary.ci_vendor)
+#define cpu_id cpu_info_primary.ci_signature
+#endif
extern struct mem_range_ops i686_mrops, k6_mrops;
@@ -31,7 +34,11 @@
0,
seltrue, xf86mmap, 0};
+#if __NetBSD_Version__ >= 106080000
+MOD_DEV("xf86", "xf86ap", NULL, -1, &newdev, -1)
+#else
MOD_DEV("xf86", LM_DT_CHAR, -1, &newdev)
+#endif
char *xf86_major_version = "2";
char *xf86_minor_version = "0";
@@ -76,7 +83,10 @@
case LKM_E_UNLOAD:
/* Free allocated memory */
+ if (mem_range_softc.mr_desc != NULL) {
free(mem_range_softc.mr_desc, M_MEMDESC);
+ mem_range_softc.mr_desc = NULL;
+ }
break;
case LKM_E_STAT:

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-ac,v 1.3 2002/09/14 08:14:22 tron Exp $
--- module/xf86_mod_install.orig Fri Sep 13 18:29:17 2002
+++ module/xf86_mod_install Fri Sep 13 18:34:52 2002
@@ -4,8 +4,8 @@
#
# Copyright (C) 1994,1999 The XFree86 Project Inc.
#
-if [ $# -ne 3 ]; then
- echo "$0: should be called by modload(8) with 3 arguments"
+if [ $# -lt 3 ]; then
+ echo "$0: should be called by modload(8) with at least 3 arguments"
exit 1
fi

View File

@@ -0,0 +1,157 @@
$NetBSD: patch-ad,v 1.9 2006/05/31 02:31:56 tron Exp $
--- module/aperture.c.orig 2006-05-31 03:22:31.000000000 +0100
+++ module/aperture.c 2006-05-31 03:29:49.000000000 +0100
@@ -71,6 +71,14 @@
/* open counter */
static int xf86_open_count = 0;
+#if !defined(__NetBSD_Version__) || __NetBSD_Version__ < 399001400
+#define PROC
+#endif
+
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 399002000
+#include <sys/kauth.h>
+#endif
+
/* mem range descriptors */
struct mem_range_softc mem_range_softc;
@@ -78,16 +86,28 @@
* Open the device
*/
int
-xf86open(dev, oflags, devtype, p)
- dev_t dev;
- int oflags;
- int devtype;
- struct proc *p;
+xf86open(dev_t dev, int oflags, int devtype,
+#ifdef PROC
+ struct proc *p)
{
+#else
+ struct lwp *l)
+{
+ struct proc *p = l->l_proc;
+#endif
+#if !defined(__NetBSD_Version__) || __NetBSD_Version__ < 399002000
if (suser(p->p_ucred, &p->p_acflag) != 0) {
return(EPERM);
}
+#else
+ int error;
+
+ error = kauth_authorize_generic(p->p_cred, KAUTH_GENERIC_ISSUSER,
+ &p->p_acflag);
+ if (error != 0)
+ return error;
+#endif
/* authorize only one simultaneous open() */
if (xf86_open_count > 0) {
return(EPERM);
@@ -101,11 +121,13 @@
* Close the device
*/
int
-xf86close(dev, cflags, devtype, p)
- dev_t dev;
- int cflags;
- int devtype;
- struct proc *p;
+xf86close(dev_t dev, int cflags, int devtype,
+#ifdef PROC
+ struct proc *p
+#else
+ struct lwp *l
+#endif
+)
{
xf86_open_count--;
return(0);
@@ -117,19 +139,22 @@
* allow only section in the vga framebuffer and above main memory
* to be mapped
*/
+/*
+ * Technically, the change to the kernel mmap interface happened
+ * during 1.5A, but after the interface changed, the kernel version
+ * was inexplicably not bumped. Starting with 1.5B _and_ with the
+ * 1.5-branch releases, the change to the kernel mmap interface
+ * appears.
+ */
#if !defined(__NetBSD_Version__) || \
- (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105000000))
+ (defined(__NetBSD_Version__) && \
+ ((__NetBSD_Version__ < 105000000) || \
+ (__NetBSD_Version__ >= 105010000) && (__NetBSD_Version__ < 105020000)))
int
-xf86mmap(dev, offset, length)
- dev_t dev;
- int offset;
- int length;
+xf86mmap(dev_t dev, int offset, int length)
#else
paddr_t
-xf86mmap(dev, offset, length)
- dev_t dev;
- off_t offset;
- int length;
+xf86mmap(dev_t dev, off_t offset, int length)
#endif /* __NetBSD_Version__ */
{
@@ -144,19 +169,24 @@
&& (unsigned)offset <= HOLE16M_END)
#endif
)) {
+#if __NetBSD_Version__ >= 106160000
+ return x86_btop(offset);
+#else
return i386_btop(offset);
+#endif
} else {
return(-1);
}
}
int
-xf86ioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
+xf86ioctl(dev_t dev, u_long cmd, caddr_t data, int flags,
+#ifdef PROC
+ struct proc *p
+#else
+ struct lwp *l
+#endif
+)
{
int nd, error = 0;
struct mem_range_op *mo = (struct mem_range_op *)data;
@@ -212,9 +242,7 @@
* memory range attributes.
*/
int
-mem_range_attr_get(mrd, arg)
- struct mem_range_desc *mrd;
- int *arg;
+mem_range_attr_get(struct mem_range_desc *mrd, int *arg)
{
/* can we handle this? */
if (mem_range_softc.mr_op == NULL)
@@ -229,9 +257,7 @@
}
int
-mem_range_attr_set(mrd, arg)
- struct mem_range_desc *mrd;
- int *arg;
+mem_range_attr_set(struct mem_range_desc *mrd, int *arg)
{
/* can we handle this? */
if (mem_range_softc.mr_op == NULL)

View File

@@ -0,0 +1,22 @@
$NetBSD: patch-ae,v 1.1 2000/07/15 06:11:20 jlam Exp $
--- memconfig/memconfig.c.orig Sat Jul 15 01:35:01 2000
+++ memconfig/memconfig.c Sat Jul 15 02:07:45 2000
@@ -34,7 +34,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+/*
+ * This doesn't work if your kernel sources are too divergent from your
+ * installed headers. Just declare the prototypes for getopt() directly.
+ */
+#if 0
#include <unistd.h>
+#else
+int getopt(int, char * const [], const char *);
+extern char *optarg;
+extern int optind;
+#endif
#include "memrange.h"

View File

@@ -0,0 +1,13 @@
$NetBSD: patch-af,v 1.1 2001/01/17 23:57:53 jlam Exp $
--- module/k6_mem.c.orig Wed Jan 17 12:36:06 2001
+++ module/k6_mem.c
@@ -89,7 +89,7 @@
return EOPNOTSUPP;
for (bit = ffs(desc->mr_len >> 17) - 1; bit < 15; bit++)
- len |= 1 << (14 - bit);
+ len |= 1 << bit;
wc = (desc->mr_flags & MDF_WRITECOMBINE) ? 1 : 0;
uc = (desc->mr_flags & MDF_UNCACHEABLE) ? 1 : 0;

View File

@@ -0,0 +1,12 @@
$NetBSD: patch-ag,v 1.1 2003/08/10 07:56:55 wiz Exp $
--- xf86test/xf86test.c.orig Sun Aug 10 09:51:43 2003
+++ xf86test/xf86test.c
@@ -36,6 +36,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>