View | Details | Raw Unified | Return to bug 551294
Collapse All | Expand All

(-)source-OLD/vmblock-only/linux/control.c (+6 lines)
Lines 46-52 Link Here
46
46
47
static struct proc_dir_entry *controlProcDirEntry;
47
static struct proc_dir_entry *controlProcDirEntry;
48
struct file_operations ControlFileOps = {
48
struct file_operations ControlFileOps = {
49
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
49
   .owner   = THIS_MODULE,
50
   .owner   = THIS_MODULE,
51
#endif
50
   .write   = ControlFileOpWrite,
52
   .write   = ControlFileOpWrite,
51
   .release = ControlFileOpRelease,
53
   .release = ControlFileOpRelease,
52
};
54
};
Lines 156-162 Link Here
156
      return -EINVAL;
158
      return -EINVAL;
157
   }
159
   }
158
160
161
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
159
   controlProcDirEntry->owner = THIS_MODULE;
162
   controlProcDirEntry->owner = THIS_MODULE;
163
#endif
160
164
161
   /* Create /proc/fs/vmblock/mountPoint */
165
   /* Create /proc/fs/vmblock/mountPoint */
162
   controlProcMountpoint = proc_mkdir(VMBLOCK_CONTROL_MOUNTPOINT,
166
   controlProcMountpoint = proc_mkdir(VMBLOCK_CONTROL_MOUNTPOINT,
Lines 168-174 Link Here
168
      return -EINVAL;
172
      return -EINVAL;
169
   }
173
   }
170
174
175
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
171
   controlProcMountpoint->owner = THIS_MODULE;
176
   controlProcMountpoint->owner = THIS_MODULE;
177
#endif
172
178
173
   /* Create /proc/fs/vmblock/dev */
179
   /* Create /proc/fs/vmblock/dev */
174
   controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
180
   controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME,
(-)source-OLD/vmblock-only/Makefile (-1 / +1 lines)
Lines 113-119 Link Here
113
113
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
116
	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
116
	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
118
	-Werror -S -o /dev/null -xc $(1) \
118
	-Werror -S -o /dev/null -xc $(1) \
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
(-)source-OLD/vmci-only/Makefile (-1 / +1 lines)
Lines 113-119 Link Here
113
113
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
116
	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
116
	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
118
	-Werror -S -o /dev/null -xc $(1) \
118
	-Werror -S -o /dev/null -xc $(1) \
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
(-)source-OLD/vmmon-only/include/x86apic.h (+4 lines)
Lines 94-100 Link Here
94
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
94
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
95
#define APIC_LVT_RESET_VALUE  0x00010000
95
#define APIC_LVT_RESET_VALUE  0x00010000
96
96
97
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
97
#define APIC_BASE_MSR         0x1b
98
#define APIC_BASE_MSR         0x1b
99
#else
100
#define APIC_BASE_MSR         0x800
101
#endif
98
102
99
#define APIC_MSR_BASEMASK     QWORD(0x0000000f,0xfffff000)
103
#define APIC_MSR_BASEMASK     QWORD(0x0000000f,0xfffff000)
100
#define APIC_MSR_ENABLED      0x00000800
104
#define APIC_MSR_ENABLED      0x00000800
(-)source-OLD/vmmon-only/include/x86svm.h (+4 lines)
Lines 47-56 Link Here
47
#endif
47
#endif
48
48
49
/* SVM related MSRs */
49
/* SVM related MSRs */
50
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
50
#define MSR_VM_CR                  0xC0010114
51
#define MSR_VM_CR                  0xC0010114
52
#endif
51
#define MSR_IGNNE                  0xC0010115
53
#define MSR_IGNNE                  0xC0010115
52
#define MSR_SMM_CTL                0xC0010116
54
#define MSR_SMM_CTL                0xC0010116
55
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
53
#define MSR_VM_HSAVE_PA            0xC0010117
56
#define MSR_VM_HSAVE_PA            0xC0010117
57
#endif
54
58
55
#define MSR_VM_CR_SVM_LOCK         0x0000000000000008ULL
59
#define MSR_VM_CR_SVM_LOCK         0x0000000000000008ULL
56
#define MSR_VM_CR_SVME_DISABLE     0x0000000000000010ULL
60
#define MSR_VM_CR_SVME_DISABLE     0x0000000000000010ULL
(-)source-OLD/vmmon-only/linux/driver.c (+7 lines)
Lines 1984-1993 Link Here
1984
   }
1984
   }
1985
1985
1986
   case IOCTL_VMX86_ALLOW_CORE_DUMP:
