!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/usr/src/linux-2.4.18-xfs-1.1/drivers/pci/   drwxr-xr-x
Free 318.37 GB of 458.09 GB (69.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     syscall.c (2.62 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 *    pci_syscall.c
 *
 * For architectures where we want to allow direct access
 * to the PCI config stuff - it would probably be preferable
 * on PCs too, but there people just do it by hand with the
 * magic northbridge registers..
 */

#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>


asmlinkage long
sys_pciconfig_read(unsigned long bus, unsigned long dfn,
           unsigned long off, unsigned long len, void *buf)
{
    struct pci_dev *dev;
    u8 byte;
    u16 word;
    u32 dword;
    long err, cfg_ret;

    err = -EPERM;
    if (!capable(CAP_SYS_ADMIN))
        goto error;

    err = -ENODEV;
    dev = pci_find_slot(bus, dfn);
    if (!dev)
        goto error;

    lock_kernel();
    switch (len) {
    case 1:
        cfg_ret = pci_read_config_byte(dev, off, &byte);
        break;
    case 2:
        cfg_ret = pci_read_config_word(dev, off, &word);
        break;
    case 4:
        cfg_ret = pci_read_config_dword(dev, off, &dword);
        break;
    default:
        err = -EINVAL;
        unlock_kernel();
        goto error;
    };
    unlock_kernel();

    err = -EIO;
    if (cfg_ret != PCIBIOS_SUCCESSFUL)
        goto error;

    switch (len) {
    case 1:
        err = put_user(byte, (unsigned char *)buf);
        break;
    case 2:
        err = put_user(word, (unsigned short *)buf);
        break;
    case 4:
        err = put_user(dword, (unsigned int *)buf);
        break;
    };
    return err;

error:
    /* ??? XFree86 doesn't even check the return value.  They
       just look for 0xffffffff in the output, since that's what
       they get instead of a machine check on x86.  */
    switch (len) {
    case 1:
        put_user(-1, (unsigned char *)buf);
        break;
    case 2:
        put_user(-1, (unsigned short *)buf);
        break;
    case 4:
        put_user(-1, (unsigned int *)buf);
        break;
    };
    return err;
}

asmlinkage long
sys_pciconfig_write(unsigned long bus, unsigned long dfn,
            unsigned long off, unsigned long len, void *buf)
{
    struct pci_dev *dev;
    u8 byte;
    u16 word;
    u32 dword;
    int err = 0;

    if (!capable(CAP_SYS_ADMIN))
        return -EPERM;
    if (!pcibios_present())
        return -ENOSYS;

    dev = pci_find_slot(bus, dfn);
    if (!dev)
        return -ENODEV;

    lock_kernel();
    switch(len) {
    case 1:
        err = get_user(byte, (u8 *)buf);
        if (err)
            break;
        err = pci_write_config_byte(dev, off, byte);
        if (err != PCIBIOS_SUCCESSFUL)
            err = -EIO;
        break;

    case 2:
        err = get_user(word, (u16 *)buf);
        if (err)
            break;
        err = pci_write_config_word(dev, off, word);
        if (err != PCIBIOS_SUCCESSFUL)
            err = -EIO;
        break;

    case 4:
        err = get_user(dword, (u32 *)buf);
        if (err)
            break;
        err = pci_write_config_dword(dev, off, dword);
        if (err != PCIBIOS_SUCCESSFUL)
            err = -EIO;
        break;

    default:
        err = -EINVAL;
        break;
    };
    unlock_kernel();

    return err;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0216 ]--