id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
9a7982793c3aee6ce86d8e7e15306215257329f2
Analyze and fix the following issue in the Linux kernel code: selinux: fix error codes in symtab_init()
Problem Details: hashtab_create() only returns NULL on allocation failures to -ENOMEM is appropriate here. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Eric Paris <eparis@redhat.com> Acked-by: Stephen D. Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org>
```diff diff --git a/security/selinux/ss/symtab.c b/security/selinux/ss/symtab.c index bcf9f620426e..160326ee99e5 100644 --- a/security/selinux/ss/symtab.c +++ b/security/selinux/ss/symtab.c @@ -36,7 +36,7 @@ int symtab_init(struct symtab *s, unsigned int size) { s->table = hashtab_create(symhash, symcmp, size); i...
338437f6a09861cdf76e1396ed5fa6dee9c7cabe
Analyze and fix the following issue in the Linux kernel code: selinux: fix error codes in cond_read_bool()
Problem Details: The original code always returned -1 (-EPERM) on error. The new code returns either -ENOMEM, or -EINVAL or it propagates the error codes from lower level functions next_entry() or hashtab_insert(). next_entry() returns -EINVAL. hashtab_insert() returns -EINVAL, -EEXIST, or -ENOMEM. Signed-off-by: Da...
```diff diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index 0389263b99ce..c91e150c3087 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c @@ -223,34 +223,37 @@ int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp) booldatum = kza...
38184c522249dc377366d4edc41dc500c2c3bb9e
Analyze and fix the following issue in the Linux kernel code: selinux: fix error codes in cond_policydb_init()
Problem Details: It's better to propagate the error code from avtab_init() instead of returning -1 (-EPERM). It turns out that avtab_init() never fails so this patch doesn't change how the code runs but it's still a clean up. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Stephen D. Smalley <sds@tycho.ns...
```diff diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index a2b3b298e604..0389263b99ce 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c @@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node) int cond_policydb...
fc5c126e4733e6fb3080d3d822ca63226e74fc84
Analyze and fix the following issue in the Linux kernel code: selinux: fix error codes in cond_read_node()
Problem Details: Originally cond_read_node() returned -1 (-EPERM) on errors which was incorrect. Now it either propagates the error codes from lower level functions next_entry() or cond_read_av_list() or it returns -ENOMEM or -EINVAL. next_entry() returns -EINVAL. cond_read_av_list() returns -EINVAL or -ENOMEM. Sign...
```diff diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index aac40c7ff28c..a2b3b298e604 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c @@ -392,24 +392,25 @@ static int cond_read_node(struct policydb *p, struct cond_node *node, void *fp) struc...
9d623b17a740d5a85c12108cdc71c64fb15484fc
Analyze and fix the following issue in the Linux kernel code: selinux: fix error codes in cond_read_av_list()
Problem Details: After this patch cond_read_av_list() no longer returns -1 for any errors. It just propagates error code back from lower levels. Those can either be -EINVAL or -ENOMEM. I also modified cond_insertf() since cond_read_av_list() passes that as a function pointer to avtab_read_item(). It isn't used anyw...
```diff diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index 775418aa0a8e..aac40c7ff28c 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c @@ -263,7 +263,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum struct...
5241c1074f6e2f2276d45d857eb5d19fbdc2e4b2
Analyze and fix the following issue in the Linux kernel code: selinux: propagate error codes in cond_read_list()
Problem Details: These are passed back when the security module gets loaded. The original code always returned -1 (-EPERM) on error but after this patch it can return -EINVAL, or -ENOMEM or propagate the error code from cond_read_node(). cond_read_node() still returns -1 all the time, but I fix that in a later patch....
```diff diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c index 4a4e35cac22b..775418aa0a8e 100644 --- a/security/selinux/ss/conditional.c +++ b/security/selinux/ss/conditional.c @@ -445,8 +445,8 @@ int cond_read_list(struct policydb *p, void *fp) int rc; rc = next_entry(buf, fp, s...
9e0bd4cba4460bff64fb07cfb07849cdfd4d325a
Analyze and fix the following issue in the Linux kernel code: selinux: cleanup return codes in avtab_read_item()
Problem Details: The avtab_read_item() function tends to return -1 as a default error code which is wrong (-1 means -EPERM). I modified it to return appropriate error codes which is -EINVAL or the error code from next_entry() or insertf(). next_entry() returns -EINVAL. insertf() is a function pointer to either avtab_...
```diff diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c index 1215b8e47dba..929480c6c430 100644 --- a/security/selinux/ss/avtab.c +++ b/security/selinux/ss/avtab.c @@ -342,20 +342,20 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol, if (vers < POLICYDB_VERSION_AVTAB) { ...
dce3a3d2ee038d230323fe06b061dbaace6b8f94
Analyze and fix the following issue in the Linux kernel code: Security: capability: code style issue
Problem Details: This fix a little code style issue deleting a space between a function name and a open parenthesis. Signed-off-by: Chihau Chau <chihau@gmail.com> Acked-by: Andrew G. Morgan <morgan@kernel.org> Signed-off-by: James Morris <jmorris@namei.org>
```diff diff --git a/security/capability.c b/security/capability.c index 4aeb699da1b3..a0bbf30fb6dc 100644 --- a/security/capability.c +++ b/security/capability.c @@ -27,7 +27,7 @@ static int cap_quota_on(struct dentry *dentry) return 0; } -static int cap_bprm_check_security (struct linux_binprm *bprm) +static int...
b8bc83ab4dcbc9938b95a90bbb50d89d1904d5ab
Analyze and fix the following issue in the Linux kernel code: securityfs: Drop dentry reference count when mknod fails
Problem Details: lookup_one_len increments dentry reference count which is not decremented when the create operation fails. This can cause a kernel BUG at fs/dcache.c:676 at unmount time. Also error code returned when new_inode() fails was replaced with more appropriate -ENOMEM. Signed-off-by: Tvrtko Ursulin <tvrtko.u...
```diff diff --git a/security/inode.c b/security/inode.c index 1c812e874504..8c777f022ad1 100644 --- a/security/inode.c +++ b/security/inode.c @@ -86,7 +86,7 @@ static int mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { struct inode *inode; - int error = -EPERM; + int error = -ENOMEM; ...
9156235b3427d6f01c5c95022f72f381f07583f5
Analyze and fix the following issue in the Linux kernel code: KEYS: Authorise keyctl_set_timeout() on a key if we have its authorisation key
Problem Details: Authorise a process to perform keyctl_set_timeout() on an uninstantiated key if that process has the authorisation key for it. This allows the instantiator to set the timeout on a key it is instantiating - provided it does it before instantiating the key. For instance, the test upcall script provided...
```diff diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 6261745e4459..639226afd0db 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -1091,7 +1091,7 @@ error: long keyctl_set_timeout(key_serial_t id, unsigned timeout) { struct timespec now; - struct key *key; + struct key *key, ...
3f629636320dfa65804779a3fc333f3147f3b064
Analyze and fix the following issue in the Linux kernel code: TOMOYO: Allow wildcard for execute permission.
Problem Details: Some applications create and execute programs dynamically. We need to accept wildcard for execute permission because such programs contain random suffix in their filenames. This patch loosens up regulation of string parameters. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-of...
```diff diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 98e3639db990..3f94011c6411 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -407,7 +407,7 @@ static int tomoyo_update_manager_entry(const char *manager, return -EINVAL; e.is_domain = true; } else { - if (!tom...
9b244373da3eab671da6c5125482121528a9ebf3
Analyze and fix the following issue in the Linux kernel code: TOMOYO: Several fixes for TOMOYO's management programs.
Problem Details: Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
```diff diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 57ddfc5d9c52..98e3639db990 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -366,7 +366,7 @@ static int tomoyo_read_profile(struct tomoyo_io_buffer *head) * * or * - * # echo '/usr/lib/ccs/editpolicy' > /sys/ker...
3444d7da1839b851eefedd372978d8a982316c36
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: Fix host GDT.LIMIT corruption
Problem Details: vmx does not restore GDT.LIMIT to the host value, instead it sets it to 64KB. This means host userspace can learn a few bits of host memory. Fix by reloading GDTR when we load other host state. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2fdcc9819f36..27a0222c2946 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -185,6 +185,7 @@ static void kvm_cpu_vmxoff(void); static DEFINE_PER_CPU(struct vmcs *, vmxarea); static DEFINE_PER_CPU(struct vmcs *, current_vmcs); static DEFINE...
7cdb996ee4d04b5bb2cd544b14e8eb91cfd7fe64
Analyze and fix the following issue in the Linux kernel code: UBI: do not print message about corruptes PEBs if we have none of them
Problem Details: Currently UBI prints UBI: corrupted PEBs will be formatted even if there are not corrupted PEBs. Fix this. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
```diff diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index a86c04821368..372a15ac9995 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c @@ -964,7 +964,7 @@ static int check_what_we_have(struct ubi_device *ubi, struct ubi_scan_info *si) } } - if (si->corr_peb_count >= 0) + if (si->c...
9ed5520dd3c9cb79c25f95fce9c57b87637d0fb7
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix page dirty tracking lost while sync page
Problem Details: In sync-page path, if spte.writable is changed, it will lose page dirty tracking, for example: assume spte.writable = 0 in a unsync-page, when it's synced, it map spte to writable(that is spte.writable = 1), later guest write spte.gfn, it means spte.gfn is dirty, then guest changed this mapping to rea...
```diff diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9b3b916ebeae..a04756a26fe2 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1985,6 +1985,8 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, mark_page_dirty(vcpu->kvm, gfn); set_pte: + if (is_writable_pte(*sptep) && !is_writabl...
daa3db693ce925a14b7e17ab6f306dc0e6a5342c
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix broken page accessed tracking with ept enabled
Problem Details: In current code, if ept is enabled(shadow_accessed_mask = 0), the page accessed tracking is lost. Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d2ea9cabc066..9b3b916ebeae 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -687,7 +687,7 @@ static void drop_spte(struct kvm *kvm, u64 *sptep, u64 new_spte) if (!is_rmap_spte(old_spte)) return; pfn = spte_to_pfn(old_spte); - if (old_s...
6e3e243c3b6e0bbd18c6ce0fbc12bc3fe2d77b34
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix mmu notifier invalidate handler for huge spte
Problem Details: The index wasn't calculated correctly (off by one) for huge spte so KVM guest was unstable with transparent hugepages. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Reviewed-by: Rik van Riel <riel@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 36c62f33513f..812770cddc8d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -850,8 +850,12 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, ret = handler(kvm, &memslot->rmap[gfn_offset], data); for (j = 0; j < KVM_NR...
c19b8bd60e19308d5583ef200ddcc782d85d9543
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix xchg instruction emulation
Problem Details: If the destination is a memory operand and the memory cannot map to a valid page, the xchg instruction emulation and locked instruction will not work on io regions and stuck in endless loop. We should emulate exchange as write to fix it. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Acked-by: Gleb...
```diff diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 689c2c3182ab..97aab036dabf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3562,6 +3562,10 @@ static int emulator_cmpxchg_emulated(unsigned long addr, goto emul_write; page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); + if (is_error_...
c0e0608cb902af1a1fd8d413ec0a07ee1e62c652
Analyze and fix the following issue in the Linux kernel code: KVM: x86: emulator: inc/dec can have lock prefix
Problem Details: Mark inc (0xfe/0 0xff/0) and dec (0xfe/1 0xff/1) as lock prefix capable. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 255473f974ab..b38bd8b92aa6 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -345,10 +345,10 @@ static u32 group_table[] = { DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, 0, 0, 0, 0, [Group4*8] = - ByteOp | DstMem |...
5991b33237b7fc7dd9f62ae04998c42217d444a7
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: Validate all gptes during fetch, not just those used for new pages
Problem Details: Currently, when we fetch an spte, we only verify that gptes match those that the walker saw if we build new shadow pages for them. However, this misses the following race: vcpu1 vcpu2 walk change gpte walk instantiate sp fetch e...
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 368e4cb6233b..8cb85f9c8adb 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -319,10 +319,11 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, int *ptwrite, pfn_t pfn) { unsigned access = gw...
0b3c933302262d83018dd5f69656bca9f28a0cd3
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: Simplify spte fetch() function
Problem Details: Partition the function into three sections: - fetching indirect shadow pages (host_level > guest_level) - fetching direct shadow pages (page_level < host_level <= guest_level) - the final spte (page_level == host_level) Instead of the current spaghetti. A slight change from the original code is that...
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index e1c1f9eb1cc1..368e4cb6233b 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -321,9 +321,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, unsigned access = gw->pt_access; struct kvm_mmu_page ...
aea924f606c309feead37ab5c43f410a08ff3826
Analyze and fix the following issue in the Linux kernel code: KVM: PIT: stop vpit before freeing irq_routing
Problem Details: Fix: general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ...... Call Trace: [<ffffffffa0159bd1>] ? kvm_set_irq+0xdd/0x24b [kvm] [<ffffffff8106ea8b>] ? trace_hardirqs_off_caller+0x1f/0x10e [<ffffffff813ad17f>] ? sub_preempt_count+0xe/0xb6 [<ffffffff8106d273>] ? put_lock_stats+0xe/0x27 .....
```diff diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 70db4d435393..0fd6378981f4 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -752,6 +752,9 @@ void kvm_free_pit(struct kvm *kvm) struct hrtimer *timer; if (kvm->arch.vpit) { + kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->ar...
a6f177efaa5856e22ed0d3c1e81e65b41654d083
Analyze and fix the following issue in the Linux kernel code: KVM: Reenter guest after emulation failure if due to access to non-mmio address
Problem Details: When shadow pages are in use sometimes KVM try to emulate an instruction when it accesses a shadowed page. If emulation fails KVM un-shadows the page and reenter guest to allow vcpu to execute the instruction. If page is not in shadow page hash KVM assumes that this was attempt to do MMIO and reports e...
```diff diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3d72fc067059..d51eed239b47 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3930,6 +3930,29 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu) return EMULATE_FAIL; } +static bool reexecute_instruction(struct kvm_vcpu *vcpu, g...
673813e81d8468e80b6dd0fa839923eb9748dc49
Analyze and fix the following issue in the Linux kernel code: KVM: fix lock imbalance in kvm_create_pit()
Problem Details: Stanse found that there is an omitted unlock in kvm_create_pit in one fail path. Add proper unlock there. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Avi Kivity <avi@redhat.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com...
```diff diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 467cc47fb733..70db4d435393 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags) pit->wq = create_singlethread_workqueue("kvm-pit-wq"); if (!pit->wq) { + mu...
07cbc6c185aee2c0479776845988242a040c7c93
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix cli/sti instruction emulation
Problem Details: If IOPL check fail, the cli/sti emulate GP and then we should skip writeback since the default write OP is OP_REG. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 8337567a0f44..286572a5675b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2979,17 +2979,19 @@ special_insn: c->dst.type = OP_NONE; /* Disable writeback. */ break; case 0xfa: /* cli */ - if (emulator_bad_iopl(ctxt, ...
b16b2b7bb5a78afceb7fe22f2a04476cd70182b7
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix 'mov rm,sreg' instruction decoding
Problem Details: The source operand of 'mov rm,sreg' is segment register, not general-purpose register, so remove SrcReg from decoding. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 59568ad21ab3..8337567a0f44 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -169,7 +169,7 @@ static u32 opcode_table[256] = { /* 0x88 - 0x8F */ ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov, ByteO...
e97e883f8bfbe02cfc2bfff45e68921dfe590c7e
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix 'and AL,imm8' instruction decoding
Problem Details: 'and AL,imm8' should be mask as ByteOp, otherwise the dest operand length will no correct and we may fill the full EAX when writeback. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index ad8d7cdd1eb9..59568ad21ab3 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -123,7 +123,7 @@ static u32 opcode_table[256] = { /* 0x20 - 0x27 */ ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock, Byt...
ce7a0ad3bdcd86e6cf907eb5992fecb1503daa26
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix the comment of out instruction
Problem Details: Fix the comment of out instruction, using the same style as the other instructions. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d842a7d2bc64..ad8d7cdd1eb9 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2949,8 +2949,8 @@ special_insn: &c->dst.val)) goto done; /* IO is needed */ break; - case 0xee: /* out al,dx */ - case 0xef: /* out ...
a5046e6c7d97d6574ffe6367311ea0b0de56aa58
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix 'mov sreg,rm16' instruction decoding
Problem Details: Memory reads for 'mov sreg,rm16' should be 16 bits only. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index e8bdddc4509e..d842a7d2bc64 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -170,7 +170,7 @@ static u32 opcode_table[256] = { ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov, ByteOp | DstReg | SrcMem ...
a9221dd5ec125fbec1702fae016c6d2ea1a9a3da
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: Atomically check for accessed bit when dropping an spte
Problem Details: Currently, in the window between the check for the accessed bit, and actually dropping the spte, a vcpu can access the page through the spte and set the bit, which will be ignored by the mmu. Fix by using an exchange operation to atmoically fetch the spte and drop it. Signed-off-by: Avi Kivity <avi@r...
```diff diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index fbdca08b8d8c..ba2efcf2b86e 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -288,6 +288,21 @@ static void __set_spte(u64 *sptep, u64 spte) #endif } +static u64 __xchg_spte(u64 *sptep, u64 new_spte) +{ +#ifdef CONFIG_X86_64 + return xchg(s...
dd180b3e90253cb4ca95d603a8c17413f8daec69
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: fix tlb flush with invalid root
Problem Details: Commit 341d9b535b6c simplify reload logic while entry guest mode, it can avoid unnecessary sync-root if KVM_REQ_MMU_RELOAD and KVM_REQ_MMU_SYNC both set. But, it cause a issue that when we handle 'KVM_REQ_TLB_FLUSH', the root is invalid, it is triggered during my test: Kernel BUG at ffffffffa00212b8 ...
```diff diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 50c79b9f5c38..502e53f999cf 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -40,6 +40,8 @@ 0xFFFFFF0000000000ULL) #define INVALID_PAGE (~(hpa_t)0) +#define VALID_PAGE(x) ((x) != IN...
5689cc53fa9d09b5bf41b1b1a7c90bd6c112ab40
Analyze and fix the following issue in the Linux kernel code: KVM: Use u64 for frame data types
Problem Details: For 32bit machines where the physical address width is larger than the virtual address width the frame number types in KVM may overflow. Fix this by changing them to u64. [sfr: fix build on 32-bit ppc] Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.o...
```diff diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index 812312542e50..9b9b5cdea840 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c @@ -316,7 +316,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr, gfn = gpaddr >> PAGE_SHIFT; new_page = gfn_t...
3b454c4945c756686e91d77eeefac80cb5d21baf
Analyze and fix the following issue in the Linux kernel code: ceph: simplify caps revocation, fix for multimds
Problem Details: The caps revocation should either initiate writeback, invalidateion, or call check_caps to ack or do the dirty work. The primary question is whether we can get away with only checking the auth cap or whether all caps need to be checked. The old code was doing...something else. At the very least, rev...
```diff diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index a5b5725931bf..82ffde618af0 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2278,8 +2278,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, * try to invalidate (once). (If there are dirty buffers, we * will invalidate...
38e8883ee31667d901feb9106f4863af35948c91
Analyze and fix the following issue in the Linux kernel code: ceph: simplify add_cap_releases
Problem Details: No functional change, aside from more useful debug output. Signed-off-by: Sage Weil <sage@newdream.net>
```diff diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 26a5368e91f2..774407f96ff1 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1069,11 +1069,14 @@ static int trim_caps(struct ceph_mds_client *mdsc, int ceph_add_cap_releases(struct ceph_mds_client *mdsc, struct ceph_mds_session...
d1d6ca73ef548748e141747e7260798327d6a2c1
Analyze and fix the following issue in the Linux kernel code: drm/agp/i915: trim stolen space to 32M
Problem Details: Some BIOSes will claim a large chunk of stolen space. Unless we reclaim it, our aperture for remapping buffer objects will be constrained. So clamp the stolen space to 32M and ignore the rest. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15469 among others. Adding the ignored stolen memory bac...
```diff diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index f804325a735e..d22ffb811bf2 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c @@ -25,6 +25,10 @@ #define USE_PCI_DMA_API 1 #endif +/* Max amount of stolen space, anything above will be returned to Linux ...
cda4b7d3a5b1dcbc0d8e7bad52134347798e9047
Analyze and fix the following issue in the Linux kernel code: drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
Problem Details: The docs warn that to position the cursor such that no part of it is visible on the pipe is an undefined operation. Avoid such circumstances upon changing the mode, or at any other time, by unsetting the cursor if it moves out of bounds. "For normal high resolution display modes, the cursor must have ...
```diff diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 132314e2bf21..ca3b8a8933c6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -43,6 +43,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type); static void intel...
8dc1775dce10d5e47d2805665804fddf39ea3a90
Analyze and fix the following issue in the Linux kernel code: drm/i915: Attempt to uncouple object after catastrophic failure in unbind
Problem Details: If we fail to flush outstanding GPU writes but return the memory to the system, we risk corrupting memory should the GPU recovery and complete those writes. On the other hand, if we bail early and free the object then we have a definite use-after-free and real memory corruption. Choose the lesser of tw...
```diff diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index f45f385c84cd..eeb768818136 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1967,11 +1967,12 @@ i915_gem_object_unbind(struct drm_gem_object *obj) * before we unbind. */ ret = i915_...
be72615bcf4d5b7b314d836c5e1b4baa4b65dad1
Analyze and fix the following issue in the Linux kernel code: drm/i915: Repeat unbinding during free if interrupted (v6)
Problem Details: If during the freeing of an object the unbind is interrupted by a system call, which is quite possible if we have outstanding GPU writes that must be flushed, the unbind is silently aborted. This still leaves the AGP region and backing pages allocated, and perhaps more importantly, the object remains u...
```diff diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a27780b7aef2..906663b9929e 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -551,6 +551,14 @@ typedef struct drm_i915_private { /** LRU list of objects with fence regs on them. */ stru...
4f444071702bf0b76cfb381150cf0fc8cacdc931
Analyze and fix the following issue in the Linux kernel code: drm/i915: apply DP bandwidth workaround for PCH eDP as well
Problem Details: Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29141 though the workaround itself is still a bit of a mystery. Tested-by: Adam Hill <sidepipeuk@yahoo.co.uk> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c612981e6195..5a11a2bada37 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -534,7 +534,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, } } - if (...
3869d4a8afd3ce97770e66d6a96672af93984cc2
Analyze and fix the following issue in the Linux kernel code: agp/intel: Support the extended physical addressing bits on Sandybridge.
Problem Details: Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> [anholt: Split this patch out of a larger patch for Sandybridge fixes] Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index d836a71bf06d..5bbc7be203a6 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -816,9 +816,9 @@ static const struct intel_driver_description { { PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB, PCI_DEVICE_ID_INTEL_I...
534843dabf79da40561148764916e1b2e6bbcebe
Analyze and fix the following issue in the Linux kernel code: drm/i915: Use 128k alignment for untiled display surface on i965 (v2)
Problem Details: The original i965, including the revised G35 and Q35, requires an alignment of 128K for the display surface with linear memory, so increase the requirement from 64k for these chipsets. For the later chipsets in the i965 family, only a 4k alignment is required. (So long as we do not start performing asy...
```diff diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 04d9d1f73d1b..ca740d9170a3 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -93,11 +93,11 @@ static const struct intel_device_info intel_i945gm_info = { }; static const struct intel_devi...
e1a4474349997d722e4ae64e40a68feb25307109
Analyze and fix the following issue in the Linux kernel code: drm/i915/pch: Cosmetic fix to FDI link training
Problem Details: Unmask the bits for link training reporting before starting link training. If stage 1 training finished before we unmask them, then we'd spin around in a loop a few times until smashing on through. Which is harmless, since training _did_ succeed, it just looks ugly in dmesg. Signed-off-by: Adam Jack...
```diff diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7e57eaba5e25..f67c74a25264 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1604,6 +1604,15 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc) int fdi_rx_im...
cbb465e72ae2cf37d252284c28a0d89ddfaaa240
Analyze and fix the following issue in the Linux kernel code: drm/i915: Include instdone[1] in hangcheck
Problem Details: References: Bug 26691 - Spurious hangcheck whilst executing a long shader over a large vertex buffer https://bugs.freedesktop.org/show_bug.cgi?id=26691 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 21a4af999191..70e252768ab3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -286,6 +286,8 @@ typedef struct drm_i915_private { struct timer_list hangcheck_timer; int hangcheck_count; u...
2377b741abec485449d145e5065dd2b7dd64226f
Analyze and fix the following issue in the Linux kernel code: drm/i915: fix FDI frequency check
Problem Details: Since mode->clock is in kHz we should be checking against 2700000 instead of just 27000. This patch gets my x201s working again (well working as well as it ever was anyway). When looking for this I also noticed we set link_bw to 270000, but the calculation is different. Does it also need to use kHz ...
```diff diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 81179fb5150e..7e57eaba5e25 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -323,6 +323,9 @@ struct intel_limit { #define IRONLAKE_DP_P1_MIN 1 #define IRONLAKE_DP_P1_M...
5f35308bab7efd8c03e4bb4feea07f9b94138c3c
Analyze and fix the following issue in the Linux kernel code: drm/i915: Propagate error from drm_install_irq() during EnterVT
Problem Details: Simple fix for error propagation along the old UMS path. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8004dc95c3a8..0bf4bcd53e97 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4687,9 +4687,19 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, BUG_ON(HAS_BSD(dev) && !list_empt...
4fe5e61180d8ea2268d6e64972d90efbe2bab4aa
Analyze and fix the following issue in the Linux kernel code: drm/i915: Apply self-refresh watermark calculation for cursor plane
Problem Details: In SR mode cursor plane watermark calculation uses same formula like display plane. This one fixes the case for 965G and G45. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b637fbf592ec..1f741a6d0b12 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2160,6 +2160,9 @@ #define PINEVIEW_CURSOR_DFT_WM 0 #define PINEVIEW_CURSOR_GUARD_WM 5 +#define I965_CURSOR_FI...
1b07e04e9cd443fc333f4036d129ba7c08d340c4
Analyze and fix the following issue in the Linux kernel code: drm/i915: Fix fifo size for self-refresh watermark on 965G
Problem Details: The total self-refresh fifo entry size for display plane is 512 instead of 128 for 965G. Also fix WM value mask for 965G. About 1.0W power can be saved on one T61 laptop after the self-refresh watermark is configured correctly. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhenyu wa...
```diff diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index dc7c6f8c6693..b637fbf592ec 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -2140,7 +2140,8 @@ #define I830_FIFO_LINE_SIZE 32 #define G4X_FIFO_SIZE 127 -#define I945_FIFO_SIZE 127 /* 9...
fa143215b11056b878875f87edac78a1cfb9d1c0
Analyze and fix the following issue in the Linux kernel code: drm/i915: Fix watermark calculation in self-refresh mode
Problem Details: For self-refresh mode WM calculation's "line time" should use mode's htotal instead of hdisplay. "surface width" is the hdisplay for display plane and 64 for cursor plane. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <...
```diff diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d147ab2f5bfc..7fba852455f4 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -176,7 +176,8 @@ struct drm_i915_display_funcs { int (*get_display_clock_speed)(struct drm_device *dev); int (...
36e83a187ca7517e9bdce7148b1c2c27661ef38f
Analyze and fix the following issue in the Linux kernel code: drm/i915: Add the support of eDP on DP-D for Ibex/CPT
Problem Details: This one adds support for eDP that connected on PCH DP-D port instead of CPU DP-A port, and only DP-D port could be used for eDP. https://bugs.freedesktop.org/show_bug.cgi?id=27220 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Tested-by: Jan-Hendrik Zab <jan@jhz.name> Tested-by: Templar <templar@r...
```diff diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f879589bead1..926470d9c63c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3452,7 +3452,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, temp |= PIPE_8BP...
d874bcff793d6167c8aa3dd0c2fd00ca40ab12a2
Analyze and fix the following issue in the Linux kernel code: drm/i915: remove duplicate PIPE*STAT bit definitions
Problem Details: Having two sets has made me think I caught a bug more than once now. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net>
```diff diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 390d111dc45e..fb6b46285471 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -171,10 +171,10 @@ void intel_enable_asle (struct drm_device *dev) ironlake_enable_display_irq(dev_priv, DE_GSE...
8699be3ef1d71d1c5e11eee239f53573d72515a3
Analyze and fix the following issue in the Linux kernel code: intel_agp: Don't oops with zero stolen memory
Problem Details: When "onboard video memory" is set do "disabled" in BIOS on Asus P4P800-VM board (i865G), kernel oopses with memory corruption: https://bugs.freedesktop.org/show_bug.cgi?id=28430 Fix that by cleanly aborting the initialization. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Er...
```diff diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 9344216183a4..f97122a53ca3 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c @@ -797,6 +797,10 @@ static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge) /* we have to call this as early...
43b27f40ebc40758a4acad03ea9fa717ba65d76e
Analyze and fix the following issue in the Linux kernel code: drm/i915: Explosion following OOM in do_execbuffer.
Problem Details: Oops, when merging the extra details following an OOM, I missed that driver_private is now NULL and the correct way to convert from the drm_gem_object into the drm_i915_gem_object is to use to_intel_bo(). BUG: unable to handle kernel NULL pointer dereference at 00000069 IP: [<c11a4a02>] i915_gem_do_ex...
```diff diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 15d2d93aaca9..8004dc95c3a8 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -3645,6 +3645,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev, return ret; } + int i915_gem_do_e...
0544edfdc3b8f172944c26b9961ca120feb04798
Analyze and fix the following issue in the Linux kernel code: gpu/drm/i915: Add a blacklist to omit modeset on LID open
Problem Details: On some machines (currently only the Toshiba Tecra A11 is known), the GPU locks up when modeset is forced on LID open. This patch adds a new DMI blacklist and omits modesetting for all matches. Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15550 Signed-off-by: Thomas Bächler <thomas@archlinux.org...
```diff diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 31df55f0a0a7..0eab8df5bf7e 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -599,6 +599,26 @@ static int intel_lvds_get_modes(struct drm_connector *connector) return 0; } +stati...
219de62a1627247fca10789f28902f66cb0b408f
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: trivial code style fixes for audio
Problem Details: Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
```diff diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 631e1edc373a..b5443fe1c1d1 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c @@ -63,7 +63,8 @@ int r600_audio_bits_per_sample(struct radeon_device *rdev) case 0x4: return 32; ...
ddd3d069c08bb1ba83aa4d522fc1360ce4afc270
Analyze and fix the following issue in the Linux kernel code: drm: Free the idr layers before calling idr_destroy()
Problem Details: /* A typical clean-up sequence for objects stored in an idr tree, will * use idr_for_each() to free all objects, if necessary, then * idr_remove_all() to remove all ids, and idr_destroy() to free * up the cached idr_layers. */ We were missing the vital idr_rmove_all() step and so were leaking the ...
```diff diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 510bc87d98f6..b5a51686f492 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -335,6 +335,7 @@ static void __exit drm_core_exit(void) unregister_chrdev(DRM_MAJOR, "drm"); + idr_remove_all(&drm_minors_idr); id...
c39721c775f7ac20af5ff1cbbd11f80aeec91baa
Analyze and fix the following issue in the Linux kernel code: drm/vmgfx: operation on ‘par->dirty.y1’ may be undefined
Problem Details: Trivial fix to set y1 = y2 = 0. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
```diff diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index b0866f04ec76..870967a97c15 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c @@ -528,7 +528,7 @@ int vmw_fb_init(struct vmw_private *vmw_priv) * Dirty & Deferred IO */ par->d...
833ee5c4ab36937a99e63935d7f06bc2c1f9343b
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: remove rs4xx gart limit
Problem Details: We used to limit the rs4xx gart aperture to 32 MB, but I suspect that was due to not meeting the alignment requirements of the aperture. This patch should only be applied after: "drm/radeon/kms: fix gtt MC base alignment on rs4xx/rs690/rs740 asics" has been applied. This patch should probably soak fo...
```diff diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 037b93a1b373..ae2b76b9a388 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c @@ -55,14 +55,6 @@ void rs400_gart_adjust_size(struct radeon_device *rdev) rdev->mc.gtt_size = 32 * 1024 * 1024; re...
167ffc44caaee68ea60dadf6931a4d195a4ed1f0
Analyze and fix the following issue in the Linux kernel code: drm: radeon: fix sign bug
Problem Details: The "error" variable is unsigned so it's never less than zero. I changed it to check if (freq < current_freq) directly. "best_error" is also unsigned so "best_error - 100" could be a large number instead of a negative. Since "error" is unsigned it is never less than a negative and so the cases where...
```diff diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8154cdf796e4..a68728dbd41d 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -558,15 +558,17 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll, ...
e376573f7267390f4e1bdc552564b6fb913bce76
Analyze and fix the following issue in the Linux kernel code: drm/radeon: fall back to GTT if bo creation/validation in VRAM fails.
Problem Details: This fixes a problem where on low VRAM cards we'd run out of space for validation. [airlied: Tested on my M7, Thinkpad T42, compiz works with no problems.] Signed-off-by: Michel Dänzer <daenzer@vmware.com> Cc: stable@kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
```diff diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index d5b9373ce06c..0afd1e62347d 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -110,6 +110,7 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_objec...
351a52a2414d2b104269755c86b476863c248034
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: add ioport register access
Problem Details: This is required for the NB_MISC regs on rs780/rs880 which means HDMI/DVI/DP ports using PCIEPHY won't work without it. It might also help with s/r (asic init) issues on other atombios cards. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=28774 and similar issues reported by Alberto Milone. [air...
```diff diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index bded8704326e..8e421f644a54 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -108,12 +108,11 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, base++; break; case ATO...
7eea7e9eea106a9c49cddf780f590dd8161481fa
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: track audio engine state, do not use not setup timer
Problem Details: This is needed to enable audio support on devices using polling. In case user decides to disable audio (module parameter) we still will try to use timer in r600_audio_enable_polling. This would lead to BUG in kernel/timer.c. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Dave Airlie <a...
```diff diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 2b26553c352c..631e1edc373a 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c @@ -160,6 +160,7 @@ static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable) { ...
40e2a5c15d09e02a71711735564151c789f95032
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: fix CS alignment checking for tiling (v2)
Problem Details: Covers depth, cb, and textures. Hopefully I got this right. v2: - fix bugs: https://bugs.freedesktop.org/show_bug.cgi?id=28327 https://bugs.freedesktop.org/show_bug.cgi?id=28381 - use ALIGNED(), IS_ALIGNED() macros Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dav...
```diff diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 5cab1b413b6c..39bac5c3bb2b 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -25,6 +25,7 @@ * Alex Deucher * Jerome Glisse */ +#include <linux/kernel.h> #include ...
21a8122ad38c60d73fe5dc51051414c3564d174a
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms: add support for internal thermal sensors (v3)
Problem Details: rv6xx/rv7xx/evergreen families supported; older asics did not have an internal thermal sensor. Note, not all oems use the internal thermal sensor, so it's only exposed in cases where it is used. Note also, that most laptops use an oem specific ACPI solution for GPU thermal information rather than usi...
```diff diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 5b7a1a4692a0..4cab0c6397e3 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -61,6 +61,7 @@ config DRM_RADEON select DRM_KMS_HELPER select DRM_TTM select POWER_SUPPLY + select HWMON help Choose thi...
d7a2952f1adec32018a78ec0c2f504dd72f38e25
Analyze and fix the following issue in the Linux kernel code: drm/radeon: Add support for the ATIF ACPI method to the radeon driver
Problem Details: By calling the ATIF method in the radeon driver we can make sure that hotkeys such as the video switch key emit ACPI events when pressed. agd5f: fix warning Signed-off-by: Alberto Milone <alberto.milone@canonical.com> Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <air...
```diff diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 84b1f2729d43..aebe00875041 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -69,5 +69,6 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ radeon-$(CONFIG_COMPAT) += radeon_ioc32...
9bd7ef5f5a5ab6088029ad95a435f03e1314275d
Analyze and fix the following issue in the Linux kernel code: drm/radeon/kms/atom: bump atom loop timeout from 1 sec to 5 secs
Problem Details: Some tables have delays that can cause the timeout to hit even when not intended. Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=27744 and related bugs. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
```diff diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 1d569830ed99..bded8704326e 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -715,8 +715,8 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) cjiffies = jiffies; if (time_...
752e386c247664152f2cce37915d1f50631d7f42
Analyze and fix the following issue in the Linux kernel code: sata_fsl,mv,nv: prepare for NCQ command completion update
Problem Details: Make the following changes to prepare for NCQ command completion update. Changes made by this patch don't cause any functional difference. * sata_fsl_host_intr(): rename the local variable qc_active to done_mask as that's what it is. * mv_process_crpb_response(): restructure if clause for easier u...
```diff diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 61c89b54ea23..18c986dbb7f1 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -1096,7 +1096,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) { struct sata_fsl_host_priv *host_priv = ap->host->private_data; void __io...
213373cf974fe69e78ec894b07f45ae2f5a3a078
Analyze and fix the following issue in the Linux kernel code: ata_piix: fix locking around SIDPR access
Problem Details: SIDPR window registers are shared across ports and as each access is done in two steps, accesses to different ports under EH may race. This primarily is caused by incorrect host locking in EH context and should be fixed by defining locking requirements for each EH operation which can be used during EH ...
```diff diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 7409f98d2ae6..3971bc0a4838 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -158,6 +158,7 @@ struct piix_map_db { struct piix_host_priv { const int *map; u32 saved_iocfg; + spinlock_t sidpr_lock; /* FIXME: remove once loc...
b429dd5998d6037e0057564f3894f56aff64d661
Analyze and fix the following issue in the Linux kernel code: [libata] ahci: Fix warning: comparison between 'enum <anonymous>' and 'enum <anonymous>'
Problem Details: The below patch casts ATA_MAX_QUEUE to int because GCC will give a warning message about the two different enum blocks: CC drivers/ata/ahci.o drivers/ata/ahci.c: In function 'ahci_init_one': drivers/ata/ahci.c:1045:2: warning: comparison between 'enum <anonymous>' and 'enum <anonymous>' Signed-...
```diff diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index f2522534ae63..fe75d8befc3a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1042,7 +1042,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) VPRINTK("ENTER\n"); - WARN_ON(ATA_MAX_QUEUE > AHCI_MAX_CMDS);...
da10a2002cf25a11f18fa1b5e327b9ed717f819c
Analyze and fix the following issue in the Linux kernel code: ahci_platform: Remove unneeded ahci_driver.probe assignment
Problem Details: The driver is using platform_driver_probe() during initialization, so ahci_driver.probe hook is never used. But it causes the following (harmless, luckily) section mismatch: WARNING: vmlinux.o(.data+0x2fb20): Section mismatch in reference from the variable ahci_driver to the function .init.text:a...
```diff diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 68ef6b563b7d..4e97f33cca44 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -171,7 +171,6 @@ static int __devexit ahci_remove(struct platform_device *pdev) } static struct platform_driver ahci_driver = ...
be6d947691376218e788418e2656fc9a3e43b9bc
Analyze and fix the following issue in the Linux kernel code: perf, sched migration: Fix key bindings
Problem Details: EVT_KEY_DOWN and EVT_LEFT_DOWN events are not bound to the RootFrame event handler. As a result, zoom/scroll via keyboard events do not work. This patch adds the missing bindings. Signed-off-by: Nikhil Rao <ncrao@google.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> C...
```diff diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py index e9898c5dbcc8..8b8fb7c60991 100644 --- a/tools/perf/scripts/python/sched-migration.py +++ b/tools/perf/scripts/python/sched-migration.py @@ -54,6 +54,8 @@ class RootFrame(wx.Frame): self.scroll_panel...
749e507411b17ad686783b6d1183befd846fb81b
Analyze and fix the following issue in the Linux kernel code: perf, sched migration: Handle ignored migrate out events
Problem Details: Migrate out events may happen on tasks that are not in the runqueue, for example this is the case for tasks that are sleeping. In this case, we don't want to log the migrate out event in the source runqueue because the task is not eventually in the runqueue and we have already logged its sleep event. ...
```diff diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py index f73e1c736a34..7304d86c76c0 100644 --- a/tools/perf/scripts/python/sched-migration.py +++ b/tools/perf/scripts/python/sched-migration.py @@ -435,7 +435,10 @@ class TimeSlice: self.__update_total_load...
0d9dab39fbbecfa8f78a4573a2e8eaf982f1207e
Analyze and fix the following issue in the Linux kernel code: powerpc/5121: fsl-diu-fb: fix issue with re-enabling DIU area descriptor
Problem Details: On MPC5121e Rev 2.0 re-configuring the DIU area descriptor by writing new descriptor address doesn't always work. As a result, DIU continues to display using old area descriptor even if the new one has been written to the descriptor register of the plane. Add the code from Freescale MPC5121EADS BSP fo...
```diff diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 27455ce298b7..9b8c99111221 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -317,6 +317,17 @@ static void fsl_diu_free(void *virt, size_t size) free_pages_exact(virt, size); } +/* + * Workaround for faile...
77a63f3d1e0a3e7ede8d10f569e8481b13ff47c5
Analyze and fix the following issue in the Linux kernel code: NFS: Fix a typo in include/linux/nfs_fs.h
Problem Details: nfs_commit_inode() needs to be defined irrespectively of whether or not we are supporting NFSv3 and NFSv4. Allow the compiler to optimise away code in the NFSv2-only case by converting it into an inlined stub function. Reported-and-tested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Trond Myklebust...
```diff diff --git a/fs/nfs/write.c b/fs/nfs/write.c index bb72ad34d51d..9f81bdd91c55 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1454,11 +1454,6 @@ out_mark_dirty: return ret; } #else -int nfs_commit_inode(struct inode *inode, int how) -{ - return 0; -} - static int nfs_commit_unstable_pages(struct inode...
437f88cc031ffe7f37f3e705367f4fe1f4be8b0f
Analyze and fix the following issue in the Linux kernel code: ext4: fix freeze deadlock under IO
Problem Details: Commit 6b0310fbf087ad6 caused a regression resulting in deadlocks when freezing a filesystem which had active IO; the vfs_check_frozen level (SB_FREEZE_WRITE) did not let the freeze-related IO syncing through. Duh. Changing the test to FREEZE_TRANS should let the normal freeze syncing get through the...
```diff diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e046eba24782..282a2704be23 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -241,7 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) if (sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); - vfs_check_frozen(sb, SB_FREEZE...
95c87e2b4460a488ec7ce42f273893e410ab385a
Analyze and fix the following issue in the Linux kernel code: KVM: Fix IOMMU memslot reference warning
Problem Details: This patch fixes the following warning. =================================================== [ INFO: suspicious rcu_dereference_check() usage. ] --------------------------------------------------- include/linux/kvm_host.h:259 invoked rcu_dereference_check() without protection! other info that might he...
```diff diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 673c88a8efe9..779559552ce7 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -126,9 +126,10 @@ unmap_pages: static int kvm_iommu_map_memslots(struct kvm *kvm) { - int i, r = 0; + int i, idx, r = 0; struct kvm_memslots *slots; + idx = srcu_read...
9e7b0e7fba45ca3c6357aeb7091ebc281f1de365
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix direct sp's access corrupted
Problem Details: If the mapping is writable but the dirty flag is not set, we will find the read-only direct sp and setup the mapping, then if the write #PF occur, we will mark this mapping writable in the read-only direct sp, now, other real read-only mapping will happily write it without #PF. It may hurt guest's COW...
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index f4e4aaa65ff3..117d63f6304d 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -325,8 +325,32 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, break; } - if (is_shadow_present_pte(*sptep) &...
5fd5387c89ec99ff6cb82d2477ffeb7211b781c2
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix conflict access permissions in direct sp
Problem Details: In no-direct mapping, we mark sp is 'direct' when we mapping the guest's larger page, but its access is encoded form upper page-struct entire not include the last mapping, it will cause access conflict. For example, have this mapping: [W] / PDE1 -> |---| P[W] | | LPA \...
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index a21a86ef9e20..f4e4aaa65ff3 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -339,6 +339,8 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, direct = 1; if (!is_dirty_gpte(gw->ptes[level - d...
36a2e6774bfb5f32a0f23bb155f1f960321f291b
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: fix writable sync sp mapping
Problem Details: While we sync many unsync sp at one time(in mmu_sync_children()), we may mapping the spte writable, it's dangerous, if one unsync sp's mapping gfn is another unsync page's gfn. For example: SP1.pte[0] = P SP2.gfn's pfn = P [SP1.pte[0] = SP2.gfn's pfn] First, we write protected SP1 and SP2, but SP1 a...
```diff diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 690a7fc58c17..ca07ed083b59 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1810,11 +1810,14 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn, bool need_unsync = false; for_each_gfn_indirect_valid_sp(vcpu->kvm, s, ...
4482b06c0459469c101a1da3f4b24594da557f99
Analyze and fix the following issue in the Linux kernel code: KVM: ia64: fix dirty_log_lock spin_lock section not to include get_dirty_log()
Problem Details: kvm_get_dirty_log() calls copy_to_user(). So we need to narrow the dirty_log_lock spin_lock section not to include this. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index bd510beb43af..d85b5d2d52d1 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c @@ -1817,10 +1817,12 @@ static int kvm_ia64_sync_dirty_log(struct kvm *kvm, n = kvm_dirty_bitmap_bytes(memslot); base = memslot->base_gfn / B...
bbeb34062fbad287c949a945a516a0c15b179993
Analyze and fix the following issue in the Linux kernel code: KVM: Fix a race condition for usage of is_hwpoison_address()
Problem Details: is_hwpoison_address accesses the page table, so the caller must hold current->mm->mmap_sem in read mode. So fix its usage in hva_to_pfn of kvm accordingly. Comment is_hwpoison_address to remind other users. Reported-by: Avi Kivity <avi@redhat.com> Signed-off-by: Huang Ying <ying.huang@intel.com> Sign...
```diff diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 378b0f61fd3c..6b44e52cacaa 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1298,6 +1298,9 @@ done: return ret; } +/* + * The caller must hold current->mm->mmap_sem in read mode. + */ int is_hwpoison_address(unsigned long addr) { ...
971eb77f87bfd352a56a24651922d0383db76219
Analyze and fix the following issue in the Linux kernel code: KVM: s390: Fix build failure due to centralized vcpu locking patches
Problem Details: This patch fixes ERROR: "__kvm_s390_vcpu_store_status" [arch/s390/kvm/kvm.ko] undefined! triggered by commit 3268c56840dcee78c3e928336550f4e1861504c4 (kvm.git) Author: Avi Kivity <avi@redhat.com> Date: Thu May 13 12:21:46 2010 +0300 KVM: s390: Centrally lock arch specific vcpu ioctls Reported-b...
```diff diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index 3ddc30895e31..f7b6df45d8be 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c @@ -135,7 +135,7 @@ static int handle_stop(struct kvm_vcpu *vcpu) spin_lock_bh(&vcpu->arch.local_int.lock); if (vcpu->arch.local_int.acti...
a1a005f36e0defea7c5490772c318c6af2261d31
Analyze and fix the following issue in the Linux kernel code: KVM: Fix xsave and xcr save/restore memory leak
Problem Details: We allocate temporary kernel buffers for these structures, but never free them. Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0c8dc9614e7d..d918cb15e5b5 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2437,6 +2437,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, void __user *argp = (void __user *)arg; int r; struct kvm_lapic_state *lapic = NULL; + struct kvm...
7d5993d63f2bac75b89e171a7098044ec4bc701f
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix group3 instruction decoding
Problem Details: Group 3 instruction with ModRM reg field as 001 is defined as test instruction under AMD arch, and emulate_grp3() is ready for emulate it, so fix the decoding. static inline int emulate_grp3(...) { ... switch (c->modrm_reg) { case 0 ... 1: /* test */ emulate_2op_SrcV("test", c->src, c->dst, ctx...
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c990db0a3a02..abb8cec420a2 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -336,11 +336,11 @@ static u32 group_table[] = { [Group1A*8] = DstMem | SrcNone | ModRM | Mov | Stack, 0, 0, 0, 0, 0, 0, 0, [Group3_Byte*8] = - B...
6045be5dea7f7905433585e524f884b711e3796a
Analyze and fix the following issue in the Linux kernel code: KVM: PPC: fix uninitialized variable warning in kvm_ppc_core_deliver_interrupts
Problem Details: Fixes: arch/powerpc/kvm/booke.c: In function 'kvmppc_core_deliver_interrupts': arch/powerpc/kvm/booke.c:147: warning: 'msr_mask' may be used uninitialized in this function Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index b687f430f8c0..8d4e35f5372c 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -144,7 +144,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority...
21bbe18b2d53e0941cbd1621400ba7b4028972cb
Analyze and fix the following issue in the Linux kernel code: KVM: Fix typos in Documentation/kvm/mmu.txt
Problem Details: Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/Documentation/kvm/mmu.txt b/Documentation/kvm/mmu.txt index 8cb42b957c73..142cc5136650 100644 --- a/Documentation/kvm/mmu.txt +++ b/Documentation/kvm/mmu.txt @@ -77,10 +77,10 @@ Memory Guest memory (gpa) is part of the user address space of the process that is using kvm. Userspace defines the ...
c37eda138473f8c843f2b4aa8da252fdfdaaafa3
Analyze and fix the following issue in the Linux kernel code: KVM: x86 emulator: fix pusha instruction emulation
Problem Details: emulate pusha instruction only writeback the last EDI register, but the other registers which need to be writeback is ignored. This patch fixed it. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a4c2dcd10326..c990db0a3a02 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1553,6 +1553,64 @@ exception: return X86EMUL_PROPAGATE_FAULT; } +static inline int writeback(struct x86_emulate_ctxt *ctxt, + struct x86_e...
bd371396b38ffc4bd6444b0203f33b99d18cedd0
Analyze and fix the following issue in the Linux kernel code: KVM: x86: fix -DDEBUG oops
Problem Details: Fix a slight error with assertion in local APIC code. Signed-off-by: Zachary Amsden <zamsden@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d8258a0060f8..024f6d1c2996 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -329,7 +329,7 @@ int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, "dest_mode 0x%x, short_hand 0x%x\n", target, source, des...
69b61833f7ce6e61e196c8a724e4d1278b24ac02
Analyze and fix the following issue in the Linux kernel code: KVM: PPC: fix build warning in kvm_arch_vcpu_ioctl_run
Problem Details: Fix compile warning: CC [M] arch/powerpc/kvm/powerpc.o arch/powerpc/kvm/powerpc.c: In function 'kvm_arch_vcpu_ioctl_run': arch/powerpc/kvm/powerpc.c:290: warning: 'gpr' may be used uninitialized in this function arch/powerpc/kvm/powerpc.c:290: note: 'gpr' was declared here Signed-off-by: Deni...
```diff diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index a1d87508892e..b5ebdfbed20b 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -287,7 +287,7 @@ static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu, static void kvmppc_complete_mmio_load(struct kvm_vcpu *v...
2390218b6aa2eb3784b0a82fa811c19097dc793a
Analyze and fix the following issue in the Linux kernel code: KVM: Fix mov cr3 #GP at wrong instruction
Problem Details: On Intel, we call skip_emulated_instruction() even if we injected a #GP, resulting in the #GP pointing at the wrong address. Fix by injecting the exception and skipping the instruction at the same place, so we can do just one or the other. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Mar...
```diff diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index ea8c319cdffc..c2813d658f3e 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -598,7 +598,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, bool has_error_co...
a83b29c6ad6d6497e569edbc29e556a384cebddd
Analyze and fix the following issue in the Linux kernel code: KVM: Fix mov cr4 #GP at wrong instruction
Problem Details: On Intel, we call skip_emulated_instruction() even if we injected a #GP, resulting in the #GP pointing at the wrong address. Fix by injecting the exception and skipping the instruction at the same place, so we can do just one or the other. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Mar...
```diff diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index b23708450210..ea8c319cdffc 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -599,7 +599,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, int kvm_set_cr0(struc...
49a9b07edcf4aff159c1f3d3a27e58cf38bc27cd
Analyze and fix the following issue in the Linux kernel code: KVM: Fix mov cr0 #GP at wrong instruction
Problem Details: On Intel, we call skip_emulated_instruction() even if we injected a #GP, resulting in the #GP pointing at the wrong address. Fix by injecting the exception and skipping the instruction at the same place, so we can do just one or the other. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Mar...
```diff diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 91631b8b2090..b23708450210 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -597,7 +597,7 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg); int kvm_task_swit...
f495c6e5e8fdc972162241df5bdff5bcebb4dc33
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: Fix incorrect rcu deref in rmode_tss_base()
Problem Details: Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 01b054c98139..26ba61d6af8c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1688,7 +1688,7 @@ static gva_t rmode_tss_base(struct kvm *kvm) gfn_t base_gfn; slots = kvm_memslots(kvm); - base_gfn = kvm->memslots->memslots[0].base_gfn +...
a24e809902339458416900869abdcc51a44bfd48
Analyze and fix the following issue in the Linux kernel code: KVM: Fix unused but set warnings
Problem Details: No real bugs in this one. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 1f7f5dd8306f..9308be2d5c02 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -444,6 +444,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, kvm_mmu_free_some_pages(vcpu); sptep = FNAME(fetc...
376d41ff2669617a1ef828466ad07a1be99d24d3
Analyze and fix the following issue in the Linux kernel code: KVM: Fix KVM_SET_SIGNAL_MASK with arg == NULL
Problem Details: When the user passed in a NULL mask pass this on from the ioctl handler. Found by gcc 4.6's new warnings. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
```diff diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 78ed71ad6aa1..84a090644d9d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1547,7 +1547,7 @@ out_free2: goto out; p = &sigset; } - r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset); + r = kvm_vcpu_ioctl_set_sigmask(vcpu, p); ...
4b9d3a04519fb508ad3b7ce8a7962929b2614185
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: fix rcu usage warning in init_rmode()
Problem Details: fix: [ INFO: suspicious rcu_dereference_check() usage. ] --------------------------------------------------- include/linux/kvm_host.h:258 invoked rcu_dereference_check() without protection! other info that might help us debug this: rcu_scheduler_active = 1, debug_locks = 1 1 lock held by qemu-system...
```diff diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7d7361750bf2..01b054c98139 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -2659,21 +2659,27 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) static int init_rmode(struct kvm *kvm) { + int idx, ret = 0; + + idx = srcu_read_lock(&kvm->s...
7fb8f881c54beb05dd4d2c947dada1c636581d87
Analyze and fix the following issue in the Linux kernel code: of/platform: Register of_platform_drivers with an "of:" prefix
Problem Details: Currently there are some drivers in tree which register both a platform_driver and an of_platform_driver with the same name. This is a temporary situation until all the relevant of_platform_drivers are converted to be normal platform_drivers. Until then, this patch gives all the of_platform_drivers a...
```diff diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 30a4641e798a..bb72223c22ae 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -74,8 +74,22 @@ static void platform_driver_shutdown_shim(struct platform_device *pdev) */ int of_register_platform_driver(struct of_platform_driver *d...
22ae782f86b726f9cea752c0f269ff6dcdf2f6e1
Analyze and fix the following issue in the Linux kernel code: of/address: Clean up function declarations
Problem Details: This patch moves the declaration of of_get_address(), of_get_pci_address(), and of_pci_address_to_resource() out of arch code and into the common linux/of_address header file. This patch also fixes some of the asm/prom.h ordering issues. It still includes some header files that it ideally shouldn't b...
```diff diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index cb9c3dd9a23b..101fa098f62a 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h @@ -20,11 +20,6 @@ #ifndef __ASSEMBLY__ #include <linux/types.h> -#include <linux/of_address.h> -#inc...
3bd89007ab4243b36bc30f5fc4aa8b4f75ff8fc2
Analyze and fix the following issue in the Linux kernel code: KVM: cleanup "*new.rmap" type
Problem Details: The type of '*new.rmap' is not 'struct page *', fix it Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
```diff diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 4a71faa96dfd..78ed71ad6aa1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -600,7 +600,7 @@ int __kvm_set_memory_region(struct kvm *kvm, /* Allocate if a slot is being created */ #ifndef CONFIG_S390 if (npages && !new.rmap) { - new...
6dc696d4ddf2181eefee361e1d24a49351aef1f6
Analyze and fix the following issue in the Linux kernel code: KVM: SVM: Fix EFER.LME being stripped
Problem Details: Must set VCPU register to be the guest notion of EFER even if that setting is not valid on hardware. This was masked by the set in set_efer until 7657fd5ace88e8092f5f3a84117e093d7b893f26 broke that. Fix is simply to set the VCPU register before stripping bits. Signed-off-by: Zachary Amsden <zamsden@r...
```diff diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 02ea5cf4b1e5..9c68a650f57e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -286,11 +286,11 @@ static inline void flush_guest_tlb(struct kvm_vcpu *vcpu) static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) { + vcpu->arch.efer = efer;...
3af1817a0d65e8c1317e8d23cfe8a91aa1d4a065
Analyze and fix the following issue in the Linux kernel code: KVM: MMU: calculate correct gfn for small host pages backing large guest pages
Problem Details: In Documentation/kvm/mmu.txt: gfn: Either the guest page table containing the translations shadowed by this page, or the base page frame for linear translations. See role.direct. But in function FNAME(fetch)(), sp->gfn is incorrect when one of following situations occurred: 1) guest is 32b...
```diff diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 2ee7060a80a5..1f7f5dd8306f 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -339,10 +339,13 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, direct = 1; if (!is_dirty_gpte(gw->ptes[level -...