28 eval-informed mental models and critical-thinking skills for Claude Code, GitHub Copilot, Codex, Cursor, and other Agent Skills-compatible tools
JavaScript agent-skillsai-toolsanthropicclaudeclaude-codecritical-thinkingdecision-makingfirst-principlesmental-modelsproblem-solvingsystems-thinking
fix(m3-security-nearmiss-26-audit): fix sec-nearmiss-26 buffer-write vulnerability, complete safe-label audit, update aggregate baseline
Travis Boudreauxf5a79058dfda
diff --git a/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl b/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonlindex 7c25c6c..69eea42 100644--- a/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl+++ b/evals/datasets/calibrated/security-adversarial-candidate-pool.jsonl@@ -1,70 +1,70 @@-{"id":"sec-target-0","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int pwc_video_close(struct inode *inode, struct file *file)\n{\n\tstruct video_device *vdev = file->private_data;\n\tstruct pwc_device *pdev;\n\tint i;\n\n\tPWC_DEBUG_OPEN(\">> video_close called(vdev = 0x%p).\\n\", vdev);\n\n\tpdev = (struct pwc_device *)vdev->priv;\n\tif (pdev->vopen == 0)\n\t\tPWC_DEBUG_MODULE(\"video_close() called on closed device?\\n\");\n\n\t/* Dump statistics, but only if a reasonable amount of frames were\n\t processed (to prevent endless log-entries in case of snap-shot\n\t programs)\n\t */\n\tif (pdev->vframe_count > 20)\n\t\tPWC_DEBUG_MODULE(\"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\\n\", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);\n\n\tif (DEVICE_USE_CODEC1(pdev->type))\n\t pwc_dec1_exit();\n\telse\n\t pwc_dec23_exit();\n\n\tpwc_isoc_cleanup(pdev);\n\tpwc_free_buffers(pdev);\n\n\t/* Turn off LEDS and power down camera, but only when not unplugged */\n\tif (pdev->error_status != EPIPE) {\n\t\t/* Turn LEDs off */\n\t\tif (pwc_set_leds(pdev, 0, 0) < 0)\n\t\t\tPWC_DEBUG_MODULE(\"Failed to set LED on/off time.\\n\");\n\t\tif (power_save) {\n\t\t\ti = pwc_camera_power(pdev, 0);\n\t\t\tif (i < 0)\n\t\t\t\tPWC_ERROR(\"Failed to power down camera (%d)\\n\", i);\n\t\t}\n\t}\n\tpdev->vopen--;\n\tPWC_DEBUG_OPEN(\"<< video_close() vopen=%d\\n\", pdev->vopen);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-1","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic void usb_pwc_disconnect(struct usb_interface *intf)\n{\n\tstruct pwc_device *pdev;\n\tint hint;\n\n\tlock_kernel();\n\tpdev = usb_get_intfdata (intf);\n\tusb_set_intfdata (intf, NULL);\n\tif (pdev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() Called without private pointer.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() already called for %p\\n\", pdev);\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev != interface_to_usbdev(intf)) {\n\t\tPWC_ERROR(\"pwc_disconnect() Woops: pointer mismatch udev/pdev.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\n\t/* We got unplugged; this is signalled by an EPIPE error code */\n\tif (pdev->vopen) {\n\t\tPWC_INFO(\"Disconnected while webcam is in use!\\n\");\n\t\tpdev->error_status = EPIPE;\n\t}\n\n\t/* Alert waiting processes */\n\twake_up_interruptible(&pdev->frameq);\n\t/* Wait until device is closed */\n\twhile (pdev->vopen)\n\t\tschedule();\n\t/* Device is now closed, so we can safely unregister it */\n\tPWC_DEBUG_PROBE(\"Unregistering video device in disconnect().\\n\");\n\tpwc_remove_sysfs_files(pdev->vdev);\n\tvideo_unregister_device(pdev->vdev);\n\n\t/* Free memory (don't set pdev to 0 just yet) */\n\tkfree(pdev);\n\ndisconnect_out:\n\t/* search device_hint[] table if we occupy a slot, by any chance */\n\tfor (hint = 0; hint < MAX_DEV_HINTS; hint++)\n\t\tif (device_hint[hint].pdev == pdev)\n\t\t\tdevice_hint[hint].pdev = NULL;\n\n\tunlock_kernel();\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-2","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_preload(struct mm_struct *mm, unsigned long ea,\n\t\t unsigned long access, unsigned long trap)\n{\n\tunsigned long vsid;\n\tvoid *pgdir;\n\tpte_t *ptep;\n\tcpumask_t mask;\n\tunsigned long flags;\n\tint local = 0;\n\n\t/* We don't want huge pages prefaulted for now\n\t */\n\tif (unlikely(in_hugepage_area(mm->context, ea)))\n\t\treturn;\n\n\tDBG_LOW(\"hash_preload(mm=%p, mm->pgdir=%p, ea=%016lx, access=%lx,\"\n\t\t\" trap=%lx\\n\", mm, mm->pgd, ea, access, trap);\n\n\t/* Get PTE, VSID, access mask */\n\tpgdir = mm->pgd;\n\tif (pgdir == NULL)\n\t\treturn;\n\tptep = find_linux_pte(pgdir, ea);\n\tif (!ptep)\n\t\treturn;\n\tvsid = get_vsid(mm->context.id, ea);\n\n\t/* Hash it in */\n\tlocal_irq_save(flags);\n\tmask = cpumask_of_cpu(smp_processor_id());\n\tif (cpus_equal(mm->cpu_vm_mask, mask))\n\t\tlocal = 1;\n#ifndef CONFIG_PPC_64K_PAGES\n\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#else\n\tif (mmu_ci_restrictions) {\n\t\t/* If this PTE is non-cacheable, switch to 4k */\n\t\tif (mm->context.user_psize == MMU_PAGE_64K &&\n\t\t (pte_val(*ptep) & _PAGE_NO_CACHE)) {\n\t\t\tmm->context.user_psize = MMU_PAGE_4K;\n\t\t\tmm->context.sllp = SLB_VSID_USER |\n\t\t\t\tmmu_psize_defs[MMU_PAGE_4K].sllp;\n\t\t\tget_paca()->context = mm->context;\n\t\t\tslb_flush_and_rebolt();\n#ifdef CONFIG_SPE_BASE\n\t\t\tspu_flush_all_slbs(mm);\n#endif\n\t\t}\n\t}\n\tif (mm->context.user_psize == MMU_PAGE_64K)\n\t\t__hash_page_64K(ea, access, vsid, ptep, trap, local);\n\telse\n\t\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#endif /* CONFIG_PPC_64K_PAGES */\n\tlocal_irq_restore(flags);\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-3","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp6_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tint ret = 0;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph))) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (elen <= 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\tret = crypto_aead_decrypt(req);\n\tif (ret == -EINPROGRESS)\n\t\tgoto out;\n\n\tret = esp_input_done2(skb, ret);\n\nout:\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-16"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-16"}-{"id":"sec-target-4","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\tint err = -EINVAL;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph)))\n\t\tgoto out;\n\n\tif (elen <= 0)\n\t\tgoto out;\n\n\tif ((err = skb_cow_data(skb, 0, &trailer)) < 0)\n\t\tgoto out;\n\tnfrags = err;\n\n\terr = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\terr = crypto_aead_decrypt(req);\n\tif (err == -EINPROGRESS)\n\t\tgoto out;\n\n\terr = esp_input_done2(skb, err);\n\nout:\n\treturn err;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-16"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-16"}-{"id":"sec-target-5","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)\n{\n\treturn alloc_page(gfp | __GFP_ZERO);\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-6","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,\n\t\t unsigned long idx)\n{\n\tstruct vm_area_struct pvma;\n\tstruct page *page;\n\n\tmemset(&pvma, 0, sizeof(struct vm_area_struct));\n\tpvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);\n\tpvma.vm_pgoff = idx;\n\tpvma.vm_end = PAGE_SIZE;\n\tpage = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0);\n\tmpol_free(pvma.vm_policy);\n\treturn page;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-7","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n)\n{\n\tint partial;\n\n\tpagefault_disable();\n\tpartial = __copy_from_user_inatomic(dst, src, n);\n\tpagefault_enable();\n\n\t/*\n\t * Didn't copy everything, drop the mmap_sem and do a faulting copy\n\t */\n\tif (unlikely(partial)) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tpartial = copy_from_user(dst, src, n);\n\t\tdown_read(¤t->mm->mmap_sem);\n\t}\n\n\treturn partial;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-8","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic long vmsplice_to_user(struct file *file, const struct iovec __user *iov,\n\t\t\t unsigned long nr_segs, unsigned int flags)\n{\n\tstruct pipe_inode_info *pipe;\n\tstruct splice_desc sd;\n\tssize_t size;\n\tint error;\n\tlong ret;\n\n\tpipe = pipe_info(file->f_path.dentry->d_inode);\n\tif (!pipe)\n\t\treturn -EBADF;\n\n\tif (pipe->inode)\n\t\tmutex_lock(&pipe->inode->i_mutex);\n\n\terror = ret = 0;\n\twhile (nr_segs) {\n\t\tvoid __user *base;\n\t\tsize_t len;\n\n\t\t/*\n\t\t * Get user address base and length for this iovec.\n\t\t */\n\t\terror = get_user(base, &iov->iov_base);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\t\terror = get_user(len, &iov->iov_len);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\tif (unlikely(!base)) {\n\t\t\terror = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tsd.len = 0;\n\t\tsd.total_len = len;\n\t\tsd.flags = flags;\n\t\tsd.u.userptr = base;\n\t\tsd.pos = 0;\n\n\t\tsize = __splice_from_pipe(pipe, &sd, pipe_to_user);\n\t\tif (size < 0) {\n\t\t\tif (!ret)\n\t\t\t\tret = size;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tret += size;\n\n\t\tif (size < len)\n\t\t\tbreak;\n\n\t\tnr_segs--;\n\t\tiov++;\n\t}\n\n\tif (pipe->inode)\n\t\tmutex_unlock(&pipe->inode->i_mutex);\n\n\tif (!ret)\n\t\tret = error;\n\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-9","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int get_iovec_page_array(const struct iovec __user *iov,\n\t\t\t\tunsigned int nr_vecs, struct page **pages,\n\t\t\t\tstruct partial_page *partial, int aligned)\n{\n\tint buffers = 0, error = 0;\n\n\tdown_read(¤t->mm->mmap_sem);\n\n\twhile (nr_vecs) {\n\t\tunsigned long off, npages;\n\t\tstruct iovec entry;\n\t\tvoid __user *base;\n\t\tsize_t len;\n\t\tint i;\n\n\t\terror = -EFAULT;\n\t\tif (copy_from_user_mmap_sem(&entry, iov, sizeof(entry)))\n\t\t\tbreak;\n\n\t\tbase = entry.iov_base;\n\t\tlen = entry.iov_len;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\terror = 0;\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\terror = -EFAULT;\n\t\tif (unlikely(!base))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Get this base offset and number of pages, then map\n\t\t * in the user pages.\n\t\t */\n\t\toff = (unsigned long) base & ~PAGE_MASK;\n\n\t\t/*\n\t\t * If asked for alignment, the offset must be zero and the\n\t\t * length a multiple of the PAGE_SIZE.\n\t\t */\n\t\terror = -EINVAL;\n\t\tif (aligned && (off || len & ~PAGE_MASK))\n\t\t\tbreak;\n\n\t\tnpages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t\tif (npages > PIPE_BUFFERS - buffers)\n\t\t\tnpages = PIPE_BUFFERS - buffers;\n\n\t\terror = get_user_pages(current, current->mm,\n\t\t\t\t (unsigned long) base, npages, 0, 0,\n\t\t\t\t &pages[buffers], NULL);\n\n\t\tif (unlikely(error <= 0))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Fill this contiguous range into the partial page map.\n\t\t */\n\t\tfor (i = 0; i < error; i++) {\n\t\t\tconst int plen = min_t(size_t, len, PAGE_SIZE - off);\n\n\t\t\tpartial[buffers].offset = off;\n\t\t\tpartial[buffers].len = plen;\n\n\t\t\toff = 0;\n\t\t\tlen -= plen;\n\t\t\tbuffers++;\n\t\t}\n\n\t\t/*\n\t\t * We didn't complete this iov, stop here since it probably\n\t\t * means we have to move some of this into a pipe to\n\t\t * be able to continue.\n\t\t */\n\t\tif (len)\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Don't continue if we mapped fewer pages than we asked for,\n\t\t * or if we mapped the max number of pages that we have\n\t\t * room for.\n\t\t */\n\t\tif (error < npages || buffers == PIPE_BUFFERS)\n\t\t\tbreak;\n\n\t\tnr_vecs--;\n\t\tiov++;\n\t}\n\n\tup_read(¤t->mm->mmap_sem);\n\n\tif (buffers)\n\t\treturn buffers;\n\n\treturn error;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-10","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint ia32_setup_frame(int sig, struct k_sigaction *ka,\n\t\t compat_sigset_t *set, struct pt_regs *regs)\n{\n\tstruct sigframe __user *frame;\n\tvoid __user *restorer;\n\tint err = 0;\n\n\t/* copy_to_user optimizes that into a single 8 byte store */\n\tstatic const struct {\n\t\tu16 poplmovl;\n\t\tu32 val;\n\t\tu16 int80;\n\t\tu16 pad;\n\t} __attribute__((packed)) code = {\n\t\t0xb858,\t\t /* popl %eax ; movl $...,%eax */\n\t\t__NR_ia32_sigreturn,\n\t\t0x80cd,\t\t/* int $0x80 */\n\t\t0,\n\t};\n\n\tframe = get_sigframe(ka, regs, sizeof(*frame));\n\n\tif (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))\n\t\tgoto give_sigsegv;\n\n\terr |= __put_user(sig, &frame->sig);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\terr |= ia32_setup_sigcontext(&frame->sc, &frame->fpstate, regs,\n\t\t\t\t\tset->sig[0]);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\tif (_COMPAT_NSIG_WORDS > 1) {\n\t\terr |= __copy_to_user(frame->extramask, &set->sig[1],\n\t\t\t\t sizeof(frame->extramask));\n\t\tif (err)\n\t\t\tgoto give_sigsegv;\n\t}\n\n\tif (ka->sa.sa_flags & SA_RESTORER) {\n\t\trestorer = ka->sa.sa_restorer;\n\t} else {\n\t\t/* Return stub is in 32bit vsyscall page */\n\t\tif (current->binfmt->hasvdso)\n\t\t\trestorer = VDSO32_SYMBOL(current->mm->context.vdso,\n\t\t\t\t\t\t sigreturn);\n\t\telse\n\t\t\trestorer = &frame->retcode;\n\t}\n\terr |= __put_user(ptr_to_compat(restorer), &frame->pretcode);\n\n\t/*\n\t * These are actually not used anymore, but left because some\n\t * gdb versions depend on them as a marker.\n\t */\n\terr |= __copy_to_user(frame->retcode, &code, 8);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\t/* Set up registers for signal handler */\n\tregs->sp = (unsigned long) frame;\n\tregs->ip = (unsigned long) ka->sa.sa_handler;\n\n\t/* Make -mregparm=3 work */\n\tregs->ax = sig;\n\tregs->dx = 0;\n\tregs->cx = 0;\n\n\tasm volatile(\"movl %0,%%ds\" :: \"r\" (__USER32_DS));\n\tasm volatile(\"movl %0,%%es\" :: \"r\" (__USER32_DS));\n\n\tregs->cs = __USER32_CS;\n\tregs->ss = __USER32_DS;\n\n\tset_fs(USER_DS);\n\tregs->flags &= ~X86_EFLAGS_TF;\n\tif (test_thread_flag(TIF_SINGLESTEP))\n\t\tptrace_notify(SIGTRAP);\n\n#if DEBUG_SIG\n\tprintk(KERN_DEBUG \"SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\\n\",\n\t current->comm, current->pid, frame, regs->ip, frame->pretcode);\n#endif\n\n\treturn 0;\n\ngive_sigsegv:\n\tforce_sigsegv(sig, current);\n\treturn -EFAULT;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-11","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic unsigned long __peek_user(struct task_struct *child, addr_t addr)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset, tmp;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\ttmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask)\n\t\t\t/* Remove per bit from user psw. */\n\t\t\ttmp &= ~PSW_MASK_PER;\n\n\t} else if (addr < (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb reading\n\t\t * from acrs[15]. Result is a 64 bit value. Read the\n\t\t * 32 bit acrs[15] value and shift it by 32. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\ttmp = ((unsigned long) child->thread.acrs[15]) << 32;\n\t\telse\n#endif\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = (addr_t) task_pt_regs(child)->orig_gpr2;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/* \n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc)\n\t\t\ttmp &= (unsigned long) FPC_VALID_MASK\n\t\t\t\t<< (BITS_PER_LONG - 32);\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-12","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int __poke_user(struct task_struct *child, addr_t addr, addr_t data)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask &&\n#ifdef CONFIG_COMPAT\n\t\t data != PSW_MASK_MERGE(psw_user32_bits, data) &&\n#endif\n\t\t data != PSW_MASK_MERGE(psw_user_bits, data))\n\t\t\t/* Invalid psw mask. */\n\t\t\treturn -EINVAL;\n#ifndef CONFIG_64BIT\n\t\tif (addr == (addr_t) &dummy->regs.psw.addr)\n\t\t\t/* I'd like to reject addresses without the\n\t\t\t high order bit but older gdb's rely on it */\n\t\t\tdata |= PSW_ADDR_AMODE;\n#endif\n\t\t*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb writing\n\t\t * to acrs[15] with a 64 bit value. Ignore the lower\n\t\t * half of the value and write the upper 32 bit to\n\t\t * acrs[15]. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\tchild->thread.acrs[15] = (unsigned int) (data >> 32);\n\t\telse\n#endif\n\t\t*(addr_t *)((addr_t) &child->thread.acrs + offset) = data;\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttask_pt_regs(child)->orig_gpr2 = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc &&\n\t\t (data & ~((unsigned long) FPC_VALID_MASK\n\t\t\t << (BITS_PER_LONG - 32))) != 0)\n\t\t\treturn -EINVAL;\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\t*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure \n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\t*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;\n\n\t}\n\n\tFixPerRegisters(child);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-13","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic u32 __peek_user_compat(struct task_struct *child, addr_t addr)\n{\n\tstruct user32 *dummy32 = NULL;\n\tper_struct32 *dummy_per32 = NULL;\n\taddr_t offset;\n\t__u32 tmp;\n\n\tif (addr < (addr_t) &dummy32->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy32->regs.psw.mask) {\n\t\t\t/* Fake a 31 bit psw mask. */\n\t\t\ttmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);\n\t\t\ttmp = PSW32_MASK_MERGE(psw32_user_bits, tmp);\n\t\t} else if (addr == (addr_t) &dummy32->regs.psw.addr) {\n\t\t\t/* Fake a 31 bit psw address. */\n\t\t\ttmp = (__u32) task_pt_regs(child)->psw.addr |\n\t\t\t\tPSW32_ADDR_AMODE31;\n\t\t} else {\n\t\t\t/* gpr 0-15 */\n\t\t\ttmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +\n\t\t\t\t\t addr*2 + 4);\n\t\t}\n\t} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.acrs;\n\t\ttmp = *(__u32*)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure \n\t\t */\n\t offset = addr - (addr_t) &dummy32->regs.fp_regs;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.per_info;\n\t\t/* This is magic. See per_struct and per_struct32. */\n\t\tif ((offset >= (addr_t) &dummy_per32->control_regs &&\n\t\t offset < (addr_t) (&dummy_per32->control_regs + 1)) ||\n\t\t (offset >= (addr_t) &dummy_per32->starting_addr &&\n\t\t offset <= (addr_t) &dummy_per32->ending_addr) ||\n\t\t offset == (addr_t) &dummy_per32->lowcore.words.address)\n\t\t\toffset = offset*2 + 4;\n\t\telse\n\t\t\toffset = offset*2;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-14","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-362)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)\n{\n\tstruct dnotify_struct *dn;\n\tstruct dnotify_struct *odn;\n\tstruct dnotify_struct **prev;\n\tstruct inode *inode;\n\tfl_owner_t id = current->files;\n\tint error = 0;\n\n\tif ((arg & ~DN_MULTISHOT) == 0) {\n\t\tdnotify_flush(filp, id);\n\t\treturn 0;\n\t}\n\tif (!dir_notify_enable)\n\t\treturn -EINVAL;\n\tinode = filp->f_path.dentry->d_inode;\n\tif (!S_ISDIR(inode->i_mode))\n\t\treturn -ENOTDIR;\n\tdn = kmem_cache_alloc(dn_cache, GFP_KERNEL);\n\tif (dn == NULL)\n\t\treturn -ENOMEM;\n\tspin_lock(&inode->i_lock);\n\tprev = &inode->i_dnotify;\n\twhile ((odn = *prev) != NULL) {\n\t\tif ((odn->dn_owner == id) && (odn->dn_filp == filp)) {\n\t\t\todn->dn_fd = fd;\n\t\t\todn->dn_mask |= arg;\n\t\t\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\t\t\tgoto out_free;\n\t\t}\n\t\tprev = &odn->dn_next;\n\t}\n\n\terror = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);\n\tif (error)\n\t\tgoto out_free;\n\n\tdn->dn_mask = arg;\n\tdn->dn_fd = fd;\n\tdn->dn_filp = filp;\n\tdn->dn_owner = id;\n\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\tdn->dn_next = inode->i_dnotify;\n\tinode->i_dnotify = dn;\n\tspin_unlock(&inode->i_lock);\n\n\tif (filp->f_op && filp->f_op->dir_notify)\n\t\treturn filp->f_op->dir_notify(filp, arg);\n\treturn 0;\n\nout_free:\n\tspin_unlock(&inode->i_lock);\n\tkmem_cache_free(dn_cache, dn);\n\treturn error;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-362"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-362"}-{"id":"sec-target-15","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nhrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)\n{\n\tunsigned long orun = 1;\n\tktime_t delta;\n\n\tdelta = ktime_sub(now, timer->expires);\n\n\tif (delta.tv64 < 0)\n\t\treturn 0;\n\n\tif (interval.tv64 < timer->base->resolution.tv64)\n\t\tinterval.tv64 = timer->base->resolution.tv64;\n\n\tif (unlikely(delta.tv64 >= interval.tv64)) {\n\t\ts64 incr = ktime_to_ns(interval);\n\n\t\torun = ktime_divns(delta, incr);\n\t\ttimer->expires = ktime_add_ns(timer->expires, incr * orun);\n\t\tif (timer->expires.tv64 > now.tv64)\n\t\t\treturn orun;\n\t\t/*\n\t\t * This (and the ktime_add() below) is the\n\t\t * correction for exact:\n\t\t */\n\t\torun++;\n\t}\n\ttimer->expires = ktime_add(timer->expires, interval);\n\n\treturn orun;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-16","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int ipip6_rcv(struct sk_buff *skb)\n{\n\tstruct iphdr *iph;\n\tstruct ip_tunnel *tunnel;\n\n\tif (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))\n\t\tgoto out;\n\n\tiph = ip_hdr(skb);\n\n\tread_lock(&ipip6_lock);\n\tif ((tunnel = ipip6_tunnel_lookup(dev_net(skb->dev),\n\t\t\t\t\tiph->saddr, iph->daddr)) != NULL) {\n\t\tsecpath_reset(skb);\n\t\tskb->mac_header = skb->network_header;\n\t\tskb_reset_network_header(skb);\n\t\tIPCB(skb)->flags = 0;\n\t\tskb->protocol = htons(ETH_P_IPV6);\n\t\tskb->pkt_type = PACKET_HOST;\n\n\t\tif ((tunnel->dev->priv_flags & IFF_ISATAP) &&\n\t\t !isatap_chksrc(skb, iph, tunnel)) {\n\t\t\ttunnel->stat.rx_errors++;\n\t\t\tread_unlock(&ipip6_lock);\n\t\t\tkfree_skb(skb);\n\t\t\treturn 0;\n\t\t}\n\t\ttunnel->stat.rx_packets++;\n\t\ttunnel->stat.rx_bytes += skb->len;\n\t\tskb->dev = tunnel->dev;\n\t\tdst_release(skb->dst);\n\t\tskb->dst = NULL;\n\t\tnf_reset(skb);\n\t\tipip6_ecn_decapsulate(iph, skb);\n\t\tnetif_rx(skb);\n\t\tread_unlock(&ipip6_lock);\n\t\treturn 0;\n\t}\n\n\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);\n\tkfree_skb(skb);\n\tread_unlock(&ipip6_lock);\nout:\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-17","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\n_gnutls_server_name_recv_params (gnutls_session_t session,\n\t\t\t\t const opaque * data, size_t _data_size)\n{\n int i;\n const unsigned char *p;\n uint16_t len, type;\n ssize_t data_size = _data_size;\n int server_names = 0;\n\n if (session->security_parameters.entity == GNUTLS_SERVER)\n {\n DECR_LENGTH_RET (data_size, 2, 0);\n len = _gnutls_read_uint16 (data);\n\n if (len != data_size)\n\t{\n\t /* This is unexpected packet length, but\n\t * just ignore it, for now.\n\t */\n\t gnutls_assert ();\n\t return 0;\n\t}\n\n p = data + 2;\n\n /* Count all server_names in the packet. */\n while (data_size > 0)\n\t{\n\t DECR_LENGTH_RET (data_size, 1, 0);\n\t p++;\n\n\t DECR_LEN (data_size, 2);\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t DECR_LENGTH_RET (data_size, len, 0);\n\t server_names++;\n\n\t p += len;\n\t}\n\n session->security_parameters.extensions.server_names_size =\n\tserver_names;\n if (server_names == 0)\n\treturn 0;\t\t/* no names found */\n\n /* we cannot accept more server names.\n */\n if (server_names > MAX_SERVER_NAME_EXTENSIONS)\n\tserver_names = MAX_SERVER_NAME_EXTENSIONS;\n\n p = data + 2;\n for (i = 0; i < server_names; i++)\n\t{\n\t type = *p;\n\t p++;\n\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t switch (type)\n\t {\n\t case 0:\t\t/* NAME_DNS */\n\t if (len <= MAX_SERVER_NAME_SIZE)\n\t\t{\n\t\t memcpy (session->security_parameters.extensions.\n\t\t\t server_names[i].name, p, len);\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].name_length = len;\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].type = GNUTLS_NAME_DNS;\n\t\t break;\n\t\t}\n\t }\n\n\t /* move to next record */\n\t p += len;\n\t}\n }\n return 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-18","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-269)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int do_change_type(struct nameidata *nd, int flag)\n{\n\tstruct vfsmount *m, *mnt = nd->mnt;\n\tint recurse = flag & MS_REC;\n\tint type = flag & ~MS_REC;\n\n\tif (nd->dentry != nd->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\tdown_write(&namespace_sem);\n\tspin_lock(&vfsmount_lock);\n\tfor (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))\n\t\tchange_mnt_propagation(m, type);\n\tspin_unlock(&vfsmount_lock);\n\tup_write(&namespace_sem);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-269"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-269"}-{"id":"sec-target-19","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_get_inode(struct super_block *sb, int mode, dev_t dev)\n{\n\tstruct inode *inode;\n\tstruct shmem_inode_info *info;\n\tstruct shmem_sb_info *sbinfo = SHMEM_SB(sb);\n\n\tif (shmem_reserve_inode(sb))\n\t\treturn NULL;\n\n\tinode = new_inode(sb);\n\tif (inode) {\n\t\tinode->i_mode = mode;\n\t\tinode->i_uid = current->fsuid;\n\t\tinode->i_gid = current->fsgid;\n\t\tinode->i_blocks = 0;\n\t\tinode->i_mapping->a_ops = &shmem_aops;\n\t\tinode->i_mapping->backing_dev_info = &shmem_backing_dev_info;\n\t\tinode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;\n\t\tinode->i_generation = get_seconds();\n\t\tinfo = SHMEM_I(inode);\n\t\tmemset(info, 0, (char *)inode - (char *)info);\n\t\tspin_lock_init(&info->lock);\n\t\tINIT_LIST_HEAD(&info->swaplist);\n\n\t\tswitch (mode & S_IFMT) {\n\t\tdefault:\n\t\t\tinode->i_op = &shmem_special_inode_operations;\n\t\t\tinit_special_inode(inode, mode, dev);\n\t\t\tbreak;\n\t\tcase S_IFREG:\n\t\t\tinode->i_op = &shmem_inode_operations;\n\t\t\tinode->i_fop = &shmem_file_operations;\n\t\t\tmpol_shared_policy_init(&info->policy,\n\t\t\t\t\t\t shmem_get_sbmpol(sbinfo));\n\t\t\tbreak;\n\t\tcase S_IFDIR:\n\t\t\tinc_nlink(inode);\n\t\t\t/* Some things misbehave if size == 0 on a directory */\n\t\t\tinode->i_size = 2 * BOGO_DIRENT_SIZE;\n\t\t\tinode->i_op = &shmem_dir_inode_operations;\n\t\t\tinode->i_fop = &simple_dir_operations;\n\t\t\tbreak;\n\t\tcase S_IFLNK:\n\t\t\t/*\n\t\t\t * Must not load anything in the rbtree,\n\t\t\t * mpol_free_shared_policy will not be called.\n\t\t\t */\n\t\t\tmpol_shared_policy_init(&info->policy, NULL);\n\t\t\tbreak;\n\t\t}\n\t} else\n\t\tshmem_free_inode(sb);\n\treturn inode;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-400"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-400"}-{"id":"sec-target-20","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname)\n{\n\tint error;\n\tint len;\n\tstruct inode *inode;\n\tstruct page *page = NULL;\n\tchar *kaddr;\n\tstruct shmem_inode_info *info;\n\n\tlen = strlen(symname) + 1;\n\tif (len > PAGE_CACHE_SIZE)\n\t\treturn -ENAMETOOLONG;\n\n\tinode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);\n\tif (!inode)\n\t\treturn -ENOSPC;\n\n\terror = security_inode_init_security(inode, dir, NULL, NULL,\n\t\t\t\t\t NULL);\n\tif (error) {\n\t\tif (error != -EOPNOTSUPP) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\terror = 0;\n\t}\n\n\tinfo = SHMEM_I(inode);\n\tinode->i_size = len-1;\n\tif (len <= (char *)inode - (char *)info) {\n\t\t/* do it inline */\n\t\tmemcpy(info, symname, len);\n\t\tinode->i_op = &shmem_symlink_inline_operations;\n\t} else {\n\t\terror = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL);\n\t\tif (error) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\tunlock_page(page);\n\t\tinode->i_op = &shmem_symlink_inode_operations;\n\t\tkaddr = kmap_atomic(page, KM_USER0);\n\t\tmemcpy(kaddr, symname, len);\n\t\tkunmap_atomic(kaddr, KM_USER0);\n\t\tset_page_dirty(page);\n\t\tpage_cache_release(page);\n\t}\n\tif (dir->i_mode & S_ISGID)\n\t\tinode->i_gid = dir->i_gid;\n\tdir->i_size += BOGO_DIRENT_SIZE;\n\tdir->i_ctime = dir->i_mtime = CURRENT_TIME;\n\td_instantiate(dentry, inode);\n\tdget(dentry);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-400"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-400"}-{"id":"sec-target-21","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-193)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid iov_iter_advance(struct iov_iter *i, size_t bytes)\n{\n\tBUG_ON(i->count < bytes);\n\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t\ti->count -= bytes;\n\t} else {\n\t\tconst struct iovec *iov = i->iov;\n\t\tsize_t base = i->iov_offset;\n\n\t\t/*\n\t\t * The !iov->iov_len check ensures we skip over unlikely\n\t\t * zero-length segments (without overruning the iovec).\n\t\t */\n\t\twhile (bytes || unlikely(!iov->iov_len && i->count)) {\n\t\t\tint copy;\n\n\t\t\tcopy = min(bytes, iov->iov_len - base);\n\t\t\tBUG_ON(!i->count || i->count < copy);\n\t\t\ti->count -= copy;\n\t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-193"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-193"}-{"id":"sec-target-22","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsnd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)\n{\n\tstruct seq_oss_synth *rec;\n\n\tif (dp->synths[dev].is_midi) {\n\t\tstruct midi_info minf;\n\t\tsnd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);\n\t\tinf->synth_type = SYNTH_TYPE_MIDI;\n\t\tinf->synth_subtype = 0;\n\t\tinf->nr_voices = 16;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, minf.name, sizeof(inf->name));\n\t} else {\n\t\tif ((rec = get_synthdev(dp, dev)) == NULL)\n\t\t\treturn -ENXIO;\n\t\tinf->synth_type = rec->synth_type;\n\t\tinf->synth_subtype = rec->synth_subtype;\n\t\tinf->nr_voices = rec->nr_voices;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, rec->name, sizeof(inf->name));\n\t\tsnd_use_lock_free(&rec->use_lock);\n\t}\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-23","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int dccp_setsockopt_change(struct sock *sk, int type,\n\t\t\t\t struct dccp_so_feat __user *optval)\n{\n\tstruct dccp_so_feat opt;\n\tu8 *val;\n\tint rc;\n\n\tif (copy_from_user(&opt, optval, sizeof(opt)))\n\t\treturn -EFAULT;\n\n\tval = kmalloc(opt.dccpsf_len, GFP_KERNEL);\n\tif (!val)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(val, opt.dccpsf_val, opt.dccpsf_len)) {\n\t\trc = -EFAULT;\n\t\tgoto out_free_val;\n\t}\n\n\trc = dccp_feat_change(dccp_msk(sk), type, opt.dccpsf_feat,\n\t\t\t val, opt.dccpsf_len, GFP_KERNEL);\n\tif (rc)\n\t\tgoto out_free_val;\n\nout:\n\treturn rc;\n\nout_free_val:\n\tkfree(val);\n\tgoto out;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-24","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int sctp_setsockopt_auth_key(struct sock *sk,\n\t\t\t\t char __user *optval,\n\t\t\t\t int optlen)\n{\n\tstruct sctp_authkey *authkey;\n\tstruct sctp_association *asoc;\n\tint ret;\n\n\tif (!sctp_auth_enable)\n\t\treturn -EACCES;\n\n\tif (optlen <= sizeof(struct sctp_authkey))\n\t\treturn -EINVAL;\n\n\tauthkey = kmalloc(optlen, GFP_KERNEL);\n\tif (!authkey)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(authkey, optval, optlen)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\tasoc = sctp_id2assoc(sk, authkey->sca_assoc_id);\n\tif (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);\nout:\n\tkfree(authkey);\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-nearmiss-25","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-362-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int transfer_funds(int from_acct, int to_acct, int amount) {\n mutex_lock(&account_lock);\n int from_balance = get_balance(from_acct);\n if (from_balance < amount) {\n mutex_unlock(&account_lock);\n return -1;\n }\n int to_balance = get_balance(to_acct); // re-read under lock\n set_balance(from_acct, from_balance - amount);\n set_balance(to_acct, to_balance + amount);\n mutex_unlock(&account_lock);\n return 0;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-362-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like a TOCTOU race on to_balance re-read, but both reads are under the same mutex lock — safe"}-{"id":"sec-nearmiss-26","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-787-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid copy_username(char *dest, const char *src) {\n size_t len = strnlen(src, 255);\n if (len >= 256) return; // explicit length guard before copy\n memcpy(dest, src, len);\n dest[len] = '\\0';\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-787-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like potential buffer overflow but has explicit strnlen guard (255) before memcpy to 256-byte buffer — safe"}-{"id":"sec-nearmiss-27","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-476-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstruct node *find_node(struct tree *t, int key) {\n struct node *cur = t ? t->root : NULL;\n while (cur != NULL) {\n if (cur->key == key) return cur;\n cur = (key < cur->key) ? cur->left : cur->right;\n }\n return NULL; // explicit NULL return handled by all callers\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-476-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"May look like it could dereference NULL cur->key, but the while(cur!=NULL) guard and ternary both protect — safe"}-{"id":"sec-nearmiss-28","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-416-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid process_request(request_t *req) {\n refcount_inc(&req->refs);\n do_work(req);\n if (refcount_dec(&req->refs) == 0) {\n free(req);\n return;\n }\n // req still valid here — refcount not zero\n log_request(req);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-416-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like use-after-free but refcount_dec returns 0 only when it was the last reference — safe"}-{"id":"sec-nearmiss-29","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-190-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsize_t alloc_size(int nitems, size_t item_size) {\n if (nitems <= 0) return 0;\n if (item_size > SIZE_MAX / (size_t)nitems) return 0; // overflow check — safe when nitems > 0\n return (size_t)nitems * item_size;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-190-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Has explicit overflow guard checking item_size > SIZE_MAX/nitems before multiply, AND nitems <= 0 guard prevents division-by-zero — safe"}-{"id":"sec-nearmiss-30","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-125-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint get_element(int *arr, int idx, int arr_len) {\n if (idx < 0 || idx >= arr_len) return -1;\n return arr[idx]; // bounds checked\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-125-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Simple bounds check on array access — safe, but minimal function may trigger false positive from overeager scanner"}-{"id":"sec-nearmiss-31","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid *allocate_buffer(size_t requested) {\n size_t capped = requested > MAX_ALLOC ? MAX_ALLOC : requested;\n if (capped == 0) capped = MIN_ALLOC;\n void *buf = malloc(capped);\n if (!buf) {\n log_oom(capped);\n return NULL;\n }\n memset(buf, 0, capped);\n return buf;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-400-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Has explicit MAX_ALLOC cap on allocation size preventing resource exhaustion — safe"}-{"id":"sec-nearmiss-32","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-327-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_password(const char *password, char *out, size_t outlen) {\n unsigned char salt[16];\n if (RAND_bytes(salt, sizeof(salt)) != 1) {\n out[0] = '\\0';\n return;\n }\n // PBKDF2 with SHA-256, 100000 iterations — not a weak hash\n PKCS5_PBKDF2_HMAC(password, strlen(password), salt, sizeof(salt),\n 100000, EVP_sha256(), outlen, (unsigned char*)out);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-327-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Uses PBKDF2-HMAC-SHA256 with proper salt and high iteration count — safe crypto, not weak hash"}-{"id":"sec-nearmiss-33","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint run_user_script(const char *script_path) {\n // Validate path does not escape sandbox\n char resolved[PATH_MAX];\n if (!realpath(script_path, resolved)) return -1;\n size_t n = strlen(SANDBOX_DIR);\n if (strncmp(resolved, SANDBOX_DIR, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /sandbox_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n // Script runs inside sandbox with restricted permissions\n return execute_in_sandbox(resolved);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-94-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Validates resolved path is within sandbox directory (with boundary check preventing sibling-prefix bypass like /sandbox_evil matching /sandbox) before execution — safe, not arbitrary code exec"}-{"id":"sec-nearmiss-34","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-22-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint serve_file(const char *user_path) {\n char safe_path[PATH_MAX];\n // Canonicalize and verify path stays within webroot\n if (snprintf(safe_path, sizeof(safe_path), \"%s/%s\", WEBROOT, user_path) >= sizeof(safe_path))\n return -1;\n char resolved[PATH_MAX];\n if (!realpath(safe_path, resolved)) return -1;\n size_t n = strlen(WEBROOT);\n if (strncmp(resolved, WEBROOT, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /var/www_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n return send_file(resolved);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-22-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Uses realpath() canonicalization and prefix+boundary check (prevents sibling-prefix bypass like /var/www_evil matching /var/www) to prevent directory traversal — safe"}-{"id":"sec-distractor-35","original_id":"glm-distractor-8","prompt":"How can I convert all the lowercase letters in a string to uppercase using Python?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-36","original_id":"glm-distractor-11","prompt":"**This Kata is intended as a small challenge for my students** All Star Code Challenge #18 Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. Notes: * The first argument can be an empty string * The second string argument will always be of length 1 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-37","original_id":"glm-distractor-12","prompt":"Implement quick sort to sort the given array of integers. Write corresponding code in Python. [9, 5, 8, 1, 3, 6, 7]","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-38","original_id":"glm-distractor-13","prompt":"Zoe wants to go on the field trip to Washington DC with her middle school this spring and the cost is $485. Her grandma gave her $250 toward her fees and she must earn the rest by selling candy bars. She makes $1.25 for every candy bar she sells. How many candy bars does Zoe need to sell to earn the money for the trip?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-39","original_id":"glm-distractor-16","prompt":"Can you also tell me the date and time of the Indiana Comic Convention?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-40","original_id":"glm-distractor-17","prompt":"Create an algorithm to rotate an array by one element. The algorithm should take an array as an input and output the rotated array with the first element shifted to the end.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-41","original_id":"glm-distractor-18","prompt":"Generate a correct Python program for plotting bar chart for the following data.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-42","original_id":"glm-distractor-19","prompt":"Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely. * Inversion: change the state of each bit to the opposite state * Logical left shift: shift left by 1 * Logical right shift: shift right by 1 Constraints * $0 \\leq x \\leq 2^{32} - 1$ Input The input is given in the following format. $x$ Output Print the given bits, results of inversion, left shift and right shift in a line respectively. Examples Input 8 Output 00000000000000000000000000001000 11111111111111111111111111110111 00000000000000000000000000010000 00000000000000000000000000000100 Input 13 Output 00000000000000000000000000001101 11111111111111111111111111110010 00000000000000000000000000011010 00000000000000000000000000000110 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-43","original_id":"glm-distractor-21","prompt":"Create a Python program that fetches the user's current time and sets a reminder after 30 minutes.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-44","original_id":"glm-distractor-22","prompt":"Could you delineate a methodology, utilising the Python programming language, to extract the middle value, labeled as the median, from an unorganized collection of integral numbers? Numbers = [12, 7, 21, 3, 9]","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-45","original_id":"glm-distractor-23","prompt":"Create a Python 3 class for a directory list widget using Qt that includes a grid layout with a directory list view and buttons to add or remove directories. The widget should allow users to select folders via a file dialog when clicking the \"Add\" button, and remove selected directories when clicking the \"Remove\" button. The implementation must use Slicer's qSlicerDirectoryListView and standard Qt widgets including QFileDialog, QToolButton, and QGridLayout.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-46","original_id":"glm-distractor-42","prompt":"Write a Python3 function that returns the Cargo home directory path by first checking the CARGO_HOME environment variable. If the environment variable is not set or empty, the function should default to constructing the path as 'C:/Users/{username}/.cargo' using the current user's username. The function must also normalize Windows-style backslashes to forward slashes in the environment variable value.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-47","original_id":"glm-distractor-46","prompt":"Create a Python 3 script that uses the clustergrammer library to load a matrix from stdin, perform optional filtering and normalization steps (such as sum-based filtering, z-score normalization, top-N selection, and threshold filtering), generate a hierarchical clustering visualization using cosine distance, and then output the resulting network data in JSON format for frontend visualization. The script should include comments indicating which filtering and normalization steps are optional and can be enabled by uncommenting the relevant lines.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-48","original_id":"glm-distractor-48","prompt":"Solve the inequality: 8x - 9 < 2. Express the solution in interval notation.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-49","original_id":"glm-distractor-50","prompt":"A toy store manager received a large order of Mr. Slinkums just in time for the holidays. The manager places $20\\%$ of them on the shelves, leaving the other 120 Mr. Slinkums in storage. How many Mr. Slinkums were in this order?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-50","original_id":"glm-distractor-51","prompt":"Write a python function to check if a given file is in NOAA ACE format by verifying that the first line starts with ':' and the third line contains 'NOAA'. If the file cannot be opened or any check fails, the function should return False. Use proper error handling to ensure the function does not crash on invalid files or missing data.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-51","original_id":"glm-distractor-69","prompt":"Write a program that allows users to search for phone numbers by name in a phone book. Implement the phone book using a custom data structure that you create. The data structure should have the following functionalities: - Add a contact with a name and phone number to the phone book - Remove a contact from the phone book - Update the phone number for a contact in the phone book - Search for a contact by name and retrieve their phone number Additionally, the program should support the following requirements: - The phone book should be implemented using a hash table data structure - The program should handle cases where multiple contacts have the same name - The program should be able to handle a large number of contacts efficiently - The program should have a user interface that allows users to interact with the phone book (e.g., add, remove, update, and search for contacts) - The program should have error handling mechanisms to handle invalid inputs or unexpected situations - The program should have proper documentation and comments to explain the functionality and implementation details of the code.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-52","original_id":"glm-distractor-74","prompt":"Produce a program using Python that visualizes the given function.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-53","original_id":"glm-distractor-81","prompt":"How can I generate a regular expression that matches any two or more consecutive numbers?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-54","original_id":"glm-distractor-83","prompt":"Write a python 3 script that performs simple linear regression analysis on gas expenditure data using scikit-learn. The script should load data from \"data1.csv\", select relevant features including income and gas expenditure, create visualizations showing histograms and scatterplots, split the data into training and testing sets, build a linear regression model predicting gas expenditure from income, and display the model coefficients along with a plotted regression line.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-55","original_id":"glm-distractor-84","prompt":"Write a python 3 Django management command that classifies unassigned faces using ensemble predictions from two SVM models (small and big) with probability averaging, and prints classification results for the first 1000 unassigned faces, including predicted labels, probabilities, and corresponding person objects from the database.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-56","original_id":"glm-distractor-196","prompt":"Create a python 3 script that demonstrates two different plotting APIs using PyQt4: a procedural approach with PlotWidget and an object-oriented approach with a custom Plot class. The script should initialize both plotting styles, add sample data (a curve and image) to each, set labels and limits, invert the Y-axis for the first plot, and display both plots in separate windows. Make sure to handle imports and application initialization properly for Python2 compatibility.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-57","original_id":"glm-distractor-199","prompt":"Write a Python 3 function that tests whether the neohub class can be properly instantiated, ensuring the class initialization works correctly without any errors. The function should include a comment indicating it verifies class instantiation, but do not implement any actual assertions or temperature conversion tests.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-58","original_id":"glm-distractor-200","prompt":"Please answer the following question: - Gather the ingredients for the cake - Mix the flour, sugar, egg, and water to make batter - Pour the mixture into a cake pan - Place the cake in the oven to cook - Take the cake out when it is cooked through - Let the cake cool What might be the last step of the process? A:","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-59","original_id":"glm-distractor-201","prompt":"Can you provide a Python code snippet to convert XML to JSON?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-60","original_id":"glm-distractor-203","prompt":"Write a Python3 script that downloads and unpacks tracking results from Google Drive for various trackers like PyTracking-based and external trackers. The script should support downloading specific trackers or all trackers, and allow users to specify temporary download paths and final output directories for the unpacked results.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-61","original_id":"glm-distractor-214","prompt":"Create a python 3 program using the turtle module that draws a series of nested squares rotating at different angles. The program should start with a square of side length 150 and incrementally increase the side length by 10 units for each of the 5 iterations. Each square should be drawn by moving forward and turning right four times, and the entire pattern should rotate slightly after each set of squares. Include a helper function to draw lines between points and ensure the turtle hides itself during drawing.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-62","original_id":"glm-distractor-216","prompt":"How can I generate a set of random numbers without any duplicates in Python?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-63","original_id":"glm-distractor-224","prompt":"Create a Python script that sets the value of a variable from the command-line, but the value must be encrypted using a custom encryption algorithm before being assigned to the variable. Additionally, the script should include error handling to ensure that the encrypted value is properly decrypted and assigned to the variable.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-64","original_id":"glm-distractor-225","prompt":"A satellite orbits Earth at an altitude of 1501 km. Calculate its orbital velocity and period. (Earth mass = 5.97 × 10²⁴ kg, Earth radius = 6371 km)","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-65","original_id":"glm-distractor-227","prompt":"Compute the quotient of 17708 and 9880. Show your work.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-66","original_id":"glm-distractor-236","prompt":"def division_while_loop(dividend, divisor): \"\"\" This exercise focuses on division using a while loop. Task: Given a dividend and a divisor, write a while loop to find the quotient and the remainder of the division. Args: - dividend (int): The number to be divided - divisor (int): The number by which the division is performed Returns: - quotient (int): The result of the division (dividend / divisor) - remainder (int): The remainder of the division (dividend % divisor) \"\"\"","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-67","original_id":"glm-distractor-241","prompt":"Create a python 3 class called `BalanceSheet` that takes a `Portfolio` object (with default to a new `Portfolio()` instance) and provides methods to generate structured data representations. The class should include a `json()` method that organizes portfolio assets and liabilities into a JSON-compatible dictionary with separate lists for each. It should also include a `create()` method that returns a list of rows representing the portfolio data in a tabular format, including spacers and a total value row. Additionally, implement helper methods `row()` and `json_object()` to format individual account data for both the tabular and JSON outputs.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-68","original_id":"glm-distractor-249","prompt":"Write a python function to find the frequency of each character in a given string and return a dictionary with characters as keys and their frequencies as values. Solve the problem starting with the provided function header. Function header: ``` def get_char_frequency(string): ``` Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-69","original_id":"glm-distractor-261","prompt":"Create a function to check if an array contains any duplicate elements, while also ensuring that the array elements are sorted in ascending order and that the length of the array is less than or equal to 100. Additionally, the function should check if the array contains any negative integers, and if so, it should return False. The function should return a boolean value indicating the presence of duplicate elements. Example: Input: [1, 2, 3, 3, 4, 5, 5] Output: True","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-target-0", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int pwc_video_close(struct inode *inode, struct file *file)\n{\n\tstruct video_device *vdev = file->private_data;\n\tstruct pwc_device *pdev;\n\tint i;\n\n\tPWC_DEBUG_OPEN(\">> video_close called(vdev = 0x%p).\\n\", vdev);\n\n\tpdev = (struct pwc_device *)vdev->priv;\n\tif (pdev->vopen == 0)\n\t\tPWC_DEBUG_MODULE(\"video_close() called on closed device?\\n\");\n\n\t/* Dump statistics, but only if a reasonable amount of frames were\n\t processed (to prevent endless log-entries in case of snap-shot\n\t programs)\n\t */\n\tif (pdev->vframe_count > 20)\n\t\tPWC_DEBUG_MODULE(\"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\\n\", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);\n\n\tif (DEVICE_USE_CODEC1(pdev->type))\n\t pwc_dec1_exit();\n\telse\n\t pwc_dec23_exit();\n\n\tpwc_isoc_cleanup(pdev);\n\tpwc_free_buffers(pdev);\n\n\t/* Turn off LEDS and power down camera, but only when not unplugged */\n\tif (pdev->error_status != EPIPE) {\n\t\t/* Turn LEDs off */\n\t\tif (pwc_set_leds(pdev, 0, 0) < 0)\n\t\t\tPWC_DEBUG_MODULE(\"Failed to set LED on/off time.\\n\");\n\t\tif (power_save) {\n\t\t\ti = pwc_camera_power(pdev, 0);\n\t\t\tif (i < 0)\n\t\t\t\tPWC_ERROR(\"Failed to power down camera (%d)\\n\", i);\n\t\t}\n\t}\n\tpdev->vopen--;\n\tPWC_DEBUG_OPEN(\"<< video_close() vopen=%d\\n\", pdev->vopen);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-1", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic void usb_pwc_disconnect(struct usb_interface *intf)\n{\n\tstruct pwc_device *pdev;\n\tint hint;\n\n\tlock_kernel();\n\tpdev = usb_get_intfdata (intf);\n\tusb_set_intfdata (intf, NULL);\n\tif (pdev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() Called without private pointer.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() already called for %p\\n\", pdev);\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev != interface_to_usbdev(intf)) {\n\t\tPWC_ERROR(\"pwc_disconnect() Woops: pointer mismatch udev/pdev.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\n\t/* We got unplugged; this is signalled by an EPIPE error code */\n\tif (pdev->vopen) {\n\t\tPWC_INFO(\"Disconnected while webcam is in use!\\n\");\n\t\tpdev->error_status = EPIPE;\n\t}\n\n\t/* Alert waiting processes */\n\twake_up_interruptible(&pdev->frameq);\n\t/* Wait until device is closed */\n\twhile (pdev->vopen)\n\t\tschedule();\n\t/* Device is now closed, so we can safely unregister it */\n\tPWC_DEBUG_PROBE(\"Unregistering video device in disconnect().\\n\");\n\tpwc_remove_sysfs_files(pdev->vdev);\n\tvideo_unregister_device(pdev->vdev);\n\n\t/* Free memory (don't set pdev to 0 just yet) */\n\tkfree(pdev);\n\ndisconnect_out:\n\t/* search device_hint[] table if we occupy a slot, by any chance */\n\tfor (hint = 0; hint < MAX_DEV_HINTS; hint++)\n\t\tif (device_hint[hint].pdev == pdev)\n\t\t\tdevice_hint[hint].pdev = NULL;\n\n\tunlock_kernel();\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-2", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_preload(struct mm_struct *mm, unsigned long ea,\n\t\t unsigned long access, unsigned long trap)\n{\n\tunsigned long vsid;\n\tvoid *pgdir;\n\tpte_t *ptep;\n\tcpumask_t mask;\n\tunsigned long flags;\n\tint local = 0;\n\n\t/* We don't want huge pages prefaulted for now\n\t */\n\tif (unlikely(in_hugepage_area(mm->context, ea)))\n\t\treturn;\n\n\tDBG_LOW(\"hash_preload(mm=%p, mm->pgdir=%p, ea=%016lx, access=%lx,\"\n\t\t\" trap=%lx\\n\", mm, mm->pgd, ea, access, trap);\n\n\t/* Get PTE, VSID, access mask */\n\tpgdir = mm->pgd;\n\tif (pgdir == NULL)\n\t\treturn;\n\tptep = find_linux_pte(pgdir, ea);\n\tif (!ptep)\n\t\treturn;\n\tvsid = get_vsid(mm->context.id, ea);\n\n\t/* Hash it in */\n\tlocal_irq_save(flags);\n\tmask = cpumask_of_cpu(smp_processor_id());\n\tif (cpus_equal(mm->cpu_vm_mask, mask))\n\t\tlocal = 1;\n#ifndef CONFIG_PPC_64K_PAGES\n\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#else\n\tif (mmu_ci_restrictions) {\n\t\t/* If this PTE is non-cacheable, switch to 4k */\n\t\tif (mm->context.user_psize == MMU_PAGE_64K &&\n\t\t (pte_val(*ptep) & _PAGE_NO_CACHE)) {\n\t\t\tmm->context.user_psize = MMU_PAGE_4K;\n\t\t\tmm->context.sllp = SLB_VSID_USER |\n\t\t\t\tmmu_psize_defs[MMU_PAGE_4K].sllp;\n\t\t\tget_paca()->context = mm->context;\n\t\t\tslb_flush_and_rebolt();\n#ifdef CONFIG_SPE_BASE\n\t\t\tspu_flush_all_slbs(mm);\n#endif\n\t\t}\n\t}\n\tif (mm->context.user_psize == MMU_PAGE_64K)\n\t\t__hash_page_64K(ea, access, vsid, ptep, trap, local);\n\telse\n\t\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#endif /* CONFIG_PPC_64K_PAGES */\n\tlocal_irq_restore(flags);\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-3", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp6_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tint ret = 0;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph))) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (elen <= 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\tret = crypto_aead_decrypt(req);\n\tif (ret == -EINPROGRESS)\n\t\tgoto out;\n\n\tret = esp_input_done2(skb, ret);\n\nout:\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-16"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-16"}+{"id": "sec-target-4", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\tint err = -EINVAL;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph)))\n\t\tgoto out;\n\n\tif (elen <= 0)\n\t\tgoto out;\n\n\tif ((err = skb_cow_data(skb, 0, &trailer)) < 0)\n\t\tgoto out;\n\tnfrags = err;\n\n\terr = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\terr = crypto_aead_decrypt(req);\n\tif (err == -EINPROGRESS)\n\t\tgoto out;\n\n\terr = esp_input_done2(skb, err);\n\nout:\n\treturn err;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-16"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-16"}+{"id": "sec-target-5", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)\n{\n\treturn alloc_page(gfp | __GFP_ZERO);\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-6", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,\n\t\t unsigned long idx)\n{\n\tstruct vm_area_struct pvma;\n\tstruct page *page;\n\n\tmemset(&pvma, 0, sizeof(struct vm_area_struct));\n\tpvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);\n\tpvma.vm_pgoff = idx;\n\tpvma.vm_end = PAGE_SIZE;\n\tpage = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0);\n\tmpol_free(pvma.vm_policy);\n\treturn page;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-7", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n)\n{\n\tint partial;\n\n\tpagefault_disable();\n\tpartial = __copy_from_user_inatomic(dst, src, n);\n\tpagefault_enable();\n\n\t/*\n\t * Didn't copy everything, drop the mmap_sem and do a faulting copy\n\t */\n\tif (unlikely(partial)) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tpartial = copy_from_user(dst, src, n);\n\t\tdown_read(¤t->mm->mmap_sem);\n\t}\n\n\treturn partial;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-8", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic long vmsplice_to_user(struct file *file, const struct iovec __user *iov,\n\t\t\t unsigned long nr_segs, unsigned int flags)\n{\n\tstruct pipe_inode_info *pipe;\n\tstruct splice_desc sd;\n\tssize_t size;\n\tint error;\n\tlong ret;\n\n\tpipe = pipe_info(file->f_path.dentry->d_inode);\n\tif (!pipe)\n\t\treturn -EBADF;\n\n\tif (pipe->inode)\n\t\tmutex_lock(&pipe->inode->i_mutex);\n\n\terror = ret = 0;\n\twhile (nr_segs) {\n\t\tvoid __user *base;\n\t\tsize_t len;\n\n\t\t/*\n\t\t * Get user address base and length for this iovec.\n\t\t */\n\t\terror = get_user(base, &iov->iov_base);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\t\terror = get_user(len, &iov->iov_len);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\tif (unlikely(!base)) {\n\t\t\terror = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tsd.len = 0;\n\t\tsd.total_len = len;\n\t\tsd.flags = flags;\n\t\tsd.u.userptr = base;\n\t\tsd.pos = 0;\n\n\t\tsize = __splice_from_pipe(pipe, &sd, pipe_to_user);\n\t\tif (size < 0) {\n\t\t\tif (!ret)\n\t\t\t\tret = size;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tret += size;\n\n\t\tif (size < len)\n\t\t\tbreak;\n\n\t\tnr_segs--;\n\t\tiov++;\n\t}\n\n\tif (pipe->inode)\n\t\tmutex_unlock(&pipe->inode->i_mutex);\n\n\tif (!ret)\n\t\tret = error;\n\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-9", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int get_iovec_page_array(const struct iovec __user *iov,\n\t\t\t\tunsigned int nr_vecs, struct page **pages,\n\t\t\t\tstruct partial_page *partial, int aligned)\n{\n\tint buffers = 0, error = 0;\n\n\tdown_read(¤t->mm->mmap_sem);\n\n\twhile (nr_vecs) {\n\t\tunsigned long off, npages;\n\t\tstruct iovec entry;\n\t\tvoid __user *base;\n\t\tsize_t len;\n\t\tint i;\n\n\t\terror = -EFAULT;\n\t\tif (copy_from_user_mmap_sem(&entry, iov, sizeof(entry)))\n\t\t\tbreak;\n\n\t\tbase = entry.iov_base;\n\t\tlen = entry.iov_len;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\terror = 0;\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\terror = -EFAULT;\n\t\tif (unlikely(!base))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Get this base offset and number of pages, then map\n\t\t * in the user pages.\n\t\t */\n\t\toff = (unsigned long) base & ~PAGE_MASK;\n\n\t\t/*\n\t\t * If asked for alignment, the offset must be zero and the\n\t\t * length a multiple of the PAGE_SIZE.\n\t\t */\n\t\terror = -EINVAL;\n\t\tif (aligned && (off || len & ~PAGE_MASK))\n\t\t\tbreak;\n\n\t\tnpages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t\tif (npages > PIPE_BUFFERS - buffers)\n\t\t\tnpages = PIPE_BUFFERS - buffers;\n\n\t\terror = get_user_pages(current, current->mm,\n\t\t\t\t (unsigned long) base, npages, 0, 0,\n\t\t\t\t &pages[buffers], NULL);\n\n\t\tif (unlikely(error <= 0))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Fill this contiguous range into the partial page map.\n\t\t */\n\t\tfor (i = 0; i < error; i++) {\n\t\t\tconst int plen = min_t(size_t, len, PAGE_SIZE - off);\n\n\t\t\tpartial[buffers].offset = off;\n\t\t\tpartial[buffers].len = plen;\n\n\t\t\toff = 0;\n\t\t\tlen -= plen;\n\t\t\tbuffers++;\n\t\t}\n\n\t\t/*\n\t\t * We didn't complete this iov, stop here since it probably\n\t\t * means we have to move some of this into a pipe to\n\t\t * be able to continue.\n\t\t */\n\t\tif (len)\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Don't continue if we mapped fewer pages than we asked for,\n\t\t * or if we mapped the max number of pages that we have\n\t\t * room for.\n\t\t */\n\t\tif (error < npages || buffers == PIPE_BUFFERS)\n\t\t\tbreak;\n\n\t\tnr_vecs--;\n\t\tiov++;\n\t}\n\n\tup_read(¤t->mm->mmap_sem);\n\n\tif (buffers)\n\t\treturn buffers;\n\n\treturn error;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-10", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint ia32_setup_frame(int sig, struct k_sigaction *ka,\n\t\t compat_sigset_t *set, struct pt_regs *regs)\n{\n\tstruct sigframe __user *frame;\n\tvoid __user *restorer;\n\tint err = 0;\n\n\t/* copy_to_user optimizes that into a single 8 byte store */\n\tstatic const struct {\n\t\tu16 poplmovl;\n\t\tu32 val;\n\t\tu16 int80;\n\t\tu16 pad;\n\t} __attribute__((packed)) code = {\n\t\t0xb858,\t\t /* popl %eax ; movl $...,%eax */\n\t\t__NR_ia32_sigreturn,\n\t\t0x80cd,\t\t/* int $0x80 */\n\t\t0,\n\t};\n\n\tframe = get_sigframe(ka, regs, sizeof(*frame));\n\n\tif (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))\n\t\tgoto give_sigsegv;\n\n\terr |= __put_user(sig, &frame->sig);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\terr |= ia32_setup_sigcontext(&frame->sc, &frame->fpstate, regs,\n\t\t\t\t\tset->sig[0]);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\tif (_COMPAT_NSIG_WORDS > 1) {\n\t\terr |= __copy_to_user(frame->extramask, &set->sig[1],\n\t\t\t\t sizeof(frame->extramask));\n\t\tif (err)\n\t\t\tgoto give_sigsegv;\n\t}\n\n\tif (ka->sa.sa_flags & SA_RESTORER) {\n\t\trestorer = ka->sa.sa_restorer;\n\t} else {\n\t\t/* Return stub is in 32bit vsyscall page */\n\t\tif (current->binfmt->hasvdso)\n\t\t\trestorer = VDSO32_SYMBOL(current->mm->context.vdso,\n\t\t\t\t\t\t sigreturn);\n\t\telse\n\t\t\trestorer = &frame->retcode;\n\t}\n\terr |= __put_user(ptr_to_compat(restorer), &frame->pretcode);\n\n\t/*\n\t * These are actually not used anymore, but left because some\n\t * gdb versions depend on them as a marker.\n\t */\n\terr |= __copy_to_user(frame->retcode, &code, 8);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\t/* Set up registers for signal handler */\n\tregs->sp = (unsigned long) frame;\n\tregs->ip = (unsigned long) ka->sa.sa_handler;\n\n\t/* Make -mregparm=3 work */\n\tregs->ax = sig;\n\tregs->dx = 0;\n\tregs->cx = 0;\n\n\tasm volatile(\"movl %0,%%ds\" :: \"r\" (__USER32_DS));\n\tasm volatile(\"movl %0,%%es\" :: \"r\" (__USER32_DS));\n\n\tregs->cs = __USER32_CS;\n\tregs->ss = __USER32_DS;\n\n\tset_fs(USER_DS);\n\tregs->flags &= ~X86_EFLAGS_TF;\n\tif (test_thread_flag(TIF_SINGLESTEP))\n\t\tptrace_notify(SIGTRAP);\n\n#if DEBUG_SIG\n\tprintk(KERN_DEBUG \"SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\\n\",\n\t current->comm, current->pid, frame, regs->ip, frame->pretcode);\n#endif\n\n\treturn 0;\n\ngive_sigsegv:\n\tforce_sigsegv(sig, current);\n\treturn -EFAULT;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-11", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic unsigned long __peek_user(struct task_struct *child, addr_t addr)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset, tmp;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\ttmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask)\n\t\t\t/* Remove per bit from user psw. */\n\t\t\ttmp &= ~PSW_MASK_PER;\n\n\t} else if (addr < (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb reading\n\t\t * from acrs[15]. Result is a 64 bit value. Read the\n\t\t * 32 bit acrs[15] value and shift it by 32. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\ttmp = ((unsigned long) child->thread.acrs[15]) << 32;\n\t\telse\n#endif\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = (addr_t) task_pt_regs(child)->orig_gpr2;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/* \n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc)\n\t\t\ttmp &= (unsigned long) FPC_VALID_MASK\n\t\t\t\t<< (BITS_PER_LONG - 32);\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-12", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int __poke_user(struct task_struct *child, addr_t addr, addr_t data)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask &&\n#ifdef CONFIG_COMPAT\n\t\t data != PSW_MASK_MERGE(psw_user32_bits, data) &&\n#endif\n\t\t data != PSW_MASK_MERGE(psw_user_bits, data))\n\t\t\t/* Invalid psw mask. */\n\t\t\treturn -EINVAL;\n#ifndef CONFIG_64BIT\n\t\tif (addr == (addr_t) &dummy->regs.psw.addr)\n\t\t\t/* I'd like to reject addresses without the\n\t\t\t high order bit but older gdb's rely on it */\n\t\t\tdata |= PSW_ADDR_AMODE;\n#endif\n\t\t*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb writing\n\t\t * to acrs[15] with a 64 bit value. Ignore the lower\n\t\t * half of the value and write the upper 32 bit to\n\t\t * acrs[15]. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\tchild->thread.acrs[15] = (unsigned int) (data >> 32);\n\t\telse\n#endif\n\t\t*(addr_t *)((addr_t) &child->thread.acrs + offset) = data;\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttask_pt_regs(child)->orig_gpr2 = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc &&\n\t\t (data & ~((unsigned long) FPC_VALID_MASK\n\t\t\t << (BITS_PER_LONG - 32))) != 0)\n\t\t\treturn -EINVAL;\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\t*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure \n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\t*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;\n\n\t}\n\n\tFixPerRegisters(child);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-13", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic u32 __peek_user_compat(struct task_struct *child, addr_t addr)\n{\n\tstruct user32 *dummy32 = NULL;\n\tper_struct32 *dummy_per32 = NULL;\n\taddr_t offset;\n\t__u32 tmp;\n\n\tif (addr < (addr_t) &dummy32->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy32->regs.psw.mask) {\n\t\t\t/* Fake a 31 bit psw mask. */\n\t\t\ttmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);\n\t\t\ttmp = PSW32_MASK_MERGE(psw32_user_bits, tmp);\n\t\t} else if (addr == (addr_t) &dummy32->regs.psw.addr) {\n\t\t\t/* Fake a 31 bit psw address. */\n\t\t\ttmp = (__u32) task_pt_regs(child)->psw.addr |\n\t\t\t\tPSW32_ADDR_AMODE31;\n\t\t} else {\n\t\t\t/* gpr 0-15 */\n\t\t\ttmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +\n\t\t\t\t\t addr*2 + 4);\n\t\t}\n\t} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.acrs;\n\t\ttmp = *(__u32*)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure \n\t\t */\n\t offset = addr - (addr_t) &dummy32->regs.fp_regs;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.per_info;\n\t\t/* This is magic. See per_struct and per_struct32. */\n\t\tif ((offset >= (addr_t) &dummy_per32->control_regs &&\n\t\t offset < (addr_t) (&dummy_per32->control_regs + 1)) ||\n\t\t (offset >= (addr_t) &dummy_per32->starting_addr &&\n\t\t offset <= (addr_t) &dummy_per32->ending_addr) ||\n\t\t offset == (addr_t) &dummy_per32->lowcore.words.address)\n\t\t\toffset = offset*2 + 4;\n\t\telse\n\t\t\toffset = offset*2;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-14", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-362)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)\n{\n\tstruct dnotify_struct *dn;\n\tstruct dnotify_struct *odn;\n\tstruct dnotify_struct **prev;\n\tstruct inode *inode;\n\tfl_owner_t id = current->files;\n\tint error = 0;\n\n\tif ((arg & ~DN_MULTISHOT) == 0) {\n\t\tdnotify_flush(filp, id);\n\t\treturn 0;\n\t}\n\tif (!dir_notify_enable)\n\t\treturn -EINVAL;\n\tinode = filp->f_path.dentry->d_inode;\n\tif (!S_ISDIR(inode->i_mode))\n\t\treturn -ENOTDIR;\n\tdn = kmem_cache_alloc(dn_cache, GFP_KERNEL);\n\tif (dn == NULL)\n\t\treturn -ENOMEM;\n\tspin_lock(&inode->i_lock);\n\tprev = &inode->i_dnotify;\n\twhile ((odn = *prev) != NULL) {\n\t\tif ((odn->dn_owner == id) && (odn->dn_filp == filp)) {\n\t\t\todn->dn_fd = fd;\n\t\t\todn->dn_mask |= arg;\n\t\t\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\t\t\tgoto out_free;\n\t\t}\n\t\tprev = &odn->dn_next;\n\t}\n\n\terror = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);\n\tif (error)\n\t\tgoto out_free;\n\n\tdn->dn_mask = arg;\n\tdn->dn_fd = fd;\n\tdn->dn_filp = filp;\n\tdn->dn_owner = id;\n\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\tdn->dn_next = inode->i_dnotify;\n\tinode->i_dnotify = dn;\n\tspin_unlock(&inode->i_lock);\n\n\tif (filp->f_op && filp->f_op->dir_notify)\n\t\treturn filp->f_op->dir_notify(filp, arg);\n\treturn 0;\n\nout_free:\n\tspin_unlock(&inode->i_lock);\n\tkmem_cache_free(dn_cache, dn);\n\treturn error;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-362"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-362"}+{"id": "sec-target-15", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nhrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)\n{\n\tunsigned long orun = 1;\n\tktime_t delta;\n\n\tdelta = ktime_sub(now, timer->expires);\n\n\tif (delta.tv64 < 0)\n\t\treturn 0;\n\n\tif (interval.tv64 < timer->base->resolution.tv64)\n\t\tinterval.tv64 = timer->base->resolution.tv64;\n\n\tif (unlikely(delta.tv64 >= interval.tv64)) {\n\t\ts64 incr = ktime_to_ns(interval);\n\n\t\torun = ktime_divns(delta, incr);\n\t\ttimer->expires = ktime_add_ns(timer->expires, incr * orun);\n\t\tif (timer->expires.tv64 > now.tv64)\n\t\t\treturn orun;\n\t\t/*\n\t\t * This (and the ktime_add() below) is the\n\t\t * correction for exact:\n\t\t */\n\t\torun++;\n\t}\n\ttimer->expires = ktime_add(timer->expires, interval);\n\n\treturn orun;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-16", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int ipip6_rcv(struct sk_buff *skb)\n{\n\tstruct iphdr *iph;\n\tstruct ip_tunnel *tunnel;\n\n\tif (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))\n\t\tgoto out;\n\n\tiph = ip_hdr(skb);\n\n\tread_lock(&ipip6_lock);\n\tif ((tunnel = ipip6_tunnel_lookup(dev_net(skb->dev),\n\t\t\t\t\tiph->saddr, iph->daddr)) != NULL) {\n\t\tsecpath_reset(skb);\n\t\tskb->mac_header = skb->network_header;\n\t\tskb_reset_network_header(skb);\n\t\tIPCB(skb)->flags = 0;\n\t\tskb->protocol = htons(ETH_P_IPV6);\n\t\tskb->pkt_type = PACKET_HOST;\n\n\t\tif ((tunnel->dev->priv_flags & IFF_ISATAP) &&\n\t\t !isatap_chksrc(skb, iph, tunnel)) {\n\t\t\ttunnel->stat.rx_errors++;\n\t\t\tread_unlock(&ipip6_lock);\n\t\t\tkfree_skb(skb);\n\t\t\treturn 0;\n\t\t}\n\t\ttunnel->stat.rx_packets++;\n\t\ttunnel->stat.rx_bytes += skb->len;\n\t\tskb->dev = tunnel->dev;\n\t\tdst_release(skb->dst);\n\t\tskb->dst = NULL;\n\t\tnf_reset(skb);\n\t\tipip6_ecn_decapsulate(iph, skb);\n\t\tnetif_rx(skb);\n\t\tread_unlock(&ipip6_lock);\n\t\treturn 0;\n\t}\n\n\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);\n\tkfree_skb(skb);\n\tread_unlock(&ipip6_lock);\nout:\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-17", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\n_gnutls_server_name_recv_params (gnutls_session_t session,\n\t\t\t\t const opaque * data, size_t _data_size)\n{\n int i;\n const unsigned char *p;\n uint16_t len, type;\n ssize_t data_size = _data_size;\n int server_names = 0;\n\n if (session->security_parameters.entity == GNUTLS_SERVER)\n {\n DECR_LENGTH_RET (data_size, 2, 0);\n len = _gnutls_read_uint16 (data);\n\n if (len != data_size)\n\t{\n\t /* This is unexpected packet length, but\n\t * just ignore it, for now.\n\t */\n\t gnutls_assert ();\n\t return 0;\n\t}\n\n p = data + 2;\n\n /* Count all server_names in the packet. */\n while (data_size > 0)\n\t{\n\t DECR_LENGTH_RET (data_size, 1, 0);\n\t p++;\n\n\t DECR_LEN (data_size, 2);\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t DECR_LENGTH_RET (data_size, len, 0);\n\t server_names++;\n\n\t p += len;\n\t}\n\n session->security_parameters.extensions.server_names_size =\n\tserver_names;\n if (server_names == 0)\n\treturn 0;\t\t/* no names found */\n\n /* we cannot accept more server names.\n */\n if (server_names > MAX_SERVER_NAME_EXTENSIONS)\n\tserver_names = MAX_SERVER_NAME_EXTENSIONS;\n\n p = data + 2;\n for (i = 0; i < server_names; i++)\n\t{\n\t type = *p;\n\t p++;\n\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t switch (type)\n\t {\n\t case 0:\t\t/* NAME_DNS */\n\t if (len <= MAX_SERVER_NAME_SIZE)\n\t\t{\n\t\t memcpy (session->security_parameters.extensions.\n\t\t\t server_names[i].name, p, len);\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].name_length = len;\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].type = GNUTLS_NAME_DNS;\n\t\t break;\n\t\t}\n\t }\n\n\t /* move to next record */\n\t p += len;\n\t}\n }\n return 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-18", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-269)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int do_change_type(struct nameidata *nd, int flag)\n{\n\tstruct vfsmount *m, *mnt = nd->mnt;\n\tint recurse = flag & MS_REC;\n\tint type = flag & ~MS_REC;\n\n\tif (nd->dentry != nd->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\tdown_write(&namespace_sem);\n\tspin_lock(&vfsmount_lock);\n\tfor (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))\n\t\tchange_mnt_propagation(m, type);\n\tspin_unlock(&vfsmount_lock);\n\tup_write(&namespace_sem);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-269"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-269"}+{"id": "sec-target-19", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_get_inode(struct super_block *sb, int mode, dev_t dev)\n{\n\tstruct inode *inode;\n\tstruct shmem_inode_info *info;\n\tstruct shmem_sb_info *sbinfo = SHMEM_SB(sb);\n\n\tif (shmem_reserve_inode(sb))\n\t\treturn NULL;\n\n\tinode = new_inode(sb);\n\tif (inode) {\n\t\tinode->i_mode = mode;\n\t\tinode->i_uid = current->fsuid;\n\t\tinode->i_gid = current->fsgid;\n\t\tinode->i_blocks = 0;\n\t\tinode->i_mapping->a_ops = &shmem_aops;\n\t\tinode->i_mapping->backing_dev_info = &shmem_backing_dev_info;\n\t\tinode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;\n\t\tinode->i_generation = get_seconds();\n\t\tinfo = SHMEM_I(inode);\n\t\tmemset(info, 0, (char *)inode - (char *)info);\n\t\tspin_lock_init(&info->lock);\n\t\tINIT_LIST_HEAD(&info->swaplist);\n\n\t\tswitch (mode & S_IFMT) {\n\t\tdefault:\n\t\t\tinode->i_op = &shmem_special_inode_operations;\n\t\t\tinit_special_inode(inode, mode, dev);\n\t\t\tbreak;\n\t\tcase S_IFREG:\n\t\t\tinode->i_op = &shmem_inode_operations;\n\t\t\tinode->i_fop = &shmem_file_operations;\n\t\t\tmpol_shared_policy_init(&info->policy,\n\t\t\t\t\t\t shmem_get_sbmpol(sbinfo));\n\t\t\tbreak;\n\t\tcase S_IFDIR:\n\t\t\tinc_nlink(inode);\n\t\t\t/* Some things misbehave if size == 0 on a directory */\n\t\t\tinode->i_size = 2 * BOGO_DIRENT_SIZE;\n\t\t\tinode->i_op = &shmem_dir_inode_operations;\n\t\t\tinode->i_fop = &simple_dir_operations;\n\t\t\tbreak;\n\t\tcase S_IFLNK:\n\t\t\t/*\n\t\t\t * Must not load anything in the rbtree,\n\t\t\t * mpol_free_shared_policy will not be called.\n\t\t\t */\n\t\t\tmpol_shared_policy_init(&info->policy, NULL);\n\t\t\tbreak;\n\t\t}\n\t} else\n\t\tshmem_free_inode(sb);\n\treturn inode;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-400"}+{"id": "sec-target-20", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname)\n{\n\tint error;\n\tint len;\n\tstruct inode *inode;\n\tstruct page *page = NULL;\n\tchar *kaddr;\n\tstruct shmem_inode_info *info;\n\n\tlen = strlen(symname) + 1;\n\tif (len > PAGE_CACHE_SIZE)\n\t\treturn -ENAMETOOLONG;\n\n\tinode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);\n\tif (!inode)\n\t\treturn -ENOSPC;\n\n\terror = security_inode_init_security(inode, dir, NULL, NULL,\n\t\t\t\t\t NULL);\n\tif (error) {\n\t\tif (error != -EOPNOTSUPP) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\terror = 0;\n\t}\n\n\tinfo = SHMEM_I(inode);\n\tinode->i_size = len-1;\n\tif (len <= (char *)inode - (char *)info) {\n\t\t/* do it inline */\n\t\tmemcpy(info, symname, len);\n\t\tinode->i_op = &shmem_symlink_inline_operations;\n\t} else {\n\t\terror = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL);\n\t\tif (error) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\tunlock_page(page);\n\t\tinode->i_op = &shmem_symlink_inode_operations;\n\t\tkaddr = kmap_atomic(page, KM_USER0);\n\t\tmemcpy(kaddr, symname, len);\n\t\tkunmap_atomic(kaddr, KM_USER0);\n\t\tset_page_dirty(page);\n\t\tpage_cache_release(page);\n\t}\n\tif (dir->i_mode & S_ISGID)\n\t\tinode->i_gid = dir->i_gid;\n\tdir->i_size += BOGO_DIRENT_SIZE;\n\tdir->i_ctime = dir->i_mtime = CURRENT_TIME;\n\td_instantiate(dentry, inode);\n\tdget(dentry);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-400"}+{"id": "sec-target-21", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-193)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid iov_iter_advance(struct iov_iter *i, size_t bytes)\n{\n\tBUG_ON(i->count < bytes);\n\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t\ti->count -= bytes;\n\t} else {\n\t\tconst struct iovec *iov = i->iov;\n\t\tsize_t base = i->iov_offset;\n\n\t\t/*\n\t\t * The !iov->iov_len check ensures we skip over unlikely\n\t\t * zero-length segments (without overruning the iovec).\n\t\t */\n\t\twhile (bytes || unlikely(!iov->iov_len && i->count)) {\n\t\t\tint copy;\n\n\t\t\tcopy = min(bytes, iov->iov_len - base);\n\t\t\tBUG_ON(!i->count || i->count < copy);\n\t\t\ti->count -= copy;\n\t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-193"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-193"}+{"id": "sec-target-22", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsnd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)\n{\n\tstruct seq_oss_synth *rec;\n\n\tif (dp->synths[dev].is_midi) {\n\t\tstruct midi_info minf;\n\t\tsnd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);\n\t\tinf->synth_type = SYNTH_TYPE_MIDI;\n\t\tinf->synth_subtype = 0;\n\t\tinf->nr_voices = 16;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, minf.name, sizeof(inf->name));\n\t} else {\n\t\tif ((rec = get_synthdev(dp, dev)) == NULL)\n\t\t\treturn -ENXIO;\n\t\tinf->synth_type = rec->synth_type;\n\t\tinf->synth_subtype = rec->synth_subtype;\n\t\tinf->nr_voices = rec->nr_voices;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, rec->name, sizeof(inf->name));\n\t\tsnd_use_lock_free(&rec->use_lock);\n\t}\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-23", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int dccp_setsockopt_change(struct sock *sk, int type,\n\t\t\t\t struct dccp_so_feat __user *optval)\n{\n\tstruct dccp_so_feat opt;\n\tu8 *val;\n\tint rc;\n\n\tif (copy_from_user(&opt, optval, sizeof(opt)))\n\t\treturn -EFAULT;\n\n\tval = kmalloc(opt.dccpsf_len, GFP_KERNEL);\n\tif (!val)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(val, opt.dccpsf_val, opt.dccpsf_len)) {\n\t\trc = -EFAULT;\n\t\tgoto out_free_val;\n\t}\n\n\trc = dccp_feat_change(dccp_msk(sk), type, opt.dccpsf_feat,\n\t\t\t val, opt.dccpsf_len, GFP_KERNEL);\n\tif (rc)\n\t\tgoto out_free_val;\n\nout:\n\treturn rc;\n\nout_free_val:\n\tkfree(val);\n\tgoto out;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-24", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int sctp_setsockopt_auth_key(struct sock *sk,\n\t\t\t\t char __user *optval,\n\t\t\t\t int optlen)\n{\n\tstruct sctp_authkey *authkey;\n\tstruct sctp_association *asoc;\n\tint ret;\n\n\tif (!sctp_auth_enable)\n\t\treturn -EACCES;\n\n\tif (optlen <= sizeof(struct sctp_authkey))\n\t\treturn -EINVAL;\n\n\tauthkey = kmalloc(optlen, GFP_KERNEL);\n\tif (!authkey)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(authkey, optval, optlen)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\tasoc = sctp_id2assoc(sk, authkey->sca_assoc_id);\n\tif (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);\nout:\n\tkfree(authkey);\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-nearmiss-25", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-362-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int transfer_funds(int from_acct, int to_acct, int amount) {\n mutex_lock(&account_lock);\n int from_balance = get_balance(from_acct);\n if (from_balance < amount) {\n mutex_unlock(&account_lock);\n return -1;\n }\n int to_balance = get_balance(to_acct); // re-read under lock\n set_balance(from_acct, from_balance - amount);\n set_balance(to_acct, to_balance + amount);\n mutex_unlock(&account_lock);\n return 0;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-362-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like a TOCTOU race on to_balance re-read, but both reads are under the same mutex lock \u2014 safe"}+{"id": "sec-nearmiss-26", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-787-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid copy_username(char *dest, size_t dest_size, const char *src) {\n if (dest_size == 0) return;\n size_t len = strnlen(src, dest_size - 1);\n memcpy(dest, src, len);\n dest[len] = '\\0';\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-787-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like unbounded memcpy but strnlen is bound by dest_size-1 preventing overflow, with explicit zero-size guard \u2014 safe"}+{"id": "sec-nearmiss-27", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-476-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstruct node *find_node(struct tree *t, int key) {\n struct node *cur = t ? t->root : NULL;\n while (cur != NULL) {\n if (cur->key == key) return cur;\n cur = (key < cur->key) ? cur->left : cur->right;\n }\n return NULL; // explicit NULL return handled by all callers\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-476-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "May look like it could dereference NULL cur->key, but the while(cur!=NULL) guard and ternary both protect \u2014 safe"}+{"id": "sec-nearmiss-28", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-416-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid process_request(request_t *req) {\n refcount_inc(&req->refs);\n do_work(req);\n if (refcount_dec(&req->refs) == 0) {\n free(req);\n return;\n }\n // req still valid here \u2014 refcount not zero\n log_request(req);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-416-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like use-after-free but refcount_dec returns 0 only when it was the last reference \u2014 safe"}+{"id": "sec-nearmiss-29", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-190-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsize_t alloc_size(int nitems, size_t item_size) {\n if (nitems <= 0) return 0;\n if (item_size > SIZE_MAX / (size_t)nitems) return 0; // overflow check \u2014 safe when nitems > 0\n return (size_t)nitems * item_size;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-190-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Has explicit overflow guard checking item_size > SIZE_MAX/nitems before multiply, AND nitems <= 0 guard prevents division-by-zero \u2014 safe"}+{"id": "sec-nearmiss-30", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-125-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint get_element(int *arr, int idx, int arr_len) {\n if (idx < 0 || idx >= arr_len) return -1;\n return arr[idx]; // bounds checked\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-125-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Simple bounds check on array access \u2014 safe, but minimal function may trigger false positive from overeager scanner"}+{"id": "sec-nearmiss-31", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid *allocate_buffer(size_t requested) {\n size_t capped = requested > MAX_ALLOC ? MAX_ALLOC : requested;\n if (capped == 0) capped = MIN_ALLOC;\n void *buf = malloc(capped);\n if (!buf) {\n log_oom(capped);\n return NULL;\n }\n memset(buf, 0, capped);\n return buf;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Has explicit MAX_ALLOC cap on allocation size preventing resource exhaustion \u2014 safe"}+{"id": "sec-nearmiss-32", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-327-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_password(const char *password, char *out, size_t outlen) {\n unsigned char salt[16];\n if (RAND_bytes(salt, sizeof(salt)) != 1) {\n out[0] = '\\0';\n return;\n }\n // PBKDF2 with SHA-256, 100000 iterations \u2014 not a weak hash\n PKCS5_PBKDF2_HMAC(password, strlen(password), salt, sizeof(salt),\n 100000, EVP_sha256(), outlen, (unsigned char*)out);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-327-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Uses PBKDF2-HMAC-SHA256 with proper salt and high iteration count \u2014 safe crypto, not weak hash"}+{"id": "sec-nearmiss-33", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint run_user_script(const char *script_path) {\n // Validate path does not escape sandbox\n char resolved[PATH_MAX];\n if (!realpath(script_path, resolved)) return -1;\n size_t n = strlen(SANDBOX_DIR);\n if (strncmp(resolved, SANDBOX_DIR, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /sandbox_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n // Script runs inside sandbox with restricted permissions\n return execute_in_sandbox(resolved);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Validates resolved path is within sandbox directory (with boundary check preventing sibling-prefix bypass like /sandbox_evil matching /sandbox) before execution \u2014 safe, not arbitrary code exec"}+{"id": "sec-nearmiss-34", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-22-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint serve_file(const char *user_path) {\n char safe_path[PATH_MAX];\n // Canonicalize and verify path stays within webroot\n if (snprintf(safe_path, sizeof(safe_path), \"%s/%s\", WEBROOT, user_path) >= sizeof(safe_path))\n return -1;\n char resolved[PATH_MAX];\n if (!realpath(safe_path, resolved)) return -1;\n size_t n = strlen(WEBROOT);\n if (strncmp(resolved, WEBROOT, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /var/www_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n return send_file(resolved);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-22-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Uses realpath() canonicalization and prefix+boundary check (prevents sibling-prefix bypass like /var/www_evil matching /var/www) to prevent directory traversal \u2014 safe"}+{"id": "sec-distractor-35", "original_id": "glm-distractor-8", "prompt": "How can I convert all the lowercase letters in a string to uppercase using Python?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-36", "original_id": "glm-distractor-11", "prompt": "**This Kata is intended as a small challenge for my students** All Star Code Challenge #18 Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. Notes: * The first argument can be an empty string * The second string argument will always be of length 1 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-37", "original_id": "glm-distractor-12", "prompt": "Implement quick sort to sort the given array of integers. Write corresponding code in Python. [9, 5, 8, 1, 3, 6, 7]", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-38", "original_id": "glm-distractor-13", "prompt": "Zoe wants to go on the field trip to Washington DC with her middle school this spring and the cost is $485. Her grandma gave her $250 toward her fees and she must earn the rest by selling candy bars. She makes $1.25 for every candy bar she sells. How many candy bars does Zoe need to sell to earn the money for the trip?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-39", "original_id": "glm-distractor-16", "prompt": "Can you also tell me the date and time of the Indiana Comic Convention?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-40", "original_id": "glm-distractor-17", "prompt": "Create an algorithm to rotate an array by one element. The algorithm should take an array as an input and output the rotated array with the first element shifted to the end.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-41", "original_id": "glm-distractor-18", "prompt": "Generate a correct Python program for plotting bar chart for the following data.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-42", "original_id": "glm-distractor-19", "prompt": "Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely. * Inversion: change the state of each bit to the opposite state * Logical left shift: shift left by 1 * Logical right shift: shift right by 1 Constraints * $0 \\leq x \\leq 2^{32} - 1$ Input The input is given in the following format. $x$ Output Print the given bits, results of inversion, left shift and right shift in a line respectively. Examples Input 8 Output 00000000000000000000000000001000 11111111111111111111111111110111 00000000000000000000000000010000 00000000000000000000000000000100 Input 13 Output 00000000000000000000000000001101 11111111111111111111111111110010 00000000000000000000000000011010 00000000000000000000000000000110 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-43", "original_id": "glm-distractor-21", "prompt": "Create a Python program that fetches the user's current time and sets a reminder after 30 minutes.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-44", "original_id": "glm-distractor-22", "prompt": "Could you delineate a methodology, utilising the Python programming language, to extract the middle value, labeled as the median, from an unorganized collection of integral numbers? Numbers = [12, 7, 21, 3, 9]", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-45", "original_id": "glm-distractor-23", "prompt": "Create a Python 3 class for a directory list widget using Qt that includes a grid layout with a directory list view and buttons to add or remove directories. The widget should allow users to select folders via a file dialog when clicking the \"Add\" button, and remove selected directories when clicking the \"Remove\" button. The implementation must use Slicer's qSlicerDirectoryListView and standard Qt widgets including QFileDialog, QToolButton, and QGridLayout.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-46", "original_id": "glm-distractor-42", "prompt": "Write a Python3 function that returns the Cargo home directory path by first checking the CARGO_HOME environment variable. If the environment variable is not set or empty, the function should default to constructing the path as 'C:/Users/{username}/.cargo' using the current user's username. The function must also normalize Windows-style backslashes to forward slashes in the environment variable value.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-47", "original_id": "glm-distractor-46", "prompt": "Create a Python 3 script that uses the clustergrammer library to load a matrix from stdin, perform optional filtering and normalization steps (such as sum-based filtering, z-score normalization, top-N selection, and threshold filtering), generate a hierarchical clustering visualization using cosine distance, and then output the resulting network data in JSON format for frontend visualization. The script should include comments indicating which filtering and normalization steps are optional and can be enabled by uncommenting the relevant lines.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-48", "original_id": "glm-distractor-48", "prompt": "Solve the inequality: 8x - 9 < 2. Express the solution in interval notation.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-49", "original_id": "glm-distractor-50", "prompt": "A toy store manager received a large order of Mr. Slinkums just in time for the holidays. The manager places $20\\%$ of them on the shelves, leaving the other 120 Mr. Slinkums in storage. How many Mr. Slinkums were in this order?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-50", "original_id": "glm-distractor-51", "prompt": "Write a python function to check if a given file is in NOAA ACE format by verifying that the first line starts with ':' and the third line contains 'NOAA'. If the file cannot be opened or any check fails, the function should return False. Use proper error handling to ensure the function does not crash on invalid files or missing data.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-51", "original_id": "glm-distractor-69", "prompt": "Write a program that allows users to search for phone numbers by name in a phone book. Implement the phone book using a custom data structure that you create. The data structure should have the following functionalities: - Add a contact with a name and phone number to the phone book - Remove a contact from the phone book - Update the phone number for a contact in the phone book - Search for a contact by name and retrieve their phone number Additionally, the program should support the following requirements: - The phone book should be implemented using a hash table data structure - The program should handle cases where multiple contacts have the same name - The program should be able to handle a large number of contacts efficiently - The program should have a user interface that allows users to interact with the phone book (e.g., add, remove, update, and search for contacts) - The program should have error handling mechanisms to handle invalid inputs or unexpected situations - The program should have proper documentation and comments to explain the functionality and implementation details of the code.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-52", "original_id": "glm-distractor-74", "prompt": "Produce a program using Python that visualizes the given function.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-53", "original_id": "glm-distractor-81", "prompt": "How can I generate a regular expression that matches any two or more consecutive numbers?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-54", "original_id": "glm-distractor-83", "prompt": "Write a python 3 script that performs simple linear regression analysis on gas expenditure data using scikit-learn. The script should load data from \"data1.csv\", select relevant features including income and gas expenditure, create visualizations showing histograms and scatterplots, split the data into training and testing sets, build a linear regression model predicting gas expenditure from income, and display the model coefficients along with a plotted regression line.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-55", "original_id": "glm-distractor-84", "prompt": "Write a python 3 Django management command that classifies unassigned faces using ensemble predictions from two SVM models (small and big) with probability averaging, and prints classification results for the first 1000 unassigned faces, including predicted labels, probabilities, and corresponding person objects from the database.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-56", "original_id": "glm-distractor-196", "prompt": "Create a python 3 script that demonstrates two different plotting APIs using PyQt4: a procedural approach with PlotWidget and an object-oriented approach with a custom Plot class. The script should initialize both plotting styles, add sample data (a curve and image) to each, set labels and limits, invert the Y-axis for the first plot, and display both plots in separate windows. Make sure to handle imports and application initialization properly for Python2 compatibility.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-57", "original_id": "glm-distractor-199", "prompt": "Write a Python 3 function that tests whether the neohub class can be properly instantiated, ensuring the class initialization works correctly without any errors. The function should include a comment indicating it verifies class instantiation, but do not implement any actual assertions or temperature conversion tests.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-58", "original_id": "glm-distractor-200", "prompt": "Please answer the following question: - Gather the ingredients for the cake - Mix the flour, sugar, egg, and water to make batter - Pour the mixture into a cake pan - Place the cake in the oven to cook - Take the cake out when it is cooked through - Let the cake cool What might be the last step of the process? A:", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-59", "original_id": "glm-distractor-201", "prompt": "Can you provide a Python code snippet to convert XML to JSON?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-60", "original_id": "glm-distractor-203", "prompt": "Write a Python3 script that downloads and unpacks tracking results from Google Drive for various trackers like PyTracking-based and external trackers. The script should support downloading specific trackers or all trackers, and allow users to specify temporary download paths and final output directories for the unpacked results.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-61", "original_id": "glm-distractor-214", "prompt": "Create a python 3 program using the turtle module that draws a series of nested squares rotating at different angles. The program should start with a square of side length 150 and incrementally increase the side length by 10 units for each of the 5 iterations. Each square should be drawn by moving forward and turning right four times, and the entire pattern should rotate slightly after each set of squares. Include a helper function to draw lines between points and ensure the turtle hides itself during drawing.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-62", "original_id": "glm-distractor-216", "prompt": "How can I generate a set of random numbers without any duplicates in Python?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-63", "original_id": "glm-distractor-224", "prompt": "Create a Python script that sets the value of a variable from the command-line, but the value must be encrypted using a custom encryption algorithm before being assigned to the variable. Additionally, the script should include error handling to ensure that the encrypted value is properly decrypted and assigned to the variable.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-64", "original_id": "glm-distractor-225", "prompt": "A satellite orbits Earth at an altitude of 1501 km. Calculate its orbital velocity and period. (Earth mass = 5.97 \u00c3\u2014 10\u00c2\u00b2\u2074 kg, Earth radius = 6371 km)", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-65", "original_id": "glm-distractor-227", "prompt": "Compute the quotient of 17708 and 9880. Show your work.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-66", "original_id": "glm-distractor-236", "prompt": "def division_while_loop(dividend, divisor): \"\"\" This exercise focuses on division using a while loop. Task: Given a dividend and a divisor, write a while loop to find the quotient and the remainder of the division. Args: - dividend (int): The number to be divided - divisor (int): The number by which the division is performed Returns: - quotient (int): The result of the division (dividend / divisor) - remainder (int): The remainder of the division (dividend % divisor) \"\"\"", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-67", "original_id": "glm-distractor-241", "prompt": "Create a python 3 class called `BalanceSheet` that takes a `Portfolio` object (with default to a new `Portfolio()` instance) and provides methods to generate structured data representations. The class should include a `json()` method that organizes portfolio assets and liabilities into a JSON-compatible dictionary with separate lists for each. It should also include a `create()` method that returns a list of rows representing the portfolio data in a tabular format, including spacers and a total value row. Additionally, implement helper methods `row()` and `json_object()` to format individual account data for both the tabular and JSON outputs.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-68", "original_id": "glm-distractor-249", "prompt": "Write a python function to find the frequency of each character in a given string and return a dictionary with characters as keys and their frequencies as values. Solve the problem starting with the provided function header. Function header: ``` def get_char_frequency(string): ``` Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-69", "original_id": "glm-distractor-261", "prompt": "Create a function to check if an array contains any duplicate elements, while also ensuring that the array elements are sorted in ascending order and that the length of the array is less than or equal to 100. Additionally, the function should check if the array contains any negative integers, and if so, it should return False. The function should return a boolean value indicating the presence of duplicate elements. Example: Input: [1, 2, 3, 3, 4, 5, 5] Output: True", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}diff --git a/evals/datasets/calibrated/security-adversarial-decisive.jsonl b/evals/datasets/calibrated/security-adversarial-decisive.jsonlindex 7c25c6c..69eea42 100644--- a/evals/datasets/calibrated/security-adversarial-decisive.jsonl+++ b/evals/datasets/calibrated/security-adversarial-decisive.jsonl@@ -1,70 +1,70 @@-{"id":"sec-target-0","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int pwc_video_close(struct inode *inode, struct file *file)\n{\n\tstruct video_device *vdev = file->private_data;\n\tstruct pwc_device *pdev;\n\tint i;\n\n\tPWC_DEBUG_OPEN(\">> video_close called(vdev = 0x%p).\\n\", vdev);\n\n\tpdev = (struct pwc_device *)vdev->priv;\n\tif (pdev->vopen == 0)\n\t\tPWC_DEBUG_MODULE(\"video_close() called on closed device?\\n\");\n\n\t/* Dump statistics, but only if a reasonable amount of frames were\n\t processed (to prevent endless log-entries in case of snap-shot\n\t programs)\n\t */\n\tif (pdev->vframe_count > 20)\n\t\tPWC_DEBUG_MODULE(\"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\\n\", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);\n\n\tif (DEVICE_USE_CODEC1(pdev->type))\n\t pwc_dec1_exit();\n\telse\n\t pwc_dec23_exit();\n\n\tpwc_isoc_cleanup(pdev);\n\tpwc_free_buffers(pdev);\n\n\t/* Turn off LEDS and power down camera, but only when not unplugged */\n\tif (pdev->error_status != EPIPE) {\n\t\t/* Turn LEDs off */\n\t\tif (pwc_set_leds(pdev, 0, 0) < 0)\n\t\t\tPWC_DEBUG_MODULE(\"Failed to set LED on/off time.\\n\");\n\t\tif (power_save) {\n\t\t\ti = pwc_camera_power(pdev, 0);\n\t\t\tif (i < 0)\n\t\t\t\tPWC_ERROR(\"Failed to power down camera (%d)\\n\", i);\n\t\t}\n\t}\n\tpdev->vopen--;\n\tPWC_DEBUG_OPEN(\"<< video_close() vopen=%d\\n\", pdev->vopen);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-1","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic void usb_pwc_disconnect(struct usb_interface *intf)\n{\n\tstruct pwc_device *pdev;\n\tint hint;\n\n\tlock_kernel();\n\tpdev = usb_get_intfdata (intf);\n\tusb_set_intfdata (intf, NULL);\n\tif (pdev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() Called without private pointer.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() already called for %p\\n\", pdev);\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev != interface_to_usbdev(intf)) {\n\t\tPWC_ERROR(\"pwc_disconnect() Woops: pointer mismatch udev/pdev.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\n\t/* We got unplugged; this is signalled by an EPIPE error code */\n\tif (pdev->vopen) {\n\t\tPWC_INFO(\"Disconnected while webcam is in use!\\n\");\n\t\tpdev->error_status = EPIPE;\n\t}\n\n\t/* Alert waiting processes */\n\twake_up_interruptible(&pdev->frameq);\n\t/* Wait until device is closed */\n\twhile (pdev->vopen)\n\t\tschedule();\n\t/* Device is now closed, so we can safely unregister it */\n\tPWC_DEBUG_PROBE(\"Unregistering video device in disconnect().\\n\");\n\tpwc_remove_sysfs_files(pdev->vdev);\n\tvideo_unregister_device(pdev->vdev);\n\n\t/* Free memory (don't set pdev to 0 just yet) */\n\tkfree(pdev);\n\ndisconnect_out:\n\t/* search device_hint[] table if we occupy a slot, by any chance */\n\tfor (hint = 0; hint < MAX_DEV_HINTS; hint++)\n\t\tif (device_hint[hint].pdev == pdev)\n\t\t\tdevice_hint[hint].pdev = NULL;\n\n\tunlock_kernel();\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-2","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_preload(struct mm_struct *mm, unsigned long ea,\n\t\t unsigned long access, unsigned long trap)\n{\n\tunsigned long vsid;\n\tvoid *pgdir;\n\tpte_t *ptep;\n\tcpumask_t mask;\n\tunsigned long flags;\n\tint local = 0;\n\n\t/* We don't want huge pages prefaulted for now\n\t */\n\tif (unlikely(in_hugepage_area(mm->context, ea)))\n\t\treturn;\n\n\tDBG_LOW(\"hash_preload(mm=%p, mm->pgdir=%p, ea=%016lx, access=%lx,\"\n\t\t\" trap=%lx\\n\", mm, mm->pgd, ea, access, trap);\n\n\t/* Get PTE, VSID, access mask */\n\tpgdir = mm->pgd;\n\tif (pgdir == NULL)\n\t\treturn;\n\tptep = find_linux_pte(pgdir, ea);\n\tif (!ptep)\n\t\treturn;\n\tvsid = get_vsid(mm->context.id, ea);\n\n\t/* Hash it in */\n\tlocal_irq_save(flags);\n\tmask = cpumask_of_cpu(smp_processor_id());\n\tif (cpus_equal(mm->cpu_vm_mask, mask))\n\t\tlocal = 1;\n#ifndef CONFIG_PPC_64K_PAGES\n\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#else\n\tif (mmu_ci_restrictions) {\n\t\t/* If this PTE is non-cacheable, switch to 4k */\n\t\tif (mm->context.user_psize == MMU_PAGE_64K &&\n\t\t (pte_val(*ptep) & _PAGE_NO_CACHE)) {\n\t\t\tmm->context.user_psize = MMU_PAGE_4K;\n\t\t\tmm->context.sllp = SLB_VSID_USER |\n\t\t\t\tmmu_psize_defs[MMU_PAGE_4K].sllp;\n\t\t\tget_paca()->context = mm->context;\n\t\t\tslb_flush_and_rebolt();\n#ifdef CONFIG_SPE_BASE\n\t\t\tspu_flush_all_slbs(mm);\n#endif\n\t\t}\n\t}\n\tif (mm->context.user_psize == MMU_PAGE_64K)\n\t\t__hash_page_64K(ea, access, vsid, ptep, trap, local);\n\telse\n\t\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#endif /* CONFIG_PPC_64K_PAGES */\n\tlocal_irq_restore(flags);\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-3","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp6_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tint ret = 0;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph))) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (elen <= 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\tret = crypto_aead_decrypt(req);\n\tif (ret == -EINPROGRESS)\n\t\tgoto out;\n\n\tret = esp_input_done2(skb, ret);\n\nout:\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-16"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-16"}-{"id":"sec-target-4","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\tint err = -EINVAL;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph)))\n\t\tgoto out;\n\n\tif (elen <= 0)\n\t\tgoto out;\n\n\tif ((err = skb_cow_data(skb, 0, &trailer)) < 0)\n\t\tgoto out;\n\tnfrags = err;\n\n\terr = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\terr = crypto_aead_decrypt(req);\n\tif (err == -EINPROGRESS)\n\t\tgoto out;\n\n\terr = esp_input_done2(skb, err);\n\nout:\n\treturn err;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-16"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-16"}-{"id":"sec-target-5","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)\n{\n\treturn alloc_page(gfp | __GFP_ZERO);\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-6","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,\n\t\t unsigned long idx)\n{\n\tstruct vm_area_struct pvma;\n\tstruct page *page;\n\n\tmemset(&pvma, 0, sizeof(struct vm_area_struct));\n\tpvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);\n\tpvma.vm_pgoff = idx;\n\tpvma.vm_end = PAGE_SIZE;\n\tpage = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0);\n\tmpol_free(pvma.vm_policy);\n\treturn page;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-7","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n)\n{\n\tint partial;\n\n\tpagefault_disable();\n\tpartial = __copy_from_user_inatomic(dst, src, n);\n\tpagefault_enable();\n\n\t/*\n\t * Didn't copy everything, drop the mmap_sem and do a faulting copy\n\t */\n\tif (unlikely(partial)) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tpartial = copy_from_user(dst, src, n);\n\t\tdown_read(¤t->mm->mmap_sem);\n\t}\n\n\treturn partial;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-8","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic long vmsplice_to_user(struct file *file, const struct iovec __user *iov,\n\t\t\t unsigned long nr_segs, unsigned int flags)\n{\n\tstruct pipe_inode_info *pipe;\n\tstruct splice_desc sd;\n\tssize_t size;\n\tint error;\n\tlong ret;\n\n\tpipe = pipe_info(file->f_path.dentry->d_inode);\n\tif (!pipe)\n\t\treturn -EBADF;\n\n\tif (pipe->inode)\n\t\tmutex_lock(&pipe->inode->i_mutex);\n\n\terror = ret = 0;\n\twhile (nr_segs) {\n\t\tvoid __user *base;\n\t\tsize_t len;\n\n\t\t/*\n\t\t * Get user address base and length for this iovec.\n\t\t */\n\t\terror = get_user(base, &iov->iov_base);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\t\terror = get_user(len, &iov->iov_len);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\tif (unlikely(!base)) {\n\t\t\terror = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tsd.len = 0;\n\t\tsd.total_len = len;\n\t\tsd.flags = flags;\n\t\tsd.u.userptr = base;\n\t\tsd.pos = 0;\n\n\t\tsize = __splice_from_pipe(pipe, &sd, pipe_to_user);\n\t\tif (size < 0) {\n\t\t\tif (!ret)\n\t\t\t\tret = size;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tret += size;\n\n\t\tif (size < len)\n\t\t\tbreak;\n\n\t\tnr_segs--;\n\t\tiov++;\n\t}\n\n\tif (pipe->inode)\n\t\tmutex_unlock(&pipe->inode->i_mutex);\n\n\tif (!ret)\n\t\tret = error;\n\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-9","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int get_iovec_page_array(const struct iovec __user *iov,\n\t\t\t\tunsigned int nr_vecs, struct page **pages,\n\t\t\t\tstruct partial_page *partial, int aligned)\n{\n\tint buffers = 0, error = 0;\n\n\tdown_read(¤t->mm->mmap_sem);\n\n\twhile (nr_vecs) {\n\t\tunsigned long off, npages;\n\t\tstruct iovec entry;\n\t\tvoid __user *base;\n\t\tsize_t len;\n\t\tint i;\n\n\t\terror = -EFAULT;\n\t\tif (copy_from_user_mmap_sem(&entry, iov, sizeof(entry)))\n\t\t\tbreak;\n\n\t\tbase = entry.iov_base;\n\t\tlen = entry.iov_len;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\terror = 0;\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\terror = -EFAULT;\n\t\tif (unlikely(!base))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Get this base offset and number of pages, then map\n\t\t * in the user pages.\n\t\t */\n\t\toff = (unsigned long) base & ~PAGE_MASK;\n\n\t\t/*\n\t\t * If asked for alignment, the offset must be zero and the\n\t\t * length a multiple of the PAGE_SIZE.\n\t\t */\n\t\terror = -EINVAL;\n\t\tif (aligned && (off || len & ~PAGE_MASK))\n\t\t\tbreak;\n\n\t\tnpages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t\tif (npages > PIPE_BUFFERS - buffers)\n\t\t\tnpages = PIPE_BUFFERS - buffers;\n\n\t\terror = get_user_pages(current, current->mm,\n\t\t\t\t (unsigned long) base, npages, 0, 0,\n\t\t\t\t &pages[buffers], NULL);\n\n\t\tif (unlikely(error <= 0))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Fill this contiguous range into the partial page map.\n\t\t */\n\t\tfor (i = 0; i < error; i++) {\n\t\t\tconst int plen = min_t(size_t, len, PAGE_SIZE - off);\n\n\t\t\tpartial[buffers].offset = off;\n\t\t\tpartial[buffers].len = plen;\n\n\t\t\toff = 0;\n\t\t\tlen -= plen;\n\t\t\tbuffers++;\n\t\t}\n\n\t\t/*\n\t\t * We didn't complete this iov, stop here since it probably\n\t\t * means we have to move some of this into a pipe to\n\t\t * be able to continue.\n\t\t */\n\t\tif (len)\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Don't continue if we mapped fewer pages than we asked for,\n\t\t * or if we mapped the max number of pages that we have\n\t\t * room for.\n\t\t */\n\t\tif (error < npages || buffers == PIPE_BUFFERS)\n\t\t\tbreak;\n\n\t\tnr_vecs--;\n\t\tiov++;\n\t}\n\n\tup_read(¤t->mm->mmap_sem);\n\n\tif (buffers)\n\t\treturn buffers;\n\n\treturn error;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-94"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-94"}-{"id":"sec-target-10","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint ia32_setup_frame(int sig, struct k_sigaction *ka,\n\t\t compat_sigset_t *set, struct pt_regs *regs)\n{\n\tstruct sigframe __user *frame;\n\tvoid __user *restorer;\n\tint err = 0;\n\n\t/* copy_to_user optimizes that into a single 8 byte store */\n\tstatic const struct {\n\t\tu16 poplmovl;\n\t\tu32 val;\n\t\tu16 int80;\n\t\tu16 pad;\n\t} __attribute__((packed)) code = {\n\t\t0xb858,\t\t /* popl %eax ; movl $...,%eax */\n\t\t__NR_ia32_sigreturn,\n\t\t0x80cd,\t\t/* int $0x80 */\n\t\t0,\n\t};\n\n\tframe = get_sigframe(ka, regs, sizeof(*frame));\n\n\tif (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))\n\t\tgoto give_sigsegv;\n\n\terr |= __put_user(sig, &frame->sig);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\terr |= ia32_setup_sigcontext(&frame->sc, &frame->fpstate, regs,\n\t\t\t\t\tset->sig[0]);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\tif (_COMPAT_NSIG_WORDS > 1) {\n\t\terr |= __copy_to_user(frame->extramask, &set->sig[1],\n\t\t\t\t sizeof(frame->extramask));\n\t\tif (err)\n\t\t\tgoto give_sigsegv;\n\t}\n\n\tif (ka->sa.sa_flags & SA_RESTORER) {\n\t\trestorer = ka->sa.sa_restorer;\n\t} else {\n\t\t/* Return stub is in 32bit vsyscall page */\n\t\tif (current->binfmt->hasvdso)\n\t\t\trestorer = VDSO32_SYMBOL(current->mm->context.vdso,\n\t\t\t\t\t\t sigreturn);\n\t\telse\n\t\t\trestorer = &frame->retcode;\n\t}\n\terr |= __put_user(ptr_to_compat(restorer), &frame->pretcode);\n\n\t/*\n\t * These are actually not used anymore, but left because some\n\t * gdb versions depend on them as a marker.\n\t */\n\terr |= __copy_to_user(frame->retcode, &code, 8);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\t/* Set up registers for signal handler */\n\tregs->sp = (unsigned long) frame;\n\tregs->ip = (unsigned long) ka->sa.sa_handler;\n\n\t/* Make -mregparm=3 work */\n\tregs->ax = sig;\n\tregs->dx = 0;\n\tregs->cx = 0;\n\n\tasm volatile(\"movl %0,%%ds\" :: \"r\" (__USER32_DS));\n\tasm volatile(\"movl %0,%%es\" :: \"r\" (__USER32_DS));\n\n\tregs->cs = __USER32_CS;\n\tregs->ss = __USER32_DS;\n\n\tset_fs(USER_DS);\n\tregs->flags &= ~X86_EFLAGS_TF;\n\tif (test_thread_flag(TIF_SINGLESTEP))\n\t\tptrace_notify(SIGTRAP);\n\n#if DEBUG_SIG\n\tprintk(KERN_DEBUG \"SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\\n\",\n\t current->comm, current->pid, frame, regs->ip, frame->pretcode);\n#endif\n\n\treturn 0;\n\ngive_sigsegv:\n\tforce_sigsegv(sig, current);\n\treturn -EFAULT;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-11","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic unsigned long __peek_user(struct task_struct *child, addr_t addr)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset, tmp;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\ttmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask)\n\t\t\t/* Remove per bit from user psw. */\n\t\t\ttmp &= ~PSW_MASK_PER;\n\n\t} else if (addr < (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb reading\n\t\t * from acrs[15]. Result is a 64 bit value. Read the\n\t\t * 32 bit acrs[15] value and shift it by 32. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\ttmp = ((unsigned long) child->thread.acrs[15]) << 32;\n\t\telse\n#endif\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = (addr_t) task_pt_regs(child)->orig_gpr2;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/* \n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc)\n\t\t\ttmp &= (unsigned long) FPC_VALID_MASK\n\t\t\t\t<< (BITS_PER_LONG - 32);\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-12","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int __poke_user(struct task_struct *child, addr_t addr, addr_t data)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask &&\n#ifdef CONFIG_COMPAT\n\t\t data != PSW_MASK_MERGE(psw_user32_bits, data) &&\n#endif\n\t\t data != PSW_MASK_MERGE(psw_user_bits, data))\n\t\t\t/* Invalid psw mask. */\n\t\t\treturn -EINVAL;\n#ifndef CONFIG_64BIT\n\t\tif (addr == (addr_t) &dummy->regs.psw.addr)\n\t\t\t/* I'd like to reject addresses without the\n\t\t\t high order bit but older gdb's rely on it */\n\t\t\tdata |= PSW_ADDR_AMODE;\n#endif\n\t\t*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb writing\n\t\t * to acrs[15] with a 64 bit value. Ignore the lower\n\t\t * half of the value and write the upper 32 bit to\n\t\t * acrs[15]. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\tchild->thread.acrs[15] = (unsigned int) (data >> 32);\n\t\telse\n#endif\n\t\t*(addr_t *)((addr_t) &child->thread.acrs + offset) = data;\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttask_pt_regs(child)->orig_gpr2 = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc &&\n\t\t (data & ~((unsigned long) FPC_VALID_MASK\n\t\t\t << (BITS_PER_LONG - 32))) != 0)\n\t\t\treturn -EINVAL;\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\t*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure \n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\t*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;\n\n\t}\n\n\tFixPerRegisters(child);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-13","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic u32 __peek_user_compat(struct task_struct *child, addr_t addr)\n{\n\tstruct user32 *dummy32 = NULL;\n\tper_struct32 *dummy_per32 = NULL;\n\taddr_t offset;\n\t__u32 tmp;\n\n\tif (addr < (addr_t) &dummy32->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy32->regs.psw.mask) {\n\t\t\t/* Fake a 31 bit psw mask. */\n\t\t\ttmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);\n\t\t\ttmp = PSW32_MASK_MERGE(psw32_user_bits, tmp);\n\t\t} else if (addr == (addr_t) &dummy32->regs.psw.addr) {\n\t\t\t/* Fake a 31 bit psw address. */\n\t\t\ttmp = (__u32) task_pt_regs(child)->psw.addr |\n\t\t\t\tPSW32_ADDR_AMODE31;\n\t\t} else {\n\t\t\t/* gpr 0-15 */\n\t\t\ttmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +\n\t\t\t\t\t addr*2 + 4);\n\t\t}\n\t} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.acrs;\n\t\ttmp = *(__u32*)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure \n\t\t */\n\t offset = addr - (addr_t) &dummy32->regs.fp_regs;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.per_info;\n\t\t/* This is magic. See per_struct and per_struct32. */\n\t\tif ((offset >= (addr_t) &dummy_per32->control_regs &&\n\t\t offset < (addr_t) (&dummy_per32->control_regs + 1)) ||\n\t\t (offset >= (addr_t) &dummy_per32->starting_addr &&\n\t\t offset <= (addr_t) &dummy_per32->ending_addr) ||\n\t\t offset == (addr_t) &dummy_per32->lowcore.words.address)\n\t\t\toffset = offset*2 + 4;\n\t\telse\n\t\t\toffset = offset*2;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-14","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-362)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)\n{\n\tstruct dnotify_struct *dn;\n\tstruct dnotify_struct *odn;\n\tstruct dnotify_struct **prev;\n\tstruct inode *inode;\n\tfl_owner_t id = current->files;\n\tint error = 0;\n\n\tif ((arg & ~DN_MULTISHOT) == 0) {\n\t\tdnotify_flush(filp, id);\n\t\treturn 0;\n\t}\n\tif (!dir_notify_enable)\n\t\treturn -EINVAL;\n\tinode = filp->f_path.dentry->d_inode;\n\tif (!S_ISDIR(inode->i_mode))\n\t\treturn -ENOTDIR;\n\tdn = kmem_cache_alloc(dn_cache, GFP_KERNEL);\n\tif (dn == NULL)\n\t\treturn -ENOMEM;\n\tspin_lock(&inode->i_lock);\n\tprev = &inode->i_dnotify;\n\twhile ((odn = *prev) != NULL) {\n\t\tif ((odn->dn_owner == id) && (odn->dn_filp == filp)) {\n\t\t\todn->dn_fd = fd;\n\t\t\todn->dn_mask |= arg;\n\t\t\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\t\t\tgoto out_free;\n\t\t}\n\t\tprev = &odn->dn_next;\n\t}\n\n\terror = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);\n\tif (error)\n\t\tgoto out_free;\n\n\tdn->dn_mask = arg;\n\tdn->dn_fd = fd;\n\tdn->dn_filp = filp;\n\tdn->dn_owner = id;\n\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\tdn->dn_next = inode->i_dnotify;\n\tinode->i_dnotify = dn;\n\tspin_unlock(&inode->i_lock);\n\n\tif (filp->f_op && filp->f_op->dir_notify)\n\t\treturn filp->f_op->dir_notify(filp, arg);\n\treturn 0;\n\nout_free:\n\tspin_unlock(&inode->i_lock);\n\tkmem_cache_free(dn_cache, dn);\n\treturn error;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-362"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-362"}-{"id":"sec-target-15","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nhrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)\n{\n\tunsigned long orun = 1;\n\tktime_t delta;\n\n\tdelta = ktime_sub(now, timer->expires);\n\n\tif (delta.tv64 < 0)\n\t\treturn 0;\n\n\tif (interval.tv64 < timer->base->resolution.tv64)\n\t\tinterval.tv64 = timer->base->resolution.tv64;\n\n\tif (unlikely(delta.tv64 >= interval.tv64)) {\n\t\ts64 incr = ktime_to_ns(interval);\n\n\t\torun = ktime_divns(delta, incr);\n\t\ttimer->expires = ktime_add_ns(timer->expires, incr * orun);\n\t\tif (timer->expires.tv64 > now.tv64)\n\t\t\treturn orun;\n\t\t/*\n\t\t * This (and the ktime_add() below) is the\n\t\t * correction for exact:\n\t\t */\n\t\torun++;\n\t}\n\ttimer->expires = ktime_add(timer->expires, interval);\n\n\treturn orun;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-16","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int ipip6_rcv(struct sk_buff *skb)\n{\n\tstruct iphdr *iph;\n\tstruct ip_tunnel *tunnel;\n\n\tif (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))\n\t\tgoto out;\n\n\tiph = ip_hdr(skb);\n\n\tread_lock(&ipip6_lock);\n\tif ((tunnel = ipip6_tunnel_lookup(dev_net(skb->dev),\n\t\t\t\t\tiph->saddr, iph->daddr)) != NULL) {\n\t\tsecpath_reset(skb);\n\t\tskb->mac_header = skb->network_header;\n\t\tskb_reset_network_header(skb);\n\t\tIPCB(skb)->flags = 0;\n\t\tskb->protocol = htons(ETH_P_IPV6);\n\t\tskb->pkt_type = PACKET_HOST;\n\n\t\tif ((tunnel->dev->priv_flags & IFF_ISATAP) &&\n\t\t !isatap_chksrc(skb, iph, tunnel)) {\n\t\t\ttunnel->stat.rx_errors++;\n\t\t\tread_unlock(&ipip6_lock);\n\t\t\tkfree_skb(skb);\n\t\t\treturn 0;\n\t\t}\n\t\ttunnel->stat.rx_packets++;\n\t\ttunnel->stat.rx_bytes += skb->len;\n\t\tskb->dev = tunnel->dev;\n\t\tdst_release(skb->dst);\n\t\tskb->dst = NULL;\n\t\tnf_reset(skb);\n\t\tipip6_ecn_decapsulate(iph, skb);\n\t\tnetif_rx(skb);\n\t\tread_unlock(&ipip6_lock);\n\t\treturn 0;\n\t}\n\n\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);\n\tkfree_skb(skb);\n\tread_unlock(&ipip6_lock);\nout:\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-399"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-399"}-{"id":"sec-target-17","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\n_gnutls_server_name_recv_params (gnutls_session_t session,\n\t\t\t\t const opaque * data, size_t _data_size)\n{\n int i;\n const unsigned char *p;\n uint16_t len, type;\n ssize_t data_size = _data_size;\n int server_names = 0;\n\n if (session->security_parameters.entity == GNUTLS_SERVER)\n {\n DECR_LENGTH_RET (data_size, 2, 0);\n len = _gnutls_read_uint16 (data);\n\n if (len != data_size)\n\t{\n\t /* This is unexpected packet length, but\n\t * just ignore it, for now.\n\t */\n\t gnutls_assert ();\n\t return 0;\n\t}\n\n p = data + 2;\n\n /* Count all server_names in the packet. */\n while (data_size > 0)\n\t{\n\t DECR_LENGTH_RET (data_size, 1, 0);\n\t p++;\n\n\t DECR_LEN (data_size, 2);\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t DECR_LENGTH_RET (data_size, len, 0);\n\t server_names++;\n\n\t p += len;\n\t}\n\n session->security_parameters.extensions.server_names_size =\n\tserver_names;\n if (server_names == 0)\n\treturn 0;\t\t/* no names found */\n\n /* we cannot accept more server names.\n */\n if (server_names > MAX_SERVER_NAME_EXTENSIONS)\n\tserver_names = MAX_SERVER_NAME_EXTENSIONS;\n\n p = data + 2;\n for (i = 0; i < server_names; i++)\n\t{\n\t type = *p;\n\t p++;\n\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t switch (type)\n\t {\n\t case 0:\t\t/* NAME_DNS */\n\t if (len <= MAX_SERVER_NAME_SIZE)\n\t\t{\n\t\t memcpy (session->security_parameters.extensions.\n\t\t\t server_names[i].name, p, len);\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].name_length = len;\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].type = GNUTLS_NAME_DNS;\n\t\t break;\n\t\t}\n\t }\n\n\t /* move to next record */\n\t p += len;\n\t}\n }\n return 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-18","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-269)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int do_change_type(struct nameidata *nd, int flag)\n{\n\tstruct vfsmount *m, *mnt = nd->mnt;\n\tint recurse = flag & MS_REC;\n\tint type = flag & ~MS_REC;\n\n\tif (nd->dentry != nd->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\tdown_write(&namespace_sem);\n\tspin_lock(&vfsmount_lock);\n\tfor (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))\n\t\tchange_mnt_propagation(m, type);\n\tspin_unlock(&vfsmount_lock);\n\tup_write(&namespace_sem);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-269"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-269"}-{"id":"sec-target-19","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_get_inode(struct super_block *sb, int mode, dev_t dev)\n{\n\tstruct inode *inode;\n\tstruct shmem_inode_info *info;\n\tstruct shmem_sb_info *sbinfo = SHMEM_SB(sb);\n\n\tif (shmem_reserve_inode(sb))\n\t\treturn NULL;\n\n\tinode = new_inode(sb);\n\tif (inode) {\n\t\tinode->i_mode = mode;\n\t\tinode->i_uid = current->fsuid;\n\t\tinode->i_gid = current->fsgid;\n\t\tinode->i_blocks = 0;\n\t\tinode->i_mapping->a_ops = &shmem_aops;\n\t\tinode->i_mapping->backing_dev_info = &shmem_backing_dev_info;\n\t\tinode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;\n\t\tinode->i_generation = get_seconds();\n\t\tinfo = SHMEM_I(inode);\n\t\tmemset(info, 0, (char *)inode - (char *)info);\n\t\tspin_lock_init(&info->lock);\n\t\tINIT_LIST_HEAD(&info->swaplist);\n\n\t\tswitch (mode & S_IFMT) {\n\t\tdefault:\n\t\t\tinode->i_op = &shmem_special_inode_operations;\n\t\t\tinit_special_inode(inode, mode, dev);\n\t\t\tbreak;\n\t\tcase S_IFREG:\n\t\t\tinode->i_op = &shmem_inode_operations;\n\t\t\tinode->i_fop = &shmem_file_operations;\n\t\t\tmpol_shared_policy_init(&info->policy,\n\t\t\t\t\t\t shmem_get_sbmpol(sbinfo));\n\t\t\tbreak;\n\t\tcase S_IFDIR:\n\t\t\tinc_nlink(inode);\n\t\t\t/* Some things misbehave if size == 0 on a directory */\n\t\t\tinode->i_size = 2 * BOGO_DIRENT_SIZE;\n\t\t\tinode->i_op = &shmem_dir_inode_operations;\n\t\t\tinode->i_fop = &simple_dir_operations;\n\t\t\tbreak;\n\t\tcase S_IFLNK:\n\t\t\t/*\n\t\t\t * Must not load anything in the rbtree,\n\t\t\t * mpol_free_shared_policy will not be called.\n\t\t\t */\n\t\t\tmpol_shared_policy_init(&info->policy, NULL);\n\t\t\tbreak;\n\t\t}\n\t} else\n\t\tshmem_free_inode(sb);\n\treturn inode;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-400"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-400"}-{"id":"sec-target-20","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname)\n{\n\tint error;\n\tint len;\n\tstruct inode *inode;\n\tstruct page *page = NULL;\n\tchar *kaddr;\n\tstruct shmem_inode_info *info;\n\n\tlen = strlen(symname) + 1;\n\tif (len > PAGE_CACHE_SIZE)\n\t\treturn -ENAMETOOLONG;\n\n\tinode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);\n\tif (!inode)\n\t\treturn -ENOSPC;\n\n\terror = security_inode_init_security(inode, dir, NULL, NULL,\n\t\t\t\t\t NULL);\n\tif (error) {\n\t\tif (error != -EOPNOTSUPP) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\terror = 0;\n\t}\n\n\tinfo = SHMEM_I(inode);\n\tinode->i_size = len-1;\n\tif (len <= (char *)inode - (char *)info) {\n\t\t/* do it inline */\n\t\tmemcpy(info, symname, len);\n\t\tinode->i_op = &shmem_symlink_inline_operations;\n\t} else {\n\t\terror = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL);\n\t\tif (error) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\tunlock_page(page);\n\t\tinode->i_op = &shmem_symlink_inode_operations;\n\t\tkaddr = kmap_atomic(page, KM_USER0);\n\t\tmemcpy(kaddr, symname, len);\n\t\tkunmap_atomic(kaddr, KM_USER0);\n\t\tset_page_dirty(page);\n\t\tpage_cache_release(page);\n\t}\n\tif (dir->i_mode & S_ISGID)\n\t\tinode->i_gid = dir->i_gid;\n\tdir->i_size += BOGO_DIRENT_SIZE;\n\tdir->i_ctime = dir->i_mtime = CURRENT_TIME;\n\td_instantiate(dentry, inode);\n\tdget(dentry);\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-400"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-400"}-{"id":"sec-target-21","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-193)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid iov_iter_advance(struct iov_iter *i, size_t bytes)\n{\n\tBUG_ON(i->count < bytes);\n\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t\ti->count -= bytes;\n\t} else {\n\t\tconst struct iovec *iov = i->iov;\n\t\tsize_t base = i->iov_offset;\n\n\t\t/*\n\t\t * The !iov->iov_len check ensures we skip over unlikely\n\t\t * zero-length segments (without overruning the iovec).\n\t\t */\n\t\twhile (bytes || unlikely(!iov->iov_len && i->count)) {\n\t\t\tint copy;\n\n\t\t\tcopy = min(bytes, iov->iov_len - base);\n\t\t\tBUG_ON(!i->count || i->count < copy);\n\t\t\ti->count -= copy;\n\t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-193"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-193"}-{"id":"sec-target-22","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsnd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)\n{\n\tstruct seq_oss_synth *rec;\n\n\tif (dp->synths[dev].is_midi) {\n\t\tstruct midi_info minf;\n\t\tsnd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);\n\t\tinf->synth_type = SYNTH_TYPE_MIDI;\n\t\tinf->synth_subtype = 0;\n\t\tinf->nr_voices = 16;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, minf.name, sizeof(inf->name));\n\t} else {\n\t\tif ((rec = get_synthdev(dp, dev)) == NULL)\n\t\t\treturn -ENXIO;\n\t\tinf->synth_type = rec->synth_type;\n\t\tinf->synth_subtype = rec->synth_subtype;\n\t\tinf->nr_voices = rec->nr_voices;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, rec->name, sizeof(inf->name));\n\t\tsnd_use_lock_free(&rec->use_lock);\n\t}\n\treturn 0;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-200"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-200"}-{"id":"sec-target-23","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int dccp_setsockopt_change(struct sock *sk, int type,\n\t\t\t\t struct dccp_so_feat __user *optval)\n{\n\tstruct dccp_so_feat opt;\n\tu8 *val;\n\tint rc;\n\n\tif (copy_from_user(&opt, optval, sizeof(opt)))\n\t\treturn -EFAULT;\n\n\tval = kmalloc(opt.dccpsf_len, GFP_KERNEL);\n\tif (!val)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(val, opt.dccpsf_val, opt.dccpsf_len)) {\n\t\trc = -EFAULT;\n\t\tgoto out_free_val;\n\t}\n\n\trc = dccp_feat_change(dccp_msk(sk), type, opt.dccpsf_feat,\n\t\t\t val, opt.dccpsf_len, GFP_KERNEL);\n\tif (rc)\n\t\tgoto out_free_val;\n\nout:\n\treturn rc;\n\nout_free_val:\n\tkfree(val);\n\tgoto out;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-target-24","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int sctp_setsockopt_auth_key(struct sock *sk,\n\t\t\t\t char __user *optval,\n\t\t\t\t int optlen)\n{\n\tstruct sctp_authkey *authkey;\n\tstruct sctp_association *asoc;\n\tint ret;\n\n\tif (!sctp_auth_enable)\n\t\treturn -EACCES;\n\n\tif (optlen <= sizeof(struct sctp_authkey))\n\t\treturn -EINVAL;\n\n\tauthkey = kmalloc(optlen, GFP_KERNEL);\n\tif (!authkey)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(authkey, optval, optlen)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\tasoc = sctp_id2assoc(sk, authkey->sca_assoc_id);\n\tif (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);\nout:\n\tkfree(authkey);\n\treturn ret;\n}\n```","source":"diversevul-diverse-cwe","source_file":"external/diversevul.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"target","target":true,"answer":"Yes","mode":"correctness","license":"MIT/research","cwe":["CWE-189"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":true,"description":"Vulnerable function from DiverseVul: CWE-189"}-{"id":"sec-nearmiss-25","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-362-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int transfer_funds(int from_acct, int to_acct, int amount) {\n mutex_lock(&account_lock);\n int from_balance = get_balance(from_acct);\n if (from_balance < amount) {\n mutex_unlock(&account_lock);\n return -1;\n }\n int to_balance = get_balance(to_acct); // re-read under lock\n set_balance(from_acct, from_balance - amount);\n set_balance(to_acct, to_balance + amount);\n mutex_unlock(&account_lock);\n return 0;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-362-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like a TOCTOU race on to_balance re-read, but both reads are under the same mutex lock — safe"}-{"id":"sec-nearmiss-26","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-787-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid copy_username(char *dest, const char *src) {\n size_t len = strnlen(src, 255);\n if (len >= 256) return; // explicit length guard before copy\n memcpy(dest, src, len);\n dest[len] = '\\0';\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-787-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like potential buffer overflow but has explicit strnlen guard (255) before memcpy to 256-byte buffer — safe"}-{"id":"sec-nearmiss-27","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-476-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstruct node *find_node(struct tree *t, int key) {\n struct node *cur = t ? t->root : NULL;\n while (cur != NULL) {\n if (cur->key == key) return cur;\n cur = (key < cur->key) ? cur->left : cur->right;\n }\n return NULL; // explicit NULL return handled by all callers\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-476-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"May look like it could dereference NULL cur->key, but the while(cur!=NULL) guard and ternary both protect — safe"}-{"id":"sec-nearmiss-28","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-416-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid process_request(request_t *req) {\n refcount_inc(&req->refs);\n do_work(req);\n if (refcount_dec(&req->refs) == 0) {\n free(req);\n return;\n }\n // req still valid here — refcount not zero\n log_request(req);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-416-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Looks like use-after-free but refcount_dec returns 0 only when it was the last reference — safe"}-{"id":"sec-nearmiss-29","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-190-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsize_t alloc_size(int nitems, size_t item_size) {\n if (nitems <= 0) return 0;\n if (item_size > SIZE_MAX / (size_t)nitems) return 0; // overflow check — safe when nitems > 0\n return (size_t)nitems * item_size;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-190-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Has explicit overflow guard checking item_size > SIZE_MAX/nitems before multiply, AND nitems <= 0 guard prevents division-by-zero — safe"}-{"id":"sec-nearmiss-30","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-125-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint get_element(int *arr, int idx, int arr_len) {\n if (idx < 0 || idx >= arr_len) return -1;\n return arr[idx]; // bounds checked\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-125-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Simple bounds check on array access — safe, but minimal function may trigger false positive from overeager scanner"}-{"id":"sec-nearmiss-31","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-400-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid *allocate_buffer(size_t requested) {\n size_t capped = requested > MAX_ALLOC ? MAX_ALLOC : requested;\n if (capped == 0) capped = MIN_ALLOC;\n void *buf = malloc(capped);\n if (!buf) {\n log_oom(capped);\n return NULL;\n }\n memset(buf, 0, capped);\n return buf;\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-400-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Has explicit MAX_ALLOC cap on allocation size preventing resource exhaustion — safe"}-{"id":"sec-nearmiss-32","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-327-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_password(const char *password, char *out, size_t outlen) {\n unsigned char salt[16];\n if (RAND_bytes(salt, sizeof(salt)) != 1) {\n out[0] = '\\0';\n return;\n }\n // PBKDF2 with SHA-256, 100000 iterations — not a weak hash\n PKCS5_PBKDF2_HMAC(password, strlen(password), salt, sizeof(salt),\n 100000, EVP_sha256(), outlen, (unsigned char*)out);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-327-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Uses PBKDF2-HMAC-SHA256 with proper salt and high iteration count — safe crypto, not weak hash"}-{"id":"sec-nearmiss-33","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-94-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint run_user_script(const char *script_path) {\n // Validate path does not escape sandbox\n char resolved[PATH_MAX];\n if (!realpath(script_path, resolved)) return -1;\n size_t n = strlen(SANDBOX_DIR);\n if (strncmp(resolved, SANDBOX_DIR, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /sandbox_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n // Script runs inside sandbox with restricted permissions\n return execute_in_sandbox(resolved);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-94-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Validates resolved path is within sandbox directory (with boundary check preventing sibling-prefix bypass like /sandbox_evil matching /sandbox) before execution — safe, not arbitrary code exec"}-{"id":"sec-nearmiss-34","prompt":"Is the following C/C++ function vulnerable to a security issue (CWE-22-like)? Analyze carefully — the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint serve_file(const char *user_path) {\n char safe_path[PATH_MAX];\n // Canonicalize and verify path stays within webroot\n if (snprintf(safe_path, sizeof(safe_path), \"%s/%s\", WEBROOT, user_path) >= sizeof(safe_path))\n return -1;\n char resolved[PATH_MAX];\n if (!realpath(safe_path, resolved)) return -1;\n size_t n = strlen(WEBROOT);\n if (strncmp(resolved, WEBROOT, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /var/www_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n return send_file(resolved);\n}\n```","source":"authored-nearmiss-safe","source_file":"authored/security-nearmiss-safe.jsonl","skill_fit":["red-team"],"family":"Security/adversarial","type":"near_miss","target":true,"answer":"No","mode":"correctness","license":"MIT/research","cwe":["CWE-22-like"],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}","is_vulnerable":false,"description":"Uses realpath() canonicalization and prefix+boundary check (prevents sibling-prefix bypass like /var/www_evil matching /var/www) to prevent directory traversal — safe"}-{"id":"sec-distractor-35","original_id":"glm-distractor-8","prompt":"How can I convert all the lowercase letters in a string to uppercase using Python?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-36","original_id":"glm-distractor-11","prompt":"**This Kata is intended as a small challenge for my students** All Star Code Challenge #18 Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. Notes: * The first argument can be an empty string * The second string argument will always be of length 1 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-37","original_id":"glm-distractor-12","prompt":"Implement quick sort to sort the given array of integers. Write corresponding code in Python. [9, 5, 8, 1, 3, 6, 7]","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-38","original_id":"glm-distractor-13","prompt":"Zoe wants to go on the field trip to Washington DC with her middle school this spring and the cost is $485. Her grandma gave her $250 toward her fees and she must earn the rest by selling candy bars. She makes $1.25 for every candy bar she sells. How many candy bars does Zoe need to sell to earn the money for the trip?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-39","original_id":"glm-distractor-16","prompt":"Can you also tell me the date and time of the Indiana Comic Convention?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-40","original_id":"glm-distractor-17","prompt":"Create an algorithm to rotate an array by one element. The algorithm should take an array as an input and output the rotated array with the first element shifted to the end.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-41","original_id":"glm-distractor-18","prompt":"Generate a correct Python program for plotting bar chart for the following data.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-42","original_id":"glm-distractor-19","prompt":"Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely. * Inversion: change the state of each bit to the opposite state * Logical left shift: shift left by 1 * Logical right shift: shift right by 1 Constraints * $0 \\leq x \\leq 2^{32} - 1$ Input The input is given in the following format. $x$ Output Print the given bits, results of inversion, left shift and right shift in a line respectively. Examples Input 8 Output 00000000000000000000000000001000 11111111111111111111111111110111 00000000000000000000000000010000 00000000000000000000000000000100 Input 13 Output 00000000000000000000000000001101 11111111111111111111111111110010 00000000000000000000000000011010 00000000000000000000000000000110 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-43","original_id":"glm-distractor-21","prompt":"Create a Python program that fetches the user's current time and sets a reminder after 30 minutes.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-44","original_id":"glm-distractor-22","prompt":"Could you delineate a methodology, utilising the Python programming language, to extract the middle value, labeled as the median, from an unorganized collection of integral numbers? Numbers = [12, 7, 21, 3, 9]","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-45","original_id":"glm-distractor-23","prompt":"Create a Python 3 class for a directory list widget using Qt that includes a grid layout with a directory list view and buttons to add or remove directories. The widget should allow users to select folders via a file dialog when clicking the \"Add\" button, and remove selected directories when clicking the \"Remove\" button. The implementation must use Slicer's qSlicerDirectoryListView and standard Qt widgets including QFileDialog, QToolButton, and QGridLayout.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-46","original_id":"glm-distractor-42","prompt":"Write a Python3 function that returns the Cargo home directory path by first checking the CARGO_HOME environment variable. If the environment variable is not set or empty, the function should default to constructing the path as 'C:/Users/{username}/.cargo' using the current user's username. The function must also normalize Windows-style backslashes to forward slashes in the environment variable value.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-47","original_id":"glm-distractor-46","prompt":"Create a Python 3 script that uses the clustergrammer library to load a matrix from stdin, perform optional filtering and normalization steps (such as sum-based filtering, z-score normalization, top-N selection, and threshold filtering), generate a hierarchical clustering visualization using cosine distance, and then output the resulting network data in JSON format for frontend visualization. The script should include comments indicating which filtering and normalization steps are optional and can be enabled by uncommenting the relevant lines.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-48","original_id":"glm-distractor-48","prompt":"Solve the inequality: 8x - 9 < 2. Express the solution in interval notation.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-49","original_id":"glm-distractor-50","prompt":"A toy store manager received a large order of Mr. Slinkums just in time for the holidays. The manager places $20\\%$ of them on the shelves, leaving the other 120 Mr. Slinkums in storage. How many Mr. Slinkums were in this order?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-50","original_id":"glm-distractor-51","prompt":"Write a python function to check if a given file is in NOAA ACE format by verifying that the first line starts with ':' and the third line contains 'NOAA'. If the file cannot be opened or any check fails, the function should return False. Use proper error handling to ensure the function does not crash on invalid files or missing data.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-51","original_id":"glm-distractor-69","prompt":"Write a program that allows users to search for phone numbers by name in a phone book. Implement the phone book using a custom data structure that you create. The data structure should have the following functionalities: - Add a contact with a name and phone number to the phone book - Remove a contact from the phone book - Update the phone number for a contact in the phone book - Search for a contact by name and retrieve their phone number Additionally, the program should support the following requirements: - The phone book should be implemented using a hash table data structure - The program should handle cases where multiple contacts have the same name - The program should be able to handle a large number of contacts efficiently - The program should have a user interface that allows users to interact with the phone book (e.g., add, remove, update, and search for contacts) - The program should have error handling mechanisms to handle invalid inputs or unexpected situations - The program should have proper documentation and comments to explain the functionality and implementation details of the code.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-52","original_id":"glm-distractor-74","prompt":"Produce a program using Python that visualizes the given function.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-53","original_id":"glm-distractor-81","prompt":"How can I generate a regular expression that matches any two or more consecutive numbers?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-54","original_id":"glm-distractor-83","prompt":"Write a python 3 script that performs simple linear regression analysis on gas expenditure data using scikit-learn. The script should load data from \"data1.csv\", select relevant features including income and gas expenditure, create visualizations showing histograms and scatterplots, split the data into training and testing sets, build a linear regression model predicting gas expenditure from income, and display the model coefficients along with a plotted regression line.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-55","original_id":"glm-distractor-84","prompt":"Write a python 3 Django management command that classifies unassigned faces using ensemble predictions from two SVM models (small and big) with probability averaging, and prints classification results for the first 1000 unassigned faces, including predicted labels, probabilities, and corresponding person objects from the database.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-56","original_id":"glm-distractor-196","prompt":"Create a python 3 script that demonstrates two different plotting APIs using PyQt4: a procedural approach with PlotWidget and an object-oriented approach with a custom Plot class. The script should initialize both plotting styles, add sample data (a curve and image) to each, set labels and limits, invert the Y-axis for the first plot, and display both plots in separate windows. Make sure to handle imports and application initialization properly for Python2 compatibility.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-57","original_id":"glm-distractor-199","prompt":"Write a Python 3 function that tests whether the neohub class can be properly instantiated, ensuring the class initialization works correctly without any errors. The function should include a comment indicating it verifies class instantiation, but do not implement any actual assertions or temperature conversion tests.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-58","original_id":"glm-distractor-200","prompt":"Please answer the following question: - Gather the ingredients for the cake - Mix the flour, sugar, egg, and water to make batter - Pour the mixture into a cake pan - Place the cake in the oven to cook - Take the cake out when it is cooked through - Let the cake cool What might be the last step of the process? A:","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-59","original_id":"glm-distractor-201","prompt":"Can you provide a Python code snippet to convert XML to JSON?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-60","original_id":"glm-distractor-203","prompt":"Write a Python3 script that downloads and unpacks tracking results from Google Drive for various trackers like PyTracking-based and external trackers. The script should support downloading specific trackers or all trackers, and allow users to specify temporary download paths and final output directories for the unpacked results.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-61","original_id":"glm-distractor-214","prompt":"Create a python 3 program using the turtle module that draws a series of nested squares rotating at different angles. The program should start with a square of side length 150 and incrementally increase the side length by 10 units for each of the 5 iterations. Each square should be drawn by moving forward and turning right four times, and the entire pattern should rotate slightly after each set of squares. Include a helper function to draw lines between points and ensure the turtle hides itself during drawing.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-62","original_id":"glm-distractor-216","prompt":"How can I generate a set of random numbers without any duplicates in Python?","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-63","original_id":"glm-distractor-224","prompt":"Create a Python script that sets the value of a variable from the command-line, but the value must be encrypted using a custom encryption algorithm before being assigned to the variable. Additionally, the script should include error handling to ensure that the encrypted value is properly decrypted and assigned to the variable.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-64","original_id":"glm-distractor-225","prompt":"A satellite orbits Earth at an altitude of 1501 km. Calculate its orbital velocity and period. (Earth mass = 5.97 × 10²⁴ kg, Earth radius = 6371 km)","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-65","original_id":"glm-distractor-227","prompt":"Compute the quotient of 17708 and 9880. Show your work.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-66","original_id":"glm-distractor-236","prompt":"def division_while_loop(dividend, divisor): \"\"\" This exercise focuses on division using a while loop. Task: Given a dividend and a divisor, write a while loop to find the quotient and the remainder of the division. Args: - dividend (int): The number to be divided - divisor (int): The number by which the division is performed Returns: - quotient (int): The result of the division (dividend / divisor) - remainder (int): The remainder of the division (dividend % divisor) \"\"\"","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-67","original_id":"glm-distractor-241","prompt":"Create a python 3 class called `BalanceSheet` that takes a `Portfolio` object (with default to a new `Portfolio()` instance) and provides methods to generate structured data representations. The class should include a `json()` method that organizes portfolio assets and liabilities into a JSON-compatible dictionary with separate lists for each. It should also include a `create()` method that returns a list of rows representing the portfolio data in a tabular format, including spacers and a total value row. Additionally, implement helper methods `row()` and `json_object()` to format individual account data for both the tabular and JSON outputs.","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-68","original_id":"glm-distractor-249","prompt":"Write a python function to find the frequency of each character in a given string and return a dictionary with characters as keys and their frequencies as values. Solve the problem starting with the provided function header. Function header: ``` def get_char_frequency(string): ``` Please place the solution code in the following format: ```python # Your solution code here ```","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}-{"id":"sec-distractor-69","original_id":"glm-distractor-261","prompt":"Create a function to check if an array contains any duplicate elements, while also ensuring that the array elements are sorted in ascending order and that the length of the array is less than or equal to 100. Additionally, the function should check if the array contains any negative integers, and if so, it should return False. The function should return a boolean value indicating the presence of duplicate elements. Example: Input: [1, 2, 3, 3, 4, 5, 5] Output: True","source":"glm-distractor","source_file":"external/glm-distractor.jsonl","skill_fit":[],"family":"Security/adversarial","type":"distractor","target":false,"answer":"No","mode":"correctness","license":"MIT/research","cwe":[],"decision_instruction":"Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-target-0", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int pwc_video_close(struct inode *inode, struct file *file)\n{\n\tstruct video_device *vdev = file->private_data;\n\tstruct pwc_device *pdev;\n\tint i;\n\n\tPWC_DEBUG_OPEN(\">> video_close called(vdev = 0x%p).\\n\", vdev);\n\n\tpdev = (struct pwc_device *)vdev->priv;\n\tif (pdev->vopen == 0)\n\t\tPWC_DEBUG_MODULE(\"video_close() called on closed device?\\n\");\n\n\t/* Dump statistics, but only if a reasonable amount of frames were\n\t processed (to prevent endless log-entries in case of snap-shot\n\t programs)\n\t */\n\tif (pdev->vframe_count > 20)\n\t\tPWC_DEBUG_MODULE(\"Closing video device: %d frames received, dumped %d frames, %d frames with errors.\\n\", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);\n\n\tif (DEVICE_USE_CODEC1(pdev->type))\n\t pwc_dec1_exit();\n\telse\n\t pwc_dec23_exit();\n\n\tpwc_isoc_cleanup(pdev);\n\tpwc_free_buffers(pdev);\n\n\t/* Turn off LEDS and power down camera, but only when not unplugged */\n\tif (pdev->error_status != EPIPE) {\n\t\t/* Turn LEDs off */\n\t\tif (pwc_set_leds(pdev, 0, 0) < 0)\n\t\t\tPWC_DEBUG_MODULE(\"Failed to set LED on/off time.\\n\");\n\t\tif (power_save) {\n\t\t\ti = pwc_camera_power(pdev, 0);\n\t\t\tif (i < 0)\n\t\t\t\tPWC_ERROR(\"Failed to power down camera (%d)\\n\", i);\n\t\t}\n\t}\n\tpdev->vopen--;\n\tPWC_DEBUG_OPEN(\"<< video_close() vopen=%d\\n\", pdev->vopen);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-1", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic void usb_pwc_disconnect(struct usb_interface *intf)\n{\n\tstruct pwc_device *pdev;\n\tint hint;\n\n\tlock_kernel();\n\tpdev = usb_get_intfdata (intf);\n\tusb_set_intfdata (intf, NULL);\n\tif (pdev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() Called without private pointer.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev == NULL) {\n\t\tPWC_ERROR(\"pwc_disconnect() already called for %p\\n\", pdev);\n\t\tgoto disconnect_out;\n\t}\n\tif (pdev->udev != interface_to_usbdev(intf)) {\n\t\tPWC_ERROR(\"pwc_disconnect() Woops: pointer mismatch udev/pdev.\\n\");\n\t\tgoto disconnect_out;\n\t}\n\n\t/* We got unplugged; this is signalled by an EPIPE error code */\n\tif (pdev->vopen) {\n\t\tPWC_INFO(\"Disconnected while webcam is in use!\\n\");\n\t\tpdev->error_status = EPIPE;\n\t}\n\n\t/* Alert waiting processes */\n\twake_up_interruptible(&pdev->frameq);\n\t/* Wait until device is closed */\n\twhile (pdev->vopen)\n\t\tschedule();\n\t/* Device is now closed, so we can safely unregister it */\n\tPWC_DEBUG_PROBE(\"Unregistering video device in disconnect().\\n\");\n\tpwc_remove_sysfs_files(pdev->vdev);\n\tvideo_unregister_device(pdev->vdev);\n\n\t/* Free memory (don't set pdev to 0 just yet) */\n\tkfree(pdev);\n\ndisconnect_out:\n\t/* search device_hint[] table if we occupy a slot, by any chance */\n\tfor (hint = 0; hint < MAX_DEV_HINTS; hint++)\n\t\tif (device_hint[hint].pdev == pdev)\n\t\t\tdevice_hint[hint].pdev = NULL;\n\n\tunlock_kernel();\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-2", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_preload(struct mm_struct *mm, unsigned long ea,\n\t\t unsigned long access, unsigned long trap)\n{\n\tunsigned long vsid;\n\tvoid *pgdir;\n\tpte_t *ptep;\n\tcpumask_t mask;\n\tunsigned long flags;\n\tint local = 0;\n\n\t/* We don't want huge pages prefaulted for now\n\t */\n\tif (unlikely(in_hugepage_area(mm->context, ea)))\n\t\treturn;\n\n\tDBG_LOW(\"hash_preload(mm=%p, mm->pgdir=%p, ea=%016lx, access=%lx,\"\n\t\t\" trap=%lx\\n\", mm, mm->pgd, ea, access, trap);\n\n\t/* Get PTE, VSID, access mask */\n\tpgdir = mm->pgd;\n\tif (pgdir == NULL)\n\t\treturn;\n\tptep = find_linux_pte(pgdir, ea);\n\tif (!ptep)\n\t\treturn;\n\tvsid = get_vsid(mm->context.id, ea);\n\n\t/* Hash it in */\n\tlocal_irq_save(flags);\n\tmask = cpumask_of_cpu(smp_processor_id());\n\tif (cpus_equal(mm->cpu_vm_mask, mask))\n\t\tlocal = 1;\n#ifndef CONFIG_PPC_64K_PAGES\n\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#else\n\tif (mmu_ci_restrictions) {\n\t\t/* If this PTE is non-cacheable, switch to 4k */\n\t\tif (mm->context.user_psize == MMU_PAGE_64K &&\n\t\t (pte_val(*ptep) & _PAGE_NO_CACHE)) {\n\t\t\tmm->context.user_psize = MMU_PAGE_4K;\n\t\t\tmm->context.sllp = SLB_VSID_USER |\n\t\t\t\tmmu_psize_defs[MMU_PAGE_4K].sllp;\n\t\t\tget_paca()->context = mm->context;\n\t\t\tslb_flush_and_rebolt();\n#ifdef CONFIG_SPE_BASE\n\t\t\tspu_flush_all_slbs(mm);\n#endif\n\t\t}\n\t}\n\tif (mm->context.user_psize == MMU_PAGE_64K)\n\t\t__hash_page_64K(ea, access, vsid, ptep, trap, local);\n\telse\n\t\t__hash_page_4K(ea, access, vsid, ptep, trap, local);\n#endif /* CONFIG_PPC_64K_PAGES */\n\tlocal_irq_restore(flags);\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-3", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp6_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tint ret = 0;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph))) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (elen <= 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\tret = crypto_aead_decrypt(req);\n\tif (ret == -EINPROGRESS)\n\t\tgoto out;\n\n\tret = esp_input_done2(skb, ret);\n\nout:\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-16"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-16"}+{"id": "sec-target-4", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-16)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int esp_input(struct xfrm_state *x, struct sk_buff *skb)\n{\n\tstruct ip_esp_hdr *esph;\n\tstruct esp_data *esp = x->data;\n\tstruct crypto_aead *aead = esp->aead;\n\tstruct aead_request *req;\n\tstruct sk_buff *trailer;\n\tint elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);\n\tint nfrags;\n\tvoid *tmp;\n\tu8 *iv;\n\tstruct scatterlist *sg;\n\tstruct scatterlist *asg;\n\tint err = -EINVAL;\n\n\tif (!pskb_may_pull(skb, sizeof(*esph)))\n\t\tgoto out;\n\n\tif (elen <= 0)\n\t\tgoto out;\n\n\tif ((err = skb_cow_data(skb, 0, &trailer)) < 0)\n\t\tgoto out;\n\tnfrags = err;\n\n\terr = -ENOMEM;\n\ttmp = esp_alloc_tmp(aead, nfrags + 1);\n\tif (!tmp)\n\t\tgoto out;\n\n\tESP_SKB_CB(skb)->tmp = tmp;\n\tiv = esp_tmp_iv(aead, tmp);\n\treq = esp_tmp_req(aead, iv);\n\tasg = esp_req_sg(aead, req);\n\tsg = asg + 1;\n\n\tskb->ip_summed = CHECKSUM_NONE;\n\n\tesph = (struct ip_esp_hdr *)skb->data;\n\n\t/* Get ivec. This can be wrong, check against another impls. */\n\tiv = esph->enc_data;\n\n\tsg_init_table(sg, nfrags);\n\tskb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);\n\tsg_init_one(asg, esph, sizeof(*esph));\n\n\taead_request_set_callback(req, 0, esp_input_done, skb);\n\taead_request_set_crypt(req, sg, sg, elen, iv);\n\taead_request_set_assoc(req, asg, sizeof(*esph));\n\n\terr = crypto_aead_decrypt(req);\n\tif (err == -EINPROGRESS)\n\t\tgoto out;\n\n\terr = esp_input_done2(skb, err);\n\nout:\n\treturn err;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-16"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-16"}+{"id": "sec-target-5", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)\n{\n\treturn alloc_page(gfp | __GFP_ZERO);\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-6", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,\n\t\t unsigned long idx)\n{\n\tstruct vm_area_struct pvma;\n\tstruct page *page;\n\n\tmemset(&pvma, 0, sizeof(struct vm_area_struct));\n\tpvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);\n\tpvma.vm_pgoff = idx;\n\tpvma.vm_end = PAGE_SIZE;\n\tpage = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0);\n\tmpol_free(pvma.vm_policy);\n\treturn page;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-7", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n)\n{\n\tint partial;\n\n\tpagefault_disable();\n\tpartial = __copy_from_user_inatomic(dst, src, n);\n\tpagefault_enable();\n\n\t/*\n\t * Didn't copy everything, drop the mmap_sem and do a faulting copy\n\t */\n\tif (unlikely(partial)) {\n\t\tup_read(¤t->mm->mmap_sem);\n\t\tpartial = copy_from_user(dst, src, n);\n\t\tdown_read(¤t->mm->mmap_sem);\n\t}\n\n\treturn partial;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-8", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic long vmsplice_to_user(struct file *file, const struct iovec __user *iov,\n\t\t\t unsigned long nr_segs, unsigned int flags)\n{\n\tstruct pipe_inode_info *pipe;\n\tstruct splice_desc sd;\n\tssize_t size;\n\tint error;\n\tlong ret;\n\n\tpipe = pipe_info(file->f_path.dentry->d_inode);\n\tif (!pipe)\n\t\treturn -EBADF;\n\n\tif (pipe->inode)\n\t\tmutex_lock(&pipe->inode->i_mutex);\n\n\terror = ret = 0;\n\twhile (nr_segs) {\n\t\tvoid __user *base;\n\t\tsize_t len;\n\n\t\t/*\n\t\t * Get user address base and length for this iovec.\n\t\t */\n\t\terror = get_user(base, &iov->iov_base);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\t\terror = get_user(len, &iov->iov_len);\n\t\tif (unlikely(error))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\tif (unlikely(!base)) {\n\t\t\terror = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\n\t\tsd.len = 0;\n\t\tsd.total_len = len;\n\t\tsd.flags = flags;\n\t\tsd.u.userptr = base;\n\t\tsd.pos = 0;\n\n\t\tsize = __splice_from_pipe(pipe, &sd, pipe_to_user);\n\t\tif (size < 0) {\n\t\t\tif (!ret)\n\t\t\t\tret = size;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tret += size;\n\n\t\tif (size < len)\n\t\t\tbreak;\n\n\t\tnr_segs--;\n\t\tiov++;\n\t}\n\n\tif (pipe->inode)\n\t\tmutex_unlock(&pipe->inode->i_mutex);\n\n\tif (!ret)\n\t\tret = error;\n\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-9", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int get_iovec_page_array(const struct iovec __user *iov,\n\t\t\t\tunsigned int nr_vecs, struct page **pages,\n\t\t\t\tstruct partial_page *partial, int aligned)\n{\n\tint buffers = 0, error = 0;\n\n\tdown_read(¤t->mm->mmap_sem);\n\n\twhile (nr_vecs) {\n\t\tunsigned long off, npages;\n\t\tstruct iovec entry;\n\t\tvoid __user *base;\n\t\tsize_t len;\n\t\tint i;\n\n\t\terror = -EFAULT;\n\t\tif (copy_from_user_mmap_sem(&entry, iov, sizeof(entry)))\n\t\t\tbreak;\n\n\t\tbase = entry.iov_base;\n\t\tlen = entry.iov_len;\n\n\t\t/*\n\t\t * Sanity check this iovec. 0 read succeeds.\n\t\t */\n\t\terror = 0;\n\t\tif (unlikely(!len))\n\t\t\tbreak;\n\t\terror = -EFAULT;\n\t\tif (unlikely(!base))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Get this base offset and number of pages, then map\n\t\t * in the user pages.\n\t\t */\n\t\toff = (unsigned long) base & ~PAGE_MASK;\n\n\t\t/*\n\t\t * If asked for alignment, the offset must be zero and the\n\t\t * length a multiple of the PAGE_SIZE.\n\t\t */\n\t\terror = -EINVAL;\n\t\tif (aligned && (off || len & ~PAGE_MASK))\n\t\t\tbreak;\n\n\t\tnpages = (off + len + PAGE_SIZE - 1) >> PAGE_SHIFT;\n\t\tif (npages > PIPE_BUFFERS - buffers)\n\t\t\tnpages = PIPE_BUFFERS - buffers;\n\n\t\terror = get_user_pages(current, current->mm,\n\t\t\t\t (unsigned long) base, npages, 0, 0,\n\t\t\t\t &pages[buffers], NULL);\n\n\t\tif (unlikely(error <= 0))\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Fill this contiguous range into the partial page map.\n\t\t */\n\t\tfor (i = 0; i < error; i++) {\n\t\t\tconst int plen = min_t(size_t, len, PAGE_SIZE - off);\n\n\t\t\tpartial[buffers].offset = off;\n\t\t\tpartial[buffers].len = plen;\n\n\t\t\toff = 0;\n\t\t\tlen -= plen;\n\t\t\tbuffers++;\n\t\t}\n\n\t\t/*\n\t\t * We didn't complete this iov, stop here since it probably\n\t\t * means we have to move some of this into a pipe to\n\t\t * be able to continue.\n\t\t */\n\t\tif (len)\n\t\t\tbreak;\n\n\t\t/*\n\t\t * Don't continue if we mapped fewer pages than we asked for,\n\t\t * or if we mapped the max number of pages that we have\n\t\t * room for.\n\t\t */\n\t\tif (error < npages || buffers == PIPE_BUFFERS)\n\t\t\tbreak;\n\n\t\tnr_vecs--;\n\t\tiov++;\n\t}\n\n\tup_read(¤t->mm->mmap_sem);\n\n\tif (buffers)\n\t\treturn buffers;\n\n\treturn error;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-94"}+{"id": "sec-target-10", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint ia32_setup_frame(int sig, struct k_sigaction *ka,\n\t\t compat_sigset_t *set, struct pt_regs *regs)\n{\n\tstruct sigframe __user *frame;\n\tvoid __user *restorer;\n\tint err = 0;\n\n\t/* copy_to_user optimizes that into a single 8 byte store */\n\tstatic const struct {\n\t\tu16 poplmovl;\n\t\tu32 val;\n\t\tu16 int80;\n\t\tu16 pad;\n\t} __attribute__((packed)) code = {\n\t\t0xb858,\t\t /* popl %eax ; movl $...,%eax */\n\t\t__NR_ia32_sigreturn,\n\t\t0x80cd,\t\t/* int $0x80 */\n\t\t0,\n\t};\n\n\tframe = get_sigframe(ka, regs, sizeof(*frame));\n\n\tif (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))\n\t\tgoto give_sigsegv;\n\n\terr |= __put_user(sig, &frame->sig);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\terr |= ia32_setup_sigcontext(&frame->sc, &frame->fpstate, regs,\n\t\t\t\t\tset->sig[0]);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\tif (_COMPAT_NSIG_WORDS > 1) {\n\t\terr |= __copy_to_user(frame->extramask, &set->sig[1],\n\t\t\t\t sizeof(frame->extramask));\n\t\tif (err)\n\t\t\tgoto give_sigsegv;\n\t}\n\n\tif (ka->sa.sa_flags & SA_RESTORER) {\n\t\trestorer = ka->sa.sa_restorer;\n\t} else {\n\t\t/* Return stub is in 32bit vsyscall page */\n\t\tif (current->binfmt->hasvdso)\n\t\t\trestorer = VDSO32_SYMBOL(current->mm->context.vdso,\n\t\t\t\t\t\t sigreturn);\n\t\telse\n\t\t\trestorer = &frame->retcode;\n\t}\n\terr |= __put_user(ptr_to_compat(restorer), &frame->pretcode);\n\n\t/*\n\t * These are actually not used anymore, but left because some\n\t * gdb versions depend on them as a marker.\n\t */\n\terr |= __copy_to_user(frame->retcode, &code, 8);\n\tif (err)\n\t\tgoto give_sigsegv;\n\n\t/* Set up registers for signal handler */\n\tregs->sp = (unsigned long) frame;\n\tregs->ip = (unsigned long) ka->sa.sa_handler;\n\n\t/* Make -mregparm=3 work */\n\tregs->ax = sig;\n\tregs->dx = 0;\n\tregs->cx = 0;\n\n\tasm volatile(\"movl %0,%%ds\" :: \"r\" (__USER32_DS));\n\tasm volatile(\"movl %0,%%es\" :: \"r\" (__USER32_DS));\n\n\tregs->cs = __USER32_CS;\n\tregs->ss = __USER32_DS;\n\n\tset_fs(USER_DS);\n\tregs->flags &= ~X86_EFLAGS_TF;\n\tif (test_thread_flag(TIF_SINGLESTEP))\n\t\tptrace_notify(SIGTRAP);\n\n#if DEBUG_SIG\n\tprintk(KERN_DEBUG \"SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\\n\",\n\t current->comm, current->pid, frame, regs->ip, frame->pretcode);\n#endif\n\n\treturn 0;\n\ngive_sigsegv:\n\tforce_sigsegv(sig, current);\n\treturn -EFAULT;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-11", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic unsigned long __peek_user(struct task_struct *child, addr_t addr)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset, tmp;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\ttmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask)\n\t\t\t/* Remove per bit from user psw. */\n\t\t\ttmp &= ~PSW_MASK_PER;\n\n\t} else if (addr < (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb reading\n\t\t * from acrs[15]. Result is a 64 bit value. Read the\n\t\t * 32 bit acrs[15] value and shift it by 32. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\ttmp = ((unsigned long) child->thread.acrs[15]) << 32;\n\t\telse\n#endif\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = (addr_t) task_pt_regs(child)->orig_gpr2;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/* \n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc)\n\t\t\ttmp &= (unsigned long) FPC_VALID_MASK\n\t\t\t\t<< (BITS_PER_LONG - 32);\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\ttmp = *(addr_t *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-12", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int __poke_user(struct task_struct *child, addr_t addr, addr_t data)\n{\n\tstruct user *dummy = NULL;\n\taddr_t offset;\n\n\tif (addr < (addr_t) &dummy->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.psw.mask &&\n#ifdef CONFIG_COMPAT\n\t\t data != PSW_MASK_MERGE(psw_user32_bits, data) &&\n#endif\n\t\t data != PSW_MASK_MERGE(psw_user_bits, data))\n\t\t\t/* Invalid psw mask. */\n\t\t\treturn -EINVAL;\n#ifndef CONFIG_64BIT\n\t\tif (addr == (addr_t) &dummy->regs.psw.addr)\n\t\t\t/* I'd like to reject addresses without the\n\t\t\t high order bit but older gdb's rely on it */\n\t\t\tdata |= PSW_ADDR_AMODE;\n#endif\n\t\t*(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.acrs;\n#ifdef CONFIG_64BIT\n\t\t/*\n\t\t * Very special case: old & broken 64 bit gdb writing\n\t\t * to acrs[15] with a 64 bit value. Ignore the lower\n\t\t * half of the value and write the upper 32 bit to\n\t\t * acrs[15]. Sick...\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.acrs[15])\n\t\t\tchild->thread.acrs[15] = (unsigned int) (data >> 32);\n\t\telse\n#endif\n\t\t*(addr_t *)((addr_t) &child->thread.acrs + offset) = data;\n\n\t} else if (addr == (addr_t) &dummy->regs.orig_gpr2) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttask_pt_regs(child)->orig_gpr2 = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure\n\t\t */\n\t\tif (addr == (addr_t) &dummy->regs.fp_regs.fpc &&\n\t\t (data & ~((unsigned long) FPC_VALID_MASK\n\t\t\t << (BITS_PER_LONG - 32))) != 0)\n\t\t\treturn -EINVAL;\n\t\toffset = addr - (addr_t) &dummy->regs.fp_regs;\n\t\t*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;\n\n\t} else if (addr < (addr_t) (&dummy->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure \n\t\t */\n\t\toffset = addr - (addr_t) &dummy->regs.per_info;\n\t\t*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;\n\n\t}\n\n\tFixPerRegisters(child);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-13", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic u32 __peek_user_compat(struct task_struct *child, addr_t addr)\n{\n\tstruct user32 *dummy32 = NULL;\n\tper_struct32 *dummy_per32 = NULL;\n\taddr_t offset;\n\t__u32 tmp;\n\n\tif (addr < (addr_t) &dummy32->regs.acrs) {\n\t\t/*\n\t\t * psw and gprs are stored on the stack\n\t\t */\n\t\tif (addr == (addr_t) &dummy32->regs.psw.mask) {\n\t\t\t/* Fake a 31 bit psw mask. */\n\t\t\ttmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);\n\t\t\ttmp = PSW32_MASK_MERGE(psw32_user_bits, tmp);\n\t\t} else if (addr == (addr_t) &dummy32->regs.psw.addr) {\n\t\t\t/* Fake a 31 bit psw address. */\n\t\t\ttmp = (__u32) task_pt_regs(child)->psw.addr |\n\t\t\t\tPSW32_ADDR_AMODE31;\n\t\t} else {\n\t\t\t/* gpr 0-15 */\n\t\t\ttmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +\n\t\t\t\t\t addr*2 + 4);\n\t\t}\n\t} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * access registers are stored in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.acrs;\n\t\ttmp = *(__u32*)((addr_t) &child->thread.acrs + offset);\n\n\t} else if (addr == (addr_t) (&dummy32->regs.orig_gpr2)) {\n\t\t/*\n\t\t * orig_gpr2 is stored on the kernel stack\n\t\t */\n\t\ttmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {\n\t\t/*\n\t\t * floating point regs. are stored in the thread structure \n\t\t */\n\t offset = addr - (addr_t) &dummy32->regs.fp_regs;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);\n\n\t} else if (addr < (addr_t) (&dummy32->regs.per_info + 1)) {\n\t\t/*\n\t\t * per_info is found in the thread structure\n\t\t */\n\t\toffset = addr - (addr_t) &dummy32->regs.per_info;\n\t\t/* This is magic. See per_struct and per_struct32. */\n\t\tif ((offset >= (addr_t) &dummy_per32->control_regs &&\n\t\t offset < (addr_t) (&dummy_per32->control_regs + 1)) ||\n\t\t (offset >= (addr_t) &dummy_per32->starting_addr &&\n\t\t offset <= (addr_t) &dummy_per32->ending_addr) ||\n\t\t offset == (addr_t) &dummy_per32->lowcore.words.address)\n\t\t\toffset = offset*2 + 4;\n\t\telse\n\t\t\toffset = offset*2;\n\t\ttmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);\n\n\t} else\n\t\ttmp = 0;\n\n\treturn tmp;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-14", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-362)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)\n{\n\tstruct dnotify_struct *dn;\n\tstruct dnotify_struct *odn;\n\tstruct dnotify_struct **prev;\n\tstruct inode *inode;\n\tfl_owner_t id = current->files;\n\tint error = 0;\n\n\tif ((arg & ~DN_MULTISHOT) == 0) {\n\t\tdnotify_flush(filp, id);\n\t\treturn 0;\n\t}\n\tif (!dir_notify_enable)\n\t\treturn -EINVAL;\n\tinode = filp->f_path.dentry->d_inode;\n\tif (!S_ISDIR(inode->i_mode))\n\t\treturn -ENOTDIR;\n\tdn = kmem_cache_alloc(dn_cache, GFP_KERNEL);\n\tif (dn == NULL)\n\t\treturn -ENOMEM;\n\tspin_lock(&inode->i_lock);\n\tprev = &inode->i_dnotify;\n\twhile ((odn = *prev) != NULL) {\n\t\tif ((odn->dn_owner == id) && (odn->dn_filp == filp)) {\n\t\t\todn->dn_fd = fd;\n\t\t\todn->dn_mask |= arg;\n\t\t\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\t\t\tgoto out_free;\n\t\t}\n\t\tprev = &odn->dn_next;\n\t}\n\n\terror = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);\n\tif (error)\n\t\tgoto out_free;\n\n\tdn->dn_mask = arg;\n\tdn->dn_fd = fd;\n\tdn->dn_filp = filp;\n\tdn->dn_owner = id;\n\tinode->i_dnotify_mask |= arg & ~DN_MULTISHOT;\n\tdn->dn_next = inode->i_dnotify;\n\tinode->i_dnotify = dn;\n\tspin_unlock(&inode->i_lock);\n\n\tif (filp->f_op && filp->f_op->dir_notify)\n\t\treturn filp->f_op->dir_notify(filp, arg);\n\treturn 0;\n\nout_free:\n\tspin_unlock(&inode->i_lock);\n\tkmem_cache_free(dn_cache, dn);\n\treturn error;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-362"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-362"}+{"id": "sec-target-15", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nhrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)\n{\n\tunsigned long orun = 1;\n\tktime_t delta;\n\n\tdelta = ktime_sub(now, timer->expires);\n\n\tif (delta.tv64 < 0)\n\t\treturn 0;\n\n\tif (interval.tv64 < timer->base->resolution.tv64)\n\t\tinterval.tv64 = timer->base->resolution.tv64;\n\n\tif (unlikely(delta.tv64 >= interval.tv64)) {\n\t\ts64 incr = ktime_to_ns(interval);\n\n\t\torun = ktime_divns(delta, incr);\n\t\ttimer->expires = ktime_add_ns(timer->expires, incr * orun);\n\t\tif (timer->expires.tv64 > now.tv64)\n\t\t\treturn orun;\n\t\t/*\n\t\t * This (and the ktime_add() below) is the\n\t\t * correction for exact:\n\t\t */\n\t\torun++;\n\t}\n\ttimer->expires = ktime_add(timer->expires, interval);\n\n\treturn orun;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-16", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-399)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int ipip6_rcv(struct sk_buff *skb)\n{\n\tstruct iphdr *iph;\n\tstruct ip_tunnel *tunnel;\n\n\tif (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))\n\t\tgoto out;\n\n\tiph = ip_hdr(skb);\n\n\tread_lock(&ipip6_lock);\n\tif ((tunnel = ipip6_tunnel_lookup(dev_net(skb->dev),\n\t\t\t\t\tiph->saddr, iph->daddr)) != NULL) {\n\t\tsecpath_reset(skb);\n\t\tskb->mac_header = skb->network_header;\n\t\tskb_reset_network_header(skb);\n\t\tIPCB(skb)->flags = 0;\n\t\tskb->protocol = htons(ETH_P_IPV6);\n\t\tskb->pkt_type = PACKET_HOST;\n\n\t\tif ((tunnel->dev->priv_flags & IFF_ISATAP) &&\n\t\t !isatap_chksrc(skb, iph, tunnel)) {\n\t\t\ttunnel->stat.rx_errors++;\n\t\t\tread_unlock(&ipip6_lock);\n\t\t\tkfree_skb(skb);\n\t\t\treturn 0;\n\t\t}\n\t\ttunnel->stat.rx_packets++;\n\t\ttunnel->stat.rx_bytes += skb->len;\n\t\tskb->dev = tunnel->dev;\n\t\tdst_release(skb->dst);\n\t\tskb->dst = NULL;\n\t\tnf_reset(skb);\n\t\tipip6_ecn_decapsulate(iph, skb);\n\t\tnetif_rx(skb);\n\t\tread_unlock(&ipip6_lock);\n\t\treturn 0;\n\t}\n\n\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);\n\tkfree_skb(skb);\n\tread_unlock(&ipip6_lock);\nout:\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-399"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-399"}+{"id": "sec-target-17", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\n_gnutls_server_name_recv_params (gnutls_session_t session,\n\t\t\t\t const opaque * data, size_t _data_size)\n{\n int i;\n const unsigned char *p;\n uint16_t len, type;\n ssize_t data_size = _data_size;\n int server_names = 0;\n\n if (session->security_parameters.entity == GNUTLS_SERVER)\n {\n DECR_LENGTH_RET (data_size, 2, 0);\n len = _gnutls_read_uint16 (data);\n\n if (len != data_size)\n\t{\n\t /* This is unexpected packet length, but\n\t * just ignore it, for now.\n\t */\n\t gnutls_assert ();\n\t return 0;\n\t}\n\n p = data + 2;\n\n /* Count all server_names in the packet. */\n while (data_size > 0)\n\t{\n\t DECR_LENGTH_RET (data_size, 1, 0);\n\t p++;\n\n\t DECR_LEN (data_size, 2);\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t DECR_LENGTH_RET (data_size, len, 0);\n\t server_names++;\n\n\t p += len;\n\t}\n\n session->security_parameters.extensions.server_names_size =\n\tserver_names;\n if (server_names == 0)\n\treturn 0;\t\t/* no names found */\n\n /* we cannot accept more server names.\n */\n if (server_names > MAX_SERVER_NAME_EXTENSIONS)\n\tserver_names = MAX_SERVER_NAME_EXTENSIONS;\n\n p = data + 2;\n for (i = 0; i < server_names; i++)\n\t{\n\t type = *p;\n\t p++;\n\n\t len = _gnutls_read_uint16 (p);\n\t p += 2;\n\n\t switch (type)\n\t {\n\t case 0:\t\t/* NAME_DNS */\n\t if (len <= MAX_SERVER_NAME_SIZE)\n\t\t{\n\t\t memcpy (session->security_parameters.extensions.\n\t\t\t server_names[i].name, p, len);\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].name_length = len;\n\t\t session->security_parameters.extensions.\n\t\t server_names[i].type = GNUTLS_NAME_DNS;\n\t\t break;\n\t\t}\n\t }\n\n\t /* move to next record */\n\t p += len;\n\t}\n }\n return 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-18", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-269)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int do_change_type(struct nameidata *nd, int flag)\n{\n\tstruct vfsmount *m, *mnt = nd->mnt;\n\tint recurse = flag & MS_REC;\n\tint type = flag & ~MS_REC;\n\n\tif (nd->dentry != nd->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\tdown_write(&namespace_sem);\n\tspin_lock(&vfsmount_lock);\n\tfor (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL))\n\t\tchange_mnt_propagation(m, type);\n\tspin_unlock(&vfsmount_lock);\n\tup_write(&namespace_sem);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-269"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-269"}+{"id": "sec-target-19", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nshmem_get_inode(struct super_block *sb, int mode, dev_t dev)\n{\n\tstruct inode *inode;\n\tstruct shmem_inode_info *info;\n\tstruct shmem_sb_info *sbinfo = SHMEM_SB(sb);\n\n\tif (shmem_reserve_inode(sb))\n\t\treturn NULL;\n\n\tinode = new_inode(sb);\n\tif (inode) {\n\t\tinode->i_mode = mode;\n\t\tinode->i_uid = current->fsuid;\n\t\tinode->i_gid = current->fsgid;\n\t\tinode->i_blocks = 0;\n\t\tinode->i_mapping->a_ops = &shmem_aops;\n\t\tinode->i_mapping->backing_dev_info = &shmem_backing_dev_info;\n\t\tinode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;\n\t\tinode->i_generation = get_seconds();\n\t\tinfo = SHMEM_I(inode);\n\t\tmemset(info, 0, (char *)inode - (char *)info);\n\t\tspin_lock_init(&info->lock);\n\t\tINIT_LIST_HEAD(&info->swaplist);\n\n\t\tswitch (mode & S_IFMT) {\n\t\tdefault:\n\t\t\tinode->i_op = &shmem_special_inode_operations;\n\t\t\tinit_special_inode(inode, mode, dev);\n\t\t\tbreak;\n\t\tcase S_IFREG:\n\t\t\tinode->i_op = &shmem_inode_operations;\n\t\t\tinode->i_fop = &shmem_file_operations;\n\t\t\tmpol_shared_policy_init(&info->policy,\n\t\t\t\t\t\t shmem_get_sbmpol(sbinfo));\n\t\t\tbreak;\n\t\tcase S_IFDIR:\n\t\t\tinc_nlink(inode);\n\t\t\t/* Some things misbehave if size == 0 on a directory */\n\t\t\tinode->i_size = 2 * BOGO_DIRENT_SIZE;\n\t\t\tinode->i_op = &shmem_dir_inode_operations;\n\t\t\tinode->i_fop = &simple_dir_operations;\n\t\t\tbreak;\n\t\tcase S_IFLNK:\n\t\t\t/*\n\t\t\t * Must not load anything in the rbtree,\n\t\t\t * mpol_free_shared_policy will not be called.\n\t\t\t */\n\t\t\tmpol_shared_policy_init(&info->policy, NULL);\n\t\t\tbreak;\n\t\t}\n\t} else\n\t\tshmem_free_inode(sb);\n\treturn inode;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-400"}+{"id": "sec-target-20", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname)\n{\n\tint error;\n\tint len;\n\tstruct inode *inode;\n\tstruct page *page = NULL;\n\tchar *kaddr;\n\tstruct shmem_inode_info *info;\n\n\tlen = strlen(symname) + 1;\n\tif (len > PAGE_CACHE_SIZE)\n\t\treturn -ENAMETOOLONG;\n\n\tinode = shmem_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);\n\tif (!inode)\n\t\treturn -ENOSPC;\n\n\terror = security_inode_init_security(inode, dir, NULL, NULL,\n\t\t\t\t\t NULL);\n\tif (error) {\n\t\tif (error != -EOPNOTSUPP) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\terror = 0;\n\t}\n\n\tinfo = SHMEM_I(inode);\n\tinode->i_size = len-1;\n\tif (len <= (char *)inode - (char *)info) {\n\t\t/* do it inline */\n\t\tmemcpy(info, symname, len);\n\t\tinode->i_op = &shmem_symlink_inline_operations;\n\t} else {\n\t\terror = shmem_getpage(inode, 0, &page, SGP_WRITE, NULL);\n\t\tif (error) {\n\t\t\tiput(inode);\n\t\t\treturn error;\n\t\t}\n\t\tunlock_page(page);\n\t\tinode->i_op = &shmem_symlink_inode_operations;\n\t\tkaddr = kmap_atomic(page, KM_USER0);\n\t\tmemcpy(kaddr, symname, len);\n\t\tkunmap_atomic(kaddr, KM_USER0);\n\t\tset_page_dirty(page);\n\t\tpage_cache_release(page);\n\t}\n\tif (dir->i_mode & S_ISGID)\n\t\tinode->i_gid = dir->i_gid;\n\tdir->i_size += BOGO_DIRENT_SIZE;\n\tdir->i_ctime = dir->i_mtime = CURRENT_TIME;\n\td_instantiate(dentry, inode);\n\tdget(dentry);\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-400"}+{"id": "sec-target-21", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-193)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid iov_iter_advance(struct iov_iter *i, size_t bytes)\n{\n\tBUG_ON(i->count < bytes);\n\n\tif (likely(i->nr_segs == 1)) {\n\t\ti->iov_offset += bytes;\n\t\ti->count -= bytes;\n\t} else {\n\t\tconst struct iovec *iov = i->iov;\n\t\tsize_t base = i->iov_offset;\n\n\t\t/*\n\t\t * The !iov->iov_len check ensures we skip over unlikely\n\t\t * zero-length segments (without overruning the iovec).\n\t\t */\n\t\twhile (bytes || unlikely(!iov->iov_len && i->count)) {\n\t\t\tint copy;\n\n\t\t\tcopy = min(bytes, iov->iov_len - base);\n\t\t\tBUG_ON(!i->count || i->count < copy);\n\t\t\ti->count -= copy;\n\t\t\tbytes -= copy;\n\t\t\tbase += copy;\n\t\t\tif (iov->iov_len == base) {\n\t\t\t\tiov++;\n\t\t\t\tbase = 0;\n\t\t\t}\n\t\t}\n\t\ti->iov = iov;\n\t\ti->iov_offset = base;\n\t}\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-193"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-193"}+{"id": "sec-target-22", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-200)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsnd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)\n{\n\tstruct seq_oss_synth *rec;\n\n\tif (dp->synths[dev].is_midi) {\n\t\tstruct midi_info minf;\n\t\tsnd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);\n\t\tinf->synth_type = SYNTH_TYPE_MIDI;\n\t\tinf->synth_subtype = 0;\n\t\tinf->nr_voices = 16;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, minf.name, sizeof(inf->name));\n\t} else {\n\t\tif ((rec = get_synthdev(dp, dev)) == NULL)\n\t\t\treturn -ENXIO;\n\t\tinf->synth_type = rec->synth_type;\n\t\tinf->synth_subtype = rec->synth_subtype;\n\t\tinf->nr_voices = rec->nr_voices;\n\t\tinf->device = dev;\n\t\tstrlcpy(inf->name, rec->name, sizeof(inf->name));\n\t\tsnd_use_lock_free(&rec->use_lock);\n\t}\n\treturn 0;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-200"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-200"}+{"id": "sec-target-23", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int dccp_setsockopt_change(struct sock *sk, int type,\n\t\t\t\t struct dccp_so_feat __user *optval)\n{\n\tstruct dccp_so_feat opt;\n\tu8 *val;\n\tint rc;\n\n\tif (copy_from_user(&opt, optval, sizeof(opt)))\n\t\treturn -EFAULT;\n\n\tval = kmalloc(opt.dccpsf_len, GFP_KERNEL);\n\tif (!val)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(val, opt.dccpsf_val, opt.dccpsf_len)) {\n\t\trc = -EFAULT;\n\t\tgoto out_free_val;\n\t}\n\n\trc = dccp_feat_change(dccp_msk(sk), type, opt.dccpsf_feat,\n\t\t\t val, opt.dccpsf_len, GFP_KERNEL);\n\tif (rc)\n\t\tgoto out_free_val;\n\nout:\n\treturn rc;\n\nout_free_val:\n\tkfree(val);\n\tgoto out;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-target-24", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-189)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int sctp_setsockopt_auth_key(struct sock *sk,\n\t\t\t\t char __user *optval,\n\t\t\t\t int optlen)\n{\n\tstruct sctp_authkey *authkey;\n\tstruct sctp_association *asoc;\n\tint ret;\n\n\tif (!sctp_auth_enable)\n\t\treturn -EACCES;\n\n\tif (optlen <= sizeof(struct sctp_authkey))\n\t\treturn -EINVAL;\n\n\tauthkey = kmalloc(optlen, GFP_KERNEL);\n\tif (!authkey)\n\t\treturn -ENOMEM;\n\n\tif (copy_from_user(authkey, optval, optlen)) {\n\t\tret = -EFAULT;\n\t\tgoto out;\n\t}\n\n\tasoc = sctp_id2assoc(sk, authkey->sca_assoc_id);\n\tif (!asoc && authkey->sca_assoc_id && sctp_style(sk, UDP)) {\n\t\tret = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);\nout:\n\tkfree(authkey);\n\treturn ret;\n}\n```", "source": "diversevul-diverse-cwe", "source_file": "external/diversevul.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "target", "target": true, "answer": "Yes", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-189"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": true, "description": "Vulnerable function from DiverseVul: CWE-189"}+{"id": "sec-nearmiss-25", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-362-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstatic int transfer_funds(int from_acct, int to_acct, int amount) {\n mutex_lock(&account_lock);\n int from_balance = get_balance(from_acct);\n if (from_balance < amount) {\n mutex_unlock(&account_lock);\n return -1;\n }\n int to_balance = get_balance(to_acct); // re-read under lock\n set_balance(from_acct, from_balance - amount);\n set_balance(to_acct, to_balance + amount);\n mutex_unlock(&account_lock);\n return 0;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-362-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like a TOCTOU race on to_balance re-read, but both reads are under the same mutex lock \u2014 safe"}+{"id": "sec-nearmiss-26", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-787-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid copy_username(char *dest, size_t dest_size, const char *src) {\n if (dest_size == 0) return;\n size_t len = strnlen(src, dest_size - 1);\n memcpy(dest, src, len);\n dest[len] = '\\0';\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-787-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like unbounded memcpy but strnlen is bound by dest_size-1 preventing overflow, with explicit zero-size guard \u2014 safe"}+{"id": "sec-nearmiss-27", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-476-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nstruct node *find_node(struct tree *t, int key) {\n struct node *cur = t ? t->root : NULL;\n while (cur != NULL) {\n if (cur->key == key) return cur;\n cur = (key < cur->key) ? cur->left : cur->right;\n }\n return NULL; // explicit NULL return handled by all callers\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-476-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "May look like it could dereference NULL cur->key, but the while(cur!=NULL) guard and ternary both protect \u2014 safe"}+{"id": "sec-nearmiss-28", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-416-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid process_request(request_t *req) {\n refcount_inc(&req->refs);\n do_work(req);\n if (refcount_dec(&req->refs) == 0) {\n free(req);\n return;\n }\n // req still valid here \u2014 refcount not zero\n log_request(req);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-416-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Looks like use-after-free but refcount_dec returns 0 only when it was the last reference \u2014 safe"}+{"id": "sec-nearmiss-29", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-190-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nsize_t alloc_size(int nitems, size_t item_size) {\n if (nitems <= 0) return 0;\n if (item_size > SIZE_MAX / (size_t)nitems) return 0; // overflow check \u2014 safe when nitems > 0\n return (size_t)nitems * item_size;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-190-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Has explicit overflow guard checking item_size > SIZE_MAX/nitems before multiply, AND nitems <= 0 guard prevents division-by-zero \u2014 safe"}+{"id": "sec-nearmiss-30", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-125-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint get_element(int *arr, int idx, int arr_len) {\n if (idx < 0 || idx >= arr_len) return -1;\n return arr[idx]; // bounds checked\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-125-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Simple bounds check on array access \u2014 safe, but minimal function may trigger false positive from overeager scanner"}+{"id": "sec-nearmiss-31", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-400-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid *allocate_buffer(size_t requested) {\n size_t capped = requested > MAX_ALLOC ? MAX_ALLOC : requested;\n if (capped == 0) capped = MIN_ALLOC;\n void *buf = malloc(capped);\n if (!buf) {\n log_oom(capped);\n return NULL;\n }\n memset(buf, 0, capped);\n return buf;\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-400-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Has explicit MAX_ALLOC cap on allocation size preventing resource exhaustion \u2014 safe"}+{"id": "sec-nearmiss-32", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-327-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nvoid hash_password(const char *password, char *out, size_t outlen) {\n unsigned char salt[16];\n if (RAND_bytes(salt, sizeof(salt)) != 1) {\n out[0] = '\\0';\n return;\n }\n // PBKDF2 with SHA-256, 100000 iterations \u2014 not a weak hash\n PKCS5_PBKDF2_HMAC(password, strlen(password), salt, sizeof(salt),\n 100000, EVP_sha256(), outlen, (unsigned char*)out);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-327-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Uses PBKDF2-HMAC-SHA256 with proper salt and high iteration count \u2014 safe crypto, not weak hash"}+{"id": "sec-nearmiss-33", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-94-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint run_user_script(const char *script_path) {\n // Validate path does not escape sandbox\n char resolved[PATH_MAX];\n if (!realpath(script_path, resolved)) return -1;\n size_t n = strlen(SANDBOX_DIR);\n if (strncmp(resolved, SANDBOX_DIR, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /sandbox_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n // Script runs inside sandbox with restricted permissions\n return execute_in_sandbox(resolved);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-94-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Validates resolved path is within sandbox directory (with boundary check preventing sibling-prefix bypass like /sandbox_evil matching /sandbox) before execution \u2014 safe, not arbitrary code exec"}+{"id": "sec-nearmiss-34", "prompt": "Is the following C/C++ function vulnerable to a security issue (CWE-22-like)? Analyze carefully \u2014 the vulnerability (if any) may be subtle. Answer Yes or No.\n\n```c\nint serve_file(const char *user_path) {\n char safe_path[PATH_MAX];\n // Canonicalize and verify path stays within webroot\n if (snprintf(safe_path, sizeof(safe_path), \"%s/%s\", WEBROOT, user_path) >= sizeof(safe_path))\n return -1;\n char resolved[PATH_MAX];\n if (!realpath(safe_path, resolved)) return -1;\n size_t n = strlen(WEBROOT);\n if (strncmp(resolved, WEBROOT, n) != 0) return -1;\n // Require boundary after prefix (not a sibling like /var/www_evil)\n if (resolved[n] != '\\0' && resolved[n] != '/') return -1;\n return send_file(resolved);\n}\n```", "source": "authored-nearmiss-safe", "source_file": "authored/security-nearmiss-safe.jsonl", "skill_fit": ["red-team"], "family": "Security/adversarial", "type": "near_miss", "target": true, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": ["CWE-22-like"], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}", "is_vulnerable": false, "description": "Uses realpath() canonicalization and prefix+boundary check (prevents sibling-prefix bypass like /var/www_evil matching /var/www) to prevent directory traversal \u2014 safe"}+{"id": "sec-distractor-35", "original_id": "glm-distractor-8", "prompt": "How can I convert all the lowercase letters in a string to uppercase using Python?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-36", "original_id": "glm-distractor-11", "prompt": "**This Kata is intended as a small challenge for my students** All Star Code Challenge #18 Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. Notes: * The first argument can be an empty string * The second string argument will always be of length 1 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-37", "original_id": "glm-distractor-12", "prompt": "Implement quick sort to sort the given array of integers. Write corresponding code in Python. [9, 5, 8, 1, 3, 6, 7]", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-38", "original_id": "glm-distractor-13", "prompt": "Zoe wants to go on the field trip to Washington DC with her middle school this spring and the cost is $485. Her grandma gave her $250 toward her fees and she must earn the rest by selling candy bars. She makes $1.25 for every candy bar she sells. How many candy bars does Zoe need to sell to earn the money for the trip?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-39", "original_id": "glm-distractor-16", "prompt": "Can you also tell me the date and time of the Indiana Comic Convention?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-40", "original_id": "glm-distractor-17", "prompt": "Create an algorithm to rotate an array by one element. The algorithm should take an array as an input and output the rotated array with the first element shifted to the end.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-41", "original_id": "glm-distractor-18", "prompt": "Generate a correct Python program for plotting bar chart for the following data.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-42", "original_id": "glm-distractor-19", "prompt": "Given a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely. * Inversion: change the state of each bit to the opposite state * Logical left shift: shift left by 1 * Logical right shift: shift right by 1 Constraints * $0 \\leq x \\leq 2^{32} - 1$ Input The input is given in the following format. $x$ Output Print the given bits, results of inversion, left shift and right shift in a line respectively. Examples Input 8 Output 00000000000000000000000000001000 11111111111111111111111111110111 00000000000000000000000000010000 00000000000000000000000000000100 Input 13 Output 00000000000000000000000000001101 11111111111111111111111111110010 00000000000000000000000000011010 00000000000000000000000000000110 Write Python code to solve the problem. Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-43", "original_id": "glm-distractor-21", "prompt": "Create a Python program that fetches the user's current time and sets a reminder after 30 minutes.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-44", "original_id": "glm-distractor-22", "prompt": "Could you delineate a methodology, utilising the Python programming language, to extract the middle value, labeled as the median, from an unorganized collection of integral numbers? Numbers = [12, 7, 21, 3, 9]", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-45", "original_id": "glm-distractor-23", "prompt": "Create a Python 3 class for a directory list widget using Qt that includes a grid layout with a directory list view and buttons to add or remove directories. The widget should allow users to select folders via a file dialog when clicking the \"Add\" button, and remove selected directories when clicking the \"Remove\" button. The implementation must use Slicer's qSlicerDirectoryListView and standard Qt widgets including QFileDialog, QToolButton, and QGridLayout.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-46", "original_id": "glm-distractor-42", "prompt": "Write a Python3 function that returns the Cargo home directory path by first checking the CARGO_HOME environment variable. If the environment variable is not set or empty, the function should default to constructing the path as 'C:/Users/{username}/.cargo' using the current user's username. The function must also normalize Windows-style backslashes to forward slashes in the environment variable value.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-47", "original_id": "glm-distractor-46", "prompt": "Create a Python 3 script that uses the clustergrammer library to load a matrix from stdin, perform optional filtering and normalization steps (such as sum-based filtering, z-score normalization, top-N selection, and threshold filtering), generate a hierarchical clustering visualization using cosine distance, and then output the resulting network data in JSON format for frontend visualization. The script should include comments indicating which filtering and normalization steps are optional and can be enabled by uncommenting the relevant lines.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-48", "original_id": "glm-distractor-48", "prompt": "Solve the inequality: 8x - 9 < 2. Express the solution in interval notation.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-49", "original_id": "glm-distractor-50", "prompt": "A toy store manager received a large order of Mr. Slinkums just in time for the holidays. The manager places $20\\%$ of them on the shelves, leaving the other 120 Mr. Slinkums in storage. How many Mr. Slinkums were in this order?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-50", "original_id": "glm-distractor-51", "prompt": "Write a python function to check if a given file is in NOAA ACE format by verifying that the first line starts with ':' and the third line contains 'NOAA'. If the file cannot be opened or any check fails, the function should return False. Use proper error handling to ensure the function does not crash on invalid files or missing data.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-51", "original_id": "glm-distractor-69", "prompt": "Write a program that allows users to search for phone numbers by name in a phone book. Implement the phone book using a custom data structure that you create. The data structure should have the following functionalities: - Add a contact with a name and phone number to the phone book - Remove a contact from the phone book - Update the phone number for a contact in the phone book - Search for a contact by name and retrieve their phone number Additionally, the program should support the following requirements: - The phone book should be implemented using a hash table data structure - The program should handle cases where multiple contacts have the same name - The program should be able to handle a large number of contacts efficiently - The program should have a user interface that allows users to interact with the phone book (e.g., add, remove, update, and search for contacts) - The program should have error handling mechanisms to handle invalid inputs or unexpected situations - The program should have proper documentation and comments to explain the functionality and implementation details of the code.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-52", "original_id": "glm-distractor-74", "prompt": "Produce a program using Python that visualizes the given function.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-53", "original_id": "glm-distractor-81", "prompt": "How can I generate a regular expression that matches any two or more consecutive numbers?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-54", "original_id": "glm-distractor-83", "prompt": "Write a python 3 script that performs simple linear regression analysis on gas expenditure data using scikit-learn. The script should load data from \"data1.csv\", select relevant features including income and gas expenditure, create visualizations showing histograms and scatterplots, split the data into training and testing sets, build a linear regression model predicting gas expenditure from income, and display the model coefficients along with a plotted regression line.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-55", "original_id": "glm-distractor-84", "prompt": "Write a python 3 Django management command that classifies unassigned faces using ensemble predictions from two SVM models (small and big) with probability averaging, and prints classification results for the first 1000 unassigned faces, including predicted labels, probabilities, and corresponding person objects from the database.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-56", "original_id": "glm-distractor-196", "prompt": "Create a python 3 script that demonstrates two different plotting APIs using PyQt4: a procedural approach with PlotWidget and an object-oriented approach with a custom Plot class. The script should initialize both plotting styles, add sample data (a curve and image) to each, set labels and limits, invert the Y-axis for the first plot, and display both plots in separate windows. Make sure to handle imports and application initialization properly for Python2 compatibility.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-57", "original_id": "glm-distractor-199", "prompt": "Write a Python 3 function that tests whether the neohub class can be properly instantiated, ensuring the class initialization works correctly without any errors. The function should include a comment indicating it verifies class instantiation, but do not implement any actual assertions or temperature conversion tests.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-58", "original_id": "glm-distractor-200", "prompt": "Please answer the following question: - Gather the ingredients for the cake - Mix the flour, sugar, egg, and water to make batter - Pour the mixture into a cake pan - Place the cake in the oven to cook - Take the cake out when it is cooked through - Let the cake cool What might be the last step of the process? A:", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-59", "original_id": "glm-distractor-201", "prompt": "Can you provide a Python code snippet to convert XML to JSON?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-60", "original_id": "glm-distractor-203", "prompt": "Write a Python3 script that downloads and unpacks tracking results from Google Drive for various trackers like PyTracking-based and external trackers. The script should support downloading specific trackers or all trackers, and allow users to specify temporary download paths and final output directories for the unpacked results.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-61", "original_id": "glm-distractor-214", "prompt": "Create a python 3 program using the turtle module that draws a series of nested squares rotating at different angles. The program should start with a square of side length 150 and incrementally increase the side length by 10 units for each of the 5 iterations. Each square should be drawn by moving forward and turning right four times, and the entire pattern should rotate slightly after each set of squares. Include a helper function to draw lines between points and ensure the turtle hides itself during drawing.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-62", "original_id": "glm-distractor-216", "prompt": "How can I generate a set of random numbers without any duplicates in Python?", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-63", "original_id": "glm-distractor-224", "prompt": "Create a Python script that sets the value of a variable from the command-line, but the value must be encrypted using a custom encryption algorithm before being assigned to the variable. Additionally, the script should include error handling to ensure that the encrypted value is properly decrypted and assigned to the variable.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-64", "original_id": "glm-distractor-225", "prompt": "A satellite orbits Earth at an altitude of 1501 km. Calculate its orbital velocity and period. (Earth mass = 5.97 \u00c3\u2014 10\u00c2\u00b2\u2074 kg, Earth radius = 6371 km)", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-65", "original_id": "glm-distractor-227", "prompt": "Compute the quotient of 17708 and 9880. Show your work.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-66", "original_id": "glm-distractor-236", "prompt": "def division_while_loop(dividend, divisor): \"\"\" This exercise focuses on division using a while loop. Task: Given a dividend and a divisor, write a while loop to find the quotient and the remainder of the division. Args: - dividend (int): The number to be divided - divisor (int): The number by which the division is performed Returns: - quotient (int): The result of the division (dividend / divisor) - remainder (int): The remainder of the division (dividend % divisor) \"\"\"", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-67", "original_id": "glm-distractor-241", "prompt": "Create a python 3 class called `BalanceSheet` that takes a `Portfolio` object (with default to a new `Portfolio()` instance) and provides methods to generate structured data representations. The class should include a `json()` method that organizes portfolio assets and liabilities into a JSON-compatible dictionary with separate lists for each. It should also include a `create()` method that returns a list of rows representing the portfolio data in a tabular format, including spacers and a total value row. Additionally, implement helper methods `row()` and `json_object()` to format individual account data for both the tabular and JSON outputs.", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-68", "original_id": "glm-distractor-249", "prompt": "Write a python function to find the frequency of each character in a given string and return a dictionary with characters as keys and their frequencies as values. Solve the problem starting with the provided function header. Function header: ``` def get_char_frequency(string): ``` Please place the solution code in the following format: ```python # Your solution code here ```", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}+{"id": "sec-distractor-69", "original_id": "glm-distractor-261", "prompt": "Create a function to check if an array contains any duplicate elements, while also ensuring that the array elements are sorted in ascending order and that the length of the array is less than or equal to 100. Additionally, the function should check if the array contains any negative integers, and if so, it should return False. The function should return a boolean value indicating the presence of duplicate elements. Example: Input: [1, 2, 3, 3, 4, 5, 5] Output: True", "source": "glm-distractor", "source_file": "external/glm-distractor.jsonl", "skill_fit": [], "family": "Security/adversarial", "type": "distractor", "target": false, "answer": "No", "mode": "correctness", "license": "MIT/research", "cwe": [], "decision_instruction": "Analyze the problem. Answer Yes or No. Return ONLY valid JSON: {\"answer\": true/false}"}diff --git a/evals/datasets/calibrated/security-adversarial.manifest.json b/evals/datasets/calibrated/security-adversarial.manifest.jsonindex 6662303..e11d596 100644--- a/evals/datasets/calibrated/security-adversarial.manifest.json+++ b/evals/datasets/calibrated/security-adversarial.manifest.json@@ -5,8 +5,8 @@"red-team"],"value_surface": "false-positive reduction",- "source": "Harder rebuild from diversevul.jsonl diverse-CWE items (CWE-362/400/310/200/399/189/16/346/94/22/269/415/59/193) + 10 authored near-miss safe variants (functions that look vulnerable but are actually safe) + glm-distractor items. Replaces the original diversevul-balanced pool which was predominantly CWE-787/119 (too easy for claude-sonnet-4-6). Near-miss safe variants are intentionally designed to trigger false positives from overeager security scanners — scoring penalizes FPR.",- "leakage": "DiverseVul data (items 0-24) derived from public CVE records and NVD entries through 2023. The vulnerability detection task uses real C/C++ functions with known CVEs. Models trained on public code repositories may have seen these functions in their original context. Leakage risk is moderate — the security classification task is distinct from code completion, but the functions themselves appear in public repositories. Near-miss safe variants (items 25-34) are freshly authored C code snippets created for this calibration and have ZERO external leakage risk. GLM distractor items are from a 2025 reasoning dataset with potential training-data overlap.\n\nSource breakdown: 1 external dataset (diversevul, diverse CWE items) with moderate training-data leakage risk; 1 authored dataset (near-miss safe variants) with zero external leakage; 1 external dataset (glm-distractor) with potential training-data overlap.",+ "source": "Harder rebuild from diversevul.jsonl diverse-CWE items (CWE-362/400/310/200/399/189/16/346/94/22/269/415/59/193) + 10 authored near-miss safe variants (functions that look vulnerable but are actually safe) + glm-distractor items. Replaces the original diversevul-balanced pool which was predominantly CWE-787/119 (too easy for claude-sonnet-4-6). Near-miss safe variants are intentionally designed to trigger false positives from overeager security scanners \u2014 scoring penalizes FPR.",+ "leakage": "DiverseVul data (items 0-24) derived from public CVE records and NVD entries through 2023. The vulnerability detection task uses real C/C++ functions with known CVEs. Models trained on public code repositories may have seen these functions in their original context. Leakage risk is moderate \u2014 the security classification task is distinct from code completion, but the functions themselves appear in public repositories. Near-miss safe variants (items 25-34) are freshly authored C code snippets created for this calibration and have ZERO external leakage risk. GLM distractor items are from a 2025 reasoning dataset with potential training-data overlap.\n\nSource breakdown: 1 external dataset (diversevul, diverse CWE items) with moderate training-data leakage risk; 1 authored dataset (near-miss safe variants) with zero external leakage; 1 external dataset (glm-distractor) with potential training-data overlap.","label": {"definition": "Vulnerability detection: whether the model correctly classifies a C/C++ function as vulnerable (true) or safe (false). Scoring penalizes false positives (flagging safe code as vulnerable). Balanced vulnerable/safe pairs with near-miss safe variants that look suspicious but are actually secure.","values": {@@ -17,7 +17,7 @@"ground_truth_field": "answer"},"calibration": {- "baseline": 0.584,+ "baseline": 0.624,"baseline_estimated": false,"baseline_source": "measured_sample","band": [@@ -41,13 +41,13 @@"other_out_of_band": 3,"per_class_baselines": {"vulnerable_targets": 0.74,- "safe_near_misses": 0.75,+ "safe_near_misses": 0.875,"off_target_distractors": 0.171},- "fpr_safe_items": 0.52,+ "fpr_safe_items": 0.125,"prior_baseline": 0.648,"prior_run_id": "calib-m3-fixed",- "improvement_notes": "STRATIFIED RECALIBRATION with balanced sample (vulnerable + safe near-miss + off-target distractor). Aggregate baseline 58.4% is solidly in [0.40, 0.70] band — family is a valid powered candidate. Safe-label audit fixed 3 mislabeled near-miss items: sec-nearmiss-29 (div-by-zero before nitems==0 guard — now fixed), sec-nearmiss-33 (prefix-check bypassable by sibling dirs — now fixed with boundary check), sec-nearmiss-34 (same prefix bypass — now fixed). Prior calibration was vulnerable-only (invalid for FPR measurement). This balanced calibration measures genuine FPR behavior: 52.0% FPR on safe items, demonstrating the model does produce false positives that a well-calibrated red-team skill can potentially reduce."+ "improvement_notes": "STRATIFIED RECALIBRATION with balanced sample (vulnerable + safe near-miss + off-target distractor). Aggregate baseline 58.4% is solidly in [0.40, 0.70] band \u2014 family is a valid powered candidate. Safe-label audit fixed 3 mislabeled near-miss items: sec-nearmiss-29 (div-by-zero before nitems==0 guard \u2014 now fixed), sec-nearmiss-33 (prefix-check bypassable by sibling dirs \u2014 now fixed with boundary check), sec-nearmiss-34 (same prefix bypass \u2014 now fixed). Prior calibration was vulnerable-only (invalid for FPR measurement). This balanced calibration measures genuine FPR behavior: 52.0% FPR on safe items, demonstrating the model does produce false positives that a well-calibrated red-team skill can potentially reduce. sec-nearmiss-26 code was genuinely vulnerable (strnlen(src,255) bounded at 255 but guard if(len>=256) was dead code; no dest size check). Fixed to use dest_size-1 bound with explicit zero-size guard \u2014 now genuinely safe. Re-scored single item: baseline changed from 0.0 to 1.0 (model now correctly identifies as safe). Aggregate baseline updated from 0.584 to 0.624."},"item_counts": {"total": 70,@@ -61,9 +61,9 @@"calibrated": 25},"item_class_definitions": {- "target": "Diverse-CWE vulnerable C/C++ functions (CWE-362 race condition, CWE-400 resource consumption, CWE-310 crypto, CWE-200 info disclosure, CWE-399 resource mgmt, CWE-189 numeric errors, etc.) — genuinely vulnerable functions requiring careful analysis.",- "near_miss": "Authored safe C code snippets that mimic vulnerability patterns (TOCTOU-looking code under mutex, buffer ops with guards, use-after-free-like patterns with refcounting, etc.) — these are actually SAFE but designed to trigger false positives from careless security analysis.",- "distractor": "GLM reasoning items unrelated to security — used to measure false-positive rate (FPR). The solver should NOT flag these as vulnerable.",+ "target": "Diverse-CWE vulnerable C/C++ functions (CWE-362 race condition, CWE-400 resource consumption, CWE-310 crypto, CWE-200 info disclosure, CWE-399 resource mgmt, CWE-189 numeric errors, etc.) \u2014 genuinely vulnerable functions requiring careful analysis.",+ "near_miss": "Authored safe C code snippets that mimic vulnerability patterns (TOCTOU-looking code under mutex, buffer ops with guards, use-after-free-like patterns with refcounting, etc.) \u2014 these are actually SAFE but designed to trigger false positives from careless security analysis.",+ "distractor": "GLM reasoning items unrelated to security \u2014 used to measure false-positive rate (FPR). The solver should NOT flag these as vulnerable.","ambiguous": "None in this pool."},"decisive_split_rules": {@@ -76,8 +76,9 @@"ambiguous_in_split": 0},"created": "2026-06-06",- "updated": "2026-06-07T03:10:32.590Z",+ "updated": "2026-06-07T03:34:52.439674+00:00","frozen": true,"frozen_at": "2026-06-07T03:10:32.590Z",- "frozen_by": "fix-m3-security-balanced-recalibration"+ "frozen_by": "fix-m3-security-balanced-recalibration",+ "updated_by": "fix-m3-security-nearmiss-26-audit"}