1986
   case IOCTL_VMX86_ALLOW_CORE_DUMP:
1987
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
1987
      if (current->euid == current->uid &&
1988
      if (current->euid == current->uid &&
1988
	  current->fsuid == current->uid &&
1989
	  current->fsuid == current->uid &&
1989
          current->egid == current->gid &&
1990
          current->egid == current->gid &&
1990
	  current->fsgid == current->gid) {
1991
	  current->fsgid == current->gid) {
1992
#else
1993
      if (current_euid() == current_uid() &&
1994
	  current_fsuid() == current_uid() &&
1995
          current_egid() == current_gid() &&
1996
	  current_fsgid() == current_gid()) {
1997
#endif
1991
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
1998
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
1992
         /* Dump core, readable by user. */
1999
         /* Dump core, readable by user. */
1993
         set_bit(MMF_DUMPABLE, &current->mm->flags);
2000
         set_bit(MMF_DUMPABLE, &current->mm->flags);
(-)source-OLD/vmmon-only/linux/hostif.c (-7 / +89 lines)
Lines 3423-3428 Link Here
3423
}
3423
}
3424
3424
3425
3425
3426
/* krellan: Linux 2.6.29 compatibility functions for capabilities */
3427
/* Errors are logged but otherwise ignored */
3428
3429
void compat_cap_raise(int cap)
3430
{
3431
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
3432
  cap_raise(current->cap_effective, cap);
3433
#else
3434
  struct cred *new_cred;
3435
  
3436
  new_cred = prepare_creds();
3437
  if (new_cred != NULL)
3438
  {
3439
    cap_raise(new_cred->cap_effective, cap);
3440
    commit_creds(new_cred);
3441
  }
3442
  else
3443
  {
3444
    Log("compat_cap_raise(%d) prepare_creds(): Out of memory\n", cap);
3445
  }
3446
#endif
3447
}
3448
3449
void compat_cap_lower(int cap)
3450
{
3451
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
3452
  cap_lower(current->cap_effective, cap);
3453
#else
3454
  struct cred *new_cred;
3455
  
3456
  new_cred = prepare_creds();
3457
  if (new_cred != NULL)
3458
  {
3459
    cap_lower(new_cred->cap_effective, cap);
3460
    commit_creds(new_cred);
3461
  }
3462
  else
3463
  {
3464
    Log("compat_cap_lower(%d) prepare_creds(): Out of memory\n", cap);
3465
  }
3466
#endif
3467
}
3468
3469
int compat_cap_raised(int cap)
3470
{
3471
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
3472
  return cap_raised(current->cap_effective, cap);
3473
#else
3474
  return cap_raised(current_cap(), cap);
3475
#endif
3476
}
3477
3478
int compat_get_fsuid(void)
3479
{
3480
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
3481
  return current->fsuid;
3482
#else
3483
  return current_fsuid();
3484
#endif
3485
}
3486
3487
void compat_set_fsuid(int fsuid)
3488
{
3489
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
3490
  current->fsuid = fsuid;
3491
#else
3492
  struct cred *new_cred;
3493
  
3494
  new_cred = prepare_creds();
3495
  if (new_cred != NULL)
3496
  {
3497
    new_cred->fsuid = fsuid;
3498
    commit_creds(new_cred);
3499
  }
3500
  else
3501
  {
3502
    Log("compat_set_fsuid(%d) prepare_creds(): Out of memory\n", fsuid);
3503
  }
3504
#endif
3505
}
3506
3507
3426
/*
3508
/*
3427
 *----------------------------------------------------------------------
3509
 *----------------------------------------------------------------------
3428
 *
3510
 *
Lines 3455-3461 Link Here
3455
   oldFS = get_fs();
3537
   oldFS = get_fs();
3456
   set_fs(KERNEL_DS);
3538
   set_fs(KERNEL_DS);
3457
   compat_allow_signal(SIGKILL);
3539
   compat_allow_signal(SIGKILL);
3458
   cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
3540
   compat_cap_raise(CAP_SYS_RESOURCE);
3459
   compat_set_user_nice(current, linuxState.fastClockPriority);
3541
   compat_set_user_nice(current, linuxState.fastClockPriority);
3460
3542
3461
   while (linuxState.fastClockRate > HZ + HZ/16) {
3543
   while (linuxState.fastClockRate > HZ + HZ/16) {
Lines 3579-3597 Link Here
3579
         Bool cap;
3661
         Bool cap;
3580
         long pid;
3662
         long pid;
3581
3663
3582
         fsuid = current->fsuid;
3664
         fsuid = compat_get_fsuid();
3583
         current->fsuid = 0;
3665
         compat_set_fsuid(0);
3584
         filp = filp_open("/dev/rtc", O_RDONLY, 0);
3666
         filp = filp_open("/dev/rtc", O_RDONLY, 0);
3585
         current->fsuid = fsuid;
3667
         compat_set_fsuid(fsuid);
3586
         if (IS_ERR(filp)) {
3668
         if (IS_ERR(filp)) {
3587
            Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
3669
            Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
3588
            return -(int)(VA)filp;
3670
            return -(int)(VA)filp;
3589
         }
3671
         }
3590
         cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
3672
         cap = compat_cap_raised(CAP_SYS_RESOURCE);
3591
         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
3673
         compat_cap_raise(CAP_SYS_RESOURCE);
3592
         res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
3674
         res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
3593
         if (!cap) {
3675
         if (!cap) {
3594
            cap_lower(current->cap_effective, CAP_SYS_RESOURCE);            
3676
            compat_cap_lower(CAP_SYS_RESOURCE);
3595
         }
3677
         }
3596
         if (res < 0) {
3678
         if (res < 0) {
3597
            Warning("/dev/rtc enable interrupt failed: %d\n", res);
3679
            Warning("/dev/rtc enable interrupt failed: %d\n", res);
(-)source-OLD/vmmon-only/Makefile (-1 / +1 lines)
Lines 113-119 Link Here
113
113
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
116
	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
116
	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
118
	-Werror -S -o /dev/null -xc $(1) \
118
	-Werror -S -o /dev/null -xc $(1) \
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
(-)source-OLD/vmnet-only/Makefile (-1 / +1 lines)
Lines 113-119 Link Here
113
113
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
116
	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
116
	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
118
	-Werror -S -o /dev/null -xc $(1) \
118
	-Werror -S -o /dev/null -xc $(1) \
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
(-)source-OLD/vmnet-only/netif.c (+16 lines)
Lines 324-330 Link Here
324
      goto out;
324
      goto out;
325
   }
325
   }
326
326
327
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
327
   dev->priv = netIf;
328
   dev->priv = netIf;
329
#else
330
   dev->ml_priv = netIf;
331
#endif
328
   netIf->dev = dev;
332
   netIf->dev = dev;
329
   
333
   
330
   memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
334
   memcpy(dev->dev_addr, netIf->port.paddr, sizeof netIf->port.paddr);
Lines 566-572 Link Here
566
VNetNetifStartXmit(struct sk_buff    *skb, // IN:
570
VNetNetifStartXmit(struct sk_buff    *skb, // IN:
567
                   struct net_device *dev) // IN:
571
                   struct net_device *dev) // IN:
568
{
572
{
573
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
569
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
574
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
575
#else
576
   VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
577
#endif
570
578
571
   if(skb == NULL) {
579
   if(skb == NULL) {
572
      return 0;
580
      return 0;
Lines 618-624 Link Here
618
VNetNetifSetMAC(struct net_device *dev, // IN:
626
VNetNetifSetMAC(struct net_device *dev, // IN:
619
                void *p)                // IN:
627
                void *p)                // IN:
620
{
628
{
629
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
621
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
630
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
631
#else
632
   VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
633
#endif
622
   struct sockaddr const *addr = p;
634
   struct sockaddr const *addr = p;
623
   if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
635
   if (!VMX86_IS_STATIC_MAC(addr->sa_data)) {
624
      return -EINVAL;
636
      return -EINVAL;
Lines 675-681 Link Here
675
struct net_device_stats *
687
struct net_device_stats *
676
VNetNetifGetStats(struct net_device *dev) // IN:
688
VNetNetifGetStats(struct net_device *dev) // IN:
677
{
689
{
690
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
678
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
691
   VNetNetIF *netIf = (VNetNetIF*)dev->priv;
692
#else
693
   VNetNetIF *netIf = (VNetNetIF*)dev->ml_priv;
694
#endif
679
   return &(netIf->stats);
695
   return &(netIf->stats);
680
}
696
}
681
697
(-)source-OLD/vsock-only/Makefile (-1 / +1 lines)
Lines 113-119 Link Here
113
113
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
114
vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
115
	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
116
	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
116
	$(EXTRA_CFLAGS) -I$(HEADER_DIR) -Iinclude2/asm/mach-default \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
117
	-DKBUILD_BASENAME=\"$(DRIVER)\" \
118
	-Werror -S -o /dev/null -xc $(1) \
118
	-Werror -S -o /dev/null -xc $(1) \
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
119
	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)

Return to bug 551294